missing revision 492e1cfe
1492e1cfeSmrg#! /bin/sh
2492e1cfeSmrg# Common stub for a few missing GNU programs while installing.
3492e1cfeSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
4492e1cfeSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
5492e1cfeSmrg
6492e1cfeSmrg# This program is free software; you can redistribute it and/or modify
7492e1cfeSmrg# it under the terms of the GNU General Public License as published by
8492e1cfeSmrg# the Free Software Foundation; either version 2, or (at your option)
9492e1cfeSmrg# any later version.
10492e1cfeSmrg
11492e1cfeSmrg# This program is distributed in the hope that it will be useful,
12492e1cfeSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
13492e1cfeSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14492e1cfeSmrg# GNU General Public License for more details.
15492e1cfeSmrg
16492e1cfeSmrg# You should have received a copy of the GNU General Public License
17492e1cfeSmrg# along with this program; if not, write to the Free Software
18492e1cfeSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19492e1cfeSmrg# 02111-1307, USA.
20492e1cfeSmrg
21492e1cfeSmrg# As a special exception to the GNU General Public License, if you
22492e1cfeSmrg# distribute this file as part of a program that contains a
23492e1cfeSmrg# configuration script generated by Autoconf, you may include it under
24492e1cfeSmrg# the same distribution terms that you use for the rest of that program.
25492e1cfeSmrg
26492e1cfeSmrgif test $# -eq 0; then
27492e1cfeSmrg  echo 1>&2 "Try \`$0 --help' for more information"
28492e1cfeSmrg  exit 1
29492e1cfeSmrgfi
30492e1cfeSmrg
31492e1cfeSmrgrun=:
32492e1cfeSmrg
33492e1cfeSmrg# In the cases where this matters, `missing' is being run in the
34492e1cfeSmrg# srcdir already.
35492e1cfeSmrgif test -f configure.ac; then
36492e1cfeSmrg  configure_ac=configure.ac
37492e1cfeSmrgelse
38492e1cfeSmrg  configure_ac=configure.in
39492e1cfeSmrgfi
40492e1cfeSmrg
41492e1cfeSmrgcase "$1" in
42492e1cfeSmrg--run)
43492e1cfeSmrg  # Try to run requested program, and just exit if it succeeds.
44492e1cfeSmrg  run=
45492e1cfeSmrg  shift
46492e1cfeSmrg  "$@" && exit 0
47492e1cfeSmrg  ;;
48492e1cfeSmrgesac
49492e1cfeSmrg
50492e1cfeSmrg# If it does not exist, or fails to run (possibly an outdated version),
51492e1cfeSmrg# try to emulate it.
52492e1cfeSmrgcase "$1" in
53492e1cfeSmrg
54492e1cfeSmrg  -h|--h|--he|--hel|--help)
55492e1cfeSmrg    echo "\
56492e1cfeSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
57492e1cfeSmrg
58492e1cfeSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
59492e1cfeSmrgerror status if there is no known handling for PROGRAM.
60492e1cfeSmrg
61492e1cfeSmrgOptions:
62492e1cfeSmrg  -h, --help      display this help and exit
63492e1cfeSmrg  -v, --version   output version information and exit
64492e1cfeSmrg  --run           try to run the given command, and emulate it if it fails
65492e1cfeSmrg
66492e1cfeSmrgSupported PROGRAM values:
67492e1cfeSmrg  aclocal      touch file \`aclocal.m4'
68492e1cfeSmrg  autoconf     touch file \`configure'
69492e1cfeSmrg  autoheader   touch file \`config.h.in'
70492e1cfeSmrg  automake     touch all \`Makefile.in' files
71492e1cfeSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
72492e1cfeSmrg  flex         create \`lex.yy.c', if possible, from existing .c
73492e1cfeSmrg  help2man     touch the output file
74492e1cfeSmrg  lex          create \`lex.yy.c', if possible, from existing .c
75492e1cfeSmrg  makeinfo     touch the output file
76492e1cfeSmrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
77492e1cfeSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
78492e1cfeSmrg    ;;
79492e1cfeSmrg
80492e1cfeSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
81492e1cfeSmrg    echo "missing 0.4 - GNU automake"
82492e1cfeSmrg    ;;
83492e1cfeSmrg
84492e1cfeSmrg  -*)
85492e1cfeSmrg    echo 1>&2 "$0: Unknown \`$1' option"
86492e1cfeSmrg    echo 1>&2 "Try \`$0 --help' for more information"
87492e1cfeSmrg    exit 1
88492e1cfeSmrg    ;;
89492e1cfeSmrg
90492e1cfeSmrg  aclocal*)
91492e1cfeSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
92492e1cfeSmrg       # We have it, but it failed.
93492e1cfeSmrg       exit 1
94492e1cfeSmrg    fi
95492e1cfeSmrg
96492e1cfeSmrg    echo 1>&2 "\
97492e1cfeSmrgWARNING: \`$1' is missing on your system.  You should only need it if
98492e1cfeSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
99492e1cfeSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
100492e1cfeSmrg         any GNU archive site."
101492e1cfeSmrg    touch aclocal.m4
102492e1cfeSmrg    ;;
103492e1cfeSmrg
104492e1cfeSmrg  autoconf)
105492e1cfeSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
106492e1cfeSmrg       # We have it, but it failed.
107492e1cfeSmrg       exit 1
108492e1cfeSmrg    fi
109492e1cfeSmrg
110492e1cfeSmrg    echo 1>&2 "\
111492e1cfeSmrgWARNING: \`$1' is missing on your system.  You should only need it if
112492e1cfeSmrg         you modified \`${configure_ac}'.  You might want to install the
113492e1cfeSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
114492e1cfeSmrg         archive site."
115492e1cfeSmrg    touch configure
116492e1cfeSmrg    ;;
117492e1cfeSmrg
118492e1cfeSmrg  autoheader)
119492e1cfeSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
120492e1cfeSmrg       # We have it, but it failed.
121492e1cfeSmrg       exit 1
122492e1cfeSmrg    fi
123492e1cfeSmrg
124492e1cfeSmrg    echo 1>&2 "\
125492e1cfeSmrgWARNING: \`$1' is missing on your system.  You should only need it if
126492e1cfeSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
127492e1cfeSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
128492e1cfeSmrg         from any GNU archive site."
129492e1cfeSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
130492e1cfeSmrg    test -z "$files" && files="config.h"
131492e1cfeSmrg    touch_files=
132492e1cfeSmrg    for f in $files; do
133492e1cfeSmrg      case "$f" in
134492e1cfeSmrg      *:*) touch_files="$touch_files "`echo "$f" |
135492e1cfeSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
136492e1cfeSmrg      *) touch_files="$touch_files $f.in";;
137492e1cfeSmrg      esac
138492e1cfeSmrg    done
139492e1cfeSmrg    touch $touch_files
140492e1cfeSmrg    ;;
141492e1cfeSmrg
142492e1cfeSmrg  automake*)
143492e1cfeSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
144492e1cfeSmrg       # We have it, but it failed.
145492e1cfeSmrg       exit 1
146492e1cfeSmrg    fi
147492e1cfeSmrg
148492e1cfeSmrg    echo 1>&2 "\
149492e1cfeSmrgWARNING: \`$1' is missing on your system.  You should only need it if
150492e1cfeSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
151492e1cfeSmrg         You might want to install the \`Automake' and \`Perl' packages.
152492e1cfeSmrg         Grab them from any GNU archive site."
153492e1cfeSmrg    find . -type f -name Makefile.am -print |
154492e1cfeSmrg	   sed 's/\.am$/.in/' |
155492e1cfeSmrg	   while read f; do touch "$f"; done
156492e1cfeSmrg    ;;
157492e1cfeSmrg
158492e1cfeSmrg  autom4te)
159492e1cfeSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
160492e1cfeSmrg       # We have it, but it failed.
161492e1cfeSmrg       exit 1
162492e1cfeSmrg    fi
163492e1cfeSmrg
164492e1cfeSmrg    echo 1>&2 "\
165492e1cfeSmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
166492e1cfeSmrg         system.  You might have modified some files without having the
167492e1cfeSmrg         proper tools for further handling them.
168492e1cfeSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
169492e1cfeSmrg         archive site."
170492e1cfeSmrg
171492e1cfeSmrg    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
172492e1cfeSmrg    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
173492e1cfeSmrg    if test -f "$file"; then
174492e1cfeSmrg	touch $file
175492e1cfeSmrg    else
176492e1cfeSmrg	test -z "$file" || exec >$file
177492e1cfeSmrg	echo "#! /bin/sh"
178492e1cfeSmrg	echo "# Created by GNU Automake missing as a replacement of"
179492e1cfeSmrg	echo "#  $ $@"
180492e1cfeSmrg	echo "exit 0"
181492e1cfeSmrg	chmod +x $file
182492e1cfeSmrg	exit 1
183492e1cfeSmrg    fi
184492e1cfeSmrg    ;;
185492e1cfeSmrg
186492e1cfeSmrg  bison|yacc)
187492e1cfeSmrg    echo 1>&2 "\
188492e1cfeSmrgWARNING: \`$1' is missing on your system.  You should only need it if
189492e1cfeSmrg         you modified a \`.y' file.  You may need the \`Bison' package
190492e1cfeSmrg         in order for those modifications to take effect.  You can get
191492e1cfeSmrg         \`Bison' from any GNU archive site."
192492e1cfeSmrg    rm -f y.tab.c y.tab.h
193492e1cfeSmrg    if [ $# -ne 1 ]; then
194492e1cfeSmrg        eval LASTARG="\${$#}"
195492e1cfeSmrg	case "$LASTARG" in
196492e1cfeSmrg	*.y)
197492e1cfeSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
198492e1cfeSmrg	    if [ -f "$SRCFILE" ]; then
199492e1cfeSmrg	         cp "$SRCFILE" y.tab.c
200492e1cfeSmrg	    fi
201492e1cfeSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
202492e1cfeSmrg	    if [ -f "$SRCFILE" ]; then
203492e1cfeSmrg	         cp "$SRCFILE" y.tab.h
204492e1cfeSmrg	    fi
205492e1cfeSmrg	  ;;
206492e1cfeSmrg	esac
207492e1cfeSmrg    fi
208492e1cfeSmrg    if [ ! -f y.tab.h ]; then
209492e1cfeSmrg	echo >y.tab.h
210492e1cfeSmrg    fi
211492e1cfeSmrg    if [ ! -f y.tab.c ]; then
212492e1cfeSmrg	echo 'main() { return 0; }' >y.tab.c
213492e1cfeSmrg    fi
214492e1cfeSmrg    ;;
215492e1cfeSmrg
216492e1cfeSmrg  lex|flex)
217492e1cfeSmrg    echo 1>&2 "\
218492e1cfeSmrgWARNING: \`$1' is missing on your system.  You should only need it if
219492e1cfeSmrg         you modified a \`.l' file.  You may need the \`Flex' package
220492e1cfeSmrg         in order for those modifications to take effect.  You can get
221492e1cfeSmrg         \`Flex' from any GNU archive site."
222492e1cfeSmrg    rm -f lex.yy.c
223492e1cfeSmrg    if [ $# -ne 1 ]; then
224492e1cfeSmrg        eval LASTARG="\${$#}"
225492e1cfeSmrg	case "$LASTARG" in
226492e1cfeSmrg	*.l)
227492e1cfeSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
228492e1cfeSmrg	    if [ -f "$SRCFILE" ]; then
229492e1cfeSmrg	         cp "$SRCFILE" lex.yy.c
230492e1cfeSmrg	    fi
231492e1cfeSmrg	  ;;
232492e1cfeSmrg	esac
233492e1cfeSmrg    fi
234492e1cfeSmrg    if [ ! -f lex.yy.c ]; then
235492e1cfeSmrg	echo 'main() { return 0; }' >lex.yy.c
236492e1cfeSmrg    fi
237492e1cfeSmrg    ;;
238492e1cfeSmrg
239492e1cfeSmrg  help2man)
240492e1cfeSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
241492e1cfeSmrg       # We have it, but it failed.
242492e1cfeSmrg       exit 1
243492e1cfeSmrg    fi
244492e1cfeSmrg
245492e1cfeSmrg    echo 1>&2 "\
246492e1cfeSmrgWARNING: \`$1' is missing on your system.  You should only need it if
247492e1cfeSmrg	 you modified a dependency of a manual page.  You may need the
248492e1cfeSmrg	 \`Help2man' package in order for those modifications to take
249492e1cfeSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
250492e1cfeSmrg
251492e1cfeSmrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
252492e1cfeSmrg    if test -z "$file"; then
253492e1cfeSmrg	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
254492e1cfeSmrg    fi
255492e1cfeSmrg    if [ -f "$file" ]; then
256492e1cfeSmrg	touch $file
257492e1cfeSmrg    else
258492e1cfeSmrg	test -z "$file" || exec >$file
259492e1cfeSmrg	echo ".ab help2man is required to generate this page"
260492e1cfeSmrg	exit 1
261492e1cfeSmrg    fi
262492e1cfeSmrg    ;;
263492e1cfeSmrg
264492e1cfeSmrg  makeinfo)
265492e1cfeSmrg    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
266492e1cfeSmrg       # We have makeinfo, but it failed.
267492e1cfeSmrg       exit 1
268492e1cfeSmrg    fi
269492e1cfeSmrg
270492e1cfeSmrg    echo 1>&2 "\
271492e1cfeSmrgWARNING: \`$1' is missing on your system.  You should only need it if
272492e1cfeSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
273492e1cfeSmrg         indirectly affecting the aspect of the manual.  The spurious
274492e1cfeSmrg         call might also be the consequence of using a buggy \`make' (AIX,
275492e1cfeSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
276492e1cfeSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
277492e1cfeSmrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
278492e1cfeSmrg    if test -z "$file"; then
279492e1cfeSmrg      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
280492e1cfeSmrg      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
281492e1cfeSmrg    fi
282492e1cfeSmrg    touch $file
283492e1cfeSmrg    ;;
284492e1cfeSmrg
285492e1cfeSmrg  tar)
286492e1cfeSmrg    shift
287492e1cfeSmrg    if test -n "$run"; then
288492e1cfeSmrg      echo 1>&2 "ERROR: \`tar' requires --run"
289492e1cfeSmrg      exit 1
290492e1cfeSmrg    fi
291492e1cfeSmrg
292492e1cfeSmrg    # We have already tried tar in the generic part.
293492e1cfeSmrg    # Look for gnutar/gtar before invocation to avoid ugly error
294492e1cfeSmrg    # messages.
295492e1cfeSmrg    if (gnutar --version > /dev/null 2>&1); then
296492e1cfeSmrg       gnutar "$@" && exit 0
297492e1cfeSmrg    fi
298492e1cfeSmrg    if (gtar --version > /dev/null 2>&1); then
299492e1cfeSmrg       gtar "$@" && exit 0
300492e1cfeSmrg    fi
301492e1cfeSmrg    firstarg="$1"
302492e1cfeSmrg    if shift; then
303492e1cfeSmrg	case "$firstarg" in
304492e1cfeSmrg	*o*)
305492e1cfeSmrg	    firstarg=`echo "$firstarg" | sed s/o//`
306492e1cfeSmrg	    tar "$firstarg" "$@" && exit 0
307492e1cfeSmrg	    ;;
308492e1cfeSmrg	esac
309492e1cfeSmrg	case "$firstarg" in
310492e1cfeSmrg	*h*)
311492e1cfeSmrg	    firstarg=`echo "$firstarg" | sed s/h//`
312492e1cfeSmrg	    tar "$firstarg" "$@" && exit 0
313492e1cfeSmrg	    ;;
314492e1cfeSmrg	esac
315492e1cfeSmrg    fi
316492e1cfeSmrg
317492e1cfeSmrg    echo 1>&2 "\
318492e1cfeSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
319492e1cfeSmrg         You may want to install GNU tar or Free paxutils, or check the
320492e1cfeSmrg         command line arguments."
321492e1cfeSmrg    exit 1
322492e1cfeSmrg    ;;
323492e1cfeSmrg
324492e1cfeSmrg  *)
325492e1cfeSmrg    echo 1>&2 "\
326492e1cfeSmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
327492e1cfeSmrg         system.  You might have modified some files without having the
328492e1cfeSmrg         proper tools for further handling them.  Check the \`README' file,
329492e1cfeSmrg         it often tells you about the needed prerequisites for installing
330492e1cfeSmrg         this package.  You may also peek at any GNU archive site, in case
331492e1cfeSmrg         some other package would contain this missing \`$1' program."
332492e1cfeSmrg    exit 1
333492e1cfeSmrg    ;;
334492e1cfeSmrgesac
335492e1cfeSmrg
336492e1cfeSmrgexit 0
337