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