missing revision 1cc8c64f
11cc8c64fSmrg#! /bin/sh
21cc8c64fSmrg# Common stub for a few missing GNU programs while installing.
31cc8c64fSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
41cc8c64fSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
51cc8c64fSmrg
61cc8c64fSmrg# This program is free software; you can redistribute it and/or modify
71cc8c64fSmrg# it under the terms of the GNU General Public License as published by
81cc8c64fSmrg# the Free Software Foundation; either version 2, or (at your option)
91cc8c64fSmrg# any later version.
101cc8c64fSmrg
111cc8c64fSmrg# This program is distributed in the hope that it will be useful,
121cc8c64fSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
131cc8c64fSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
141cc8c64fSmrg# GNU General Public License for more details.
151cc8c64fSmrg
161cc8c64fSmrg# You should have received a copy of the GNU General Public License
171cc8c64fSmrg# along with this program; if not, write to the Free Software
181cc8c64fSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
191cc8c64fSmrg# 02111-1307, USA.
201cc8c64fSmrg
211cc8c64fSmrg# As a special exception to the GNU General Public License, if you
221cc8c64fSmrg# distribute this file as part of a program that contains a
231cc8c64fSmrg# configuration script generated by Autoconf, you may include it under
241cc8c64fSmrg# the same distribution terms that you use for the rest of that program.
251cc8c64fSmrg
261cc8c64fSmrgif test $# -eq 0; then
271cc8c64fSmrg  echo 1>&2 "Try \`$0 --help' for more information"
281cc8c64fSmrg  exit 1
291cc8c64fSmrgfi
301cc8c64fSmrg
311cc8c64fSmrgrun=:
321cc8c64fSmrg
331cc8c64fSmrg# In the cases where this matters, `missing' is being run in the
341cc8c64fSmrg# srcdir already.
351cc8c64fSmrgif test -f configure.ac; then
361cc8c64fSmrg  configure_ac=configure.ac
371cc8c64fSmrgelse
381cc8c64fSmrg  configure_ac=configure.in
391cc8c64fSmrgfi
401cc8c64fSmrg
411cc8c64fSmrgcase "$1" in
421cc8c64fSmrg--run)
431cc8c64fSmrg  # Try to run requested program, and just exit if it succeeds.
441cc8c64fSmrg  run=
451cc8c64fSmrg  shift
461cc8c64fSmrg  "$@" && exit 0
471cc8c64fSmrg  ;;
481cc8c64fSmrgesac
491cc8c64fSmrg
501cc8c64fSmrg# If it does not exist, or fails to run (possibly an outdated version),
511cc8c64fSmrg# try to emulate it.
521cc8c64fSmrgcase "$1" in
531cc8c64fSmrg
541cc8c64fSmrg  -h|--h|--he|--hel|--help)
551cc8c64fSmrg    echo "\
561cc8c64fSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
571cc8c64fSmrg
581cc8c64fSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
591cc8c64fSmrgerror status if there is no known handling for PROGRAM.
601cc8c64fSmrg
611cc8c64fSmrgOptions:
621cc8c64fSmrg  -h, --help      display this help and exit
631cc8c64fSmrg  -v, --version   output version information and exit
641cc8c64fSmrg  --run           try to run the given command, and emulate it if it fails
651cc8c64fSmrg
661cc8c64fSmrgSupported PROGRAM values:
671cc8c64fSmrg  aclocal      touch file \`aclocal.m4'
681cc8c64fSmrg  autoconf     touch file \`configure'
691cc8c64fSmrg  autoheader   touch file \`config.h.in'
701cc8c64fSmrg  automake     touch all \`Makefile.in' files
711cc8c64fSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
721cc8c64fSmrg  flex         create \`lex.yy.c', if possible, from existing .c
731cc8c64fSmrg  help2man     touch the output file
741cc8c64fSmrg  lex          create \`lex.yy.c', if possible, from existing .c
751cc8c64fSmrg  makeinfo     touch the output file
761cc8c64fSmrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
771cc8c64fSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
781cc8c64fSmrg    ;;
791cc8c64fSmrg
801cc8c64fSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
811cc8c64fSmrg    echo "missing 0.4 - GNU automake"
821cc8c64fSmrg    ;;
831cc8c64fSmrg
841cc8c64fSmrg  -*)
851cc8c64fSmrg    echo 1>&2 "$0: Unknown \`$1' option"
861cc8c64fSmrg    echo 1>&2 "Try \`$0 --help' for more information"
871cc8c64fSmrg    exit 1
881cc8c64fSmrg    ;;
891cc8c64fSmrg
901cc8c64fSmrg  aclocal*)
911cc8c64fSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
921cc8c64fSmrg       # We have it, but it failed.
931cc8c64fSmrg       exit 1
941cc8c64fSmrg    fi
951cc8c64fSmrg
961cc8c64fSmrg    echo 1>&2 "\
971cc8c64fSmrgWARNING: \`$1' is missing on your system.  You should only need it if
981cc8c64fSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
991cc8c64fSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
1001cc8c64fSmrg         any GNU archive site."
1011cc8c64fSmrg    touch aclocal.m4
1021cc8c64fSmrg    ;;
1031cc8c64fSmrg
1041cc8c64fSmrg  autoconf)
1051cc8c64fSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1061cc8c64fSmrg       # We have it, but it failed.
1071cc8c64fSmrg       exit 1
1081cc8c64fSmrg    fi
1091cc8c64fSmrg
1101cc8c64fSmrg    echo 1>&2 "\
1111cc8c64fSmrgWARNING: \`$1' is missing on your system.  You should only need it if
1121cc8c64fSmrg         you modified \`${configure_ac}'.  You might want to install the
1131cc8c64fSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1141cc8c64fSmrg         archive site."
1151cc8c64fSmrg    touch configure
1161cc8c64fSmrg    ;;
1171cc8c64fSmrg
1181cc8c64fSmrg  autoheader)
1191cc8c64fSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1201cc8c64fSmrg       # We have it, but it failed.
1211cc8c64fSmrg       exit 1
1221cc8c64fSmrg    fi
1231cc8c64fSmrg
1241cc8c64fSmrg    echo 1>&2 "\
1251cc8c64fSmrgWARNING: \`$1' is missing on your system.  You should only need it if
1261cc8c64fSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1271cc8c64fSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1281cc8c64fSmrg         from any GNU archive site."
1291cc8c64fSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1301cc8c64fSmrg    test -z "$files" && files="config.h"
1311cc8c64fSmrg    touch_files=
1321cc8c64fSmrg    for f in $files; do
1331cc8c64fSmrg      case "$f" in
1341cc8c64fSmrg      *:*) touch_files="$touch_files "`echo "$f" |
1351cc8c64fSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1361cc8c64fSmrg      *) touch_files="$touch_files $f.in";;
1371cc8c64fSmrg      esac
1381cc8c64fSmrg    done
1391cc8c64fSmrg    touch $touch_files
1401cc8c64fSmrg    ;;
1411cc8c64fSmrg
1421cc8c64fSmrg  automake*)
1431cc8c64fSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1441cc8c64fSmrg       # We have it, but it failed.
1451cc8c64fSmrg       exit 1
1461cc8c64fSmrg    fi
1471cc8c64fSmrg
1481cc8c64fSmrg    echo 1>&2 "\
1491cc8c64fSmrgWARNING: \`$1' is missing on your system.  You should only need it if
1501cc8c64fSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1511cc8c64fSmrg         You might want to install the \`Automake' and \`Perl' packages.
1521cc8c64fSmrg         Grab them from any GNU archive site."
1531cc8c64fSmrg    find . -type f -name Makefile.am -print |
1541cc8c64fSmrg	   sed 's/\.am$/.in/' |
1551cc8c64fSmrg	   while read f; do touch "$f"; done
1561cc8c64fSmrg    ;;
1571cc8c64fSmrg
1581cc8c64fSmrg  autom4te)
1591cc8c64fSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1601cc8c64fSmrg       # We have it, but it failed.
1611cc8c64fSmrg       exit 1
1621cc8c64fSmrg    fi
1631cc8c64fSmrg
1641cc8c64fSmrg    echo 1>&2 "\
1651cc8c64fSmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
1661cc8c64fSmrg         system.  You might have modified some files without having the
1671cc8c64fSmrg         proper tools for further handling them.
1681cc8c64fSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
1691cc8c64fSmrg         archive site."
1701cc8c64fSmrg
1711cc8c64fSmrg    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
1721cc8c64fSmrg    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
1731cc8c64fSmrg    if test -f "$file"; then
1741cc8c64fSmrg	touch $file
1751cc8c64fSmrg    else
1761cc8c64fSmrg	test -z "$file" || exec >$file
1771cc8c64fSmrg	echo "#! /bin/sh"
1781cc8c64fSmrg	echo "# Created by GNU Automake missing as a replacement of"
1791cc8c64fSmrg	echo "#  $ $@"
1801cc8c64fSmrg	echo "exit 0"
1811cc8c64fSmrg	chmod +x $file
1821cc8c64fSmrg	exit 1
1831cc8c64fSmrg    fi
1841cc8c64fSmrg    ;;
1851cc8c64fSmrg
1861cc8c64fSmrg  bison|yacc)
1871cc8c64fSmrg    echo 1>&2 "\
1881cc8c64fSmrgWARNING: \`$1' is missing on your system.  You should only need it if
1891cc8c64fSmrg         you modified a \`.y' file.  You may need the \`Bison' package
1901cc8c64fSmrg         in order for those modifications to take effect.  You can get
1911cc8c64fSmrg         \`Bison' from any GNU archive site."
1921cc8c64fSmrg    rm -f y.tab.c y.tab.h
1931cc8c64fSmrg    if [ $# -ne 1 ]; then
1941cc8c64fSmrg        eval LASTARG="\${$#}"
1951cc8c64fSmrg	case "$LASTARG" in
1961cc8c64fSmrg	*.y)
1971cc8c64fSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
1981cc8c64fSmrg	    if [ -f "$SRCFILE" ]; then
1991cc8c64fSmrg	         cp "$SRCFILE" y.tab.c
2001cc8c64fSmrg	    fi
2011cc8c64fSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2021cc8c64fSmrg	    if [ -f "$SRCFILE" ]; then
2031cc8c64fSmrg	         cp "$SRCFILE" y.tab.h
2041cc8c64fSmrg	    fi
2051cc8c64fSmrg	  ;;
2061cc8c64fSmrg	esac
2071cc8c64fSmrg    fi
2081cc8c64fSmrg    if [ ! -f y.tab.h ]; then
2091cc8c64fSmrg	echo >y.tab.h
2101cc8c64fSmrg    fi
2111cc8c64fSmrg    if [ ! -f y.tab.c ]; then
2121cc8c64fSmrg	echo 'main() { return 0; }' >y.tab.c
2131cc8c64fSmrg    fi
2141cc8c64fSmrg    ;;
2151cc8c64fSmrg
2161cc8c64fSmrg  lex|flex)
2171cc8c64fSmrg    echo 1>&2 "\
2181cc8c64fSmrgWARNING: \`$1' is missing on your system.  You should only need it if
2191cc8c64fSmrg         you modified a \`.l' file.  You may need the \`Flex' package
2201cc8c64fSmrg         in order for those modifications to take effect.  You can get
2211cc8c64fSmrg         \`Flex' from any GNU archive site."
2221cc8c64fSmrg    rm -f lex.yy.c
2231cc8c64fSmrg    if [ $# -ne 1 ]; then
2241cc8c64fSmrg        eval LASTARG="\${$#}"
2251cc8c64fSmrg	case "$LASTARG" in
2261cc8c64fSmrg	*.l)
2271cc8c64fSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2281cc8c64fSmrg	    if [ -f "$SRCFILE" ]; then
2291cc8c64fSmrg	         cp "$SRCFILE" lex.yy.c
2301cc8c64fSmrg	    fi
2311cc8c64fSmrg	  ;;
2321cc8c64fSmrg	esac
2331cc8c64fSmrg    fi
2341cc8c64fSmrg    if [ ! -f lex.yy.c ]; then
2351cc8c64fSmrg	echo 'main() { return 0; }' >lex.yy.c
2361cc8c64fSmrg    fi
2371cc8c64fSmrg    ;;
2381cc8c64fSmrg
2391cc8c64fSmrg  help2man)
2401cc8c64fSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
2411cc8c64fSmrg       # We have it, but it failed.
2421cc8c64fSmrg       exit 1
2431cc8c64fSmrg    fi
2441cc8c64fSmrg
2451cc8c64fSmrg    echo 1>&2 "\
2461cc8c64fSmrgWARNING: \`$1' is missing on your system.  You should only need it if
2471cc8c64fSmrg	 you modified a dependency of a manual page.  You may need the
2481cc8c64fSmrg	 \`Help2man' package in order for those modifications to take
2491cc8c64fSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
2501cc8c64fSmrg
2511cc8c64fSmrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
2521cc8c64fSmrg    if test -z "$file"; then
2531cc8c64fSmrg	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
2541cc8c64fSmrg    fi
2551cc8c64fSmrg    if [ -f "$file" ]; then
2561cc8c64fSmrg	touch $file
2571cc8c64fSmrg    else
2581cc8c64fSmrg	test -z "$file" || exec >$file
2591cc8c64fSmrg	echo ".ab help2man is required to generate this page"
2601cc8c64fSmrg	exit 1
2611cc8c64fSmrg    fi
2621cc8c64fSmrg    ;;
2631cc8c64fSmrg
2641cc8c64fSmrg  makeinfo)
2651cc8c64fSmrg    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
2661cc8c64fSmrg       # We have makeinfo, but it failed.
2671cc8c64fSmrg       exit 1
2681cc8c64fSmrg    fi
2691cc8c64fSmrg
2701cc8c64fSmrg    echo 1>&2 "\
2711cc8c64fSmrgWARNING: \`$1' is missing on your system.  You should only need it if
2721cc8c64fSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
2731cc8c64fSmrg         indirectly affecting the aspect of the manual.  The spurious
2741cc8c64fSmrg         call might also be the consequence of using a buggy \`make' (AIX,
2751cc8c64fSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
2761cc8c64fSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
2771cc8c64fSmrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
2781cc8c64fSmrg    if test -z "$file"; then
2791cc8c64fSmrg      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
2801cc8c64fSmrg      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
2811cc8c64fSmrg    fi
2821cc8c64fSmrg    touch $file
2831cc8c64fSmrg    ;;
2841cc8c64fSmrg
2851cc8c64fSmrg  tar)
2861cc8c64fSmrg    shift
2871cc8c64fSmrg    if test -n "$run"; then
2881cc8c64fSmrg      echo 1>&2 "ERROR: \`tar' requires --run"
2891cc8c64fSmrg      exit 1
2901cc8c64fSmrg    fi
2911cc8c64fSmrg
2921cc8c64fSmrg    # We have already tried tar in the generic part.
2931cc8c64fSmrg    # Look for gnutar/gtar before invocation to avoid ugly error
2941cc8c64fSmrg    # messages.
2951cc8c64fSmrg    if (gnutar --version > /dev/null 2>&1); then
2961cc8c64fSmrg       gnutar "$@" && exit 0
2971cc8c64fSmrg    fi
2981cc8c64fSmrg    if (gtar --version > /dev/null 2>&1); then
2991cc8c64fSmrg       gtar "$@" && exit 0
3001cc8c64fSmrg    fi
3011cc8c64fSmrg    firstarg="$1"
3021cc8c64fSmrg    if shift; then
3031cc8c64fSmrg	case "$firstarg" in
3041cc8c64fSmrg	*o*)
3051cc8c64fSmrg	    firstarg=`echo "$firstarg" | sed s/o//`
3061cc8c64fSmrg	    tar "$firstarg" "$@" && exit 0
3071cc8c64fSmrg	    ;;
3081cc8c64fSmrg	esac
3091cc8c64fSmrg	case "$firstarg" in
3101cc8c64fSmrg	*h*)
3111cc8c64fSmrg	    firstarg=`echo "$firstarg" | sed s/h//`
3121cc8c64fSmrg	    tar "$firstarg" "$@" && exit 0
3131cc8c64fSmrg	    ;;
3141cc8c64fSmrg	esac
3151cc8c64fSmrg    fi
3161cc8c64fSmrg
3171cc8c64fSmrg    echo 1>&2 "\
3181cc8c64fSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
3191cc8c64fSmrg         You may want to install GNU tar or Free paxutils, or check the
3201cc8c64fSmrg         command line arguments."
3211cc8c64fSmrg    exit 1
3221cc8c64fSmrg    ;;
3231cc8c64fSmrg
3241cc8c64fSmrg  *)
3251cc8c64fSmrg    echo 1>&2 "\
3261cc8c64fSmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
3271cc8c64fSmrg         system.  You might have modified some files without having the
3281cc8c64fSmrg         proper tools for further handling them.  Check the \`README' file,
3291cc8c64fSmrg         it often tells you about the needed prerequisites for installing
3301cc8c64fSmrg         this package.  You may also peek at any GNU archive site, in case
3311cc8c64fSmrg         some other package would contain this missing \`$1' program."
3321cc8c64fSmrg    exit 1
3331cc8c64fSmrg    ;;
3341cc8c64fSmrgesac
3351cc8c64fSmrg
3361cc8c64fSmrgexit 0
337