missing revision bd304fc0
1fc5a983dSmrg#! /bin/sh
2fc5a983dSmrg# Common stub for a few missing GNU programs while installing.
3fc5a983dSmrg
4bd304fc0Smrgscriptversion=2012-01-06.13; # UTC
5fc5a983dSmrg
6bd304fc0Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
7bd304fc0Smrg# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
8fc5a983dSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
9fc5a983dSmrg
10fc5a983dSmrg# This program is free software; you can redistribute it and/or modify
11fc5a983dSmrg# it under the terms of the GNU General Public License as published by
12fc5a983dSmrg# the Free Software Foundation; either version 2, or (at your option)
13fc5a983dSmrg# any later version.
14fc5a983dSmrg
15fc5a983dSmrg# This program is distributed in the hope that it will be useful,
16fc5a983dSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
17fc5a983dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18fc5a983dSmrg# GNU General Public License for more details.
19fc5a983dSmrg
20fc5a983dSmrg# You should have received a copy of the GNU General Public License
21bd304fc0Smrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
22fc5a983dSmrg
23fc5a983dSmrg# As a special exception to the GNU General Public License, if you
24fc5a983dSmrg# distribute this file as part of a program that contains a
25fc5a983dSmrg# configuration script generated by Autoconf, you may include it under
26fc5a983dSmrg# the same distribution terms that you use for the rest of that program.
27fc5a983dSmrg
28fc5a983dSmrgif test $# -eq 0; then
29fc5a983dSmrg  echo 1>&2 "Try \`$0 --help' for more information"
30fc5a983dSmrg  exit 1
31fc5a983dSmrgfi
32fc5a983dSmrg
33fc5a983dSmrgrun=:
34fc5a983dSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
35fc5a983dSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
36fc5a983dSmrg
37fc5a983dSmrg# In the cases where this matters, `missing' is being run in the
38fc5a983dSmrg# srcdir already.
39fc5a983dSmrgif test -f configure.ac; then
40fc5a983dSmrg  configure_ac=configure.ac
41fc5a983dSmrgelse
42fc5a983dSmrg  configure_ac=configure.in
43fc5a983dSmrgfi
44fc5a983dSmrg
45fc5a983dSmrgmsg="missing on your system"
46fc5a983dSmrg
47fc5a983dSmrgcase $1 in
48fc5a983dSmrg--run)
49fc5a983dSmrg  # Try to run requested program, and just exit if it succeeds.
50fc5a983dSmrg  run=
51fc5a983dSmrg  shift
52fc5a983dSmrg  "$@" && exit 0
53fc5a983dSmrg  # Exit code 63 means version mismatch.  This often happens
54fc5a983dSmrg  # when the user try to use an ancient version of a tool on
55fc5a983dSmrg  # a file that requires a minimum version.  In this case we
56fc5a983dSmrg  # we should proceed has if the program had been absent, or
57fc5a983dSmrg  # if --run hadn't been passed.
58fc5a983dSmrg  if test $? = 63; then
59fc5a983dSmrg    run=:
60fc5a983dSmrg    msg="probably too old"
61fc5a983dSmrg  fi
62fc5a983dSmrg  ;;
63fc5a983dSmrg
64fc5a983dSmrg  -h|--h|--he|--hel|--help)
65fc5a983dSmrg    echo "\
66fc5a983dSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
67fc5a983dSmrg
68fc5a983dSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
69fc5a983dSmrgerror status if there is no known handling for PROGRAM.
70fc5a983dSmrg
71fc5a983dSmrgOptions:
72fc5a983dSmrg  -h, --help      display this help and exit
73fc5a983dSmrg  -v, --version   output version information and exit
74fc5a983dSmrg  --run           try to run the given command, and emulate it if it fails
75fc5a983dSmrg
76fc5a983dSmrgSupported PROGRAM values:
77fc5a983dSmrg  aclocal      touch file \`aclocal.m4'
78fc5a983dSmrg  autoconf     touch file \`configure'
79fc5a983dSmrg  autoheader   touch file \`config.h.in'
80fc5a983dSmrg  autom4te     touch the output file, or create a stub one
81fc5a983dSmrg  automake     touch all \`Makefile.in' files
82fc5a983dSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
83fc5a983dSmrg  flex         create \`lex.yy.c', if possible, from existing .c
84fc5a983dSmrg  help2man     touch the output file
85fc5a983dSmrg  lex          create \`lex.yy.c', if possible, from existing .c
86fc5a983dSmrg  makeinfo     touch the output file
87fc5a983dSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
88fc5a983dSmrg
89bd304fc0SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
90bd304fc0Smrg\`g' are ignored when checking the name.
91bd304fc0Smrg
92fc5a983dSmrgSend bug reports to <bug-automake@gnu.org>."
93fc5a983dSmrg    exit $?
94fc5a983dSmrg    ;;
95fc5a983dSmrg
96fc5a983dSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
97fc5a983dSmrg    echo "missing $scriptversion (GNU Automake)"
98fc5a983dSmrg    exit $?
99fc5a983dSmrg    ;;
100fc5a983dSmrg
101fc5a983dSmrg  -*)
102fc5a983dSmrg    echo 1>&2 "$0: Unknown \`$1' option"
103fc5a983dSmrg    echo 1>&2 "Try \`$0 --help' for more information"
104fc5a983dSmrg    exit 1
105fc5a983dSmrg    ;;
106fc5a983dSmrg
107fc5a983dSmrgesac
108fc5a983dSmrg
109bd304fc0Smrg# normalize program name to check for.
110bd304fc0Smrgprogram=`echo "$1" | sed '
111bd304fc0Smrg  s/^gnu-//; t
112bd304fc0Smrg  s/^gnu//; t
113bd304fc0Smrg  s/^g//; t'`
114bd304fc0Smrg
115fc5a983dSmrg# Now exit if we have it, but it failed.  Also exit now if we
116fc5a983dSmrg# don't have it and --version was passed (most likely to detect
117bd304fc0Smrg# the program).  This is about non-GNU programs, so use $1 not
118bd304fc0Smrg# $program.
119fc5a983dSmrgcase $1 in
120bd304fc0Smrg  lex*|yacc*)
121fc5a983dSmrg    # Not GNU programs, they don't have --version.
122fc5a983dSmrg    ;;
123fc5a983dSmrg
124fc5a983dSmrg  *)
125fc5a983dSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
126fc5a983dSmrg       # We have it, but it failed.
127fc5a983dSmrg       exit 1
128fc5a983dSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
129fc5a983dSmrg       # Could not run --version or --help.  This is probably someone
130fc5a983dSmrg       # running `$TOOL --version' or `$TOOL --help' to check whether
131fc5a983dSmrg       # $TOOL exists and not knowing $TOOL uses missing.
132fc5a983dSmrg       exit 1
133fc5a983dSmrg    fi
134fc5a983dSmrg    ;;
135fc5a983dSmrgesac
136fc5a983dSmrg
137fc5a983dSmrg# If it does not exist, or fails to run (possibly an outdated version),
138fc5a983dSmrg# try to emulate it.
139bd304fc0Smrgcase $program in
140fc5a983dSmrg  aclocal*)
141fc5a983dSmrg    echo 1>&2 "\
142fc5a983dSmrgWARNING: \`$1' is $msg.  You should only need it if
143fc5a983dSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
144fc5a983dSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
145fc5a983dSmrg         any GNU archive site."
146fc5a983dSmrg    touch aclocal.m4
147fc5a983dSmrg    ;;
148fc5a983dSmrg
149bd304fc0Smrg  autoconf*)
150fc5a983dSmrg    echo 1>&2 "\
151fc5a983dSmrgWARNING: \`$1' is $msg.  You should only need it if
152fc5a983dSmrg         you modified \`${configure_ac}'.  You might want to install the
153fc5a983dSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
154fc5a983dSmrg         archive site."
155fc5a983dSmrg    touch configure
156fc5a983dSmrg    ;;
157fc5a983dSmrg
158bd304fc0Smrg  autoheader*)
159fc5a983dSmrg    echo 1>&2 "\
160fc5a983dSmrgWARNING: \`$1' is $msg.  You should only need it if
161fc5a983dSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
162fc5a983dSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
163fc5a983dSmrg         from any GNU archive site."
164fc5a983dSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
165fc5a983dSmrg    test -z "$files" && files="config.h"
166fc5a983dSmrg    touch_files=
167fc5a983dSmrg    for f in $files; do
168fc5a983dSmrg      case $f in
169fc5a983dSmrg      *:*) touch_files="$touch_files "`echo "$f" |
170fc5a983dSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
171fc5a983dSmrg      *) touch_files="$touch_files $f.in";;
172fc5a983dSmrg      esac
173fc5a983dSmrg    done
174fc5a983dSmrg    touch $touch_files
175fc5a983dSmrg    ;;
176fc5a983dSmrg
177fc5a983dSmrg  automake*)
178fc5a983dSmrg    echo 1>&2 "\
179fc5a983dSmrgWARNING: \`$1' is $msg.  You should only need it if
180fc5a983dSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
181fc5a983dSmrg         You might want to install the \`Automake' and \`Perl' packages.
182fc5a983dSmrg         Grab them from any GNU archive site."
183fc5a983dSmrg    find . -type f -name Makefile.am -print |
184fc5a983dSmrg	   sed 's/\.am$/.in/' |
185fc5a983dSmrg	   while read f; do touch "$f"; done
186fc5a983dSmrg    ;;
187fc5a983dSmrg
188bd304fc0Smrg  autom4te*)
189fc5a983dSmrg    echo 1>&2 "\
190fc5a983dSmrgWARNING: \`$1' is needed, but is $msg.
191fc5a983dSmrg         You might have modified some files without having the
192fc5a983dSmrg         proper tools for further handling them.
193fc5a983dSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
194fc5a983dSmrg         archive site."
195fc5a983dSmrg
196fc5a983dSmrg    file=`echo "$*" | sed -n "$sed_output"`
197fc5a983dSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
198fc5a983dSmrg    if test -f "$file"; then
199fc5a983dSmrg	touch $file
200fc5a983dSmrg    else
201fc5a983dSmrg	test -z "$file" || exec >$file
202fc5a983dSmrg	echo "#! /bin/sh"
203fc5a983dSmrg	echo "# Created by GNU Automake missing as a replacement of"
204fc5a983dSmrg	echo "#  $ $@"
205fc5a983dSmrg	echo "exit 0"
206fc5a983dSmrg	chmod +x $file
207fc5a983dSmrg	exit 1
208fc5a983dSmrg    fi
209fc5a983dSmrg    ;;
210fc5a983dSmrg
211bd304fc0Smrg  bison*|yacc*)
212fc5a983dSmrg    echo 1>&2 "\
213fc5a983dSmrgWARNING: \`$1' $msg.  You should only need it if
214fc5a983dSmrg         you modified a \`.y' file.  You may need the \`Bison' package
215fc5a983dSmrg         in order for those modifications to take effect.  You can get
216fc5a983dSmrg         \`Bison' from any GNU archive site."
217fc5a983dSmrg    rm -f y.tab.c y.tab.h
218fc5a983dSmrg    if test $# -ne 1; then
219bd304fc0Smrg        eval LASTARG=\${$#}
220fc5a983dSmrg	case $LASTARG in
221fc5a983dSmrg	*.y)
222fc5a983dSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
223fc5a983dSmrg	    if test -f "$SRCFILE"; then
224fc5a983dSmrg	         cp "$SRCFILE" y.tab.c
225fc5a983dSmrg	    fi
226fc5a983dSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
227fc5a983dSmrg	    if test -f "$SRCFILE"; then
228fc5a983dSmrg	         cp "$SRCFILE" y.tab.h
229fc5a983dSmrg	    fi
230fc5a983dSmrg	  ;;
231fc5a983dSmrg	esac
232fc5a983dSmrg    fi
233fc5a983dSmrg    if test ! -f y.tab.h; then
234fc5a983dSmrg	echo >y.tab.h
235fc5a983dSmrg    fi
236fc5a983dSmrg    if test ! -f y.tab.c; then
237fc5a983dSmrg	echo 'main() { return 0; }' >y.tab.c
238fc5a983dSmrg    fi
239fc5a983dSmrg    ;;
240fc5a983dSmrg
241bd304fc0Smrg  lex*|flex*)
242fc5a983dSmrg    echo 1>&2 "\
243fc5a983dSmrgWARNING: \`$1' is $msg.  You should only need it if
244fc5a983dSmrg         you modified a \`.l' file.  You may need the \`Flex' package
245fc5a983dSmrg         in order for those modifications to take effect.  You can get
246fc5a983dSmrg         \`Flex' from any GNU archive site."
247fc5a983dSmrg    rm -f lex.yy.c
248fc5a983dSmrg    if test $# -ne 1; then
249bd304fc0Smrg        eval LASTARG=\${$#}
250fc5a983dSmrg	case $LASTARG in
251fc5a983dSmrg	*.l)
252fc5a983dSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
253fc5a983dSmrg	    if test -f "$SRCFILE"; then
254fc5a983dSmrg	         cp "$SRCFILE" lex.yy.c
255fc5a983dSmrg	    fi
256fc5a983dSmrg	  ;;
257fc5a983dSmrg	esac
258fc5a983dSmrg    fi
259fc5a983dSmrg    if test ! -f lex.yy.c; then
260fc5a983dSmrg	echo 'main() { return 0; }' >lex.yy.c
261fc5a983dSmrg    fi
262fc5a983dSmrg    ;;
263fc5a983dSmrg
264bd304fc0Smrg  help2man*)
265fc5a983dSmrg    echo 1>&2 "\
266fc5a983dSmrgWARNING: \`$1' is $msg.  You should only need it if
267fc5a983dSmrg	 you modified a dependency of a manual page.  You may need the
268fc5a983dSmrg	 \`Help2man' package in order for those modifications to take
269fc5a983dSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
270fc5a983dSmrg
271fc5a983dSmrg    file=`echo "$*" | sed -n "$sed_output"`
272fc5a983dSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
273fc5a983dSmrg    if test -f "$file"; then
274fc5a983dSmrg	touch $file
275fc5a983dSmrg    else
276fc5a983dSmrg	test -z "$file" || exec >$file
277fc5a983dSmrg	echo ".ab help2man is required to generate this page"
278bd304fc0Smrg	exit $?
279fc5a983dSmrg    fi
280fc5a983dSmrg    ;;
281fc5a983dSmrg
282bd304fc0Smrg  makeinfo*)
283fc5a983dSmrg    echo 1>&2 "\
284fc5a983dSmrgWARNING: \`$1' is $msg.  You should only need it if
285fc5a983dSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
286fc5a983dSmrg         indirectly affecting the aspect of the manual.  The spurious
287fc5a983dSmrg         call might also be the consequence of using a buggy \`make' (AIX,
288fc5a983dSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
289fc5a983dSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
290fc5a983dSmrg    # The file to touch is that specified with -o ...
291fc5a983dSmrg    file=`echo "$*" | sed -n "$sed_output"`
292fc5a983dSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
293fc5a983dSmrg    if test -z "$file"; then
294fc5a983dSmrg      # ... or it is the one specified with @setfilename ...
295fc5a983dSmrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
296fc5a983dSmrg      file=`sed -n '
297fc5a983dSmrg	/^@setfilename/{
298fc5a983dSmrg	  s/.* \([^ ]*\) *$/\1/
299fc5a983dSmrg	  p
300fc5a983dSmrg	  q
301fc5a983dSmrg	}' $infile`
302fc5a983dSmrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
303fc5a983dSmrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
304fc5a983dSmrg    fi
305fc5a983dSmrg    # If the file does not exist, the user really needs makeinfo;
306fc5a983dSmrg    # let's fail without touching anything.
307fc5a983dSmrg    test -f $file || exit 1
308fc5a983dSmrg    touch $file
309fc5a983dSmrg    ;;
310fc5a983dSmrg
311fc5a983dSmrg  *)
312fc5a983dSmrg    echo 1>&2 "\
313fc5a983dSmrgWARNING: \`$1' is needed, and is $msg.
314fc5a983dSmrg         You might have modified some files without having the
315fc5a983dSmrg         proper tools for further handling them.  Check the \`README' file,
316fc5a983dSmrg         it often tells you about the needed prerequisites for installing
317fc5a983dSmrg         this package.  You may also peek at any GNU archive site, in case
318fc5a983dSmrg         some other package would contain this missing \`$1' program."
319fc5a983dSmrg    exit 1
320fc5a983dSmrg    ;;
321fc5a983dSmrgesac
322fc5a983dSmrg
323fc5a983dSmrgexit 0
324fc5a983dSmrg
325fc5a983dSmrg# Local variables:
326fc5a983dSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
327fc5a983dSmrg# time-stamp-start: "scriptversion="
328fc5a983dSmrg# time-stamp-format: "%:y-%02m-%02d.%02H"
329bd304fc0Smrg# time-stamp-time-zone: "UTC"
330bd304fc0Smrg# time-stamp-end: "; # UTC"
331fc5a983dSmrg# End:
332