missing revision 010cdda0
1010cdda0Smrg#! /bin/sh
2010cdda0Smrg# Common stub for a few missing GNU programs while installing.
3010cdda0Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
4010cdda0Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
5010cdda0Smrg
6010cdda0Smrg# This program is free software; you can redistribute it and/or modify
7010cdda0Smrg# it under the terms of the GNU General Public License as published by
8010cdda0Smrg# the Free Software Foundation; either version 2, or (at your option)
9010cdda0Smrg# any later version.
10010cdda0Smrg
11010cdda0Smrg# This program is distributed in the hope that it will be useful,
12010cdda0Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
13010cdda0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14010cdda0Smrg# GNU General Public License for more details.
15010cdda0Smrg
16010cdda0Smrg# You should have received a copy of the GNU General Public License
17010cdda0Smrg# along with this program; if not, write to the Free Software
18010cdda0Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19010cdda0Smrg# 02111-1307, USA.
20010cdda0Smrg
21010cdda0Smrg# As a special exception to the GNU General Public License, if you
22010cdda0Smrg# distribute this file as part of a program that contains a
23010cdda0Smrg# configuration script generated by Autoconf, you may include it under
24010cdda0Smrg# the same distribution terms that you use for the rest of that program.
25010cdda0Smrg
26010cdda0Smrgif test $# -eq 0; then
27010cdda0Smrg  echo 1>&2 "Try \`$0 --help' for more information"
28010cdda0Smrg  exit 1
29010cdda0Smrgfi
30010cdda0Smrg
31010cdda0Smrgrun=:
32010cdda0Smrg
33010cdda0Smrg# In the cases where this matters, `missing' is being run in the
34010cdda0Smrg# srcdir already.
35010cdda0Smrgif test -f configure.ac; then
36010cdda0Smrg  configure_ac=configure.ac
37010cdda0Smrgelse
38010cdda0Smrg  configure_ac=configure.in
39010cdda0Smrgfi
40010cdda0Smrg
41010cdda0Smrgcase "$1" in
42010cdda0Smrg--run)
43010cdda0Smrg  # Try to run requested program, and just exit if it succeeds.
44010cdda0Smrg  run=
45010cdda0Smrg  shift
46010cdda0Smrg  "$@" && exit 0
47010cdda0Smrg  ;;
48010cdda0Smrgesac
49010cdda0Smrg
50010cdda0Smrg# If it does not exist, or fails to run (possibly an outdated version),
51010cdda0Smrg# try to emulate it.
52010cdda0Smrgcase "$1" in
53010cdda0Smrg
54010cdda0Smrg  -h|--h|--he|--hel|--help)
55010cdda0Smrg    echo "\
56010cdda0Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
57010cdda0Smrg
58010cdda0SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
59010cdda0Smrgerror status if there is no known handling for PROGRAM.
60010cdda0Smrg
61010cdda0SmrgOptions:
62010cdda0Smrg  -h, --help      display this help and exit
63010cdda0Smrg  -v, --version   output version information and exit
64010cdda0Smrg  --run           try to run the given command, and emulate it if it fails
65010cdda0Smrg
66010cdda0SmrgSupported PROGRAM values:
67010cdda0Smrg  aclocal      touch file \`aclocal.m4'
68010cdda0Smrg  autoconf     touch file \`configure'
69010cdda0Smrg  autoheader   touch file \`config.h.in'
70010cdda0Smrg  automake     touch all \`Makefile.in' files
71010cdda0Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
72010cdda0Smrg  flex         create \`lex.yy.c', if possible, from existing .c
73010cdda0Smrg  help2man     touch the output file
74010cdda0Smrg  lex          create \`lex.yy.c', if possible, from existing .c
75010cdda0Smrg  makeinfo     touch the output file
76010cdda0Smrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
77010cdda0Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
78010cdda0Smrg    ;;
79010cdda0Smrg
80010cdda0Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
81010cdda0Smrg    echo "missing 0.4 - GNU automake"
82010cdda0Smrg    ;;
83010cdda0Smrg
84010cdda0Smrg  -*)
85010cdda0Smrg    echo 1>&2 "$0: Unknown \`$1' option"
86010cdda0Smrg    echo 1>&2 "Try \`$0 --help' for more information"
87010cdda0Smrg    exit 1
88010cdda0Smrg    ;;
89010cdda0Smrg
90010cdda0Smrg  aclocal*)
91010cdda0Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
92010cdda0Smrg       # We have it, but it failed.
93010cdda0Smrg       exit 1
94010cdda0Smrg    fi
95010cdda0Smrg
96010cdda0Smrg    echo 1>&2 "\
97010cdda0SmrgWARNING: \`$1' is missing on your system.  You should only need it if
98010cdda0Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
99010cdda0Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
100010cdda0Smrg         any GNU archive site."
101010cdda0Smrg    touch aclocal.m4
102010cdda0Smrg    ;;
103010cdda0Smrg
104010cdda0Smrg  autoconf)
105010cdda0Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
106010cdda0Smrg       # We have it, but it failed.
107010cdda0Smrg       exit 1
108010cdda0Smrg    fi
109010cdda0Smrg
110010cdda0Smrg    echo 1>&2 "\
111010cdda0SmrgWARNING: \`$1' is missing on your system.  You should only need it if
112010cdda0Smrg         you modified \`${configure_ac}'.  You might want to install the
113010cdda0Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
114010cdda0Smrg         archive site."
115010cdda0Smrg    touch configure
116010cdda0Smrg    ;;
117010cdda0Smrg
118010cdda0Smrg  autoheader)
119010cdda0Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
120010cdda0Smrg       # We have it, but it failed.
121010cdda0Smrg       exit 1
122010cdda0Smrg    fi
123010cdda0Smrg
124010cdda0Smrg    echo 1>&2 "\
125010cdda0SmrgWARNING: \`$1' is missing on your system.  You should only need it if
126010cdda0Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
127010cdda0Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
128010cdda0Smrg         from any GNU archive site."
129010cdda0Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
130010cdda0Smrg    test -z "$files" && files="config.h"
131010cdda0Smrg    touch_files=
132010cdda0Smrg    for f in $files; do
133010cdda0Smrg      case "$f" in
134010cdda0Smrg      *:*) touch_files="$touch_files "`echo "$f" |
135010cdda0Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
136010cdda0Smrg      *) touch_files="$touch_files $f.in";;
137010cdda0Smrg      esac
138010cdda0Smrg    done
139010cdda0Smrg    touch $touch_files
140010cdda0Smrg    ;;
141010cdda0Smrg
142010cdda0Smrg  automake*)
143010cdda0Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
144010cdda0Smrg       # We have it, but it failed.
145010cdda0Smrg       exit 1
146010cdda0Smrg    fi
147010cdda0Smrg
148010cdda0Smrg    echo 1>&2 "\
149010cdda0SmrgWARNING: \`$1' is missing on your system.  You should only need it if
150010cdda0Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
151010cdda0Smrg         You might want to install the \`Automake' and \`Perl' packages.
152010cdda0Smrg         Grab them from any GNU archive site."
153010cdda0Smrg    find . -type f -name Makefile.am -print |
154010cdda0Smrg	   sed 's/\.am$/.in/' |
155010cdda0Smrg	   while read f; do touch "$f"; done
156010cdda0Smrg    ;;
157010cdda0Smrg
158010cdda0Smrg  autom4te)
159010cdda0Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
160010cdda0Smrg       # We have it, but it failed.
161010cdda0Smrg       exit 1
162010cdda0Smrg    fi
163010cdda0Smrg
164010cdda0Smrg    echo 1>&2 "\
165010cdda0SmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
166010cdda0Smrg         system.  You might have modified some files without having the
167010cdda0Smrg         proper tools for further handling them.
168010cdda0Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
169010cdda0Smrg         archive site."
170010cdda0Smrg
171010cdda0Smrg    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
172010cdda0Smrg    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
173010cdda0Smrg    if test -f "$file"; then
174010cdda0Smrg	touch $file
175010cdda0Smrg    else
176010cdda0Smrg	test -z "$file" || exec >$file
177010cdda0Smrg	echo "#! /bin/sh"
178010cdda0Smrg	echo "# Created by GNU Automake missing as a replacement of"
179010cdda0Smrg	echo "#  $ $@"
180010cdda0Smrg	echo "exit 0"
181010cdda0Smrg	chmod +x $file
182010cdda0Smrg	exit 1
183010cdda0Smrg    fi
184010cdda0Smrg    ;;
185010cdda0Smrg
186010cdda0Smrg  bison|yacc)
187010cdda0Smrg    echo 1>&2 "\
188010cdda0SmrgWARNING: \`$1' is missing on your system.  You should only need it if
189010cdda0Smrg         you modified a \`.y' file.  You may need the \`Bison' package
190010cdda0Smrg         in order for those modifications to take effect.  You can get
191010cdda0Smrg         \`Bison' from any GNU archive site."
192010cdda0Smrg    rm -f y.tab.c y.tab.h
193010cdda0Smrg    if [ $# -ne 1 ]; then
194010cdda0Smrg        eval LASTARG="\${$#}"
195010cdda0Smrg	case "$LASTARG" in
196010cdda0Smrg	*.y)
197010cdda0Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
198010cdda0Smrg	    if [ -f "$SRCFILE" ]; then
199010cdda0Smrg	         cp "$SRCFILE" y.tab.c
200010cdda0Smrg	    fi
201010cdda0Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
202010cdda0Smrg	    if [ -f "$SRCFILE" ]; then
203010cdda0Smrg	         cp "$SRCFILE" y.tab.h
204010cdda0Smrg	    fi
205010cdda0Smrg	  ;;
206010cdda0Smrg	esac
207010cdda0Smrg    fi
208010cdda0Smrg    if [ ! -f y.tab.h ]; then
209010cdda0Smrg	echo >y.tab.h
210010cdda0Smrg    fi
211010cdda0Smrg    if [ ! -f y.tab.c ]; then
212010cdda0Smrg	echo 'main() { return 0; }' >y.tab.c
213010cdda0Smrg    fi
214010cdda0Smrg    ;;
215010cdda0Smrg
216010cdda0Smrg  lex|flex)
217010cdda0Smrg    echo 1>&2 "\
218010cdda0SmrgWARNING: \`$1' is missing on your system.  You should only need it if
219010cdda0Smrg         you modified a \`.l' file.  You may need the \`Flex' package
220010cdda0Smrg         in order for those modifications to take effect.  You can get
221010cdda0Smrg         \`Flex' from any GNU archive site."
222010cdda0Smrg    rm -f lex.yy.c
223010cdda0Smrg    if [ $# -ne 1 ]; then
224010cdda0Smrg        eval LASTARG="\${$#}"
225010cdda0Smrg	case "$LASTARG" in
226010cdda0Smrg	*.l)
227010cdda0Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
228010cdda0Smrg	    if [ -f "$SRCFILE" ]; then
229010cdda0Smrg	         cp "$SRCFILE" lex.yy.c
230010cdda0Smrg	    fi
231010cdda0Smrg	  ;;
232010cdda0Smrg	esac
233010cdda0Smrg    fi
234010cdda0Smrg    if [ ! -f lex.yy.c ]; then
235010cdda0Smrg	echo 'main() { return 0; }' >lex.yy.c
236010cdda0Smrg    fi
237010cdda0Smrg    ;;
238010cdda0Smrg
239010cdda0Smrg  help2man)
240010cdda0Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
241010cdda0Smrg       # We have it, but it failed.
242010cdda0Smrg       exit 1
243010cdda0Smrg    fi
244010cdda0Smrg
245010cdda0Smrg    echo 1>&2 "\
246010cdda0SmrgWARNING: \`$1' is missing on your system.  You should only need it if
247010cdda0Smrg	 you modified a dependency of a manual page.  You may need the
248010cdda0Smrg	 \`Help2man' package in order for those modifications to take
249010cdda0Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
250010cdda0Smrg
251010cdda0Smrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
252010cdda0Smrg    if test -z "$file"; then
253010cdda0Smrg	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
254010cdda0Smrg    fi
255010cdda0Smrg    if [ -f "$file" ]; then
256010cdda0Smrg	touch $file
257010cdda0Smrg    else
258010cdda0Smrg	test -z "$file" || exec >$file
259010cdda0Smrg	echo ".ab help2man is required to generate this page"
260010cdda0Smrg	exit 1
261010cdda0Smrg    fi
262010cdda0Smrg    ;;
263010cdda0Smrg
264010cdda0Smrg  makeinfo)
265010cdda0Smrg    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
266010cdda0Smrg       # We have makeinfo, but it failed.
267010cdda0Smrg       exit 1
268010cdda0Smrg    fi
269010cdda0Smrg
270010cdda0Smrg    echo 1>&2 "\
271010cdda0SmrgWARNING: \`$1' is missing on your system.  You should only need it if
272010cdda0Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
273010cdda0Smrg         indirectly affecting the aspect of the manual.  The spurious
274010cdda0Smrg         call might also be the consequence of using a buggy \`make' (AIX,
275010cdda0Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
276010cdda0Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
277010cdda0Smrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
278010cdda0Smrg    if test -z "$file"; then
279010cdda0Smrg      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
280010cdda0Smrg      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
281010cdda0Smrg    fi
282010cdda0Smrg    touch $file
283010cdda0Smrg    ;;
284010cdda0Smrg
285010cdda0Smrg  tar)
286010cdda0Smrg    shift
287010cdda0Smrg    if test -n "$run"; then
288010cdda0Smrg      echo 1>&2 "ERROR: \`tar' requires --run"
289010cdda0Smrg      exit 1
290010cdda0Smrg    fi
291010cdda0Smrg
292010cdda0Smrg    # We have already tried tar in the generic part.
293010cdda0Smrg    # Look for gnutar/gtar before invocation to avoid ugly error
294010cdda0Smrg    # messages.
295010cdda0Smrg    if (gnutar --version > /dev/null 2>&1); then
296010cdda0Smrg       gnutar "$@" && exit 0
297010cdda0Smrg    fi
298010cdda0Smrg    if (gtar --version > /dev/null 2>&1); then
299010cdda0Smrg       gtar "$@" && exit 0
300010cdda0Smrg    fi
301010cdda0Smrg    firstarg="$1"
302010cdda0Smrg    if shift; then
303010cdda0Smrg	case "$firstarg" in
304010cdda0Smrg	*o*)
305010cdda0Smrg	    firstarg=`echo "$firstarg" | sed s/o//`
306010cdda0Smrg	    tar "$firstarg" "$@" && exit 0
307010cdda0Smrg	    ;;
308010cdda0Smrg	esac
309010cdda0Smrg	case "$firstarg" in
310010cdda0Smrg	*h*)
311010cdda0Smrg	    firstarg=`echo "$firstarg" | sed s/h//`
312010cdda0Smrg	    tar "$firstarg" "$@" && exit 0
313010cdda0Smrg	    ;;
314010cdda0Smrg	esac
315010cdda0Smrg    fi
316010cdda0Smrg
317010cdda0Smrg    echo 1>&2 "\
318010cdda0SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
319010cdda0Smrg         You may want to install GNU tar or Free paxutils, or check the
320010cdda0Smrg         command line arguments."
321010cdda0Smrg    exit 1
322010cdda0Smrg    ;;
323010cdda0Smrg
324010cdda0Smrg  *)
325010cdda0Smrg    echo 1>&2 "\
326010cdda0SmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
327010cdda0Smrg         system.  You might have modified some files without having the
328010cdda0Smrg         proper tools for further handling them.  Check the \`README' file,
329010cdda0Smrg         it often tells you about the needed prerequisites for installing
330010cdda0Smrg         this package.  You may also peek at any GNU archive site, in case
331010cdda0Smrg         some other package would contain this missing \`$1' program."
332010cdda0Smrg    exit 1
333010cdda0Smrg    ;;
334010cdda0Smrgesac
335010cdda0Smrg
336010cdda0Smrgexit 0
337