missing revision a6fdc6fa
1a6fdc6faSmrg#! /bin/sh
2a6fdc6faSmrg# Common stub for a few missing GNU programs while installing.
3a6fdc6faSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
4a6fdc6faSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
5a6fdc6faSmrg
6a6fdc6faSmrg# This program is free software; you can redistribute it and/or modify
7a6fdc6faSmrg# it under the terms of the GNU General Public License as published by
8a6fdc6faSmrg# the Free Software Foundation; either version 2, or (at your option)
9a6fdc6faSmrg# any later version.
10a6fdc6faSmrg
11a6fdc6faSmrg# This program is distributed in the hope that it will be useful,
12a6fdc6faSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
13a6fdc6faSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14a6fdc6faSmrg# GNU General Public License for more details.
15a6fdc6faSmrg
16a6fdc6faSmrg# You should have received a copy of the GNU General Public License
17a6fdc6faSmrg# along with this program; if not, write to the Free Software
18a6fdc6faSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19a6fdc6faSmrg# 02111-1307, USA.
20a6fdc6faSmrg
21a6fdc6faSmrg# As a special exception to the GNU General Public License, if you
22a6fdc6faSmrg# distribute this file as part of a program that contains a
23a6fdc6faSmrg# configuration script generated by Autoconf, you may include it under
24a6fdc6faSmrg# the same distribution terms that you use for the rest of that program.
25a6fdc6faSmrg
26a6fdc6faSmrgif test $# -eq 0; then
27a6fdc6faSmrg  echo 1>&2 "Try \`$0 --help' for more information"
28a6fdc6faSmrg  exit 1
29a6fdc6faSmrgfi
30a6fdc6faSmrg
31a6fdc6faSmrgrun=:
32a6fdc6faSmrg
33a6fdc6faSmrg# In the cases where this matters, `missing' is being run in the
34a6fdc6faSmrg# srcdir already.
35a6fdc6faSmrgif test -f configure.ac; then
36a6fdc6faSmrg  configure_ac=configure.ac
37a6fdc6faSmrgelse
38a6fdc6faSmrg  configure_ac=configure.in
39a6fdc6faSmrgfi
40a6fdc6faSmrg
41a6fdc6faSmrgcase "$1" in
42a6fdc6faSmrg--run)
43a6fdc6faSmrg  # Try to run requested program, and just exit if it succeeds.
44a6fdc6faSmrg  run=
45a6fdc6faSmrg  shift
46a6fdc6faSmrg  "$@" && exit 0
47a6fdc6faSmrg  ;;
48a6fdc6faSmrgesac
49a6fdc6faSmrg
50a6fdc6faSmrg# If it does not exist, or fails to run (possibly an outdated version),
51a6fdc6faSmrg# try to emulate it.
52a6fdc6faSmrgcase "$1" in
53a6fdc6faSmrg
54a6fdc6faSmrg  -h|--h|--he|--hel|--help)
55a6fdc6faSmrg    echo "\
56a6fdc6faSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
57a6fdc6faSmrg
58a6fdc6faSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
59a6fdc6faSmrgerror status if there is no known handling for PROGRAM.
60a6fdc6faSmrg
61a6fdc6faSmrgOptions:
62a6fdc6faSmrg  -h, --help      display this help and exit
63a6fdc6faSmrg  -v, --version   output version information and exit
64a6fdc6faSmrg  --run           try to run the given command, and emulate it if it fails
65a6fdc6faSmrg
66a6fdc6faSmrgSupported PROGRAM values:
67a6fdc6faSmrg  aclocal      touch file \`aclocal.m4'
68a6fdc6faSmrg  autoconf     touch file \`configure'
69a6fdc6faSmrg  autoheader   touch file \`config.h.in'
70a6fdc6faSmrg  automake     touch all \`Makefile.in' files
71a6fdc6faSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
72a6fdc6faSmrg  flex         create \`lex.yy.c', if possible, from existing .c
73a6fdc6faSmrg  help2man     touch the output file
74a6fdc6faSmrg  lex          create \`lex.yy.c', if possible, from existing .c
75a6fdc6faSmrg  makeinfo     touch the output file
76a6fdc6faSmrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
77a6fdc6faSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
78a6fdc6faSmrg    ;;
79a6fdc6faSmrg
80a6fdc6faSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
81a6fdc6faSmrg    echo "missing 0.4 - GNU automake"
82a6fdc6faSmrg    ;;
83a6fdc6faSmrg
84a6fdc6faSmrg  -*)
85a6fdc6faSmrg    echo 1>&2 "$0: Unknown \`$1' option"
86a6fdc6faSmrg    echo 1>&2 "Try \`$0 --help' for more information"
87a6fdc6faSmrg    exit 1
88a6fdc6faSmrg    ;;
89a6fdc6faSmrg
90a6fdc6faSmrg  aclocal*)
91a6fdc6faSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
92a6fdc6faSmrg       # We have it, but it failed.
93a6fdc6faSmrg       exit 1
94a6fdc6faSmrg    fi
95a6fdc6faSmrg
96a6fdc6faSmrg    echo 1>&2 "\
97a6fdc6faSmrgWARNING: \`$1' is missing on your system.  You should only need it if
98a6fdc6faSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
99a6fdc6faSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
100a6fdc6faSmrg         any GNU archive site."
101a6fdc6faSmrg    touch aclocal.m4
102a6fdc6faSmrg    ;;
103a6fdc6faSmrg
104a6fdc6faSmrg  autoconf)
105a6fdc6faSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
106a6fdc6faSmrg       # We have it, but it failed.
107a6fdc6faSmrg       exit 1
108a6fdc6faSmrg    fi
109a6fdc6faSmrg
110a6fdc6faSmrg    echo 1>&2 "\
111a6fdc6faSmrgWARNING: \`$1' is missing on your system.  You should only need it if
112a6fdc6faSmrg         you modified \`${configure_ac}'.  You might want to install the
113a6fdc6faSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
114a6fdc6faSmrg         archive site."
115a6fdc6faSmrg    touch configure
116a6fdc6faSmrg    ;;
117a6fdc6faSmrg
118a6fdc6faSmrg  autoheader)
119a6fdc6faSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
120a6fdc6faSmrg       # We have it, but it failed.
121a6fdc6faSmrg       exit 1
122a6fdc6faSmrg    fi
123a6fdc6faSmrg
124a6fdc6faSmrg    echo 1>&2 "\
125a6fdc6faSmrgWARNING: \`$1' is missing on your system.  You should only need it if
126a6fdc6faSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
127a6fdc6faSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
128a6fdc6faSmrg         from any GNU archive site."
129a6fdc6faSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
130a6fdc6faSmrg    test -z "$files" && files="config.h"
131a6fdc6faSmrg    touch_files=
132a6fdc6faSmrg    for f in $files; do
133a6fdc6faSmrg      case "$f" in
134a6fdc6faSmrg      *:*) touch_files="$touch_files "`echo "$f" |
135a6fdc6faSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
136a6fdc6faSmrg      *) touch_files="$touch_files $f.in";;
137a6fdc6faSmrg      esac
138a6fdc6faSmrg    done
139a6fdc6faSmrg    touch $touch_files
140a6fdc6faSmrg    ;;
141a6fdc6faSmrg
142a6fdc6faSmrg  automake*)
143a6fdc6faSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
144a6fdc6faSmrg       # We have it, but it failed.
145a6fdc6faSmrg       exit 1
146a6fdc6faSmrg    fi
147a6fdc6faSmrg
148a6fdc6faSmrg    echo 1>&2 "\
149a6fdc6faSmrgWARNING: \`$1' is missing on your system.  You should only need it if
150a6fdc6faSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
151a6fdc6faSmrg         You might want to install the \`Automake' and \`Perl' packages.
152a6fdc6faSmrg         Grab them from any GNU archive site."
153a6fdc6faSmrg    find . -type f -name Makefile.am -print |
154a6fdc6faSmrg	   sed 's/\.am$/.in/' |
155a6fdc6faSmrg	   while read f; do touch "$f"; done
156a6fdc6faSmrg    ;;
157a6fdc6faSmrg
158a6fdc6faSmrg  autom4te)
159a6fdc6faSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
160a6fdc6faSmrg       # We have it, but it failed.
161a6fdc6faSmrg       exit 1
162a6fdc6faSmrg    fi
163a6fdc6faSmrg
164a6fdc6faSmrg    echo 1>&2 "\
165a6fdc6faSmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
166a6fdc6faSmrg         system.  You might have modified some files without having the
167a6fdc6faSmrg         proper tools for further handling them.
168a6fdc6faSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
169a6fdc6faSmrg         archive site."
170a6fdc6faSmrg
171a6fdc6faSmrg    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
172a6fdc6faSmrg    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
173a6fdc6faSmrg    if test -f "$file"; then
174a6fdc6faSmrg	touch $file
175a6fdc6faSmrg    else
176a6fdc6faSmrg	test -z "$file" || exec >$file
177a6fdc6faSmrg	echo "#! /bin/sh"
178a6fdc6faSmrg	echo "# Created by GNU Automake missing as a replacement of"
179a6fdc6faSmrg	echo "#  $ $@"
180a6fdc6faSmrg	echo "exit 0"
181a6fdc6faSmrg	chmod +x $file
182a6fdc6faSmrg	exit 1
183a6fdc6faSmrg    fi
184a6fdc6faSmrg    ;;
185a6fdc6faSmrg
186a6fdc6faSmrg  bison|yacc)
187a6fdc6faSmrg    echo 1>&2 "\
188a6fdc6faSmrgWARNING: \`$1' is missing on your system.  You should only need it if
189a6fdc6faSmrg         you modified a \`.y' file.  You may need the \`Bison' package
190a6fdc6faSmrg         in order for those modifications to take effect.  You can get
191a6fdc6faSmrg         \`Bison' from any GNU archive site."
192a6fdc6faSmrg    rm -f y.tab.c y.tab.h
193a6fdc6faSmrg    if [ $# -ne 1 ]; then
194a6fdc6faSmrg        eval LASTARG="\${$#}"
195a6fdc6faSmrg	case "$LASTARG" in
196a6fdc6faSmrg	*.y)
197a6fdc6faSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
198a6fdc6faSmrg	    if [ -f "$SRCFILE" ]; then
199a6fdc6faSmrg	         cp "$SRCFILE" y.tab.c
200a6fdc6faSmrg	    fi
201a6fdc6faSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
202a6fdc6faSmrg	    if [ -f "$SRCFILE" ]; then
203a6fdc6faSmrg	         cp "$SRCFILE" y.tab.h
204a6fdc6faSmrg	    fi
205a6fdc6faSmrg	  ;;
206a6fdc6faSmrg	esac
207a6fdc6faSmrg    fi
208a6fdc6faSmrg    if [ ! -f y.tab.h ]; then
209a6fdc6faSmrg	echo >y.tab.h
210a6fdc6faSmrg    fi
211a6fdc6faSmrg    if [ ! -f y.tab.c ]; then
212a6fdc6faSmrg	echo 'main() { return 0; }' >y.tab.c
213a6fdc6faSmrg    fi
214a6fdc6faSmrg    ;;
215a6fdc6faSmrg
216a6fdc6faSmrg  lex|flex)
217a6fdc6faSmrg    echo 1>&2 "\
218a6fdc6faSmrgWARNING: \`$1' is missing on your system.  You should only need it if
219a6fdc6faSmrg         you modified a \`.l' file.  You may need the \`Flex' package
220a6fdc6faSmrg         in order for those modifications to take effect.  You can get
221a6fdc6faSmrg         \`Flex' from any GNU archive site."
222a6fdc6faSmrg    rm -f lex.yy.c
223a6fdc6faSmrg    if [ $# -ne 1 ]; then
224a6fdc6faSmrg        eval LASTARG="\${$#}"
225a6fdc6faSmrg	case "$LASTARG" in
226a6fdc6faSmrg	*.l)
227a6fdc6faSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
228a6fdc6faSmrg	    if [ -f "$SRCFILE" ]; then
229a6fdc6faSmrg	         cp "$SRCFILE" lex.yy.c
230a6fdc6faSmrg	    fi
231a6fdc6faSmrg	  ;;
232a6fdc6faSmrg	esac
233a6fdc6faSmrg    fi
234a6fdc6faSmrg    if [ ! -f lex.yy.c ]; then
235a6fdc6faSmrg	echo 'main() { return 0; }' >lex.yy.c
236a6fdc6faSmrg    fi
237a6fdc6faSmrg    ;;
238a6fdc6faSmrg
239a6fdc6faSmrg  help2man)
240a6fdc6faSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
241a6fdc6faSmrg       # We have it, but it failed.
242a6fdc6faSmrg       exit 1
243a6fdc6faSmrg    fi
244a6fdc6faSmrg
245a6fdc6faSmrg    echo 1>&2 "\
246a6fdc6faSmrgWARNING: \`$1' is missing on your system.  You should only need it if
247a6fdc6faSmrg	 you modified a dependency of a manual page.  You may need the
248a6fdc6faSmrg	 \`Help2man' package in order for those modifications to take
249a6fdc6faSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
250a6fdc6faSmrg
251a6fdc6faSmrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
252a6fdc6faSmrg    if test -z "$file"; then
253a6fdc6faSmrg	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
254a6fdc6faSmrg    fi
255a6fdc6faSmrg    if [ -f "$file" ]; then
256a6fdc6faSmrg	touch $file
257a6fdc6faSmrg    else
258a6fdc6faSmrg	test -z "$file" || exec >$file
259a6fdc6faSmrg	echo ".ab help2man is required to generate this page"
260a6fdc6faSmrg	exit 1
261a6fdc6faSmrg    fi
262a6fdc6faSmrg    ;;
263a6fdc6faSmrg
264a6fdc6faSmrg  makeinfo)
265a6fdc6faSmrg    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
266a6fdc6faSmrg       # We have makeinfo, but it failed.
267a6fdc6faSmrg       exit 1
268a6fdc6faSmrg    fi
269a6fdc6faSmrg
270a6fdc6faSmrg    echo 1>&2 "\
271a6fdc6faSmrgWARNING: \`$1' is missing on your system.  You should only need it if
272a6fdc6faSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
273a6fdc6faSmrg         indirectly affecting the aspect of the manual.  The spurious
274a6fdc6faSmrg         call might also be the consequence of using a buggy \`make' (AIX,
275a6fdc6faSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
276a6fdc6faSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
277a6fdc6faSmrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
278a6fdc6faSmrg    if test -z "$file"; then
279a6fdc6faSmrg      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
280a6fdc6faSmrg      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
281a6fdc6faSmrg    fi
282a6fdc6faSmrg    touch $file
283a6fdc6faSmrg    ;;
284a6fdc6faSmrg
285a6fdc6faSmrg  tar)
286a6fdc6faSmrg    shift
287a6fdc6faSmrg    if test -n "$run"; then
288a6fdc6faSmrg      echo 1>&2 "ERROR: \`tar' requires --run"
289a6fdc6faSmrg      exit 1
290a6fdc6faSmrg    fi
291a6fdc6faSmrg
292a6fdc6faSmrg    # We have already tried tar in the generic part.
293a6fdc6faSmrg    # Look for gnutar/gtar before invocation to avoid ugly error
294a6fdc6faSmrg    # messages.
295a6fdc6faSmrg    if (gnutar --version > /dev/null 2>&1); then
296a6fdc6faSmrg       gnutar "$@" && exit 0
297a6fdc6faSmrg    fi
298a6fdc6faSmrg    if (gtar --version > /dev/null 2>&1); then
299a6fdc6faSmrg       gtar "$@" && exit 0
300a6fdc6faSmrg    fi
301a6fdc6faSmrg    firstarg="$1"
302a6fdc6faSmrg    if shift; then
303a6fdc6faSmrg	case "$firstarg" in
304a6fdc6faSmrg	*o*)
305a6fdc6faSmrg	    firstarg=`echo "$firstarg" | sed s/o//`
306a6fdc6faSmrg	    tar "$firstarg" "$@" && exit 0
307a6fdc6faSmrg	    ;;
308a6fdc6faSmrg	esac
309a6fdc6faSmrg	case "$firstarg" in
310a6fdc6faSmrg	*h*)
311a6fdc6faSmrg	    firstarg=`echo "$firstarg" | sed s/h//`
312a6fdc6faSmrg	    tar "$firstarg" "$@" && exit 0
313a6fdc6faSmrg	    ;;
314a6fdc6faSmrg	esac
315a6fdc6faSmrg    fi
316a6fdc6faSmrg
317a6fdc6faSmrg    echo 1>&2 "\
318a6fdc6faSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
319a6fdc6faSmrg         You may want to install GNU tar or Free paxutils, or check the
320a6fdc6faSmrg         command line arguments."
321a6fdc6faSmrg    exit 1
322a6fdc6faSmrg    ;;
323a6fdc6faSmrg
324a6fdc6faSmrg  *)
325a6fdc6faSmrg    echo 1>&2 "\
326a6fdc6faSmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
327a6fdc6faSmrg         system.  You might have modified some files without having the
328a6fdc6faSmrg         proper tools for further handling them.  Check the \`README' file,
329a6fdc6faSmrg         it often tells you about the needed prerequisites for installing
330a6fdc6faSmrg         this package.  You may also peek at any GNU archive site, in case
331a6fdc6faSmrg         some other package would contain this missing \`$1' program."
332a6fdc6faSmrg    exit 1
333a6fdc6faSmrg    ;;
334a6fdc6faSmrgesac
335a6fdc6faSmrg
336a6fdc6faSmrgexit 0
337