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