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