missing revision 439fab64
1439fab64Smrg#! /bin/sh
2439fab64Smrg# Common stub for a few missing GNU programs while installing.
3439fab64Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
4439fab64Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
5439fab64Smrg
6439fab64Smrg# This program is free software; you can redistribute it and/or modify
7439fab64Smrg# it under the terms of the GNU General Public License as published by
8439fab64Smrg# the Free Software Foundation; either version 2, or (at your option)
9439fab64Smrg# any later version.
10439fab64Smrg
11439fab64Smrg# This program is distributed in the hope that it will be useful,
12439fab64Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
13439fab64Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14439fab64Smrg# GNU General Public License for more details.
15439fab64Smrg
16439fab64Smrg# You should have received a copy of the GNU General Public License
17439fab64Smrg# along with this program; if not, write to the Free Software
18439fab64Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19439fab64Smrg# 02111-1307, USA.
20439fab64Smrg
21439fab64Smrg# As a special exception to the GNU General Public License, if you
22439fab64Smrg# distribute this file as part of a program that contains a
23439fab64Smrg# configuration script generated by Autoconf, you may include it under
24439fab64Smrg# the same distribution terms that you use for the rest of that program.
25439fab64Smrg
26439fab64Smrgif test $# -eq 0; then
27439fab64Smrg  echo 1>&2 "Try \`$0 --help' for more information"
28439fab64Smrg  exit 1
29439fab64Smrgfi
30439fab64Smrg
31439fab64Smrgrun=:
32439fab64Smrg
33439fab64Smrg# In the cases where this matters, `missing' is being run in the
34439fab64Smrg# srcdir already.
35439fab64Smrgif test -f configure.ac; then
36439fab64Smrg  configure_ac=configure.ac
37439fab64Smrgelse
38439fab64Smrg  configure_ac=configure.in
39439fab64Smrgfi
40439fab64Smrg
41439fab64Smrgcase "$1" in
42439fab64Smrg--run)
43439fab64Smrg  # Try to run requested program, and just exit if it succeeds.
44439fab64Smrg  run=
45439fab64Smrg  shift
46439fab64Smrg  "$@" && exit 0
47439fab64Smrg  ;;
48439fab64Smrgesac
49439fab64Smrg
50439fab64Smrg# If it does not exist, or fails to run (possibly an outdated version),
51439fab64Smrg# try to emulate it.
52439fab64Smrgcase "$1" in
53439fab64Smrg
54439fab64Smrg  -h|--h|--he|--hel|--help)
55439fab64Smrg    echo "\
56439fab64Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
57439fab64Smrg
58439fab64SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
59439fab64Smrgerror status if there is no known handling for PROGRAM.
60439fab64Smrg
61439fab64SmrgOptions:
62439fab64Smrg  -h, --help      display this help and exit
63439fab64Smrg  -v, --version   output version information and exit
64439fab64Smrg  --run           try to run the given command, and emulate it if it fails
65439fab64Smrg
66439fab64SmrgSupported PROGRAM values:
67439fab64Smrg  aclocal      touch file \`aclocal.m4'
68439fab64Smrg  autoconf     touch file \`configure'
69439fab64Smrg  autoheader   touch file \`config.h.in'
70439fab64Smrg  automake     touch all \`Makefile.in' files
71439fab64Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
72439fab64Smrg  flex         create \`lex.yy.c', if possible, from existing .c
73439fab64Smrg  help2man     touch the output file
74439fab64Smrg  lex          create \`lex.yy.c', if possible, from existing .c
75439fab64Smrg  makeinfo     touch the output file
76439fab64Smrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
77439fab64Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
78439fab64Smrg    ;;
79439fab64Smrg
80439fab64Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
81439fab64Smrg    echo "missing 0.4 - GNU automake"
82439fab64Smrg    ;;
83439fab64Smrg
84439fab64Smrg  -*)
85439fab64Smrg    echo 1>&2 "$0: Unknown \`$1' option"
86439fab64Smrg    echo 1>&2 "Try \`$0 --help' for more information"
87439fab64Smrg    exit 1
88439fab64Smrg    ;;
89439fab64Smrg
90439fab64Smrg  aclocal*)
91439fab64Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
92439fab64Smrg       # We have it, but it failed.
93439fab64Smrg       exit 1
94439fab64Smrg    fi
95439fab64Smrg
96439fab64Smrg    echo 1>&2 "\
97439fab64SmrgWARNING: \`$1' is missing on your system.  You should only need it if
98439fab64Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
99439fab64Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
100439fab64Smrg         any GNU archive site."
101439fab64Smrg    touch aclocal.m4
102439fab64Smrg    ;;
103439fab64Smrg
104439fab64Smrg  autoconf)
105439fab64Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
106439fab64Smrg       # We have it, but it failed.
107439fab64Smrg       exit 1
108439fab64Smrg    fi
109439fab64Smrg
110439fab64Smrg    echo 1>&2 "\
111439fab64SmrgWARNING: \`$1' is missing on your system.  You should only need it if
112439fab64Smrg         you modified \`${configure_ac}'.  You might want to install the
113439fab64Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
114439fab64Smrg         archive site."
115439fab64Smrg    touch configure
116439fab64Smrg    ;;
117439fab64Smrg
118439fab64Smrg  autoheader)
119439fab64Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
120439fab64Smrg       # We have it, but it failed.
121439fab64Smrg       exit 1
122439fab64Smrg    fi
123439fab64Smrg
124439fab64Smrg    echo 1>&2 "\
125439fab64SmrgWARNING: \`$1' is missing on your system.  You should only need it if
126439fab64Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
127439fab64Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
128439fab64Smrg         from any GNU archive site."
129439fab64Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
130439fab64Smrg    test -z "$files" && files="config.h"
131439fab64Smrg    touch_files=
132439fab64Smrg    for f in $files; do
133439fab64Smrg      case "$f" in
134439fab64Smrg      *:*) touch_files="$touch_files "`echo "$f" |
135439fab64Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
136439fab64Smrg      *) touch_files="$touch_files $f.in";;
137439fab64Smrg      esac
138439fab64Smrg    done
139439fab64Smrg    touch $touch_files
140439fab64Smrg    ;;
141439fab64Smrg
142439fab64Smrg  automake*)
143439fab64Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
144439fab64Smrg       # We have it, but it failed.
145439fab64Smrg       exit 1
146439fab64Smrg    fi
147439fab64Smrg
148439fab64Smrg    echo 1>&2 "\
149439fab64SmrgWARNING: \`$1' is missing on your system.  You should only need it if
150439fab64Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
151439fab64Smrg         You might want to install the \`Automake' and \`Perl' packages.
152439fab64Smrg         Grab them from any GNU archive site."
153439fab64Smrg    find . -type f -name Makefile.am -print |
154439fab64Smrg	   sed 's/\.am$/.in/' |
155439fab64Smrg	   while read f; do touch "$f"; done
156439fab64Smrg    ;;
157439fab64Smrg
158439fab64Smrg  autom4te)
159439fab64Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
160439fab64Smrg       # We have it, but it failed.
161439fab64Smrg       exit 1
162439fab64Smrg    fi
163439fab64Smrg
164439fab64Smrg    echo 1>&2 "\
165439fab64SmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
166439fab64Smrg         system.  You might have modified some files without having the
167439fab64Smrg         proper tools for further handling them.
168439fab64Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
169439fab64Smrg         archive site."
170439fab64Smrg
171439fab64Smrg    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
172439fab64Smrg    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
173439fab64Smrg    if test -f "$file"; then
174439fab64Smrg	touch $file
175439fab64Smrg    else
176439fab64Smrg	test -z "$file" || exec >$file
177439fab64Smrg	echo "#! /bin/sh"
178439fab64Smrg	echo "# Created by GNU Automake missing as a replacement of"
179439fab64Smrg	echo "#  $ $@"
180439fab64Smrg	echo "exit 0"
181439fab64Smrg	chmod +x $file
182439fab64Smrg	exit 1
183439fab64Smrg    fi
184439fab64Smrg    ;;
185439fab64Smrg
186439fab64Smrg  bison|yacc)
187439fab64Smrg    echo 1>&2 "\
188439fab64SmrgWARNING: \`$1' is missing on your system.  You should only need it if
189439fab64Smrg         you modified a \`.y' file.  You may need the \`Bison' package
190439fab64Smrg         in order for those modifications to take effect.  You can get
191439fab64Smrg         \`Bison' from any GNU archive site."
192439fab64Smrg    rm -f y.tab.c y.tab.h
193439fab64Smrg    if [ $# -ne 1 ]; then
194439fab64Smrg        eval LASTARG="\${$#}"
195439fab64Smrg	case "$LASTARG" in
196439fab64Smrg	*.y)
197439fab64Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
198439fab64Smrg	    if [ -f "$SRCFILE" ]; then
199439fab64Smrg	         cp "$SRCFILE" y.tab.c
200439fab64Smrg	    fi
201439fab64Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
202439fab64Smrg	    if [ -f "$SRCFILE" ]; then
203439fab64Smrg	         cp "$SRCFILE" y.tab.h
204439fab64Smrg	    fi
205439fab64Smrg	  ;;
206439fab64Smrg	esac
207439fab64Smrg    fi
208439fab64Smrg    if [ ! -f y.tab.h ]; then
209439fab64Smrg	echo >y.tab.h
210439fab64Smrg    fi
211439fab64Smrg    if [ ! -f y.tab.c ]; then
212439fab64Smrg	echo 'main() { return 0; }' >y.tab.c
213439fab64Smrg    fi
214439fab64Smrg    ;;
215439fab64Smrg
216439fab64Smrg  lex|flex)
217439fab64Smrg    echo 1>&2 "\
218439fab64SmrgWARNING: \`$1' is missing on your system.  You should only need it if
219439fab64Smrg         you modified a \`.l' file.  You may need the \`Flex' package
220439fab64Smrg         in order for those modifications to take effect.  You can get
221439fab64Smrg         \`Flex' from any GNU archive site."
222439fab64Smrg    rm -f lex.yy.c
223439fab64Smrg    if [ $# -ne 1 ]; then
224439fab64Smrg        eval LASTARG="\${$#}"
225439fab64Smrg	case "$LASTARG" in
226439fab64Smrg	*.l)
227439fab64Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
228439fab64Smrg	    if [ -f "$SRCFILE" ]; then
229439fab64Smrg	         cp "$SRCFILE" lex.yy.c
230439fab64Smrg	    fi
231439fab64Smrg	  ;;
232439fab64Smrg	esac
233439fab64Smrg    fi
234439fab64Smrg    if [ ! -f lex.yy.c ]; then
235439fab64Smrg	echo 'main() { return 0; }' >lex.yy.c
236439fab64Smrg    fi
237439fab64Smrg    ;;
238439fab64Smrg
239439fab64Smrg  help2man)
240439fab64Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
241439fab64Smrg       # We have it, but it failed.
242439fab64Smrg       exit 1
243439fab64Smrg    fi
244439fab64Smrg
245439fab64Smrg    echo 1>&2 "\
246439fab64SmrgWARNING: \`$1' is missing on your system.  You should only need it if
247439fab64Smrg	 you modified a dependency of a manual page.  You may need the
248439fab64Smrg	 \`Help2man' package in order for those modifications to take
249439fab64Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
250439fab64Smrg
251439fab64Smrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
252439fab64Smrg    if test -z "$file"; then
253439fab64Smrg	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
254439fab64Smrg    fi
255439fab64Smrg    if [ -f "$file" ]; then
256439fab64Smrg	touch $file
257439fab64Smrg    else
258439fab64Smrg	test -z "$file" || exec >$file
259439fab64Smrg	echo ".ab help2man is required to generate this page"
260439fab64Smrg	exit 1
261439fab64Smrg    fi
262439fab64Smrg    ;;
263439fab64Smrg
264439fab64Smrg  makeinfo)
265439fab64Smrg    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
266439fab64Smrg       # We have makeinfo, but it failed.
267439fab64Smrg       exit 1
268439fab64Smrg    fi
269439fab64Smrg
270439fab64Smrg    echo 1>&2 "\
271439fab64SmrgWARNING: \`$1' is missing on your system.  You should only need it if
272439fab64Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
273439fab64Smrg         indirectly affecting the aspect of the manual.  The spurious
274439fab64Smrg         call might also be the consequence of using a buggy \`make' (AIX,
275439fab64Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
276439fab64Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
277439fab64Smrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
278439fab64Smrg    if test -z "$file"; then
279439fab64Smrg      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
280439fab64Smrg      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
281439fab64Smrg    fi
282439fab64Smrg    touch $file
283439fab64Smrg    ;;
284439fab64Smrg
285439fab64Smrg  tar)
286439fab64Smrg    shift
287439fab64Smrg    if test -n "$run"; then
288439fab64Smrg      echo 1>&2 "ERROR: \`tar' requires --run"
289439fab64Smrg      exit 1
290439fab64Smrg    fi
291439fab64Smrg
292439fab64Smrg    # We have already tried tar in the generic part.
293439fab64Smrg    # Look for gnutar/gtar before invocation to avoid ugly error
294439fab64Smrg    # messages.
295439fab64Smrg    if (gnutar --version > /dev/null 2>&1); then
296439fab64Smrg       gnutar "$@" && exit 0
297439fab64Smrg    fi
298439fab64Smrg    if (gtar --version > /dev/null 2>&1); then
299439fab64Smrg       gtar "$@" && exit 0
300439fab64Smrg    fi
301439fab64Smrg    firstarg="$1"
302439fab64Smrg    if shift; then
303439fab64Smrg	case "$firstarg" in
304439fab64Smrg	*o*)
305439fab64Smrg	    firstarg=`echo "$firstarg" | sed s/o//`
306439fab64Smrg	    tar "$firstarg" "$@" && exit 0
307439fab64Smrg	    ;;
308439fab64Smrg	esac
309439fab64Smrg	case "$firstarg" in
310439fab64Smrg	*h*)
311439fab64Smrg	    firstarg=`echo "$firstarg" | sed s/h//`
312439fab64Smrg	    tar "$firstarg" "$@" && exit 0
313439fab64Smrg	    ;;
314439fab64Smrg	esac
315439fab64Smrg    fi
316439fab64Smrg
317439fab64Smrg    echo 1>&2 "\
318439fab64SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
319439fab64Smrg         You may want to install GNU tar or Free paxutils, or check the
320439fab64Smrg         command line arguments."
321439fab64Smrg    exit 1
322439fab64Smrg    ;;
323439fab64Smrg
324439fab64Smrg  *)
325439fab64Smrg    echo 1>&2 "\
326439fab64SmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
327439fab64Smrg         system.  You might have modified some files without having the
328439fab64Smrg         proper tools for further handling them.  Check the \`README' file,
329439fab64Smrg         it often tells you about the needed prerequisites for installing
330439fab64Smrg         this package.  You may also peek at any GNU archive site, in case
331439fab64Smrg         some other package would contain this missing \`$1' program."
332439fab64Smrg    exit 1
333439fab64Smrg    ;;
334439fab64Smrgesac
335439fab64Smrg
336439fab64Smrgexit 0
337