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