missing revision 0cc6efb6
10cc6efb6Smrg#! /bin/sh
20cc6efb6Smrg# Common stub for a few missing GNU programs while installing.
30cc6efb6Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
40cc6efb6Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
50cc6efb6Smrg
60cc6efb6Smrg# This program is free software; you can redistribute it and/or modify
70cc6efb6Smrg# it under the terms of the GNU General Public License as published by
80cc6efb6Smrg# the Free Software Foundation; either version 2, or (at your option)
90cc6efb6Smrg# any later version.
100cc6efb6Smrg
110cc6efb6Smrg# This program is distributed in the hope that it will be useful,
120cc6efb6Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
130cc6efb6Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
140cc6efb6Smrg# GNU General Public License for more details.
150cc6efb6Smrg
160cc6efb6Smrg# You should have received a copy of the GNU General Public License
170cc6efb6Smrg# along with this program; if not, write to the Free Software
180cc6efb6Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
190cc6efb6Smrg# 02111-1307, USA.
200cc6efb6Smrg
210cc6efb6Smrg# As a special exception to the GNU General Public License, if you
220cc6efb6Smrg# distribute this file as part of a program that contains a
230cc6efb6Smrg# configuration script generated by Autoconf, you may include it under
240cc6efb6Smrg# the same distribution terms that you use for the rest of that program.
250cc6efb6Smrg
260cc6efb6Smrgif test $# -eq 0; then
270cc6efb6Smrg  echo 1>&2 "Try \`$0 --help' for more information"
280cc6efb6Smrg  exit 1
290cc6efb6Smrgfi
300cc6efb6Smrg
310cc6efb6Smrgrun=:
320cc6efb6Smrg
330cc6efb6Smrg# In the cases where this matters, `missing' is being run in the
340cc6efb6Smrg# srcdir already.
350cc6efb6Smrgif test -f configure.ac; then
360cc6efb6Smrg  configure_ac=configure.ac
370cc6efb6Smrgelse
380cc6efb6Smrg  configure_ac=configure.in
390cc6efb6Smrgfi
400cc6efb6Smrg
410cc6efb6Smrgcase "$1" in
420cc6efb6Smrg--run)
430cc6efb6Smrg  # Try to run requested program, and just exit if it succeeds.
440cc6efb6Smrg  run=
450cc6efb6Smrg  shift
460cc6efb6Smrg  "$@" && exit 0
470cc6efb6Smrg  ;;
480cc6efb6Smrgesac
490cc6efb6Smrg
500cc6efb6Smrg# If it does not exist, or fails to run (possibly an outdated version),
510cc6efb6Smrg# try to emulate it.
520cc6efb6Smrgcase "$1" in
530cc6efb6Smrg
540cc6efb6Smrg  -h|--h|--he|--hel|--help)
550cc6efb6Smrg    echo "\
560cc6efb6Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
570cc6efb6Smrg
580cc6efb6SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
590cc6efb6Smrgerror status if there is no known handling for PROGRAM.
600cc6efb6Smrg
610cc6efb6SmrgOptions:
620cc6efb6Smrg  -h, --help      display this help and exit
630cc6efb6Smrg  -v, --version   output version information and exit
640cc6efb6Smrg  --run           try to run the given command, and emulate it if it fails
650cc6efb6Smrg
660cc6efb6SmrgSupported PROGRAM values:
670cc6efb6Smrg  aclocal      touch file \`aclocal.m4'
680cc6efb6Smrg  autoconf     touch file \`configure'
690cc6efb6Smrg  autoheader   touch file \`config.h.in'
700cc6efb6Smrg  automake     touch all \`Makefile.in' files
710cc6efb6Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
720cc6efb6Smrg  flex         create \`lex.yy.c', if possible, from existing .c
730cc6efb6Smrg  help2man     touch the output file
740cc6efb6Smrg  lex          create \`lex.yy.c', if possible, from existing .c
750cc6efb6Smrg  makeinfo     touch the output file
760cc6efb6Smrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
770cc6efb6Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
780cc6efb6Smrg    ;;
790cc6efb6Smrg
800cc6efb6Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
810cc6efb6Smrg    echo "missing 0.4 - GNU automake"
820cc6efb6Smrg    ;;
830cc6efb6Smrg
840cc6efb6Smrg  -*)
850cc6efb6Smrg    echo 1>&2 "$0: Unknown \`$1' option"
860cc6efb6Smrg    echo 1>&2 "Try \`$0 --help' for more information"
870cc6efb6Smrg    exit 1
880cc6efb6Smrg    ;;
890cc6efb6Smrg
900cc6efb6Smrg  aclocal*)
910cc6efb6Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
920cc6efb6Smrg       # We have it, but it failed.
930cc6efb6Smrg       exit 1
940cc6efb6Smrg    fi
950cc6efb6Smrg
960cc6efb6Smrg    echo 1>&2 "\
970cc6efb6SmrgWARNING: \`$1' is missing on your system.  You should only need it if
980cc6efb6Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
990cc6efb6Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
1000cc6efb6Smrg         any GNU archive site."
1010cc6efb6Smrg    touch aclocal.m4
1020cc6efb6Smrg    ;;
1030cc6efb6Smrg
1040cc6efb6Smrg  autoconf)
1050cc6efb6Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1060cc6efb6Smrg       # We have it, but it failed.
1070cc6efb6Smrg       exit 1
1080cc6efb6Smrg    fi
1090cc6efb6Smrg
1100cc6efb6Smrg    echo 1>&2 "\
1110cc6efb6SmrgWARNING: \`$1' is missing on your system.  You should only need it if
1120cc6efb6Smrg         you modified \`${configure_ac}'.  You might want to install the
1130cc6efb6Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1140cc6efb6Smrg         archive site."
1150cc6efb6Smrg    touch configure
1160cc6efb6Smrg    ;;
1170cc6efb6Smrg
1180cc6efb6Smrg  autoheader)
1190cc6efb6Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1200cc6efb6Smrg       # We have it, but it failed.
1210cc6efb6Smrg       exit 1
1220cc6efb6Smrg    fi
1230cc6efb6Smrg
1240cc6efb6Smrg    echo 1>&2 "\
1250cc6efb6SmrgWARNING: \`$1' is missing on your system.  You should only need it if
1260cc6efb6Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1270cc6efb6Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1280cc6efb6Smrg         from any GNU archive site."
1290cc6efb6Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1300cc6efb6Smrg    test -z "$files" && files="config.h"
1310cc6efb6Smrg    touch_files=
1320cc6efb6Smrg    for f in $files; do
1330cc6efb6Smrg      case "$f" in
1340cc6efb6Smrg      *:*) touch_files="$touch_files "`echo "$f" |
1350cc6efb6Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1360cc6efb6Smrg      *) touch_files="$touch_files $f.in";;
1370cc6efb6Smrg      esac
1380cc6efb6Smrg    done
1390cc6efb6Smrg    touch $touch_files
1400cc6efb6Smrg    ;;
1410cc6efb6Smrg
1420cc6efb6Smrg  automake*)
1430cc6efb6Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1440cc6efb6Smrg       # We have it, but it failed.
1450cc6efb6Smrg       exit 1
1460cc6efb6Smrg    fi
1470cc6efb6Smrg
1480cc6efb6Smrg    echo 1>&2 "\
1490cc6efb6SmrgWARNING: \`$1' is missing on your system.  You should only need it if
1500cc6efb6Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1510cc6efb6Smrg         You might want to install the \`Automake' and \`Perl' packages.
1520cc6efb6Smrg         Grab them from any GNU archive site."
1530cc6efb6Smrg    find . -type f -name Makefile.am -print |
1540cc6efb6Smrg	   sed 's/\.am$/.in/' |
1550cc6efb6Smrg	   while read f; do touch "$f"; done
1560cc6efb6Smrg    ;;
1570cc6efb6Smrg
1580cc6efb6Smrg  autom4te)
1590cc6efb6Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1600cc6efb6Smrg       # We have it, but it failed.
1610cc6efb6Smrg       exit 1
1620cc6efb6Smrg    fi
1630cc6efb6Smrg
1640cc6efb6Smrg    echo 1>&2 "\
1650cc6efb6SmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
1660cc6efb6Smrg         system.  You might have modified some files without having the
1670cc6efb6Smrg         proper tools for further handling them.
1680cc6efb6Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
1690cc6efb6Smrg         archive site."
1700cc6efb6Smrg
1710cc6efb6Smrg    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
1720cc6efb6Smrg    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
1730cc6efb6Smrg    if test -f "$file"; then
1740cc6efb6Smrg	touch $file
1750cc6efb6Smrg    else
1760cc6efb6Smrg	test -z "$file" || exec >$file
1770cc6efb6Smrg	echo "#! /bin/sh"
1780cc6efb6Smrg	echo "# Created by GNU Automake missing as a replacement of"
1790cc6efb6Smrg	echo "#  $ $@"
1800cc6efb6Smrg	echo "exit 0"
1810cc6efb6Smrg	chmod +x $file
1820cc6efb6Smrg	exit 1
1830cc6efb6Smrg    fi
1840cc6efb6Smrg    ;;
1850cc6efb6Smrg
1860cc6efb6Smrg  bison|yacc)
1870cc6efb6Smrg    echo 1>&2 "\
1880cc6efb6SmrgWARNING: \`$1' is missing on your system.  You should only need it if
1890cc6efb6Smrg         you modified a \`.y' file.  You may need the \`Bison' package
1900cc6efb6Smrg         in order for those modifications to take effect.  You can get
1910cc6efb6Smrg         \`Bison' from any GNU archive site."
1920cc6efb6Smrg    rm -f y.tab.c y.tab.h
1930cc6efb6Smrg    if [ $# -ne 1 ]; then
1940cc6efb6Smrg        eval LASTARG="\${$#}"
1950cc6efb6Smrg	case "$LASTARG" in
1960cc6efb6Smrg	*.y)
1970cc6efb6Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
1980cc6efb6Smrg	    if [ -f "$SRCFILE" ]; then
1990cc6efb6Smrg	         cp "$SRCFILE" y.tab.c
2000cc6efb6Smrg	    fi
2010cc6efb6Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2020cc6efb6Smrg	    if [ -f "$SRCFILE" ]; then
2030cc6efb6Smrg	         cp "$SRCFILE" y.tab.h
2040cc6efb6Smrg	    fi
2050cc6efb6Smrg	  ;;
2060cc6efb6Smrg	esac
2070cc6efb6Smrg    fi
2080cc6efb6Smrg    if [ ! -f y.tab.h ]; then
2090cc6efb6Smrg	echo >y.tab.h
2100cc6efb6Smrg    fi
2110cc6efb6Smrg    if [ ! -f y.tab.c ]; then
2120cc6efb6Smrg	echo 'main() { return 0; }' >y.tab.c
2130cc6efb6Smrg    fi
2140cc6efb6Smrg    ;;
2150cc6efb6Smrg
2160cc6efb6Smrg  lex|flex)
2170cc6efb6Smrg    echo 1>&2 "\
2180cc6efb6SmrgWARNING: \`$1' is missing on your system.  You should only need it if
2190cc6efb6Smrg         you modified a \`.l' file.  You may need the \`Flex' package
2200cc6efb6Smrg         in order for those modifications to take effect.  You can get
2210cc6efb6Smrg         \`Flex' from any GNU archive site."
2220cc6efb6Smrg    rm -f lex.yy.c
2230cc6efb6Smrg    if [ $# -ne 1 ]; then
2240cc6efb6Smrg        eval LASTARG="\${$#}"
2250cc6efb6Smrg	case "$LASTARG" in
2260cc6efb6Smrg	*.l)
2270cc6efb6Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2280cc6efb6Smrg	    if [ -f "$SRCFILE" ]; then
2290cc6efb6Smrg	         cp "$SRCFILE" lex.yy.c
2300cc6efb6Smrg	    fi
2310cc6efb6Smrg	  ;;
2320cc6efb6Smrg	esac
2330cc6efb6Smrg    fi
2340cc6efb6Smrg    if [ ! -f lex.yy.c ]; then
2350cc6efb6Smrg	echo 'main() { return 0; }' >lex.yy.c
2360cc6efb6Smrg    fi
2370cc6efb6Smrg    ;;
2380cc6efb6Smrg
2390cc6efb6Smrg  help2man)
2400cc6efb6Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
2410cc6efb6Smrg       # We have it, but it failed.
2420cc6efb6Smrg       exit 1
2430cc6efb6Smrg    fi
2440cc6efb6Smrg
2450cc6efb6Smrg    echo 1>&2 "\
2460cc6efb6SmrgWARNING: \`$1' is missing on your system.  You should only need it if
2470cc6efb6Smrg	 you modified a dependency of a manual page.  You may need the
2480cc6efb6Smrg	 \`Help2man' package in order for those modifications to take
2490cc6efb6Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
2500cc6efb6Smrg
2510cc6efb6Smrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
2520cc6efb6Smrg    if test -z "$file"; then
2530cc6efb6Smrg	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
2540cc6efb6Smrg    fi
2550cc6efb6Smrg    if [ -f "$file" ]; then
2560cc6efb6Smrg	touch $file
2570cc6efb6Smrg    else
2580cc6efb6Smrg	test -z "$file" || exec >$file
2590cc6efb6Smrg	echo ".ab help2man is required to generate this page"
2600cc6efb6Smrg	exit 1
2610cc6efb6Smrg    fi
2620cc6efb6Smrg    ;;
2630cc6efb6Smrg
2640cc6efb6Smrg  makeinfo)
2650cc6efb6Smrg    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
2660cc6efb6Smrg       # We have makeinfo, but it failed.
2670cc6efb6Smrg       exit 1
2680cc6efb6Smrg    fi
2690cc6efb6Smrg
2700cc6efb6Smrg    echo 1>&2 "\
2710cc6efb6SmrgWARNING: \`$1' is missing on your system.  You should only need it if
2720cc6efb6Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
2730cc6efb6Smrg         indirectly affecting the aspect of the manual.  The spurious
2740cc6efb6Smrg         call might also be the consequence of using a buggy \`make' (AIX,
2750cc6efb6Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
2760cc6efb6Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
2770cc6efb6Smrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
2780cc6efb6Smrg    if test -z "$file"; then
2790cc6efb6Smrg      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
2800cc6efb6Smrg      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
2810cc6efb6Smrg    fi
2820cc6efb6Smrg    touch $file
2830cc6efb6Smrg    ;;
2840cc6efb6Smrg
2850cc6efb6Smrg  tar)
2860cc6efb6Smrg    shift
2870cc6efb6Smrg    if test -n "$run"; then
2880cc6efb6Smrg      echo 1>&2 "ERROR: \`tar' requires --run"
2890cc6efb6Smrg      exit 1
2900cc6efb6Smrg    fi
2910cc6efb6Smrg
2920cc6efb6Smrg    # We have already tried tar in the generic part.
2930cc6efb6Smrg    # Look for gnutar/gtar before invocation to avoid ugly error
2940cc6efb6Smrg    # messages.
2950cc6efb6Smrg    if (gnutar --version > /dev/null 2>&1); then
2960cc6efb6Smrg       gnutar "$@" && exit 0
2970cc6efb6Smrg    fi
2980cc6efb6Smrg    if (gtar --version > /dev/null 2>&1); then
2990cc6efb6Smrg       gtar "$@" && exit 0
3000cc6efb6Smrg    fi
3010cc6efb6Smrg    firstarg="$1"
3020cc6efb6Smrg    if shift; then
3030cc6efb6Smrg	case "$firstarg" in
3040cc6efb6Smrg	*o*)
3050cc6efb6Smrg	    firstarg=`echo "$firstarg" | sed s/o//`
3060cc6efb6Smrg	    tar "$firstarg" "$@" && exit 0
3070cc6efb6Smrg	    ;;
3080cc6efb6Smrg	esac
3090cc6efb6Smrg	case "$firstarg" in
3100cc6efb6Smrg	*h*)
3110cc6efb6Smrg	    firstarg=`echo "$firstarg" | sed s/h//`
3120cc6efb6Smrg	    tar "$firstarg" "$@" && exit 0
3130cc6efb6Smrg	    ;;
3140cc6efb6Smrg	esac
3150cc6efb6Smrg    fi
3160cc6efb6Smrg
3170cc6efb6Smrg    echo 1>&2 "\
3180cc6efb6SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
3190cc6efb6Smrg         You may want to install GNU tar or Free paxutils, or check the
3200cc6efb6Smrg         command line arguments."
3210cc6efb6Smrg    exit 1
3220cc6efb6Smrg    ;;
3230cc6efb6Smrg
3240cc6efb6Smrg  *)
3250cc6efb6Smrg    echo 1>&2 "\
3260cc6efb6SmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
3270cc6efb6Smrg         system.  You might have modified some files without having the
3280cc6efb6Smrg         proper tools for further handling them.  Check the \`README' file,
3290cc6efb6Smrg         it often tells you about the needed prerequisites for installing
3300cc6efb6Smrg         this package.  You may also peek at any GNU archive site, in case
3310cc6efb6Smrg         some other package would contain this missing \`$1' program."
3320cc6efb6Smrg    exit 1
3330cc6efb6Smrg    ;;
3340cc6efb6Smrgesac
3350cc6efb6Smrg
3360cc6efb6Smrgexit 0
337