missing revision 7888fd0e
10fa2845dSmrg#! /bin/sh
20fa2845dSmrg# Common stub for a few missing GNU programs while installing.
30fa2845dSmrg
47888fd0eSmrgscriptversion=2009-04-28.21; # UTC
50fa2845dSmrg
67888fd0eSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
77888fd0eSmrg# 2008, 2009 Free Software Foundation, Inc.
80fa2845dSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
90fa2845dSmrg
100fa2845dSmrg# This program is free software; you can redistribute it and/or modify
110fa2845dSmrg# it under the terms of the GNU General Public License as published by
120fa2845dSmrg# the Free Software Foundation; either version 2, or (at your option)
130fa2845dSmrg# any later version.
140fa2845dSmrg
150fa2845dSmrg# This program is distributed in the hope that it will be useful,
160fa2845dSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
170fa2845dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
180fa2845dSmrg# GNU General Public License for more details.
190fa2845dSmrg
200fa2845dSmrg# You should have received a copy of the GNU General Public License
217888fd0eSmrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
220fa2845dSmrg
230fa2845dSmrg# As a special exception to the GNU General Public License, if you
240fa2845dSmrg# distribute this file as part of a program that contains a
250fa2845dSmrg# configuration script generated by Autoconf, you may include it under
260fa2845dSmrg# the same distribution terms that you use for the rest of that program.
270fa2845dSmrg
280fa2845dSmrgif test $# -eq 0; then
290fa2845dSmrg  echo 1>&2 "Try \`$0 --help' for more information"
300fa2845dSmrg  exit 1
310fa2845dSmrgfi
320fa2845dSmrg
330fa2845dSmrgrun=:
340fa2845dSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
350fa2845dSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
360fa2845dSmrg
370fa2845dSmrg# In the cases where this matters, `missing' is being run in the
380fa2845dSmrg# srcdir already.
390fa2845dSmrgif test -f configure.ac; then
400fa2845dSmrg  configure_ac=configure.ac
410fa2845dSmrgelse
420fa2845dSmrg  configure_ac=configure.in
430fa2845dSmrgfi
440fa2845dSmrg
450fa2845dSmrgmsg="missing on your system"
460fa2845dSmrg
470fa2845dSmrgcase $1 in
480fa2845dSmrg--run)
490fa2845dSmrg  # Try to run requested program, and just exit if it succeeds.
500fa2845dSmrg  run=
510fa2845dSmrg  shift
520fa2845dSmrg  "$@" && exit 0
530fa2845dSmrg  # Exit code 63 means version mismatch.  This often happens
540fa2845dSmrg  # when the user try to use an ancient version of a tool on
550fa2845dSmrg  # a file that requires a minimum version.  In this case we
560fa2845dSmrg  # we should proceed has if the program had been absent, or
570fa2845dSmrg  # if --run hadn't been passed.
580fa2845dSmrg  if test $? = 63; then
590fa2845dSmrg    run=:
600fa2845dSmrg    msg="probably too old"
610fa2845dSmrg  fi
620fa2845dSmrg  ;;
630fa2845dSmrg
640fa2845dSmrg  -h|--h|--he|--hel|--help)
650fa2845dSmrg    echo "\
660fa2845dSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
670fa2845dSmrg
680fa2845dSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
690fa2845dSmrgerror status if there is no known handling for PROGRAM.
700fa2845dSmrg
710fa2845dSmrgOptions:
720fa2845dSmrg  -h, --help      display this help and exit
730fa2845dSmrg  -v, --version   output version information and exit
740fa2845dSmrg  --run           try to run the given command, and emulate it if it fails
750fa2845dSmrg
760fa2845dSmrgSupported PROGRAM values:
770fa2845dSmrg  aclocal      touch file \`aclocal.m4'
780fa2845dSmrg  autoconf     touch file \`configure'
790fa2845dSmrg  autoheader   touch file \`config.h.in'
800fa2845dSmrg  autom4te     touch the output file, or create a stub one
810fa2845dSmrg  automake     touch all \`Makefile.in' files
820fa2845dSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
830fa2845dSmrg  flex         create \`lex.yy.c', if possible, from existing .c
840fa2845dSmrg  help2man     touch the output file
850fa2845dSmrg  lex          create \`lex.yy.c', if possible, from existing .c
860fa2845dSmrg  makeinfo     touch the output file
870fa2845dSmrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
880fa2845dSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
890fa2845dSmrg
907888fd0eSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
917888fd0eSmrg\`g' are ignored when checking the name.
927888fd0eSmrg
930fa2845dSmrgSend bug reports to <bug-automake@gnu.org>."
940fa2845dSmrg    exit $?
950fa2845dSmrg    ;;
960fa2845dSmrg
970fa2845dSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
980fa2845dSmrg    echo "missing $scriptversion (GNU Automake)"
990fa2845dSmrg    exit $?
1000fa2845dSmrg    ;;
1010fa2845dSmrg
1020fa2845dSmrg  -*)
1030fa2845dSmrg    echo 1>&2 "$0: Unknown \`$1' option"
1040fa2845dSmrg    echo 1>&2 "Try \`$0 --help' for more information"
1050fa2845dSmrg    exit 1
1060fa2845dSmrg    ;;
1070fa2845dSmrg
1080fa2845dSmrgesac
1090fa2845dSmrg
1107888fd0eSmrg# normalize program name to check for.
1117888fd0eSmrgprogram=`echo "$1" | sed '
1127888fd0eSmrg  s/^gnu-//; t
1137888fd0eSmrg  s/^gnu//; t
1147888fd0eSmrg  s/^g//; t'`
1157888fd0eSmrg
1160fa2845dSmrg# Now exit if we have it, but it failed.  Also exit now if we
1170fa2845dSmrg# don't have it and --version was passed (most likely to detect
1187888fd0eSmrg# the program).  This is about non-GNU programs, so use $1 not
1197888fd0eSmrg# $program.
1200fa2845dSmrgcase $1 in
1217888fd0eSmrg  lex*|yacc*)
1220fa2845dSmrg    # Not GNU programs, they don't have --version.
1230fa2845dSmrg    ;;
1240fa2845dSmrg
1257888fd0eSmrg  tar*)
1260fa2845dSmrg    if test -n "$run"; then
1270fa2845dSmrg       echo 1>&2 "ERROR: \`tar' requires --run"
1280fa2845dSmrg       exit 1
1290fa2845dSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1300fa2845dSmrg       exit 1
1310fa2845dSmrg    fi
1320fa2845dSmrg    ;;
1330fa2845dSmrg
1340fa2845dSmrg  *)
1350fa2845dSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1360fa2845dSmrg       # We have it, but it failed.
1370fa2845dSmrg       exit 1
1380fa2845dSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1390fa2845dSmrg       # Could not run --version or --help.  This is probably someone
1400fa2845dSmrg       # running `$TOOL --version' or `$TOOL --help' to check whether
1410fa2845dSmrg       # $TOOL exists and not knowing $TOOL uses missing.
1420fa2845dSmrg       exit 1
1430fa2845dSmrg    fi
1440fa2845dSmrg    ;;
1450fa2845dSmrgesac
1460fa2845dSmrg
1470fa2845dSmrg# If it does not exist, or fails to run (possibly an outdated version),
1480fa2845dSmrg# try to emulate it.
1497888fd0eSmrgcase $program in
1500fa2845dSmrg  aclocal*)
1510fa2845dSmrg    echo 1>&2 "\
1520fa2845dSmrgWARNING: \`$1' is $msg.  You should only need it if
1530fa2845dSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
1540fa2845dSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
1550fa2845dSmrg         any GNU archive site."
1560fa2845dSmrg    touch aclocal.m4
1570fa2845dSmrg    ;;
1580fa2845dSmrg
1597888fd0eSmrg  autoconf*)
1600fa2845dSmrg    echo 1>&2 "\
1610fa2845dSmrgWARNING: \`$1' is $msg.  You should only need it if
1620fa2845dSmrg         you modified \`${configure_ac}'.  You might want to install the
1630fa2845dSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1640fa2845dSmrg         archive site."
1650fa2845dSmrg    touch configure
1660fa2845dSmrg    ;;
1670fa2845dSmrg
1687888fd0eSmrg  autoheader*)
1690fa2845dSmrg    echo 1>&2 "\
1700fa2845dSmrgWARNING: \`$1' is $msg.  You should only need it if
1710fa2845dSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1720fa2845dSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1730fa2845dSmrg         from any GNU archive site."
1740fa2845dSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1750fa2845dSmrg    test -z "$files" && files="config.h"
1760fa2845dSmrg    touch_files=
1770fa2845dSmrg    for f in $files; do
1780fa2845dSmrg      case $f in
1790fa2845dSmrg      *:*) touch_files="$touch_files "`echo "$f" |
1800fa2845dSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1810fa2845dSmrg      *) touch_files="$touch_files $f.in";;
1820fa2845dSmrg      esac
1830fa2845dSmrg    done
1840fa2845dSmrg    touch $touch_files
1850fa2845dSmrg    ;;
1860fa2845dSmrg
1870fa2845dSmrg  automake*)
1880fa2845dSmrg    echo 1>&2 "\
1890fa2845dSmrgWARNING: \`$1' is $msg.  You should only need it if
1900fa2845dSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1910fa2845dSmrg         You might want to install the \`Automake' and \`Perl' packages.
1920fa2845dSmrg         Grab them from any GNU archive site."
1930fa2845dSmrg    find . -type f -name Makefile.am -print |
1940fa2845dSmrg	   sed 's/\.am$/.in/' |
1950fa2845dSmrg	   while read f; do touch "$f"; done
1960fa2845dSmrg    ;;
1970fa2845dSmrg
1987888fd0eSmrg  autom4te*)
1990fa2845dSmrg    echo 1>&2 "\
2000fa2845dSmrgWARNING: \`$1' is needed, but is $msg.
2010fa2845dSmrg         You might have modified some files without having the
2020fa2845dSmrg         proper tools for further handling them.
2030fa2845dSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
2040fa2845dSmrg         archive site."
2050fa2845dSmrg
2060fa2845dSmrg    file=`echo "$*" | sed -n "$sed_output"`
2070fa2845dSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2080fa2845dSmrg    if test -f "$file"; then
2090fa2845dSmrg	touch $file
2100fa2845dSmrg    else
2110fa2845dSmrg	test -z "$file" || exec >$file
2120fa2845dSmrg	echo "#! /bin/sh"
2130fa2845dSmrg	echo "# Created by GNU Automake missing as a replacement of"
2140fa2845dSmrg	echo "#  $ $@"
2150fa2845dSmrg	echo "exit 0"
2160fa2845dSmrg	chmod +x $file
2170fa2845dSmrg	exit 1
2180fa2845dSmrg    fi
2190fa2845dSmrg    ;;
2200fa2845dSmrg
2217888fd0eSmrg  bison*|yacc*)
2220fa2845dSmrg    echo 1>&2 "\
2230fa2845dSmrgWARNING: \`$1' $msg.  You should only need it if
2240fa2845dSmrg         you modified a \`.y' file.  You may need the \`Bison' package
2250fa2845dSmrg         in order for those modifications to take effect.  You can get
2260fa2845dSmrg         \`Bison' from any GNU archive site."
2270fa2845dSmrg    rm -f y.tab.c y.tab.h
2280fa2845dSmrg    if test $# -ne 1; then
2290fa2845dSmrg        eval LASTARG="\${$#}"
2300fa2845dSmrg	case $LASTARG in
2310fa2845dSmrg	*.y)
2320fa2845dSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
2330fa2845dSmrg	    if test -f "$SRCFILE"; then
2340fa2845dSmrg	         cp "$SRCFILE" y.tab.c
2350fa2845dSmrg	    fi
2360fa2845dSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2370fa2845dSmrg	    if test -f "$SRCFILE"; then
2380fa2845dSmrg	         cp "$SRCFILE" y.tab.h
2390fa2845dSmrg	    fi
2400fa2845dSmrg	  ;;
2410fa2845dSmrg	esac
2420fa2845dSmrg    fi
2430fa2845dSmrg    if test ! -f y.tab.h; then
2440fa2845dSmrg	echo >y.tab.h
2450fa2845dSmrg    fi
2460fa2845dSmrg    if test ! -f y.tab.c; then
2470fa2845dSmrg	echo 'main() { return 0; }' >y.tab.c
2480fa2845dSmrg    fi
2490fa2845dSmrg    ;;
2500fa2845dSmrg
2517888fd0eSmrg  lex*|flex*)
2520fa2845dSmrg    echo 1>&2 "\
2530fa2845dSmrgWARNING: \`$1' is $msg.  You should only need it if
2540fa2845dSmrg         you modified a \`.l' file.  You may need the \`Flex' package
2550fa2845dSmrg         in order for those modifications to take effect.  You can get
2560fa2845dSmrg         \`Flex' from any GNU archive site."
2570fa2845dSmrg    rm -f lex.yy.c
2580fa2845dSmrg    if test $# -ne 1; then
2590fa2845dSmrg        eval LASTARG="\${$#}"
2600fa2845dSmrg	case $LASTARG in
2610fa2845dSmrg	*.l)
2620fa2845dSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2630fa2845dSmrg	    if test -f "$SRCFILE"; then
2640fa2845dSmrg	         cp "$SRCFILE" lex.yy.c
2650fa2845dSmrg	    fi
2660fa2845dSmrg	  ;;
2670fa2845dSmrg	esac
2680fa2845dSmrg    fi
2690fa2845dSmrg    if test ! -f lex.yy.c; then
2700fa2845dSmrg	echo 'main() { return 0; }' >lex.yy.c
2710fa2845dSmrg    fi
2720fa2845dSmrg    ;;
2730fa2845dSmrg
2747888fd0eSmrg  help2man*)
2750fa2845dSmrg    echo 1>&2 "\
2760fa2845dSmrgWARNING: \`$1' is $msg.  You should only need it if
2770fa2845dSmrg	 you modified a dependency of a manual page.  You may need the
2780fa2845dSmrg	 \`Help2man' package in order for those modifications to take
2790fa2845dSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
2800fa2845dSmrg
2810fa2845dSmrg    file=`echo "$*" | sed -n "$sed_output"`
2820fa2845dSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2830fa2845dSmrg    if test -f "$file"; then
2840fa2845dSmrg	touch $file
2850fa2845dSmrg    else
2860fa2845dSmrg	test -z "$file" || exec >$file
2870fa2845dSmrg	echo ".ab help2man is required to generate this page"
2887888fd0eSmrg	exit $?
2890fa2845dSmrg    fi
2900fa2845dSmrg    ;;
2910fa2845dSmrg
2927888fd0eSmrg  makeinfo*)
2930fa2845dSmrg    echo 1>&2 "\
2940fa2845dSmrgWARNING: \`$1' is $msg.  You should only need it if
2950fa2845dSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
2960fa2845dSmrg         indirectly affecting the aspect of the manual.  The spurious
2970fa2845dSmrg         call might also be the consequence of using a buggy \`make' (AIX,
2980fa2845dSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
2990fa2845dSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
3000fa2845dSmrg    # The file to touch is that specified with -o ...
3010fa2845dSmrg    file=`echo "$*" | sed -n "$sed_output"`
3020fa2845dSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
3030fa2845dSmrg    if test -z "$file"; then
3040fa2845dSmrg      # ... or it is the one specified with @setfilename ...
3050fa2845dSmrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
3060fa2845dSmrg      file=`sed -n '
3070fa2845dSmrg	/^@setfilename/{
3080fa2845dSmrg	  s/.* \([^ ]*\) *$/\1/
3090fa2845dSmrg	  p
3100fa2845dSmrg	  q
3110fa2845dSmrg	}' $infile`
3120fa2845dSmrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
3130fa2845dSmrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
3140fa2845dSmrg    fi
3150fa2845dSmrg    # If the file does not exist, the user really needs makeinfo;
3160fa2845dSmrg    # let's fail without touching anything.
3170fa2845dSmrg    test -f $file || exit 1
3180fa2845dSmrg    touch $file
3190fa2845dSmrg    ;;
3200fa2845dSmrg
3217888fd0eSmrg  tar*)
3220fa2845dSmrg    shift
3230fa2845dSmrg
3240fa2845dSmrg    # We have already tried tar in the generic part.
3250fa2845dSmrg    # Look for gnutar/gtar before invocation to avoid ugly error
3260fa2845dSmrg    # messages.
3270fa2845dSmrg    if (gnutar --version > /dev/null 2>&1); then
3280fa2845dSmrg       gnutar "$@" && exit 0
3290fa2845dSmrg    fi
3300fa2845dSmrg    if (gtar --version > /dev/null 2>&1); then
3310fa2845dSmrg       gtar "$@" && exit 0
3320fa2845dSmrg    fi
3330fa2845dSmrg    firstarg="$1"
3340fa2845dSmrg    if shift; then
3350fa2845dSmrg	case $firstarg in
3360fa2845dSmrg	*o*)
3370fa2845dSmrg	    firstarg=`echo "$firstarg" | sed s/o//`
3380fa2845dSmrg	    tar "$firstarg" "$@" && exit 0
3390fa2845dSmrg	    ;;
3400fa2845dSmrg	esac
3410fa2845dSmrg	case $firstarg in
3420fa2845dSmrg	*h*)
3430fa2845dSmrg	    firstarg=`echo "$firstarg" | sed s/h//`
3440fa2845dSmrg	    tar "$firstarg" "$@" && exit 0
3450fa2845dSmrg	    ;;
3460fa2845dSmrg	esac
3470fa2845dSmrg    fi
3480fa2845dSmrg
3490fa2845dSmrg    echo 1>&2 "\
3500fa2845dSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
3510fa2845dSmrg         You may want to install GNU tar or Free paxutils, or check the
3520fa2845dSmrg         command line arguments."
3530fa2845dSmrg    exit 1
3540fa2845dSmrg    ;;
3550fa2845dSmrg
3560fa2845dSmrg  *)
3570fa2845dSmrg    echo 1>&2 "\
3580fa2845dSmrgWARNING: \`$1' is needed, and is $msg.
3590fa2845dSmrg         You might have modified some files without having the
3600fa2845dSmrg         proper tools for further handling them.  Check the \`README' file,
3610fa2845dSmrg         it often tells you about the needed prerequisites for installing
3620fa2845dSmrg         this package.  You may also peek at any GNU archive site, in case
3630fa2845dSmrg         some other package would contain this missing \`$1' program."
3640fa2845dSmrg    exit 1
3650fa2845dSmrg    ;;
3660fa2845dSmrgesac
3670fa2845dSmrg
3680fa2845dSmrgexit 0
3690fa2845dSmrg
3700fa2845dSmrg# Local variables:
3710fa2845dSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
3720fa2845dSmrg# time-stamp-start: "scriptversion="
3730fa2845dSmrg# time-stamp-format: "%:y-%02m-%02d.%02H"
3747888fd0eSmrg# time-stamp-time-zone: "UTC"
3757888fd0eSmrg# time-stamp-end: "; # UTC"
3760fa2845dSmrg# End:
377