missing revision 966bf024
1966bf024Smrg#! /bin/sh
2966bf024Smrg# Common stub for a few missing GNU programs while installing.
3966bf024Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
4966bf024Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
5966bf024Smrg
6966bf024Smrg# This program is free software; you can redistribute it and/or modify
7966bf024Smrg# it under the terms of the GNU General Public License as published by
8966bf024Smrg# the Free Software Foundation; either version 2, or (at your option)
9966bf024Smrg# any later version.
10966bf024Smrg
11966bf024Smrg# This program is distributed in the hope that it will be useful,
12966bf024Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
13966bf024Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14966bf024Smrg# GNU General Public License for more details.
15966bf024Smrg
16966bf024Smrg# You should have received a copy of the GNU General Public License
17966bf024Smrg# along with this program; if not, write to the Free Software
18966bf024Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19966bf024Smrg# 02111-1307, USA.
20966bf024Smrg
21966bf024Smrg# As a special exception to the GNU General Public License, if you
22966bf024Smrg# distribute this file as part of a program that contains a
23966bf024Smrg# configuration script generated by Autoconf, you may include it under
24966bf024Smrg# the same distribution terms that you use for the rest of that program.
25966bf024Smrg
26966bf024Smrgif test $# -eq 0; then
27966bf024Smrg  echo 1>&2 "Try \`$0 --help' for more information"
28966bf024Smrg  exit 1
29966bf024Smrgfi
30966bf024Smrg
31966bf024Smrgrun=:
32966bf024Smrg
33966bf024Smrg# In the cases where this matters, `missing' is being run in the
34966bf024Smrg# srcdir already.
35966bf024Smrgif test -f configure.ac; then
36966bf024Smrg  configure_ac=configure.ac
37966bf024Smrgelse
38966bf024Smrg  configure_ac=configure.in
39966bf024Smrgfi
40966bf024Smrg
41966bf024Smrgcase "$1" in
42966bf024Smrg--run)
43966bf024Smrg  # Try to run requested program, and just exit if it succeeds.
44966bf024Smrg  run=
45966bf024Smrg  shift
46966bf024Smrg  "$@" && exit 0
47966bf024Smrg  ;;
48966bf024Smrgesac
49966bf024Smrg
50966bf024Smrg# If it does not exist, or fails to run (possibly an outdated version),
51966bf024Smrg# try to emulate it.
52966bf024Smrgcase "$1" in
53966bf024Smrg
54966bf024Smrg  -h|--h|--he|--hel|--help)
55966bf024Smrg    echo "\
56966bf024Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
57966bf024Smrg
58966bf024SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
59966bf024Smrgerror status if there is no known handling for PROGRAM.
60966bf024Smrg
61966bf024SmrgOptions:
62966bf024Smrg  -h, --help      display this help and exit
63966bf024Smrg  -v, --version   output version information and exit
64966bf024Smrg  --run           try to run the given command, and emulate it if it fails
65966bf024Smrg
66966bf024SmrgSupported PROGRAM values:
67966bf024Smrg  aclocal      touch file \`aclocal.m4'
68966bf024Smrg  autoconf     touch file \`configure'
69966bf024Smrg  autoheader   touch file \`config.h.in'
70966bf024Smrg  automake     touch all \`Makefile.in' files
71966bf024Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
72966bf024Smrg  flex         create \`lex.yy.c', if possible, from existing .c
73966bf024Smrg  help2man     touch the output file
74966bf024Smrg  lex          create \`lex.yy.c', if possible, from existing .c
75966bf024Smrg  makeinfo     touch the output file
76966bf024Smrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
77966bf024Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
78966bf024Smrg    ;;
79966bf024Smrg
80966bf024Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
81966bf024Smrg    echo "missing 0.4 - GNU automake"
82966bf024Smrg    ;;
83966bf024Smrg
84966bf024Smrg  -*)
85966bf024Smrg    echo 1>&2 "$0: Unknown \`$1' option"
86966bf024Smrg    echo 1>&2 "Try \`$0 --help' for more information"
87966bf024Smrg    exit 1
88966bf024Smrg    ;;
89966bf024Smrg
90966bf024Smrg  aclocal*)
91966bf024Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
92966bf024Smrg       # We have it, but it failed.
93966bf024Smrg       exit 1
94966bf024Smrg    fi
95966bf024Smrg
96966bf024Smrg    echo 1>&2 "\
97966bf024SmrgWARNING: \`$1' is missing on your system.  You should only need it if
98966bf024Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
99966bf024Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
100966bf024Smrg         any GNU archive site."
101966bf024Smrg    touch aclocal.m4
102966bf024Smrg    ;;
103966bf024Smrg
104966bf024Smrg  autoconf)
105966bf024Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
106966bf024Smrg       # We have it, but it failed.
107966bf024Smrg       exit 1
108966bf024Smrg    fi
109966bf024Smrg
110966bf024Smrg    echo 1>&2 "\
111966bf024SmrgWARNING: \`$1' is missing on your system.  You should only need it if
112966bf024Smrg         you modified \`${configure_ac}'.  You might want to install the
113966bf024Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
114966bf024Smrg         archive site."
115966bf024Smrg    touch configure
116966bf024Smrg    ;;
117966bf024Smrg
118966bf024Smrg  autoheader)
119966bf024Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
120966bf024Smrg       # We have it, but it failed.
121966bf024Smrg       exit 1
122966bf024Smrg    fi
123966bf024Smrg
124966bf024Smrg    echo 1>&2 "\
125966bf024SmrgWARNING: \`$1' is missing on your system.  You should only need it if
126966bf024Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
127966bf024Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
128966bf024Smrg         from any GNU archive site."
129966bf024Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
130966bf024Smrg    test -z "$files" && files="config.h"
131966bf024Smrg    touch_files=
132966bf024Smrg    for f in $files; do
133966bf024Smrg      case "$f" in
134966bf024Smrg      *:*) touch_files="$touch_files "`echo "$f" |
135966bf024Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
136966bf024Smrg      *) touch_files="$touch_files $f.in";;
137966bf024Smrg      esac
138966bf024Smrg    done
139966bf024Smrg    touch $touch_files
140966bf024Smrg    ;;
141966bf024Smrg
142966bf024Smrg  automake*)
143966bf024Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
144966bf024Smrg       # We have it, but it failed.
145966bf024Smrg       exit 1
146966bf024Smrg    fi
147966bf024Smrg
148966bf024Smrg    echo 1>&2 "\
149966bf024SmrgWARNING: \`$1' is missing on your system.  You should only need it if
150966bf024Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
151966bf024Smrg         You might want to install the \`Automake' and \`Perl' packages.
152966bf024Smrg         Grab them from any GNU archive site."
153966bf024Smrg    find . -type f -name Makefile.am -print |
154966bf024Smrg	   sed 's/\.am$/.in/' |
155966bf024Smrg	   while read f; do touch "$f"; done
156966bf024Smrg    ;;
157966bf024Smrg
158966bf024Smrg  autom4te)
159966bf024Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
160966bf024Smrg       # We have it, but it failed.
161966bf024Smrg       exit 1
162966bf024Smrg    fi
163966bf024Smrg
164966bf024Smrg    echo 1>&2 "\
165966bf024SmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
166966bf024Smrg         system.  You might have modified some files without having the
167966bf024Smrg         proper tools for further handling them.
168966bf024Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
169966bf024Smrg         archive site."
170966bf024Smrg
171966bf024Smrg    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
172966bf024Smrg    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
173966bf024Smrg    if test -f "$file"; then
174966bf024Smrg	touch $file
175966bf024Smrg    else
176966bf024Smrg	test -z "$file" || exec >$file
177966bf024Smrg	echo "#! /bin/sh"
178966bf024Smrg	echo "# Created by GNU Automake missing as a replacement of"
179966bf024Smrg	echo "#  $ $@"
180966bf024Smrg	echo "exit 0"
181966bf024Smrg	chmod +x $file
182966bf024Smrg	exit 1
183966bf024Smrg    fi
184966bf024Smrg    ;;
185966bf024Smrg
186966bf024Smrg  bison|yacc)
187966bf024Smrg    echo 1>&2 "\
188966bf024SmrgWARNING: \`$1' is missing on your system.  You should only need it if
189966bf024Smrg         you modified a \`.y' file.  You may need the \`Bison' package
190966bf024Smrg         in order for those modifications to take effect.  You can get
191966bf024Smrg         \`Bison' from any GNU archive site."
192966bf024Smrg    rm -f y.tab.c y.tab.h
193966bf024Smrg    if [ $# -ne 1 ]; then
194966bf024Smrg        eval LASTARG="\${$#}"
195966bf024Smrg	case "$LASTARG" in
196966bf024Smrg	*.y)
197966bf024Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
198966bf024Smrg	    if [ -f "$SRCFILE" ]; then
199966bf024Smrg	         cp "$SRCFILE" y.tab.c
200966bf024Smrg	    fi
201966bf024Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
202966bf024Smrg	    if [ -f "$SRCFILE" ]; then
203966bf024Smrg	         cp "$SRCFILE" y.tab.h
204966bf024Smrg	    fi
205966bf024Smrg	  ;;
206966bf024Smrg	esac
207966bf024Smrg    fi
208966bf024Smrg    if [ ! -f y.tab.h ]; then
209966bf024Smrg	echo >y.tab.h
210966bf024Smrg    fi
211966bf024Smrg    if [ ! -f y.tab.c ]; then
212966bf024Smrg	echo 'main() { return 0; }' >y.tab.c
213966bf024Smrg    fi
214966bf024Smrg    ;;
215966bf024Smrg
216966bf024Smrg  lex|flex)
217966bf024Smrg    echo 1>&2 "\
218966bf024SmrgWARNING: \`$1' is missing on your system.  You should only need it if
219966bf024Smrg         you modified a \`.l' file.  You may need the \`Flex' package
220966bf024Smrg         in order for those modifications to take effect.  You can get
221966bf024Smrg         \`Flex' from any GNU archive site."
222966bf024Smrg    rm -f lex.yy.c
223966bf024Smrg    if [ $# -ne 1 ]; then
224966bf024Smrg        eval LASTARG="\${$#}"
225966bf024Smrg	case "$LASTARG" in
226966bf024Smrg	*.l)
227966bf024Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
228966bf024Smrg	    if [ -f "$SRCFILE" ]; then
229966bf024Smrg	         cp "$SRCFILE" lex.yy.c
230966bf024Smrg	    fi
231966bf024Smrg	  ;;
232966bf024Smrg	esac
233966bf024Smrg    fi
234966bf024Smrg    if [ ! -f lex.yy.c ]; then
235966bf024Smrg	echo 'main() { return 0; }' >lex.yy.c
236966bf024Smrg    fi
237966bf024Smrg    ;;
238966bf024Smrg
239966bf024Smrg  help2man)
240966bf024Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
241966bf024Smrg       # We have it, but it failed.
242966bf024Smrg       exit 1
243966bf024Smrg    fi
244966bf024Smrg
245966bf024Smrg    echo 1>&2 "\
246966bf024SmrgWARNING: \`$1' is missing on your system.  You should only need it if
247966bf024Smrg	 you modified a dependency of a manual page.  You may need the
248966bf024Smrg	 \`Help2man' package in order for those modifications to take
249966bf024Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
250966bf024Smrg
251966bf024Smrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
252966bf024Smrg    if test -z "$file"; then
253966bf024Smrg	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
254966bf024Smrg    fi
255966bf024Smrg    if [ -f "$file" ]; then
256966bf024Smrg	touch $file
257966bf024Smrg    else
258966bf024Smrg	test -z "$file" || exec >$file
259966bf024Smrg	echo ".ab help2man is required to generate this page"
260966bf024Smrg	exit 1
261966bf024Smrg    fi
262966bf024Smrg    ;;
263966bf024Smrg
264966bf024Smrg  makeinfo)
265966bf024Smrg    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
266966bf024Smrg       # We have makeinfo, but it failed.
267966bf024Smrg       exit 1
268966bf024Smrg    fi
269966bf024Smrg
270966bf024Smrg    echo 1>&2 "\
271966bf024SmrgWARNING: \`$1' is missing on your system.  You should only need it if
272966bf024Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
273966bf024Smrg         indirectly affecting the aspect of the manual.  The spurious
274966bf024Smrg         call might also be the consequence of using a buggy \`make' (AIX,
275966bf024Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
276966bf024Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
277966bf024Smrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
278966bf024Smrg    if test -z "$file"; then
279966bf024Smrg      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
280966bf024Smrg      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
281966bf024Smrg    fi
282966bf024Smrg    touch $file
283966bf024Smrg    ;;
284966bf024Smrg
285966bf024Smrg  tar)
286966bf024Smrg    shift
287966bf024Smrg    if test -n "$run"; then
288966bf024Smrg      echo 1>&2 "ERROR: \`tar' requires --run"
289966bf024Smrg      exit 1
290966bf024Smrg    fi
291966bf024Smrg
292966bf024Smrg    # We have already tried tar in the generic part.
293966bf024Smrg    # Look for gnutar/gtar before invocation to avoid ugly error
294966bf024Smrg    # messages.
295966bf024Smrg    if (gnutar --version > /dev/null 2>&1); then
296966bf024Smrg       gnutar "$@" && exit 0
297966bf024Smrg    fi
298966bf024Smrg    if (gtar --version > /dev/null 2>&1); then
299966bf024Smrg       gtar "$@" && exit 0
300966bf024Smrg    fi
301966bf024Smrg    firstarg="$1"
302966bf024Smrg    if shift; then
303966bf024Smrg	case "$firstarg" in
304966bf024Smrg	*o*)
305966bf024Smrg	    firstarg=`echo "$firstarg" | sed s/o//`
306966bf024Smrg	    tar "$firstarg" "$@" && exit 0
307966bf024Smrg	    ;;
308966bf024Smrg	esac
309966bf024Smrg	case "$firstarg" in
310966bf024Smrg	*h*)
311966bf024Smrg	    firstarg=`echo "$firstarg" | sed s/h//`
312966bf024Smrg	    tar "$firstarg" "$@" && exit 0
313966bf024Smrg	    ;;
314966bf024Smrg	esac
315966bf024Smrg    fi
316966bf024Smrg
317966bf024Smrg    echo 1>&2 "\
318966bf024SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
319966bf024Smrg         You may want to install GNU tar or Free paxutils, or check the
320966bf024Smrg         command line arguments."
321966bf024Smrg    exit 1
322966bf024Smrg    ;;
323966bf024Smrg
324966bf024Smrg  *)
325966bf024Smrg    echo 1>&2 "\
326966bf024SmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
327966bf024Smrg         system.  You might have modified some files without having the
328966bf024Smrg         proper tools for further handling them.  Check the \`README' file,
329966bf024Smrg         it often tells you about the needed prerequisites for installing
330966bf024Smrg         this package.  You may also peek at any GNU archive site, in case
331966bf024Smrg         some other package would contain this missing \`$1' program."
332966bf024Smrg    exit 1
333966bf024Smrg    ;;
334966bf024Smrgesac
335966bf024Smrg
336966bf024Smrgexit 0
337