missing revision 6cf5427a
10cc6efb6Smrg#! /bin/sh
20cc6efb6Smrg# Common stub for a few missing GNU programs while installing.
36cf5427aSmrg
46cf5427aSmrgscriptversion=2009-04-28.21; # UTC
56cf5427aSmrg
66cf5427aSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
76cf5427aSmrg# 2008, 2009 Free Software Foundation, Inc.
80cc6efb6Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
90cc6efb6Smrg
100cc6efb6Smrg# This program is free software; you can redistribute it and/or modify
110cc6efb6Smrg# it under the terms of the GNU General Public License as published by
120cc6efb6Smrg# the Free Software Foundation; either version 2, or (at your option)
130cc6efb6Smrg# any later version.
140cc6efb6Smrg
150cc6efb6Smrg# This program is distributed in the hope that it will be useful,
160cc6efb6Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
170cc6efb6Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
180cc6efb6Smrg# GNU General Public License for more details.
190cc6efb6Smrg
200cc6efb6Smrg# You should have received a copy of the GNU General Public License
216cf5427aSmrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
220cc6efb6Smrg
230cc6efb6Smrg# As a special exception to the GNU General Public License, if you
240cc6efb6Smrg# distribute this file as part of a program that contains a
250cc6efb6Smrg# configuration script generated by Autoconf, you may include it under
260cc6efb6Smrg# the same distribution terms that you use for the rest of that program.
270cc6efb6Smrg
280cc6efb6Smrgif test $# -eq 0; then
290cc6efb6Smrg  echo 1>&2 "Try \`$0 --help' for more information"
300cc6efb6Smrg  exit 1
310cc6efb6Smrgfi
320cc6efb6Smrg
330cc6efb6Smrgrun=:
346cf5427aSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
356cf5427aSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
360cc6efb6Smrg
370cc6efb6Smrg# In the cases where this matters, `missing' is being run in the
380cc6efb6Smrg# srcdir already.
390cc6efb6Smrgif test -f configure.ac; then
400cc6efb6Smrg  configure_ac=configure.ac
410cc6efb6Smrgelse
420cc6efb6Smrg  configure_ac=configure.in
430cc6efb6Smrgfi
440cc6efb6Smrg
456cf5427aSmrgmsg="missing on your system"
466cf5427aSmrg
476cf5427aSmrgcase $1 in
480cc6efb6Smrg--run)
490cc6efb6Smrg  # Try to run requested program, and just exit if it succeeds.
500cc6efb6Smrg  run=
510cc6efb6Smrg  shift
520cc6efb6Smrg  "$@" && exit 0
536cf5427aSmrg  # Exit code 63 means version mismatch.  This often happens
546cf5427aSmrg  # when the user try to use an ancient version of a tool on
556cf5427aSmrg  # a file that requires a minimum version.  In this case we
566cf5427aSmrg  # we should proceed has if the program had been absent, or
576cf5427aSmrg  # if --run hadn't been passed.
586cf5427aSmrg  if test $? = 63; then
596cf5427aSmrg    run=:
606cf5427aSmrg    msg="probably too old"
616cf5427aSmrg  fi
620cc6efb6Smrg  ;;
630cc6efb6Smrg
640cc6efb6Smrg  -h|--h|--he|--hel|--help)
650cc6efb6Smrg    echo "\
660cc6efb6Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
670cc6efb6Smrg
680cc6efb6SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
690cc6efb6Smrgerror status if there is no known handling for PROGRAM.
700cc6efb6Smrg
710cc6efb6SmrgOptions:
720cc6efb6Smrg  -h, --help      display this help and exit
730cc6efb6Smrg  -v, --version   output version information and exit
740cc6efb6Smrg  --run           try to run the given command, and emulate it if it fails
750cc6efb6Smrg
760cc6efb6SmrgSupported PROGRAM values:
770cc6efb6Smrg  aclocal      touch file \`aclocal.m4'
780cc6efb6Smrg  autoconf     touch file \`configure'
790cc6efb6Smrg  autoheader   touch file \`config.h.in'
806cf5427aSmrg  autom4te     touch the output file, or create a stub one
810cc6efb6Smrg  automake     touch all \`Makefile.in' files
820cc6efb6Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
830cc6efb6Smrg  flex         create \`lex.yy.c', if possible, from existing .c
840cc6efb6Smrg  help2man     touch the output file
850cc6efb6Smrg  lex          create \`lex.yy.c', if possible, from existing .c
860cc6efb6Smrg  makeinfo     touch the output file
870cc6efb6Smrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
886cf5427aSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
896cf5427aSmrg
906cf5427aSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
916cf5427aSmrg\`g' are ignored when checking the name.
926cf5427aSmrg
936cf5427aSmrgSend bug reports to <bug-automake@gnu.org>."
946cf5427aSmrg    exit $?
950cc6efb6Smrg    ;;
960cc6efb6Smrg
970cc6efb6Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
986cf5427aSmrg    echo "missing $scriptversion (GNU Automake)"
996cf5427aSmrg    exit $?
1000cc6efb6Smrg    ;;
1010cc6efb6Smrg
1020cc6efb6Smrg  -*)
1030cc6efb6Smrg    echo 1>&2 "$0: Unknown \`$1' option"
1040cc6efb6Smrg    echo 1>&2 "Try \`$0 --help' for more information"
1050cc6efb6Smrg    exit 1
1060cc6efb6Smrg    ;;
1070cc6efb6Smrg
1086cf5427aSmrgesac
1096cf5427aSmrg
1106cf5427aSmrg# normalize program name to check for.
1116cf5427aSmrgprogram=`echo "$1" | sed '
1126cf5427aSmrg  s/^gnu-//; t
1136cf5427aSmrg  s/^gnu//; t
1146cf5427aSmrg  s/^g//; t'`
1156cf5427aSmrg
1166cf5427aSmrg# Now exit if we have it, but it failed.  Also exit now if we
1176cf5427aSmrg# don't have it and --version was passed (most likely to detect
1186cf5427aSmrg# the program).  This is about non-GNU programs, so use $1 not
1196cf5427aSmrg# $program.
1206cf5427aSmrgcase $1 in
1216cf5427aSmrg  lex*|yacc*)
1226cf5427aSmrg    # Not GNU programs, they don't have --version.
1236cf5427aSmrg    ;;
1246cf5427aSmrg
1256cf5427aSmrg  tar*)
1266cf5427aSmrg    if test -n "$run"; then
1276cf5427aSmrg       echo 1>&2 "ERROR: \`tar' requires --run"
1286cf5427aSmrg       exit 1
1296cf5427aSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1306cf5427aSmrg       exit 1
1316cf5427aSmrg    fi
1326cf5427aSmrg    ;;
1336cf5427aSmrg
1346cf5427aSmrg  *)
1350cc6efb6Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1360cc6efb6Smrg       # We have it, but it failed.
1370cc6efb6Smrg       exit 1
1386cf5427aSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1396cf5427aSmrg       # Could not run --version or --help.  This is probably someone
1406cf5427aSmrg       # running `$TOOL --version' or `$TOOL --help' to check whether
1416cf5427aSmrg       # $TOOL exists and not knowing $TOOL uses missing.
1426cf5427aSmrg       exit 1
1430cc6efb6Smrg    fi
1446cf5427aSmrg    ;;
1456cf5427aSmrgesac
1460cc6efb6Smrg
1476cf5427aSmrg# If it does not exist, or fails to run (possibly an outdated version),
1486cf5427aSmrg# try to emulate it.
1496cf5427aSmrgcase $program in
1506cf5427aSmrg  aclocal*)
1510cc6efb6Smrg    echo 1>&2 "\
1526cf5427aSmrgWARNING: \`$1' is $msg.  You should only need it if
1530cc6efb6Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
1540cc6efb6Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
1550cc6efb6Smrg         any GNU archive site."
1560cc6efb6Smrg    touch aclocal.m4
1570cc6efb6Smrg    ;;
1580cc6efb6Smrg
1596cf5427aSmrg  autoconf*)
1600cc6efb6Smrg    echo 1>&2 "\
1616cf5427aSmrgWARNING: \`$1' is $msg.  You should only need it if
1620cc6efb6Smrg         you modified \`${configure_ac}'.  You might want to install the
1630cc6efb6Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1640cc6efb6Smrg         archive site."
1650cc6efb6Smrg    touch configure
1660cc6efb6Smrg    ;;
1670cc6efb6Smrg
1686cf5427aSmrg  autoheader*)
1690cc6efb6Smrg    echo 1>&2 "\
1706cf5427aSmrgWARNING: \`$1' is $msg.  You should only need it if
1710cc6efb6Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1720cc6efb6Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1730cc6efb6Smrg         from any GNU archive site."
1740cc6efb6Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1750cc6efb6Smrg    test -z "$files" && files="config.h"
1760cc6efb6Smrg    touch_files=
1770cc6efb6Smrg    for f in $files; do
1786cf5427aSmrg      case $f in
1790cc6efb6Smrg      *:*) touch_files="$touch_files "`echo "$f" |
1800cc6efb6Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1810cc6efb6Smrg      *) touch_files="$touch_files $f.in";;
1820cc6efb6Smrg      esac
1830cc6efb6Smrg    done
1840cc6efb6Smrg    touch $touch_files
1850cc6efb6Smrg    ;;
1860cc6efb6Smrg
1870cc6efb6Smrg  automake*)
1880cc6efb6Smrg    echo 1>&2 "\
1896cf5427aSmrgWARNING: \`$1' is $msg.  You should only need it if
1900cc6efb6Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1910cc6efb6Smrg         You might want to install the \`Automake' and \`Perl' packages.
1920cc6efb6Smrg         Grab them from any GNU archive site."
1930cc6efb6Smrg    find . -type f -name Makefile.am -print |
1940cc6efb6Smrg	   sed 's/\.am$/.in/' |
1950cc6efb6Smrg	   while read f; do touch "$f"; done
1960cc6efb6Smrg    ;;
1970cc6efb6Smrg
1986cf5427aSmrg  autom4te*)
1990cc6efb6Smrg    echo 1>&2 "\
2006cf5427aSmrgWARNING: \`$1' is needed, but is $msg.
2016cf5427aSmrg         You might have modified some files without having the
2020cc6efb6Smrg         proper tools for further handling them.
2030cc6efb6Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
2040cc6efb6Smrg         archive site."
2050cc6efb6Smrg
2066cf5427aSmrg    file=`echo "$*" | sed -n "$sed_output"`
2076cf5427aSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2080cc6efb6Smrg    if test -f "$file"; then
2090cc6efb6Smrg	touch $file
2100cc6efb6Smrg    else
2110cc6efb6Smrg	test -z "$file" || exec >$file
2120cc6efb6Smrg	echo "#! /bin/sh"
2130cc6efb6Smrg	echo "# Created by GNU Automake missing as a replacement of"
2140cc6efb6Smrg	echo "#  $ $@"
2150cc6efb6Smrg	echo "exit 0"
2160cc6efb6Smrg	chmod +x $file
2170cc6efb6Smrg	exit 1
2180cc6efb6Smrg    fi
2190cc6efb6Smrg    ;;
2200cc6efb6Smrg
2216cf5427aSmrg  bison*|yacc*)
2220cc6efb6Smrg    echo 1>&2 "\
2236cf5427aSmrgWARNING: \`$1' $msg.  You should only need it if
2240cc6efb6Smrg         you modified a \`.y' file.  You may need the \`Bison' package
2250cc6efb6Smrg         in order for those modifications to take effect.  You can get
2260cc6efb6Smrg         \`Bison' from any GNU archive site."
2270cc6efb6Smrg    rm -f y.tab.c y.tab.h
2286cf5427aSmrg    if test $# -ne 1; then
2290cc6efb6Smrg        eval LASTARG="\${$#}"
2306cf5427aSmrg	case $LASTARG in
2310cc6efb6Smrg	*.y)
2320cc6efb6Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
2336cf5427aSmrg	    if test -f "$SRCFILE"; then
2340cc6efb6Smrg	         cp "$SRCFILE" y.tab.c
2350cc6efb6Smrg	    fi
2360cc6efb6Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2376cf5427aSmrg	    if test -f "$SRCFILE"; then
2380cc6efb6Smrg	         cp "$SRCFILE" y.tab.h
2390cc6efb6Smrg	    fi
2400cc6efb6Smrg	  ;;
2410cc6efb6Smrg	esac
2420cc6efb6Smrg    fi
2436cf5427aSmrg    if test ! -f y.tab.h; then
2440cc6efb6Smrg	echo >y.tab.h
2450cc6efb6Smrg    fi
2466cf5427aSmrg    if test ! -f y.tab.c; then
2470cc6efb6Smrg	echo 'main() { return 0; }' >y.tab.c
2480cc6efb6Smrg    fi
2490cc6efb6Smrg    ;;
2500cc6efb6Smrg
2516cf5427aSmrg  lex*|flex*)
2520cc6efb6Smrg    echo 1>&2 "\
2536cf5427aSmrgWARNING: \`$1' is $msg.  You should only need it if
2540cc6efb6Smrg         you modified a \`.l' file.  You may need the \`Flex' package
2550cc6efb6Smrg         in order for those modifications to take effect.  You can get
2560cc6efb6Smrg         \`Flex' from any GNU archive site."
2570cc6efb6Smrg    rm -f lex.yy.c
2586cf5427aSmrg    if test $# -ne 1; then
2590cc6efb6Smrg        eval LASTARG="\${$#}"
2606cf5427aSmrg	case $LASTARG in
2610cc6efb6Smrg	*.l)
2620cc6efb6Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2636cf5427aSmrg	    if test -f "$SRCFILE"; then
2640cc6efb6Smrg	         cp "$SRCFILE" lex.yy.c
2650cc6efb6Smrg	    fi
2660cc6efb6Smrg	  ;;
2670cc6efb6Smrg	esac
2680cc6efb6Smrg    fi
2696cf5427aSmrg    if test ! -f lex.yy.c; then
2700cc6efb6Smrg	echo 'main() { return 0; }' >lex.yy.c
2710cc6efb6Smrg    fi
2720cc6efb6Smrg    ;;
2730cc6efb6Smrg
2746cf5427aSmrg  help2man*)
2750cc6efb6Smrg    echo 1>&2 "\
2766cf5427aSmrgWARNING: \`$1' is $msg.  You should only need it if
2770cc6efb6Smrg	 you modified a dependency of a manual page.  You may need the
2780cc6efb6Smrg	 \`Help2man' package in order for those modifications to take
2790cc6efb6Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
2800cc6efb6Smrg
2816cf5427aSmrg    file=`echo "$*" | sed -n "$sed_output"`
2826cf5427aSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2836cf5427aSmrg    if test -f "$file"; then
2840cc6efb6Smrg	touch $file
2850cc6efb6Smrg    else
2860cc6efb6Smrg	test -z "$file" || exec >$file
2870cc6efb6Smrg	echo ".ab help2man is required to generate this page"
2886cf5427aSmrg	exit $?
2890cc6efb6Smrg    fi
2900cc6efb6Smrg    ;;
2910cc6efb6Smrg
2926cf5427aSmrg  makeinfo*)
2930cc6efb6Smrg    echo 1>&2 "\
2946cf5427aSmrgWARNING: \`$1' is $msg.  You should only need it if
2950cc6efb6Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
2960cc6efb6Smrg         indirectly affecting the aspect of the manual.  The spurious
2970cc6efb6Smrg         call might also be the consequence of using a buggy \`make' (AIX,
2980cc6efb6Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
2990cc6efb6Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
3006cf5427aSmrg    # The file to touch is that specified with -o ...
3016cf5427aSmrg    file=`echo "$*" | sed -n "$sed_output"`
3026cf5427aSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
3030cc6efb6Smrg    if test -z "$file"; then
3046cf5427aSmrg      # ... or it is the one specified with @setfilename ...
3056cf5427aSmrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
3066cf5427aSmrg      file=`sed -n '
3076cf5427aSmrg	/^@setfilename/{
3086cf5427aSmrg	  s/.* \([^ ]*\) *$/\1/
3096cf5427aSmrg	  p
3106cf5427aSmrg	  q
3116cf5427aSmrg	}' $infile`
3126cf5427aSmrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
3136cf5427aSmrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
3140cc6efb6Smrg    fi
3156cf5427aSmrg    # If the file does not exist, the user really needs makeinfo;
3166cf5427aSmrg    # let's fail without touching anything.
3176cf5427aSmrg    test -f $file || exit 1
3180cc6efb6Smrg    touch $file
3190cc6efb6Smrg    ;;
3200cc6efb6Smrg
3216cf5427aSmrg  tar*)
3220cc6efb6Smrg    shift
3230cc6efb6Smrg
3240cc6efb6Smrg    # We have already tried tar in the generic part.
3250cc6efb6Smrg    # Look for gnutar/gtar before invocation to avoid ugly error
3260cc6efb6Smrg    # messages.
3270cc6efb6Smrg    if (gnutar --version > /dev/null 2>&1); then
3280cc6efb6Smrg       gnutar "$@" && exit 0
3290cc6efb6Smrg    fi
3300cc6efb6Smrg    if (gtar --version > /dev/null 2>&1); then
3310cc6efb6Smrg       gtar "$@" && exit 0
3320cc6efb6Smrg    fi
3330cc6efb6Smrg    firstarg="$1"
3340cc6efb6Smrg    if shift; then
3356cf5427aSmrg	case $firstarg in
3360cc6efb6Smrg	*o*)
3370cc6efb6Smrg	    firstarg=`echo "$firstarg" | sed s/o//`
3380cc6efb6Smrg	    tar "$firstarg" "$@" && exit 0
3390cc6efb6Smrg	    ;;
3400cc6efb6Smrg	esac
3416cf5427aSmrg	case $firstarg in
3420cc6efb6Smrg	*h*)
3430cc6efb6Smrg	    firstarg=`echo "$firstarg" | sed s/h//`
3440cc6efb6Smrg	    tar "$firstarg" "$@" && exit 0
3450cc6efb6Smrg	    ;;
3460cc6efb6Smrg	esac
3470cc6efb6Smrg    fi
3480cc6efb6Smrg
3490cc6efb6Smrg    echo 1>&2 "\
3500cc6efb6SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
3510cc6efb6Smrg         You may want to install GNU tar or Free paxutils, or check the
3520cc6efb6Smrg         command line arguments."
3530cc6efb6Smrg    exit 1
3540cc6efb6Smrg    ;;
3550cc6efb6Smrg
3560cc6efb6Smrg  *)
3570cc6efb6Smrg    echo 1>&2 "\
3586cf5427aSmrgWARNING: \`$1' is needed, and is $msg.
3596cf5427aSmrg         You might have modified some files without having the
3600cc6efb6Smrg         proper tools for further handling them.  Check the \`README' file,
3610cc6efb6Smrg         it often tells you about the needed prerequisites for installing
3620cc6efb6Smrg         this package.  You may also peek at any GNU archive site, in case
3630cc6efb6Smrg         some other package would contain this missing \`$1' program."
3640cc6efb6Smrg    exit 1
3650cc6efb6Smrg    ;;
3660cc6efb6Smrgesac
3670cc6efb6Smrg
3680cc6efb6Smrgexit 0
3696cf5427aSmrg
3706cf5427aSmrg# Local variables:
3716cf5427aSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
3726cf5427aSmrg# time-stamp-start: "scriptversion="
3736cf5427aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H"
3746cf5427aSmrg# time-stamp-time-zone: "UTC"
3756cf5427aSmrg# time-stamp-end: "; # UTC"
3766cf5427aSmrg# End:
377