missing revision f3dfa9d3
1a0d3b6eaSmrg#! /bin/sh
2f3dfa9d3Smrg# Common stub for a few missing GNU programs while installing.
3a0d3b6eaSmrg
4f3dfa9d3Smrgscriptversion=2012-01-06.13; # UTC
5a0d3b6eaSmrg
6f3dfa9d3Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
7f3dfa9d3Smrg# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
8f3dfa9d3Smrg# 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
21f8a31ee4Smrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
22a0d3b6eaSmrg
23a0d3b6eaSmrg# As a special exception to the GNU General Public License, if you
24a0d3b6eaSmrg# distribute this file as part of a program that contains a
25a0d3b6eaSmrg# configuration script generated by Autoconf, you may include it under
26a0d3b6eaSmrg# the same distribution terms that you use for the rest of that program.
27a0d3b6eaSmrg
28a0d3b6eaSmrgif test $# -eq 0; then
29f3dfa9d3Smrg  echo 1>&2 "Try \`$0 --help' for more information"
30a0d3b6eaSmrg  exit 1
31a0d3b6eaSmrgfi
32a0d3b6eaSmrg
33f3dfa9d3Smrgrun=:
34f3dfa9d3Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
35f3dfa9d3Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
36a0d3b6eaSmrg
37f3dfa9d3Smrg# In the cases where this matters, `missing' is being run in the
38f3dfa9d3Smrg# srcdir already.
39f3dfa9d3Smrgif test -f configure.ac; then
40f3dfa9d3Smrg  configure_ac=configure.ac
41f3dfa9d3Smrgelse
42f3dfa9d3Smrg  configure_ac=configure.in
43f3dfa9d3Smrgfi
44a0d3b6eaSmrg
45f3dfa9d3Smrgmsg="missing on your system"
46f3dfa9d3Smrg
47f3dfa9d3Smrgcase $1 in
48f3dfa9d3Smrg--run)
49f3dfa9d3Smrg  # Try to run requested program, and just exit if it succeeds.
50f3dfa9d3Smrg  run=
51f3dfa9d3Smrg  shift
52f3dfa9d3Smrg  "$@" && exit 0
53f3dfa9d3Smrg  # Exit code 63 means version mismatch.  This often happens
54f3dfa9d3Smrg  # when the user try to use an ancient version of a tool on
55f3dfa9d3Smrg  # a file that requires a minimum version.  In this case we
56f3dfa9d3Smrg  # we should proceed has if the program had been absent, or
57f3dfa9d3Smrg  # if --run hadn't been passed.
58f3dfa9d3Smrg  if test $? = 63; then
59f3dfa9d3Smrg    run=:
60f3dfa9d3Smrg    msg="probably too old"
61f3dfa9d3Smrg  fi
62f3dfa9d3Smrg  ;;
63a0d3b6eaSmrg
64a0d3b6eaSmrg  -h|--h|--he|--hel|--help)
65a0d3b6eaSmrg    echo "\
66a0d3b6eaSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
67a0d3b6eaSmrg
68f3dfa9d3SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
69f3dfa9d3Smrgerror status if there is no known handling for PROGRAM.
70a0d3b6eaSmrg
71a0d3b6eaSmrgOptions:
72a0d3b6eaSmrg  -h, --help      display this help and exit
73a0d3b6eaSmrg  -v, --version   output version information and exit
74f3dfa9d3Smrg  --run           try to run the given command, and emulate it if it fails
75a0d3b6eaSmrg
76a0d3b6eaSmrgSupported PROGRAM values:
77f3dfa9d3Smrg  aclocal      touch file \`aclocal.m4'
78f3dfa9d3Smrg  autoconf     touch file \`configure'
79f3dfa9d3Smrg  autoheader   touch file \`config.h.in'
80f3dfa9d3Smrg  autom4te     touch the output file, or create a stub one
81f3dfa9d3Smrg  automake     touch all \`Makefile.in' files
82f3dfa9d3Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
83f3dfa9d3Smrg  flex         create \`lex.yy.c', if possible, from existing .c
84f3dfa9d3Smrg  help2man     touch the output file
85f3dfa9d3Smrg  lex          create \`lex.yy.c', if possible, from existing .c
86f3dfa9d3Smrg  makeinfo     touch the output file
87f3dfa9d3Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
88a0d3b6eaSmrg
89f3dfa9d3SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
90f3dfa9d3Smrg\`g' are ignored when checking the name.
91f8a31ee4Smrg
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  -*)
102f3dfa9d3Smrg    echo 1>&2 "$0: Unknown \`$1' option"
103f3dfa9d3Smrg    echo 1>&2 "Try \`$0 --help' for more information"
104a0d3b6eaSmrg    exit 1
105a0d3b6eaSmrg    ;;
106a0d3b6eaSmrg
107a0d3b6eaSmrgesac
108a0d3b6eaSmrg
109f3dfa9d3Smrg# normalize program name to check for.
110f3dfa9d3Smrgprogram=`echo "$1" | sed '
111f3dfa9d3Smrg  s/^gnu-//; t
112f3dfa9d3Smrg  s/^gnu//; t
113f3dfa9d3Smrg  s/^g//; t'`
114f3dfa9d3Smrg
115f3dfa9d3Smrg# Now exit if we have it, but it failed.  Also exit now if we
116f3dfa9d3Smrg# don't have it and --version was passed (most likely to detect
117f3dfa9d3Smrg# the program).  This is about non-GNU programs, so use $1 not
118f3dfa9d3Smrg# $program.
119f3dfa9d3Smrgcase $1 in
120f3dfa9d3Smrg  lex*|yacc*)
121f3dfa9d3Smrg    # Not GNU programs, they don't have --version.
122f3dfa9d3Smrg    ;;
123f3dfa9d3Smrg
124f3dfa9d3Smrg  *)
125f3dfa9d3Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
126f3dfa9d3Smrg       # We have it, but it failed.
127f3dfa9d3Smrg       exit 1
128f3dfa9d3Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
129f3dfa9d3Smrg       # Could not run --version or --help.  This is probably someone
130f3dfa9d3Smrg       # running `$TOOL --version' or `$TOOL --help' to check whether
131f3dfa9d3Smrg       # $TOOL exists and not knowing $TOOL uses missing.
132f3dfa9d3Smrg       exit 1
133f3dfa9d3Smrg    fi
134f3dfa9d3Smrg    ;;
135f3dfa9d3Smrgesac
136f3dfa9d3Smrg
137f3dfa9d3Smrg# If it does not exist, or fails to run (possibly an outdated version),
138f3dfa9d3Smrg# try to emulate it.
139f3dfa9d3Smrgcase $program in
140f3dfa9d3Smrg  aclocal*)
141f3dfa9d3Smrg    echo 1>&2 "\
142f3dfa9d3SmrgWARNING: \`$1' is $msg.  You should only need it if
143f3dfa9d3Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
144f3dfa9d3Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
145f3dfa9d3Smrg         any GNU archive site."
146f3dfa9d3Smrg    touch aclocal.m4
147f3dfa9d3Smrg    ;;
148f3dfa9d3Smrg
149f3dfa9d3Smrg  autoconf*)
150f3dfa9d3Smrg    echo 1>&2 "\
151f3dfa9d3SmrgWARNING: \`$1' is $msg.  You should only need it if
152f3dfa9d3Smrg         you modified \`${configure_ac}'.  You might want to install the
153f3dfa9d3Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
154f3dfa9d3Smrg         archive site."
155f3dfa9d3Smrg    touch configure
156f3dfa9d3Smrg    ;;
157a0d3b6eaSmrg
158f3dfa9d3Smrg  autoheader*)
159f3dfa9d3Smrg    echo 1>&2 "\
160f3dfa9d3SmrgWARNING: \`$1' is $msg.  You should only need it if
161f3dfa9d3Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
162f3dfa9d3Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
163f3dfa9d3Smrg         from any GNU archive site."
164f3dfa9d3Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
165f3dfa9d3Smrg    test -z "$files" && files="config.h"
166f3dfa9d3Smrg    touch_files=
167f3dfa9d3Smrg    for f in $files; do
168f3dfa9d3Smrg      case $f in
169f3dfa9d3Smrg      *:*) touch_files="$touch_files "`echo "$f" |
170f3dfa9d3Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
171f3dfa9d3Smrg      *) touch_files="$touch_files $f.in";;
172f3dfa9d3Smrg      esac
173f3dfa9d3Smrg    done
174f3dfa9d3Smrg    touch $touch_files
175a0d3b6eaSmrg    ;;
176f3dfa9d3Smrg
177f3dfa9d3Smrg  automake*)
178f3dfa9d3Smrg    echo 1>&2 "\
179f3dfa9d3SmrgWARNING: \`$1' is $msg.  You should only need it if
180f3dfa9d3Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
181f3dfa9d3Smrg         You might want to install the \`Automake' and \`Perl' packages.
182f3dfa9d3Smrg         Grab them from any GNU archive site."
183f3dfa9d3Smrg    find . -type f -name Makefile.am -print |
184f3dfa9d3Smrg	   sed 's/\.am$/.in/' |
185f3dfa9d3Smrg	   while read f; do touch "$f"; done
186f3dfa9d3Smrg    ;;
187f3dfa9d3Smrg
188f3dfa9d3Smrg  autom4te*)
189f3dfa9d3Smrg    echo 1>&2 "\
190f3dfa9d3SmrgWARNING: \`$1' is needed, but is $msg.
191f3dfa9d3Smrg         You might have modified some files without having the
192f3dfa9d3Smrg         proper tools for further handling them.
193f3dfa9d3Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
194f3dfa9d3Smrg         archive site."
195f3dfa9d3Smrg
196f3dfa9d3Smrg    file=`echo "$*" | sed -n "$sed_output"`
197f3dfa9d3Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
198f3dfa9d3Smrg    if test -f "$file"; then
199f3dfa9d3Smrg	touch $file
200f3dfa9d3Smrg    else
201f3dfa9d3Smrg	test -z "$file" || exec >$file
202f3dfa9d3Smrg	echo "#! /bin/sh"
203f3dfa9d3Smrg	echo "# Created by GNU Automake missing as a replacement of"
204f3dfa9d3Smrg	echo "#  $ $@"
205f3dfa9d3Smrg	echo "exit 0"
206f3dfa9d3Smrg	chmod +x $file
207f3dfa9d3Smrg	exit 1
208f3dfa9d3Smrg    fi
209f3dfa9d3Smrg    ;;
210f3dfa9d3Smrg
211f3dfa9d3Smrg  bison*|yacc*)
212f3dfa9d3Smrg    echo 1>&2 "\
213f3dfa9d3SmrgWARNING: \`$1' $msg.  You should only need it if
214f3dfa9d3Smrg         you modified a \`.y' file.  You may need the \`Bison' package
215f3dfa9d3Smrg         in order for those modifications to take effect.  You can get
216f3dfa9d3Smrg         \`Bison' from any GNU archive site."
217f3dfa9d3Smrg    rm -f y.tab.c y.tab.h
218f3dfa9d3Smrg    if test $# -ne 1; then
219f3dfa9d3Smrg        eval LASTARG=\${$#}
220f3dfa9d3Smrg	case $LASTARG in
221f3dfa9d3Smrg	*.y)
222f3dfa9d3Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
223f3dfa9d3Smrg	    if test -f "$SRCFILE"; then
224f3dfa9d3Smrg	         cp "$SRCFILE" y.tab.c
225f3dfa9d3Smrg	    fi
226f3dfa9d3Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
227f3dfa9d3Smrg	    if test -f "$SRCFILE"; then
228f3dfa9d3Smrg	         cp "$SRCFILE" y.tab.h
229f3dfa9d3Smrg	    fi
230f3dfa9d3Smrg	  ;;
231f3dfa9d3Smrg	esac
232f3dfa9d3Smrg    fi
233f3dfa9d3Smrg    if test ! -f y.tab.h; then
234f3dfa9d3Smrg	echo >y.tab.h
235f3dfa9d3Smrg    fi
236f3dfa9d3Smrg    if test ! -f y.tab.c; then
237f3dfa9d3Smrg	echo 'main() { return 0; }' >y.tab.c
238f3dfa9d3Smrg    fi
239f3dfa9d3Smrg    ;;
240f3dfa9d3Smrg
241f3dfa9d3Smrg  lex*|flex*)
242f3dfa9d3Smrg    echo 1>&2 "\
243f3dfa9d3SmrgWARNING: \`$1' is $msg.  You should only need it if
244f3dfa9d3Smrg         you modified a \`.l' file.  You may need the \`Flex' package
245f3dfa9d3Smrg         in order for those modifications to take effect.  You can get
246f3dfa9d3Smrg         \`Flex' from any GNU archive site."
247f3dfa9d3Smrg    rm -f lex.yy.c
248f3dfa9d3Smrg    if test $# -ne 1; then
249f3dfa9d3Smrg        eval LASTARG=\${$#}
250f3dfa9d3Smrg	case $LASTARG in
251f3dfa9d3Smrg	*.l)
252f3dfa9d3Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
253f3dfa9d3Smrg	    if test -f "$SRCFILE"; then
254f3dfa9d3Smrg	         cp "$SRCFILE" lex.yy.c
255f3dfa9d3Smrg	    fi
256f3dfa9d3Smrg	  ;;
257f3dfa9d3Smrg	esac
258f3dfa9d3Smrg    fi
259f3dfa9d3Smrg    if test ! -f lex.yy.c; then
260f3dfa9d3Smrg	echo 'main() { return 0; }' >lex.yy.c
261f3dfa9d3Smrg    fi
262f3dfa9d3Smrg    ;;
263f3dfa9d3Smrg
264f3dfa9d3Smrg  help2man*)
265f3dfa9d3Smrg    echo 1>&2 "\
266f3dfa9d3SmrgWARNING: \`$1' is $msg.  You should only need it if
267f3dfa9d3Smrg	 you modified a dependency of a manual page.  You may need the
268f3dfa9d3Smrg	 \`Help2man' package in order for those modifications to take
269f3dfa9d3Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
270f3dfa9d3Smrg
271f3dfa9d3Smrg    file=`echo "$*" | sed -n "$sed_output"`
272f3dfa9d3Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
273f3dfa9d3Smrg    if test -f "$file"; then
274f3dfa9d3Smrg	touch $file
275f3dfa9d3Smrg    else
276f3dfa9d3Smrg	test -z "$file" || exec >$file
277f3dfa9d3Smrg	echo ".ab help2man is required to generate this page"
278f3dfa9d3Smrg	exit $?
279f3dfa9d3Smrg    fi
280f3dfa9d3Smrg    ;;
281f3dfa9d3Smrg
282f3dfa9d3Smrg  makeinfo*)
283f3dfa9d3Smrg    echo 1>&2 "\
284f3dfa9d3SmrgWARNING: \`$1' is $msg.  You should only need it if
285f3dfa9d3Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
286f3dfa9d3Smrg         indirectly affecting the aspect of the manual.  The spurious
287f3dfa9d3Smrg         call might also be the consequence of using a buggy \`make' (AIX,
288f3dfa9d3Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
289f3dfa9d3Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
290f3dfa9d3Smrg    # The file to touch is that specified with -o ...
291f3dfa9d3Smrg    file=`echo "$*" | sed -n "$sed_output"`
292f3dfa9d3Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
293f3dfa9d3Smrg    if test -z "$file"; then
294f3dfa9d3Smrg      # ... or it is the one specified with @setfilename ...
295f3dfa9d3Smrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
296f3dfa9d3Smrg      file=`sed -n '
297f3dfa9d3Smrg	/^@setfilename/{
298f3dfa9d3Smrg	  s/.* \([^ ]*\) *$/\1/
299f3dfa9d3Smrg	  p
300f3dfa9d3Smrg	  q
301f3dfa9d3Smrg	}' $infile`
302f3dfa9d3Smrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
303f3dfa9d3Smrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
304f3dfa9d3Smrg    fi
305f3dfa9d3Smrg    # If the file does not exist, the user really needs makeinfo;
306f3dfa9d3Smrg    # let's fail without touching anything.
307f3dfa9d3Smrg    test -f $file || exit 1
308f3dfa9d3Smrg    touch $file
309f3dfa9d3Smrg    ;;
310f3dfa9d3Smrg
311f3dfa9d3Smrg  *)
312f3dfa9d3Smrg    echo 1>&2 "\
313f3dfa9d3SmrgWARNING: \`$1' is needed, and is $msg.
314f3dfa9d3Smrg         You might have modified some files without having the
315f3dfa9d3Smrg         proper tools for further handling them.  Check the \`README' file,
316f3dfa9d3Smrg         it often tells you about the needed prerequisites for installing
317f3dfa9d3Smrg         this package.  You may also peek at any GNU archive site, in case
318f3dfa9d3Smrg         some other package would contain this missing \`$1' program."
319f3dfa9d3Smrg    exit 1
320f3dfa9d3Smrg    ;;
321f3dfa9d3Smrgesac
322f3dfa9d3Smrg
323f3dfa9d3Smrgexit 0
324a0d3b6eaSmrg
325a0d3b6eaSmrg# Local variables:
326a0d3b6eaSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
327a0d3b6eaSmrg# time-stamp-start: "scriptversion="
328a0d3b6eaSmrg# time-stamp-format: "%:y-%02m-%02d.%02H"
329f8a31ee4Smrg# time-stamp-time-zone: "UTC"
330f8a31ee4Smrg# time-stamp-end: "; # UTC"
331a0d3b6eaSmrg# End:
332