missing revision 65d490d0
1e4da13eeSmacallan#! /bin/sh
2e4da13eeSmacallan# Common stub for a few missing GNU programs while installing.
3e4da13eeSmacallan
465d490d0Smrgscriptversion=2012-01-06.18; # UTC
5e4da13eeSmacallan
665d490d0Smrg# Copyright (C) 1996-2012 Free Software Foundation, Inc.
7e4da13eeSmacallan# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
8e4da13eeSmacallan
9e4da13eeSmacallan# This program is free software; you can redistribute it and/or modify
10e4da13eeSmacallan# it under the terms of the GNU General Public License as published by
11e4da13eeSmacallan# the Free Software Foundation; either version 2, or (at your option)
12e4da13eeSmacallan# any later version.
13e4da13eeSmacallan
14e4da13eeSmacallan# This program is distributed in the hope that it will be useful,
15e4da13eeSmacallan# but WITHOUT ANY WARRANTY; without even the implied warranty of
16e4da13eeSmacallan# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17e4da13eeSmacallan# GNU General Public License for more details.
18e4da13eeSmacallan
19e4da13eeSmacallan# You should have received a copy of the GNU General Public License
2065d490d0Smrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
21e4da13eeSmacallan
22e4da13eeSmacallan# As a special exception to the GNU General Public License, if you
23e4da13eeSmacallan# distribute this file as part of a program that contains a
24e4da13eeSmacallan# configuration script generated by Autoconf, you may include it under
25e4da13eeSmacallan# the same distribution terms that you use for the rest of that program.
26e4da13eeSmacallan
27e4da13eeSmacallanif test $# -eq 0; then
2865d490d0Smrg  echo 1>&2 "Try '$0 --help' for more information"
29e4da13eeSmacallan  exit 1
30e4da13eeSmacallanfi
31e4da13eeSmacallan
32e4da13eeSmacallanrun=:
33e4da13eeSmacallansed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
34e4da13eeSmacallansed_minuso='s/.* -o \([^ ]*\).*/\1/p'
35e4da13eeSmacallan
3665d490d0Smrg# In the cases where this matters, 'missing' is being run in the
37e4da13eeSmacallan# srcdir already.
38e4da13eeSmacallanif test -f configure.ac; then
39e4da13eeSmacallan  configure_ac=configure.ac
40e4da13eeSmacallanelse
41e4da13eeSmacallan  configure_ac=configure.in
42e4da13eeSmacallanfi
43e4da13eeSmacallan
44e4da13eeSmacallanmsg="missing on your system"
45e4da13eeSmacallan
46e4da13eeSmacallancase $1 in
47e4da13eeSmacallan--run)
48e4da13eeSmacallan  # Try to run requested program, and just exit if it succeeds.
49e4da13eeSmacallan  run=
50e4da13eeSmacallan  shift
51e4da13eeSmacallan  "$@" && exit 0
52e4da13eeSmacallan  # Exit code 63 means version mismatch.  This often happens
53e4da13eeSmacallan  # when the user try to use an ancient version of a tool on
54e4da13eeSmacallan  # a file that requires a minimum version.  In this case we
55e4da13eeSmacallan  # we should proceed has if the program had been absent, or
56e4da13eeSmacallan  # if --run hadn't been passed.
57e4da13eeSmacallan  if test $? = 63; then
58e4da13eeSmacallan    run=:
59e4da13eeSmacallan    msg="probably too old"
60e4da13eeSmacallan  fi
61e4da13eeSmacallan  ;;
62e4da13eeSmacallan
63e4da13eeSmacallan  -h|--h|--he|--hel|--help)
64e4da13eeSmacallan    echo "\
65e4da13eeSmacallan$0 [OPTION]... PROGRAM [ARGUMENT]...
66e4da13eeSmacallan
6765d490d0SmrgHandle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
68e4da13eeSmacallanerror status if there is no known handling for PROGRAM.
69e4da13eeSmacallan
70e4da13eeSmacallanOptions:
71e4da13eeSmacallan  -h, --help      display this help and exit
72e4da13eeSmacallan  -v, --version   output version information and exit
73e4da13eeSmacallan  --run           try to run the given command, and emulate it if it fails
74e4da13eeSmacallan
75e4da13eeSmacallanSupported PROGRAM values:
7665d490d0Smrg  aclocal      touch file 'aclocal.m4'
7765d490d0Smrg  autoconf     touch file 'configure'
7865d490d0Smrg  autoheader   touch file 'config.h.in'
79e4da13eeSmacallan  autom4te     touch the output file, or create a stub one
8065d490d0Smrg  automake     touch all 'Makefile.in' files
8165d490d0Smrg  bison        create 'y.tab.[ch]', if possible, from existing .[ch]
8265d490d0Smrg  flex         create 'lex.yy.c', if possible, from existing .c
83e4da13eeSmacallan  help2man     touch the output file
8465d490d0Smrg  lex          create 'lex.yy.c', if possible, from existing .c
85e4da13eeSmacallan  makeinfo     touch the output file
8665d490d0Smrg  yacc         create 'y.tab.[ch]', if possible, from existing .[ch]
8765d490d0Smrg
8865d490d0SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
8965d490d0Smrg'g' are ignored when checking the name.
90e4da13eeSmacallan
91e4da13eeSmacallanSend bug reports to <bug-automake@gnu.org>."
92e4da13eeSmacallan    exit $?
93e4da13eeSmacallan    ;;
94e4da13eeSmacallan
95e4da13eeSmacallan  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
96e4da13eeSmacallan    echo "missing $scriptversion (GNU Automake)"
97e4da13eeSmacallan    exit $?
98e4da13eeSmacallan    ;;
99e4da13eeSmacallan
100e4da13eeSmacallan  -*)
10165d490d0Smrg    echo 1>&2 "$0: Unknown '$1' option"
10265d490d0Smrg    echo 1>&2 "Try '$0 --help' for more information"
103e4da13eeSmacallan    exit 1
104e4da13eeSmacallan    ;;
105e4da13eeSmacallan
106e4da13eeSmacallanesac
107e4da13eeSmacallan
10865d490d0Smrg# normalize program name to check for.
10965d490d0Smrgprogram=`echo "$1" | sed '
11065d490d0Smrg  s/^gnu-//; t
11165d490d0Smrg  s/^gnu//; t
11265d490d0Smrg  s/^g//; t'`
11365d490d0Smrg
114e4da13eeSmacallan# Now exit if we have it, but it failed.  Also exit now if we
115e4da13eeSmacallan# don't have it and --version was passed (most likely to detect
11665d490d0Smrg# the program).  This is about non-GNU programs, so use $1 not
11765d490d0Smrg# $program.
118e4da13eeSmacallancase $1 in
11965d490d0Smrg  lex*|yacc*)
120e4da13eeSmacallan    # Not GNU programs, they don't have --version.
121e4da13eeSmacallan    ;;
122e4da13eeSmacallan
123e4da13eeSmacallan  *)
124e4da13eeSmacallan    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
125e4da13eeSmacallan       # We have it, but it failed.
126e4da13eeSmacallan       exit 1
127e4da13eeSmacallan    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
128e4da13eeSmacallan       # Could not run --version or --help.  This is probably someone
12965d490d0Smrg       # running '$TOOL --version' or '$TOOL --help' to check whether
130e4da13eeSmacallan       # $TOOL exists and not knowing $TOOL uses missing.
131e4da13eeSmacallan       exit 1
132e4da13eeSmacallan    fi
133e4da13eeSmacallan    ;;
134e4da13eeSmacallanesac
135e4da13eeSmacallan
136e4da13eeSmacallan# If it does not exist, or fails to run (possibly an outdated version),
137e4da13eeSmacallan# try to emulate it.
13865d490d0Smrgcase $program in
139e4da13eeSmacallan  aclocal*)
140e4da13eeSmacallan    echo 1>&2 "\
14165d490d0SmrgWARNING: '$1' is $msg.  You should only need it if
14265d490d0Smrg         you modified 'acinclude.m4' or '${configure_ac}'.  You might want
14365d490d0Smrg         to install the Automake and Perl packages.  Grab them from
144e4da13eeSmacallan         any GNU archive site."
145e4da13eeSmacallan    touch aclocal.m4
146e4da13eeSmacallan    ;;
147e4da13eeSmacallan
14865d490d0Smrg  autoconf*)
149e4da13eeSmacallan    echo 1>&2 "\
15065d490d0SmrgWARNING: '$1' is $msg.  You should only need it if
15165d490d0Smrg         you modified '${configure_ac}'.  You might want to install the
15265d490d0Smrg         Autoconf and GNU m4 packages.  Grab them from any GNU
153e4da13eeSmacallan         archive site."
154e4da13eeSmacallan    touch configure
155e4da13eeSmacallan    ;;
156e4da13eeSmacallan
15765d490d0Smrg  autoheader*)
158e4da13eeSmacallan    echo 1>&2 "\
15965d490d0SmrgWARNING: '$1' is $msg.  You should only need it if
16065d490d0Smrg         you modified 'acconfig.h' or '${configure_ac}'.  You might want
16165d490d0Smrg         to install the Autoconf and GNU m4 packages.  Grab them
162e4da13eeSmacallan         from any GNU archive site."
163e4da13eeSmacallan    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
164e4da13eeSmacallan    test -z "$files" && files="config.h"
165e4da13eeSmacallan    touch_files=
166e4da13eeSmacallan    for f in $files; do
167e4da13eeSmacallan      case $f in
168e4da13eeSmacallan      *:*) touch_files="$touch_files "`echo "$f" |
169e4da13eeSmacallan				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
170e4da13eeSmacallan      *) touch_files="$touch_files $f.in";;
171e4da13eeSmacallan      esac
172e4da13eeSmacallan    done
173e4da13eeSmacallan    touch $touch_files
174e4da13eeSmacallan    ;;
175e4da13eeSmacallan
176e4da13eeSmacallan  automake*)
177e4da13eeSmacallan    echo 1>&2 "\
17865d490d0SmrgWARNING: '$1' is $msg.  You should only need it if
17965d490d0Smrg         you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'.
18065d490d0Smrg         You might want to install the Automake and Perl packages.
181e4da13eeSmacallan         Grab them from any GNU archive site."
182e4da13eeSmacallan    find . -type f -name Makefile.am -print |
183e4da13eeSmacallan	   sed 's/\.am$/.in/' |
184e4da13eeSmacallan	   while read f; do touch "$f"; done
185e4da13eeSmacallan    ;;
186e4da13eeSmacallan
18765d490d0Smrg  autom4te*)
188e4da13eeSmacallan    echo 1>&2 "\
18965d490d0SmrgWARNING: '$1' is needed, but is $msg.
190e4da13eeSmacallan         You might have modified some files without having the
191e4da13eeSmacallan         proper tools for further handling them.
19265d490d0Smrg         You can get '$1' as part of Autoconf from any GNU
193e4da13eeSmacallan         archive site."
194e4da13eeSmacallan
195e4da13eeSmacallan    file=`echo "$*" | sed -n "$sed_output"`
196e4da13eeSmacallan    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
197e4da13eeSmacallan    if test -f "$file"; then
198e4da13eeSmacallan	touch $file
199e4da13eeSmacallan    else
200e4da13eeSmacallan	test -z "$file" || exec >$file
201e4da13eeSmacallan	echo "#! /bin/sh"
202e4da13eeSmacallan	echo "# Created by GNU Automake missing as a replacement of"
203e4da13eeSmacallan	echo "#  $ $@"
204e4da13eeSmacallan	echo "exit 0"
205e4da13eeSmacallan	chmod +x $file
206e4da13eeSmacallan	exit 1
207e4da13eeSmacallan    fi
208e4da13eeSmacallan    ;;
209e4da13eeSmacallan
21065d490d0Smrg  bison*|yacc*)
211e4da13eeSmacallan    echo 1>&2 "\
21265d490d0SmrgWARNING: '$1' $msg.  You should only need it if
21365d490d0Smrg         you modified a '.y' file.  You may need the Bison package
214e4da13eeSmacallan         in order for those modifications to take effect.  You can get
21565d490d0Smrg         Bison from any GNU archive site."
216e4da13eeSmacallan    rm -f y.tab.c y.tab.h
217e4da13eeSmacallan    if test $# -ne 1; then
21865d490d0Smrg        eval LASTARG=\${$#}
219e4da13eeSmacallan	case $LASTARG in
220e4da13eeSmacallan	*.y)
221e4da13eeSmacallan	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
222e4da13eeSmacallan	    if test -f "$SRCFILE"; then
223e4da13eeSmacallan	         cp "$SRCFILE" y.tab.c
224e4da13eeSmacallan	    fi
225e4da13eeSmacallan	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
226e4da13eeSmacallan	    if test -f "$SRCFILE"; then
227e4da13eeSmacallan	         cp "$SRCFILE" y.tab.h
228e4da13eeSmacallan	    fi
229e4da13eeSmacallan	  ;;
230e4da13eeSmacallan	esac
231e4da13eeSmacallan    fi
232e4da13eeSmacallan    if test ! -f y.tab.h; then
233e4da13eeSmacallan	echo >y.tab.h
234e4da13eeSmacallan    fi
235e4da13eeSmacallan    if test ! -f y.tab.c; then
236e4da13eeSmacallan	echo 'main() { return 0; }' >y.tab.c
237e4da13eeSmacallan    fi
238e4da13eeSmacallan    ;;
239e4da13eeSmacallan
24065d490d0Smrg  lex*|flex*)
241e4da13eeSmacallan    echo 1>&2 "\
24265d490d0SmrgWARNING: '$1' is $msg.  You should only need it if
24365d490d0Smrg         you modified a '.l' file.  You may need the Flex package
244e4da13eeSmacallan         in order for those modifications to take effect.  You can get
24565d490d0Smrg         Flex from any GNU archive site."
246e4da13eeSmacallan    rm -f lex.yy.c
247e4da13eeSmacallan    if test $# -ne 1; then
24865d490d0Smrg        eval LASTARG=\${$#}
249e4da13eeSmacallan	case $LASTARG in
250e4da13eeSmacallan	*.l)
251e4da13eeSmacallan	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
252e4da13eeSmacallan	    if test -f "$SRCFILE"; then
253e4da13eeSmacallan	         cp "$SRCFILE" lex.yy.c
254e4da13eeSmacallan	    fi
255e4da13eeSmacallan	  ;;
256e4da13eeSmacallan	esac
257e4da13eeSmacallan    fi
258e4da13eeSmacallan    if test ! -f lex.yy.c; then
259e4da13eeSmacallan	echo 'main() { return 0; }' >lex.yy.c
260e4da13eeSmacallan    fi
261e4da13eeSmacallan    ;;
262e4da13eeSmacallan
26365d490d0Smrg  help2man*)
264e4da13eeSmacallan    echo 1>&2 "\
26565d490d0SmrgWARNING: '$1' is $msg.  You should only need it if
266e4da13eeSmacallan	 you modified a dependency of a manual page.  You may need the
26765d490d0Smrg	 Help2man package in order for those modifications to take
26865d490d0Smrg	 effect.  You can get Help2man from any GNU archive site."
269e4da13eeSmacallan
270e4da13eeSmacallan    file=`echo "$*" | sed -n "$sed_output"`
271e4da13eeSmacallan    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
272e4da13eeSmacallan    if test -f "$file"; then
273e4da13eeSmacallan	touch $file
274e4da13eeSmacallan    else
275e4da13eeSmacallan	test -z "$file" || exec >$file
276e4da13eeSmacallan	echo ".ab help2man is required to generate this page"
27765d490d0Smrg	exit $?
278e4da13eeSmacallan    fi
279e4da13eeSmacallan    ;;
280e4da13eeSmacallan
28165d490d0Smrg  makeinfo*)
282e4da13eeSmacallan    echo 1>&2 "\
28365d490d0SmrgWARNING: '$1' is $msg.  You should only need it if
28465d490d0Smrg         you modified a '.texi' or '.texinfo' file, or any other file
285e4da13eeSmacallan         indirectly affecting the aspect of the manual.  The spurious
28665d490d0Smrg         call might also be the consequence of using a buggy 'make' (AIX,
28765d490d0Smrg         DU, IRIX).  You might want to install the Texinfo package or
28865d490d0Smrg         the GNU make package.  Grab either from any GNU archive site."
289e4da13eeSmacallan    # The file to touch is that specified with -o ...
290e4da13eeSmacallan    file=`echo "$*" | sed -n "$sed_output"`
291e4da13eeSmacallan    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
292e4da13eeSmacallan    if test -z "$file"; then
293e4da13eeSmacallan      # ... or it is the one specified with @setfilename ...
294e4da13eeSmacallan      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
295e4da13eeSmacallan      file=`sed -n '
296e4da13eeSmacallan	/^@setfilename/{
297e4da13eeSmacallan	  s/.* \([^ ]*\) *$/\1/
298e4da13eeSmacallan	  p
299e4da13eeSmacallan	  q
300e4da13eeSmacallan	}' $infile`
301e4da13eeSmacallan      # ... or it is derived from the source name (dir/f.texi becomes f.info)
302e4da13eeSmacallan      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
303e4da13eeSmacallan    fi
304e4da13eeSmacallan    # If the file does not exist, the user really needs makeinfo;
305e4da13eeSmacallan    # let's fail without touching anything.
306e4da13eeSmacallan    test -f $file || exit 1
307e4da13eeSmacallan    touch $file
308e4da13eeSmacallan    ;;
309e4da13eeSmacallan
310e4da13eeSmacallan  *)
311e4da13eeSmacallan    echo 1>&2 "\
31265d490d0SmrgWARNING: '$1' is needed, and is $msg.
313e4da13eeSmacallan         You might have modified some files without having the
31465d490d0Smrg         proper tools for further handling them.  Check the 'README' file,
315e4da13eeSmacallan         it often tells you about the needed prerequisites for installing
316e4da13eeSmacallan         this package.  You may also peek at any GNU archive site, in case
31765d490d0Smrg         some other package would contain this missing '$1' program."
318e4da13eeSmacallan    exit 1
319e4da13eeSmacallan    ;;
320e4da13eeSmacallanesac
321e4da13eeSmacallan
322e4da13eeSmacallanexit 0
323e4da13eeSmacallan
324e4da13eeSmacallan# Local variables:
325e4da13eeSmacallan# eval: (add-hook 'write-file-hooks 'time-stamp)
326e4da13eeSmacallan# time-stamp-start: "scriptversion="
327e4da13eeSmacallan# time-stamp-format: "%:y-%02m-%02d.%02H"
32865d490d0Smrg# time-stamp-time-zone: "UTC"
32965d490d0Smrg# time-stamp-end: "; # UTC"
330e4da13eeSmacallan# End:
331