missing revision b9bb67cb
11cc8c64fSmrg#! /bin/sh
21cc8c64fSmrg# Common stub for a few missing GNU programs while installing.
3b9bb67cbSmrg
4b9bb67cbSmrgscriptversion=2009-04-28.21; # UTC
5b9bb67cbSmrg
6b9bb67cbSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
7b9bb67cbSmrg# 2008, 2009 Free Software Foundation, Inc.
81cc8c64fSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
91cc8c64fSmrg
101cc8c64fSmrg# This program is free software; you can redistribute it and/or modify
111cc8c64fSmrg# it under the terms of the GNU General Public License as published by
121cc8c64fSmrg# the Free Software Foundation; either version 2, or (at your option)
131cc8c64fSmrg# any later version.
141cc8c64fSmrg
151cc8c64fSmrg# This program is distributed in the hope that it will be useful,
161cc8c64fSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
171cc8c64fSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
181cc8c64fSmrg# GNU General Public License for more details.
191cc8c64fSmrg
201cc8c64fSmrg# You should have received a copy of the GNU General Public License
21b9bb67cbSmrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
221cc8c64fSmrg
231cc8c64fSmrg# As a special exception to the GNU General Public License, if you
241cc8c64fSmrg# distribute this file as part of a program that contains a
251cc8c64fSmrg# configuration script generated by Autoconf, you may include it under
261cc8c64fSmrg# the same distribution terms that you use for the rest of that program.
271cc8c64fSmrg
281cc8c64fSmrgif test $# -eq 0; then
291cc8c64fSmrg  echo 1>&2 "Try \`$0 --help' for more information"
301cc8c64fSmrg  exit 1
311cc8c64fSmrgfi
321cc8c64fSmrg
331cc8c64fSmrgrun=:
34b9bb67cbSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
35b9bb67cbSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
361cc8c64fSmrg
371cc8c64fSmrg# In the cases where this matters, `missing' is being run in the
381cc8c64fSmrg# srcdir already.
391cc8c64fSmrgif test -f configure.ac; then
401cc8c64fSmrg  configure_ac=configure.ac
411cc8c64fSmrgelse
421cc8c64fSmrg  configure_ac=configure.in
431cc8c64fSmrgfi
441cc8c64fSmrg
45b9bb67cbSmrgmsg="missing on your system"
46b9bb67cbSmrg
47b9bb67cbSmrgcase $1 in
481cc8c64fSmrg--run)
491cc8c64fSmrg  # Try to run requested program, and just exit if it succeeds.
501cc8c64fSmrg  run=
511cc8c64fSmrg  shift
521cc8c64fSmrg  "$@" && exit 0
53b9bb67cbSmrg  # Exit code 63 means version mismatch.  This often happens
54b9bb67cbSmrg  # when the user try to use an ancient version of a tool on
55b9bb67cbSmrg  # a file that requires a minimum version.  In this case we
56b9bb67cbSmrg  # we should proceed has if the program had been absent, or
57b9bb67cbSmrg  # if --run hadn't been passed.
58b9bb67cbSmrg  if test $? = 63; then
59b9bb67cbSmrg    run=:
60b9bb67cbSmrg    msg="probably too old"
61b9bb67cbSmrg  fi
621cc8c64fSmrg  ;;
631cc8c64fSmrg
641cc8c64fSmrg  -h|--h|--he|--hel|--help)
651cc8c64fSmrg    echo "\
661cc8c64fSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
671cc8c64fSmrg
681cc8c64fSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
691cc8c64fSmrgerror status if there is no known handling for PROGRAM.
701cc8c64fSmrg
711cc8c64fSmrgOptions:
721cc8c64fSmrg  -h, --help      display this help and exit
731cc8c64fSmrg  -v, --version   output version information and exit
741cc8c64fSmrg  --run           try to run the given command, and emulate it if it fails
751cc8c64fSmrg
761cc8c64fSmrgSupported PROGRAM values:
771cc8c64fSmrg  aclocal      touch file \`aclocal.m4'
781cc8c64fSmrg  autoconf     touch file \`configure'
791cc8c64fSmrg  autoheader   touch file \`config.h.in'
80b9bb67cbSmrg  autom4te     touch the output file, or create a stub one
811cc8c64fSmrg  automake     touch all \`Makefile.in' files
821cc8c64fSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
831cc8c64fSmrg  flex         create \`lex.yy.c', if possible, from existing .c
841cc8c64fSmrg  help2man     touch the output file
851cc8c64fSmrg  lex          create \`lex.yy.c', if possible, from existing .c
861cc8c64fSmrg  makeinfo     touch the output file
871cc8c64fSmrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
88b9bb67cbSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
89b9bb67cbSmrg
90b9bb67cbSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
91b9bb67cbSmrg\`g' are ignored when checking the name.
92b9bb67cbSmrg
93b9bb67cbSmrgSend bug reports to <bug-automake@gnu.org>."
94b9bb67cbSmrg    exit $?
951cc8c64fSmrg    ;;
961cc8c64fSmrg
971cc8c64fSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
98b9bb67cbSmrg    echo "missing $scriptversion (GNU Automake)"
99b9bb67cbSmrg    exit $?
1001cc8c64fSmrg    ;;
1011cc8c64fSmrg
1021cc8c64fSmrg  -*)
1031cc8c64fSmrg    echo 1>&2 "$0: Unknown \`$1' option"
1041cc8c64fSmrg    echo 1>&2 "Try \`$0 --help' for more information"
1051cc8c64fSmrg    exit 1
1061cc8c64fSmrg    ;;
1071cc8c64fSmrg
108b9bb67cbSmrgesac
109b9bb67cbSmrg
110b9bb67cbSmrg# normalize program name to check for.
111b9bb67cbSmrgprogram=`echo "$1" | sed '
112b9bb67cbSmrg  s/^gnu-//; t
113b9bb67cbSmrg  s/^gnu//; t
114b9bb67cbSmrg  s/^g//; t'`
115b9bb67cbSmrg
116b9bb67cbSmrg# Now exit if we have it, but it failed.  Also exit now if we
117b9bb67cbSmrg# don't have it and --version was passed (most likely to detect
118b9bb67cbSmrg# the program).  This is about non-GNU programs, so use $1 not
119b9bb67cbSmrg# $program.
120b9bb67cbSmrgcase $1 in
121b9bb67cbSmrg  lex*|yacc*)
122b9bb67cbSmrg    # Not GNU programs, they don't have --version.
123b9bb67cbSmrg    ;;
124b9bb67cbSmrg
125b9bb67cbSmrg  tar*)
126b9bb67cbSmrg    if test -n "$run"; then
127b9bb67cbSmrg       echo 1>&2 "ERROR: \`tar' requires --run"
128b9bb67cbSmrg       exit 1
129b9bb67cbSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
130b9bb67cbSmrg       exit 1
131b9bb67cbSmrg    fi
132b9bb67cbSmrg    ;;
133b9bb67cbSmrg
134b9bb67cbSmrg  *)
1351cc8c64fSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1361cc8c64fSmrg       # We have it, but it failed.
1371cc8c64fSmrg       exit 1
138b9bb67cbSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
139b9bb67cbSmrg       # Could not run --version or --help.  This is probably someone
140b9bb67cbSmrg       # running `$TOOL --version' or `$TOOL --help' to check whether
141b9bb67cbSmrg       # $TOOL exists and not knowing $TOOL uses missing.
142b9bb67cbSmrg       exit 1
1431cc8c64fSmrg    fi
144b9bb67cbSmrg    ;;
145b9bb67cbSmrgesac
1461cc8c64fSmrg
147b9bb67cbSmrg# If it does not exist, or fails to run (possibly an outdated version),
148b9bb67cbSmrg# try to emulate it.
149b9bb67cbSmrgcase $program in
150b9bb67cbSmrg  aclocal*)
1511cc8c64fSmrg    echo 1>&2 "\
152b9bb67cbSmrgWARNING: \`$1' is $msg.  You should only need it if
1531cc8c64fSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
1541cc8c64fSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
1551cc8c64fSmrg         any GNU archive site."
1561cc8c64fSmrg    touch aclocal.m4
1571cc8c64fSmrg    ;;
1581cc8c64fSmrg
159b9bb67cbSmrg  autoconf*)
1601cc8c64fSmrg    echo 1>&2 "\
161b9bb67cbSmrgWARNING: \`$1' is $msg.  You should only need it if
1621cc8c64fSmrg         you modified \`${configure_ac}'.  You might want to install the
1631cc8c64fSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1641cc8c64fSmrg         archive site."
1651cc8c64fSmrg    touch configure
1661cc8c64fSmrg    ;;
1671cc8c64fSmrg
168b9bb67cbSmrg  autoheader*)
1691cc8c64fSmrg    echo 1>&2 "\
170b9bb67cbSmrgWARNING: \`$1' is $msg.  You should only need it if
1711cc8c64fSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1721cc8c64fSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1731cc8c64fSmrg         from any GNU archive site."
1741cc8c64fSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1751cc8c64fSmrg    test -z "$files" && files="config.h"
1761cc8c64fSmrg    touch_files=
1771cc8c64fSmrg    for f in $files; do
178b9bb67cbSmrg      case $f in
1791cc8c64fSmrg      *:*) touch_files="$touch_files "`echo "$f" |
1801cc8c64fSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1811cc8c64fSmrg      *) touch_files="$touch_files $f.in";;
1821cc8c64fSmrg      esac
1831cc8c64fSmrg    done
1841cc8c64fSmrg    touch $touch_files
1851cc8c64fSmrg    ;;
1861cc8c64fSmrg
1871cc8c64fSmrg  automake*)
1881cc8c64fSmrg    echo 1>&2 "\
189b9bb67cbSmrgWARNING: \`$1' is $msg.  You should only need it if
1901cc8c64fSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1911cc8c64fSmrg         You might want to install the \`Automake' and \`Perl' packages.
1921cc8c64fSmrg         Grab them from any GNU archive site."
1931cc8c64fSmrg    find . -type f -name Makefile.am -print |
1941cc8c64fSmrg	   sed 's/\.am$/.in/' |
1951cc8c64fSmrg	   while read f; do touch "$f"; done
1961cc8c64fSmrg    ;;
1971cc8c64fSmrg
198b9bb67cbSmrg  autom4te*)
1991cc8c64fSmrg    echo 1>&2 "\
200b9bb67cbSmrgWARNING: \`$1' is needed, but is $msg.
201b9bb67cbSmrg         You might have modified some files without having the
2021cc8c64fSmrg         proper tools for further handling them.
2031cc8c64fSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
2041cc8c64fSmrg         archive site."
2051cc8c64fSmrg
206b9bb67cbSmrg    file=`echo "$*" | sed -n "$sed_output"`
207b9bb67cbSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2081cc8c64fSmrg    if test -f "$file"; then
2091cc8c64fSmrg	touch $file
2101cc8c64fSmrg    else
2111cc8c64fSmrg	test -z "$file" || exec >$file
2121cc8c64fSmrg	echo "#! /bin/sh"
2131cc8c64fSmrg	echo "# Created by GNU Automake missing as a replacement of"
2141cc8c64fSmrg	echo "#  $ $@"
2151cc8c64fSmrg	echo "exit 0"
2161cc8c64fSmrg	chmod +x $file
2171cc8c64fSmrg	exit 1
2181cc8c64fSmrg    fi
2191cc8c64fSmrg    ;;
2201cc8c64fSmrg
221b9bb67cbSmrg  bison*|yacc*)
2221cc8c64fSmrg    echo 1>&2 "\
223b9bb67cbSmrgWARNING: \`$1' $msg.  You should only need it if
2241cc8c64fSmrg         you modified a \`.y' file.  You may need the \`Bison' package
2251cc8c64fSmrg         in order for those modifications to take effect.  You can get
2261cc8c64fSmrg         \`Bison' from any GNU archive site."
2271cc8c64fSmrg    rm -f y.tab.c y.tab.h
228b9bb67cbSmrg    if test $# -ne 1; then
2291cc8c64fSmrg        eval LASTARG="\${$#}"
230b9bb67cbSmrg	case $LASTARG in
2311cc8c64fSmrg	*.y)
2321cc8c64fSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
233b9bb67cbSmrg	    if test -f "$SRCFILE"; then
2341cc8c64fSmrg	         cp "$SRCFILE" y.tab.c
2351cc8c64fSmrg	    fi
2361cc8c64fSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
237b9bb67cbSmrg	    if test -f "$SRCFILE"; then
2381cc8c64fSmrg	         cp "$SRCFILE" y.tab.h
2391cc8c64fSmrg	    fi
2401cc8c64fSmrg	  ;;
2411cc8c64fSmrg	esac
2421cc8c64fSmrg    fi
243b9bb67cbSmrg    if test ! -f y.tab.h; then
2441cc8c64fSmrg	echo >y.tab.h
2451cc8c64fSmrg    fi
246b9bb67cbSmrg    if test ! -f y.tab.c; then
2471cc8c64fSmrg	echo 'main() { return 0; }' >y.tab.c
2481cc8c64fSmrg    fi
2491cc8c64fSmrg    ;;
2501cc8c64fSmrg
251b9bb67cbSmrg  lex*|flex*)
2521cc8c64fSmrg    echo 1>&2 "\
253b9bb67cbSmrgWARNING: \`$1' is $msg.  You should only need it if
2541cc8c64fSmrg         you modified a \`.l' file.  You may need the \`Flex' package
2551cc8c64fSmrg         in order for those modifications to take effect.  You can get
2561cc8c64fSmrg         \`Flex' from any GNU archive site."
2571cc8c64fSmrg    rm -f lex.yy.c
258b9bb67cbSmrg    if test $# -ne 1; then
2591cc8c64fSmrg        eval LASTARG="\${$#}"
260b9bb67cbSmrg	case $LASTARG in
2611cc8c64fSmrg	*.l)
2621cc8c64fSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
263b9bb67cbSmrg	    if test -f "$SRCFILE"; then
2641cc8c64fSmrg	         cp "$SRCFILE" lex.yy.c
2651cc8c64fSmrg	    fi
2661cc8c64fSmrg	  ;;
2671cc8c64fSmrg	esac
2681cc8c64fSmrg    fi
269b9bb67cbSmrg    if test ! -f lex.yy.c; then
2701cc8c64fSmrg	echo 'main() { return 0; }' >lex.yy.c
2711cc8c64fSmrg    fi
2721cc8c64fSmrg    ;;
2731cc8c64fSmrg
274b9bb67cbSmrg  help2man*)
2751cc8c64fSmrg    echo 1>&2 "\
276b9bb67cbSmrgWARNING: \`$1' is $msg.  You should only need it if
2771cc8c64fSmrg	 you modified a dependency of a manual page.  You may need the
2781cc8c64fSmrg	 \`Help2man' package in order for those modifications to take
2791cc8c64fSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
2801cc8c64fSmrg
281b9bb67cbSmrg    file=`echo "$*" | sed -n "$sed_output"`
282b9bb67cbSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
283b9bb67cbSmrg    if test -f "$file"; then
2841cc8c64fSmrg	touch $file
2851cc8c64fSmrg    else
2861cc8c64fSmrg	test -z "$file" || exec >$file
2871cc8c64fSmrg	echo ".ab help2man is required to generate this page"
288b9bb67cbSmrg	exit $?
2891cc8c64fSmrg    fi
2901cc8c64fSmrg    ;;
2911cc8c64fSmrg
292b9bb67cbSmrg  makeinfo*)
2931cc8c64fSmrg    echo 1>&2 "\
294b9bb67cbSmrgWARNING: \`$1' is $msg.  You should only need it if
2951cc8c64fSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
2961cc8c64fSmrg         indirectly affecting the aspect of the manual.  The spurious
2971cc8c64fSmrg         call might also be the consequence of using a buggy \`make' (AIX,
2981cc8c64fSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
2991cc8c64fSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
300b9bb67cbSmrg    # The file to touch is that specified with -o ...
301b9bb67cbSmrg    file=`echo "$*" | sed -n "$sed_output"`
302b9bb67cbSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
3031cc8c64fSmrg    if test -z "$file"; then
304b9bb67cbSmrg      # ... or it is the one specified with @setfilename ...
305b9bb67cbSmrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
306b9bb67cbSmrg      file=`sed -n '
307b9bb67cbSmrg	/^@setfilename/{
308b9bb67cbSmrg	  s/.* \([^ ]*\) *$/\1/
309b9bb67cbSmrg	  p
310b9bb67cbSmrg	  q
311b9bb67cbSmrg	}' $infile`
312b9bb67cbSmrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
313b9bb67cbSmrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
3141cc8c64fSmrg    fi
315b9bb67cbSmrg    # If the file does not exist, the user really needs makeinfo;
316b9bb67cbSmrg    # let's fail without touching anything.
317b9bb67cbSmrg    test -f $file || exit 1
3181cc8c64fSmrg    touch $file
3191cc8c64fSmrg    ;;
3201cc8c64fSmrg
321b9bb67cbSmrg  tar*)
3221cc8c64fSmrg    shift
3231cc8c64fSmrg
3241cc8c64fSmrg    # We have already tried tar in the generic part.
3251cc8c64fSmrg    # Look for gnutar/gtar before invocation to avoid ugly error
3261cc8c64fSmrg    # messages.
3271cc8c64fSmrg    if (gnutar --version > /dev/null 2>&1); then
3281cc8c64fSmrg       gnutar "$@" && exit 0
3291cc8c64fSmrg    fi
3301cc8c64fSmrg    if (gtar --version > /dev/null 2>&1); then
3311cc8c64fSmrg       gtar "$@" && exit 0
3321cc8c64fSmrg    fi
3331cc8c64fSmrg    firstarg="$1"
3341cc8c64fSmrg    if shift; then
335b9bb67cbSmrg	case $firstarg in
3361cc8c64fSmrg	*o*)
3371cc8c64fSmrg	    firstarg=`echo "$firstarg" | sed s/o//`
3381cc8c64fSmrg	    tar "$firstarg" "$@" && exit 0
3391cc8c64fSmrg	    ;;
3401cc8c64fSmrg	esac
341b9bb67cbSmrg	case $firstarg in
3421cc8c64fSmrg	*h*)
3431cc8c64fSmrg	    firstarg=`echo "$firstarg" | sed s/h//`
3441cc8c64fSmrg	    tar "$firstarg" "$@" && exit 0
3451cc8c64fSmrg	    ;;
3461cc8c64fSmrg	esac
3471cc8c64fSmrg    fi
3481cc8c64fSmrg
3491cc8c64fSmrg    echo 1>&2 "\
3501cc8c64fSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
3511cc8c64fSmrg         You may want to install GNU tar or Free paxutils, or check the
3521cc8c64fSmrg         command line arguments."
3531cc8c64fSmrg    exit 1
3541cc8c64fSmrg    ;;
3551cc8c64fSmrg
3561cc8c64fSmrg  *)
3571cc8c64fSmrg    echo 1>&2 "\
358b9bb67cbSmrgWARNING: \`$1' is needed, and is $msg.
359b9bb67cbSmrg         You might have modified some files without having the
3601cc8c64fSmrg         proper tools for further handling them.  Check the \`README' file,
3611cc8c64fSmrg         it often tells you about the needed prerequisites for installing
3621cc8c64fSmrg         this package.  You may also peek at any GNU archive site, in case
3631cc8c64fSmrg         some other package would contain this missing \`$1' program."
3641cc8c64fSmrg    exit 1
3651cc8c64fSmrg    ;;
3661cc8c64fSmrgesac
3671cc8c64fSmrg
3681cc8c64fSmrgexit 0
369b9bb67cbSmrg
370b9bb67cbSmrg# Local variables:
371b9bb67cbSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
372b9bb67cbSmrg# time-stamp-start: "scriptversion="
373b9bb67cbSmrg# time-stamp-format: "%:y-%02m-%02d.%02H"
374b9bb67cbSmrg# time-stamp-time-zone: "UTC"
375b9bb67cbSmrg# time-stamp-end: "; # UTC"
376b9bb67cbSmrg# End:
377