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