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