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