missing revision 2227fc13
1644fc5c1Stron#! /bin/sh
2644fc5c1Stron# Common stub for a few missing GNU programs while installing.
32227fc13Smrg
42227fc13Smrgscriptversion=2009-04-28.21; # UTC
52227fc13Smrg
62227fc13Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
72227fc13Smrg# 2008, 2009 Free Software Foundation, Inc.
8644fc5c1Stron# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
9644fc5c1Stron
10644fc5c1Stron# This program is free software; you can redistribute it and/or modify
11644fc5c1Stron# it under the terms of the GNU General Public License as published by
12644fc5c1Stron# the Free Software Foundation; either version 2, or (at your option)
13644fc5c1Stron# any later version.
14644fc5c1Stron
15644fc5c1Stron# This program is distributed in the hope that it will be useful,
16644fc5c1Stron# but WITHOUT ANY WARRANTY; without even the implied warranty of
17644fc5c1Stron# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18644fc5c1Stron# GNU General Public License for more details.
19644fc5c1Stron
20644fc5c1Stron# You should have received a copy of the GNU General Public License
212227fc13Smrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
22644fc5c1Stron
23644fc5c1Stron# As a special exception to the GNU General Public License, if you
24644fc5c1Stron# distribute this file as part of a program that contains a
25644fc5c1Stron# configuration script generated by Autoconf, you may include it under
26644fc5c1Stron# the same distribution terms that you use for the rest of that program.
27644fc5c1Stron
28644fc5c1Stronif test $# -eq 0; then
29644fc5c1Stron  echo 1>&2 "Try \`$0 --help' for more information"
30644fc5c1Stron  exit 1
31644fc5c1Stronfi
32644fc5c1Stron
33644fc5c1Stronrun=:
342227fc13Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
352227fc13Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
36644fc5c1Stron
37644fc5c1Stron# In the cases where this matters, `missing' is being run in the
38644fc5c1Stron# srcdir already.
39644fc5c1Stronif test -f configure.ac; then
40644fc5c1Stron  configure_ac=configure.ac
41644fc5c1Stronelse
42644fc5c1Stron  configure_ac=configure.in
43644fc5c1Stronfi
44644fc5c1Stron
452227fc13Smrgmsg="missing on your system"
462227fc13Smrg
472227fc13Smrgcase $1 in
48644fc5c1Stron--run)
49644fc5c1Stron  # Try to run requested program, and just exit if it succeeds.
50644fc5c1Stron  run=
51644fc5c1Stron  shift
52644fc5c1Stron  "$@" && exit 0
532227fc13Smrg  # Exit code 63 means version mismatch.  This often happens
542227fc13Smrg  # when the user try to use an ancient version of a tool on
552227fc13Smrg  # a file that requires a minimum version.  In this case we
562227fc13Smrg  # we should proceed has if the program had been absent, or
572227fc13Smrg  # if --run hadn't been passed.
582227fc13Smrg  if test $? = 63; then
592227fc13Smrg    run=:
602227fc13Smrg    msg="probably too old"
612227fc13Smrg  fi
62644fc5c1Stron  ;;
63644fc5c1Stron
64644fc5c1Stron  -h|--h|--he|--hel|--help)
65644fc5c1Stron    echo "\
66644fc5c1Stron$0 [OPTION]... PROGRAM [ARGUMENT]...
67644fc5c1Stron
68644fc5c1StronHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
69644fc5c1Stronerror status if there is no known handling for PROGRAM.
70644fc5c1Stron
71644fc5c1StronOptions:
72644fc5c1Stron  -h, --help      display this help and exit
73644fc5c1Stron  -v, --version   output version information and exit
74644fc5c1Stron  --run           try to run the given command, and emulate it if it fails
75644fc5c1Stron
76644fc5c1StronSupported PROGRAM values:
77644fc5c1Stron  aclocal      touch file \`aclocal.m4'
78644fc5c1Stron  autoconf     touch file \`configure'
79644fc5c1Stron  autoheader   touch file \`config.h.in'
802227fc13Smrg  autom4te     touch the output file, or create a stub one
81644fc5c1Stron  automake     touch all \`Makefile.in' files
82644fc5c1Stron  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
83644fc5c1Stron  flex         create \`lex.yy.c', if possible, from existing .c
84644fc5c1Stron  help2man     touch the output file
85644fc5c1Stron  lex          create \`lex.yy.c', if possible, from existing .c
86644fc5c1Stron  makeinfo     touch the output file
87644fc5c1Stron  tar          try tar, gnutar, gtar, then tar without non-portable flags
882227fc13Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
892227fc13Smrg
902227fc13SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
912227fc13Smrg\`g' are ignored when checking the name.
922227fc13Smrg
932227fc13SmrgSend bug reports to <bug-automake@gnu.org>."
942227fc13Smrg    exit $?
95644fc5c1Stron    ;;
96644fc5c1Stron
97644fc5c1Stron  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
982227fc13Smrg    echo "missing $scriptversion (GNU Automake)"
992227fc13Smrg    exit $?
100644fc5c1Stron    ;;
101644fc5c1Stron
102644fc5c1Stron  -*)
103644fc5c1Stron    echo 1>&2 "$0: Unknown \`$1' option"
104644fc5c1Stron    echo 1>&2 "Try \`$0 --help' for more information"
105644fc5c1Stron    exit 1
106644fc5c1Stron    ;;
107644fc5c1Stron
1082227fc13Smrgesac
1092227fc13Smrg
1102227fc13Smrg# normalize program name to check for.
1112227fc13Smrgprogram=`echo "$1" | sed '
1122227fc13Smrg  s/^gnu-//; t
1132227fc13Smrg  s/^gnu//; t
1142227fc13Smrg  s/^g//; t'`
1152227fc13Smrg
1162227fc13Smrg# Now exit if we have it, but it failed.  Also exit now if we
1172227fc13Smrg# don't have it and --version was passed (most likely to detect
1182227fc13Smrg# the program).  This is about non-GNU programs, so use $1 not
1192227fc13Smrg# $program.
1202227fc13Smrgcase $1 in
1212227fc13Smrg  lex*|yacc*)
1222227fc13Smrg    # Not GNU programs, they don't have --version.
1232227fc13Smrg    ;;
1242227fc13Smrg
1252227fc13Smrg  tar*)
1262227fc13Smrg    if test -n "$run"; then
1272227fc13Smrg       echo 1>&2 "ERROR: \`tar' requires --run"
1282227fc13Smrg       exit 1
1292227fc13Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1302227fc13Smrg       exit 1
1312227fc13Smrg    fi
1322227fc13Smrg    ;;
1332227fc13Smrg
1342227fc13Smrg  *)
135644fc5c1Stron    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
136644fc5c1Stron       # We have it, but it failed.
137644fc5c1Stron       exit 1
1382227fc13Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1392227fc13Smrg       # Could not run --version or --help.  This is probably someone
1402227fc13Smrg       # running `$TOOL --version' or `$TOOL --help' to check whether
1412227fc13Smrg       # $TOOL exists and not knowing $TOOL uses missing.
1422227fc13Smrg       exit 1
143644fc5c1Stron    fi
1442227fc13Smrg    ;;
1452227fc13Smrgesac
146644fc5c1Stron
1472227fc13Smrg# If it does not exist, or fails to run (possibly an outdated version),
1482227fc13Smrg# try to emulate it.
1492227fc13Smrgcase $program in
1502227fc13Smrg  aclocal*)
151644fc5c1Stron    echo 1>&2 "\
1522227fc13SmrgWARNING: \`$1' is $msg.  You should only need it if
153644fc5c1Stron         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
154644fc5c1Stron         to install the \`Automake' and \`Perl' packages.  Grab them from
155644fc5c1Stron         any GNU archive site."
156644fc5c1Stron    touch aclocal.m4
157644fc5c1Stron    ;;
158644fc5c1Stron
1592227fc13Smrg  autoconf*)
160644fc5c1Stron    echo 1>&2 "\
1612227fc13SmrgWARNING: \`$1' is $msg.  You should only need it if
162644fc5c1Stron         you modified \`${configure_ac}'.  You might want to install the
163644fc5c1Stron         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
164644fc5c1Stron         archive site."
165644fc5c1Stron    touch configure
166644fc5c1Stron    ;;
167644fc5c1Stron
1682227fc13Smrg  autoheader*)
169644fc5c1Stron    echo 1>&2 "\
1702227fc13SmrgWARNING: \`$1' is $msg.  You should only need it if
171644fc5c1Stron         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
172644fc5c1Stron         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
173644fc5c1Stron         from any GNU archive site."
174644fc5c1Stron    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
175644fc5c1Stron    test -z "$files" && files="config.h"
176644fc5c1Stron    touch_files=
177644fc5c1Stron    for f in $files; do
1782227fc13Smrg      case $f in
179644fc5c1Stron      *:*) touch_files="$touch_files "`echo "$f" |
180644fc5c1Stron				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
181644fc5c1Stron      *) touch_files="$touch_files $f.in";;
182644fc5c1Stron      esac
183644fc5c1Stron    done
184644fc5c1Stron    touch $touch_files
185644fc5c1Stron    ;;
186644fc5c1Stron
187644fc5c1Stron  automake*)
188644fc5c1Stron    echo 1>&2 "\
1892227fc13SmrgWARNING: \`$1' is $msg.  You should only need it if
190644fc5c1Stron         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
191644fc5c1Stron         You might want to install the \`Automake' and \`Perl' packages.
192644fc5c1Stron         Grab them from any GNU archive site."
193644fc5c1Stron    find . -type f -name Makefile.am -print |
194644fc5c1Stron	   sed 's/\.am$/.in/' |
195644fc5c1Stron	   while read f; do touch "$f"; done
196644fc5c1Stron    ;;
197644fc5c1Stron
1982227fc13Smrg  autom4te*)
199644fc5c1Stron    echo 1>&2 "\
2002227fc13SmrgWARNING: \`$1' is needed, but is $msg.
2012227fc13Smrg         You might have modified some files without having the
202644fc5c1Stron         proper tools for further handling them.
203644fc5c1Stron         You can get \`$1' as part of \`Autoconf' from any GNU
204644fc5c1Stron         archive site."
205644fc5c1Stron
2062227fc13Smrg    file=`echo "$*" | sed -n "$sed_output"`
2072227fc13Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
208644fc5c1Stron    if test -f "$file"; then
209644fc5c1Stron	touch $file
210644fc5c1Stron    else
211644fc5c1Stron	test -z "$file" || exec >$file
212644fc5c1Stron	echo "#! /bin/sh"
213644fc5c1Stron	echo "# Created by GNU Automake missing as a replacement of"
214644fc5c1Stron	echo "#  $ $@"
215644fc5c1Stron	echo "exit 0"
216644fc5c1Stron	chmod +x $file
217644fc5c1Stron	exit 1
218644fc5c1Stron    fi
219644fc5c1Stron    ;;
220644fc5c1Stron
2212227fc13Smrg  bison*|yacc*)
222644fc5c1Stron    echo 1>&2 "\
2232227fc13SmrgWARNING: \`$1' $msg.  You should only need it if
224644fc5c1Stron         you modified a \`.y' file.  You may need the \`Bison' package
225644fc5c1Stron         in order for those modifications to take effect.  You can get
226644fc5c1Stron         \`Bison' from any GNU archive site."
227644fc5c1Stron    rm -f y.tab.c y.tab.h
2282227fc13Smrg    if test $# -ne 1; then
229644fc5c1Stron        eval LASTARG="\${$#}"
2302227fc13Smrg	case $LASTARG in
231644fc5c1Stron	*.y)
232644fc5c1Stron	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
2332227fc13Smrg	    if test -f "$SRCFILE"; then
234644fc5c1Stron	         cp "$SRCFILE" y.tab.c
235644fc5c1Stron	    fi
236644fc5c1Stron	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2372227fc13Smrg	    if test -f "$SRCFILE"; then
238644fc5c1Stron	         cp "$SRCFILE" y.tab.h
239644fc5c1Stron	    fi
240644fc5c1Stron	  ;;
241644fc5c1Stron	esac
242644fc5c1Stron    fi
2432227fc13Smrg    if test ! -f y.tab.h; then
244644fc5c1Stron	echo >y.tab.h
245644fc5c1Stron    fi
2462227fc13Smrg    if test ! -f y.tab.c; then
247644fc5c1Stron	echo 'main() { return 0; }' >y.tab.c
248644fc5c1Stron    fi
249644fc5c1Stron    ;;
250644fc5c1Stron
2512227fc13Smrg  lex*|flex*)
252644fc5c1Stron    echo 1>&2 "\
2532227fc13SmrgWARNING: \`$1' is $msg.  You should only need it if
254644fc5c1Stron         you modified a \`.l' file.  You may need the \`Flex' package
255644fc5c1Stron         in order for those modifications to take effect.  You can get
256644fc5c1Stron         \`Flex' from any GNU archive site."
257644fc5c1Stron    rm -f lex.yy.c
2582227fc13Smrg    if test $# -ne 1; then
259644fc5c1Stron        eval LASTARG="\${$#}"
2602227fc13Smrg	case $LASTARG in
261644fc5c1Stron	*.l)
262644fc5c1Stron	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2632227fc13Smrg	    if test -f "$SRCFILE"; then
264644fc5c1Stron	         cp "$SRCFILE" lex.yy.c
265644fc5c1Stron	    fi
266644fc5c1Stron	  ;;
267644fc5c1Stron	esac
268644fc5c1Stron    fi
2692227fc13Smrg    if test ! -f lex.yy.c; then
270644fc5c1Stron	echo 'main() { return 0; }' >lex.yy.c
271644fc5c1Stron    fi
272644fc5c1Stron    ;;
273644fc5c1Stron
2742227fc13Smrg  help2man*)
275644fc5c1Stron    echo 1>&2 "\
2762227fc13SmrgWARNING: \`$1' is $msg.  You should only need it if
277644fc5c1Stron	 you modified a dependency of a manual page.  You may need the
278644fc5c1Stron	 \`Help2man' package in order for those modifications to take
279644fc5c1Stron	 effect.  You can get \`Help2man' from any GNU archive site."
280644fc5c1Stron
2812227fc13Smrg    file=`echo "$*" | sed -n "$sed_output"`
2822227fc13Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2832227fc13Smrg    if test -f "$file"; then
284644fc5c1Stron	touch $file
285644fc5c1Stron    else
286644fc5c1Stron	test -z "$file" || exec >$file
287644fc5c1Stron	echo ".ab help2man is required to generate this page"
2882227fc13Smrg	exit $?
289644fc5c1Stron    fi
290644fc5c1Stron    ;;
291644fc5c1Stron
2922227fc13Smrg  makeinfo*)
293644fc5c1Stron    echo 1>&2 "\
2942227fc13SmrgWARNING: \`$1' is $msg.  You should only need it if
295644fc5c1Stron         you modified a \`.texi' or \`.texinfo' file, or any other file
296644fc5c1Stron         indirectly affecting the aspect of the manual.  The spurious
297644fc5c1Stron         call might also be the consequence of using a buggy \`make' (AIX,
298644fc5c1Stron         DU, IRIX).  You might want to install the \`Texinfo' package or
299644fc5c1Stron         the \`GNU make' package.  Grab either from any GNU archive site."
3002227fc13Smrg    # The file to touch is that specified with -o ...
3012227fc13Smrg    file=`echo "$*" | sed -n "$sed_output"`
3022227fc13Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
303644fc5c1Stron    if test -z "$file"; then
3042227fc13Smrg      # ... or it is the one specified with @setfilename ...
3052227fc13Smrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
3062227fc13Smrg      file=`sed -n '
3072227fc13Smrg	/^@setfilename/{
3082227fc13Smrg	  s/.* \([^ ]*\) *$/\1/
3092227fc13Smrg	  p
3102227fc13Smrg	  q
3112227fc13Smrg	}' $infile`
3122227fc13Smrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
3132227fc13Smrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
314644fc5c1Stron    fi
3152227fc13Smrg    # If the file does not exist, the user really needs makeinfo;
3162227fc13Smrg    # let's fail without touching anything.
3172227fc13Smrg    test -f $file || exit 1
318644fc5c1Stron    touch $file
319644fc5c1Stron    ;;
320644fc5c1Stron
3212227fc13Smrg  tar*)
322644fc5c1Stron    shift
323644fc5c1Stron
324644fc5c1Stron    # We have already tried tar in the generic part.
325644fc5c1Stron    # Look for gnutar/gtar before invocation to avoid ugly error
326644fc5c1Stron    # messages.
327644fc5c1Stron    if (gnutar --version > /dev/null 2>&1); then
328644fc5c1Stron       gnutar "$@" && exit 0
329644fc5c1Stron    fi
330644fc5c1Stron    if (gtar --version > /dev/null 2>&1); then
331644fc5c1Stron       gtar "$@" && exit 0
332644fc5c1Stron    fi
333644fc5c1Stron    firstarg="$1"
334644fc5c1Stron    if shift; then
3352227fc13Smrg	case $firstarg in
336644fc5c1Stron	*o*)
337644fc5c1Stron	    firstarg=`echo "$firstarg" | sed s/o//`
338644fc5c1Stron	    tar "$firstarg" "$@" && exit 0
339644fc5c1Stron	    ;;
340644fc5c1Stron	esac
3412227fc13Smrg	case $firstarg in
342644fc5c1Stron	*h*)
343644fc5c1Stron	    firstarg=`echo "$firstarg" | sed s/h//`
344644fc5c1Stron	    tar "$firstarg" "$@" && exit 0
345644fc5c1Stron	    ;;
346644fc5c1Stron	esac
347644fc5c1Stron    fi
348644fc5c1Stron
349644fc5c1Stron    echo 1>&2 "\
350644fc5c1StronWARNING: I can't seem to be able to run \`tar' with the given arguments.
351644fc5c1Stron         You may want to install GNU tar or Free paxutils, or check the
352644fc5c1Stron         command line arguments."
353644fc5c1Stron    exit 1
354644fc5c1Stron    ;;
355644fc5c1Stron
356644fc5c1Stron  *)
357644fc5c1Stron    echo 1>&2 "\
3582227fc13SmrgWARNING: \`$1' is needed, and is $msg.
3592227fc13Smrg         You might have modified some files without having the
360644fc5c1Stron         proper tools for further handling them.  Check the \`README' file,
361644fc5c1Stron         it often tells you about the needed prerequisites for installing
362644fc5c1Stron         this package.  You may also peek at any GNU archive site, in case
363644fc5c1Stron         some other package would contain this missing \`$1' program."
364644fc5c1Stron    exit 1
365644fc5c1Stron    ;;
366644fc5c1Stronesac
367644fc5c1Stron
368644fc5c1Stronexit 0
3692227fc13Smrg
3702227fc13Smrg# Local variables:
3712227fc13Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
3722227fc13Smrg# time-stamp-start: "scriptversion="
3732227fc13Smrg# time-stamp-format: "%:y-%02m-%02d.%02H"
3742227fc13Smrg# time-stamp-time-zone: "UTC"
3752227fc13Smrg# time-stamp-end: "; # UTC"
3762227fc13Smrg# End:
377