missing revision a5a92c01
11fb077a1Smrg#! /bin/sh
21fb077a1Smrg# Common stub for a few missing GNU programs while installing.
31fb077a1Smrg
4a5a92c01Smrgscriptversion=2009-04-28.21; # UTC
51fb077a1Smrg
6a5a92c01Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
7a5a92c01Smrg# 2008, 2009 Free Software Foundation, Inc.
81fb077a1Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
91fb077a1Smrg
101fb077a1Smrg# This program is free software; you can redistribute it and/or modify
111fb077a1Smrg# it under the terms of the GNU General Public License as published by
121fb077a1Smrg# the Free Software Foundation; either version 2, or (at your option)
131fb077a1Smrg# any later version.
141fb077a1Smrg
151fb077a1Smrg# This program is distributed in the hope that it will be useful,
161fb077a1Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
171fb077a1Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
181fb077a1Smrg# GNU General Public License for more details.
191fb077a1Smrg
201fb077a1Smrg# You should have received a copy of the GNU General Public License
21a5a92c01Smrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
221fb077a1Smrg
231fb077a1Smrg# As a special exception to the GNU General Public License, if you
241fb077a1Smrg# distribute this file as part of a program that contains a
251fb077a1Smrg# configuration script generated by Autoconf, you may include it under
261fb077a1Smrg# the same distribution terms that you use for the rest of that program.
271fb077a1Smrg
281fb077a1Smrgif test $# -eq 0; then
291fb077a1Smrg  echo 1>&2 "Try \`$0 --help' for more information"
301fb077a1Smrg  exit 1
311fb077a1Smrgfi
321fb077a1Smrg
331fb077a1Smrgrun=:
341fb077a1Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
351fb077a1Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
361fb077a1Smrg
371fb077a1Smrg# In the cases where this matters, `missing' is being run in the
381fb077a1Smrg# srcdir already.
391fb077a1Smrgif test -f configure.ac; then
401fb077a1Smrg  configure_ac=configure.ac
411fb077a1Smrgelse
421fb077a1Smrg  configure_ac=configure.in
431fb077a1Smrgfi
441fb077a1Smrg
451fb077a1Smrgmsg="missing on your system"
461fb077a1Smrg
471fb077a1Smrgcase $1 in
481fb077a1Smrg--run)
491fb077a1Smrg  # Try to run requested program, and just exit if it succeeds.
501fb077a1Smrg  run=
511fb077a1Smrg  shift
521fb077a1Smrg  "$@" && exit 0
531fb077a1Smrg  # Exit code 63 means version mismatch.  This often happens
541fb077a1Smrg  # when the user try to use an ancient version of a tool on
551fb077a1Smrg  # a file that requires a minimum version.  In this case we
561fb077a1Smrg  # we should proceed has if the program had been absent, or
571fb077a1Smrg  # if --run hadn't been passed.
581fb077a1Smrg  if test $? = 63; then
591fb077a1Smrg    run=:
601fb077a1Smrg    msg="probably too old"
611fb077a1Smrg  fi
621fb077a1Smrg  ;;
631fb077a1Smrg
641fb077a1Smrg  -h|--h|--he|--hel|--help)
651fb077a1Smrg    echo "\
661fb077a1Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
671fb077a1Smrg
681fb077a1SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
691fb077a1Smrgerror status if there is no known handling for PROGRAM.
701fb077a1Smrg
711fb077a1SmrgOptions:
721fb077a1Smrg  -h, --help      display this help and exit
731fb077a1Smrg  -v, --version   output version information and exit
741fb077a1Smrg  --run           try to run the given command, and emulate it if it fails
751fb077a1Smrg
761fb077a1SmrgSupported PROGRAM values:
771fb077a1Smrg  aclocal      touch file \`aclocal.m4'
781fb077a1Smrg  autoconf     touch file \`configure'
791fb077a1Smrg  autoheader   touch file \`config.h.in'
801fb077a1Smrg  autom4te     touch the output file, or create a stub one
811fb077a1Smrg  automake     touch all \`Makefile.in' files
821fb077a1Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
831fb077a1Smrg  flex         create \`lex.yy.c', if possible, from existing .c
841fb077a1Smrg  help2man     touch the output file
851fb077a1Smrg  lex          create \`lex.yy.c', if possible, from existing .c
861fb077a1Smrg  makeinfo     touch the output file
871fb077a1Smrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
881fb077a1Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
891fb077a1Smrg
90a5a92c01SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
91a5a92c01Smrg\`g' are ignored when checking the name.
92a5a92c01Smrg
931fb077a1SmrgSend bug reports to <bug-automake@gnu.org>."
941fb077a1Smrg    exit $?
951fb077a1Smrg    ;;
961fb077a1Smrg
971fb077a1Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
981fb077a1Smrg    echo "missing $scriptversion (GNU Automake)"
991fb077a1Smrg    exit $?
1001fb077a1Smrg    ;;
1011fb077a1Smrg
1021fb077a1Smrg  -*)
1031fb077a1Smrg    echo 1>&2 "$0: Unknown \`$1' option"
1041fb077a1Smrg    echo 1>&2 "Try \`$0 --help' for more information"
1051fb077a1Smrg    exit 1
1061fb077a1Smrg    ;;
1071fb077a1Smrg
1081fb077a1Smrgesac
1091fb077a1Smrg
110a5a92c01Smrg# normalize program name to check for.
111a5a92c01Smrgprogram=`echo "$1" | sed '
112a5a92c01Smrg  s/^gnu-//; t
113a5a92c01Smrg  s/^gnu//; t
114a5a92c01Smrg  s/^g//; t'`
115a5a92c01Smrg
1161fb077a1Smrg# Now exit if we have it, but it failed.  Also exit now if we
1171fb077a1Smrg# don't have it and --version was passed (most likely to detect
118a5a92c01Smrg# the program).  This is about non-GNU programs, so use $1 not
119a5a92c01Smrg# $program.
1201fb077a1Smrgcase $1 in
121a5a92c01Smrg  lex*|yacc*)
1221fb077a1Smrg    # Not GNU programs, they don't have --version.
1231fb077a1Smrg    ;;
1241fb077a1Smrg
125a5a92c01Smrg  tar*)
1261fb077a1Smrg    if test -n "$run"; then
1271fb077a1Smrg       echo 1>&2 "ERROR: \`tar' requires --run"
1281fb077a1Smrg       exit 1
1291fb077a1Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1301fb077a1Smrg       exit 1
1311fb077a1Smrg    fi
1321fb077a1Smrg    ;;
1331fb077a1Smrg
1341fb077a1Smrg  *)
1351fb077a1Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1361fb077a1Smrg       # We have it, but it failed.
1371fb077a1Smrg       exit 1
1381fb077a1Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1391fb077a1Smrg       # Could not run --version or --help.  This is probably someone
1401fb077a1Smrg       # running `$TOOL --version' or `$TOOL --help' to check whether
1411fb077a1Smrg       # $TOOL exists and not knowing $TOOL uses missing.
1421fb077a1Smrg       exit 1
1431fb077a1Smrg    fi
1441fb077a1Smrg    ;;
1451fb077a1Smrgesac
1461fb077a1Smrg
1471fb077a1Smrg# If it does not exist, or fails to run (possibly an outdated version),
1481fb077a1Smrg# try to emulate it.
149a5a92c01Smrgcase $program in
1501fb077a1Smrg  aclocal*)
1511fb077a1Smrg    echo 1>&2 "\
1521fb077a1SmrgWARNING: \`$1' is $msg.  You should only need it if
1531fb077a1Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
1541fb077a1Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
1551fb077a1Smrg         any GNU archive site."
1561fb077a1Smrg    touch aclocal.m4
1571fb077a1Smrg    ;;
1581fb077a1Smrg
159a5a92c01Smrg  autoconf*)
1601fb077a1Smrg    echo 1>&2 "\
1611fb077a1SmrgWARNING: \`$1' is $msg.  You should only need it if
1621fb077a1Smrg         you modified \`${configure_ac}'.  You might want to install the
1631fb077a1Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1641fb077a1Smrg         archive site."
1651fb077a1Smrg    touch configure
1661fb077a1Smrg    ;;
1671fb077a1Smrg
168a5a92c01Smrg  autoheader*)
1691fb077a1Smrg    echo 1>&2 "\
1701fb077a1SmrgWARNING: \`$1' is $msg.  You should only need it if
1711fb077a1Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1721fb077a1Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1731fb077a1Smrg         from any GNU archive site."
1741fb077a1Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1751fb077a1Smrg    test -z "$files" && files="config.h"
1761fb077a1Smrg    touch_files=
1771fb077a1Smrg    for f in $files; do
1781fb077a1Smrg      case $f in
1791fb077a1Smrg      *:*) touch_files="$touch_files "`echo "$f" |
1801fb077a1Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1811fb077a1Smrg      *) touch_files="$touch_files $f.in";;
1821fb077a1Smrg      esac
1831fb077a1Smrg    done
1841fb077a1Smrg    touch $touch_files
1851fb077a1Smrg    ;;
1861fb077a1Smrg
1871fb077a1Smrg  automake*)
1881fb077a1Smrg    echo 1>&2 "\
1891fb077a1SmrgWARNING: \`$1' is $msg.  You should only need it if
1901fb077a1Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1911fb077a1Smrg         You might want to install the \`Automake' and \`Perl' packages.
1921fb077a1Smrg         Grab them from any GNU archive site."
1931fb077a1Smrg    find . -type f -name Makefile.am -print |
1941fb077a1Smrg	   sed 's/\.am$/.in/' |
1951fb077a1Smrg	   while read f; do touch "$f"; done
1961fb077a1Smrg    ;;
1971fb077a1Smrg
198a5a92c01Smrg  autom4te*)
1991fb077a1Smrg    echo 1>&2 "\
2001fb077a1SmrgWARNING: \`$1' is needed, but is $msg.
2011fb077a1Smrg         You might have modified some files without having the
2021fb077a1Smrg         proper tools for further handling them.
2031fb077a1Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
2041fb077a1Smrg         archive site."
2051fb077a1Smrg
2061fb077a1Smrg    file=`echo "$*" | sed -n "$sed_output"`
2071fb077a1Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2081fb077a1Smrg    if test -f "$file"; then
2091fb077a1Smrg	touch $file
2101fb077a1Smrg    else
2111fb077a1Smrg	test -z "$file" || exec >$file
2121fb077a1Smrg	echo "#! /bin/sh"
2131fb077a1Smrg	echo "# Created by GNU Automake missing as a replacement of"
2141fb077a1Smrg	echo "#  $ $@"
2151fb077a1Smrg	echo "exit 0"
2161fb077a1Smrg	chmod +x $file
2171fb077a1Smrg	exit 1
2181fb077a1Smrg    fi
2191fb077a1Smrg    ;;
2201fb077a1Smrg
221a5a92c01Smrg  bison*|yacc*)
2221fb077a1Smrg    echo 1>&2 "\
2231fb077a1SmrgWARNING: \`$1' $msg.  You should only need it if
2241fb077a1Smrg         you modified a \`.y' file.  You may need the \`Bison' package
2251fb077a1Smrg         in order for those modifications to take effect.  You can get
2261fb077a1Smrg         \`Bison' from any GNU archive site."
2271fb077a1Smrg    rm -f y.tab.c y.tab.h
2281fb077a1Smrg    if test $# -ne 1; then
2291fb077a1Smrg        eval LASTARG="\${$#}"
2301fb077a1Smrg	case $LASTARG in
2311fb077a1Smrg	*.y)
2321fb077a1Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
2331fb077a1Smrg	    if test -f "$SRCFILE"; then
2341fb077a1Smrg	         cp "$SRCFILE" y.tab.c
2351fb077a1Smrg	    fi
2361fb077a1Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2371fb077a1Smrg	    if test -f "$SRCFILE"; then
2381fb077a1Smrg	         cp "$SRCFILE" y.tab.h
2391fb077a1Smrg	    fi
2401fb077a1Smrg	  ;;
2411fb077a1Smrg	esac
2421fb077a1Smrg    fi
2431fb077a1Smrg    if test ! -f y.tab.h; then
2441fb077a1Smrg	echo >y.tab.h
2451fb077a1Smrg    fi
2461fb077a1Smrg    if test ! -f y.tab.c; then
2471fb077a1Smrg	echo 'main() { return 0; }' >y.tab.c
2481fb077a1Smrg    fi
2491fb077a1Smrg    ;;
2501fb077a1Smrg
251a5a92c01Smrg  lex*|flex*)
2521fb077a1Smrg    echo 1>&2 "\
2531fb077a1SmrgWARNING: \`$1' is $msg.  You should only need it if
2541fb077a1Smrg         you modified a \`.l' file.  You may need the \`Flex' package
2551fb077a1Smrg         in order for those modifications to take effect.  You can get
2561fb077a1Smrg         \`Flex' from any GNU archive site."
2571fb077a1Smrg    rm -f lex.yy.c
2581fb077a1Smrg    if test $# -ne 1; then
2591fb077a1Smrg        eval LASTARG="\${$#}"
2601fb077a1Smrg	case $LASTARG in
2611fb077a1Smrg	*.l)
2621fb077a1Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2631fb077a1Smrg	    if test -f "$SRCFILE"; then
2641fb077a1Smrg	         cp "$SRCFILE" lex.yy.c
2651fb077a1Smrg	    fi
2661fb077a1Smrg	  ;;
2671fb077a1Smrg	esac
2681fb077a1Smrg    fi
2691fb077a1Smrg    if test ! -f lex.yy.c; then
2701fb077a1Smrg	echo 'main() { return 0; }' >lex.yy.c
2711fb077a1Smrg    fi
2721fb077a1Smrg    ;;
2731fb077a1Smrg
274a5a92c01Smrg  help2man*)
2751fb077a1Smrg    echo 1>&2 "\
2761fb077a1SmrgWARNING: \`$1' is $msg.  You should only need it if
2771fb077a1Smrg	 you modified a dependency of a manual page.  You may need the
2781fb077a1Smrg	 \`Help2man' package in order for those modifications to take
2791fb077a1Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
2801fb077a1Smrg
2811fb077a1Smrg    file=`echo "$*" | sed -n "$sed_output"`
2821fb077a1Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2831fb077a1Smrg    if test -f "$file"; then
2841fb077a1Smrg	touch $file
2851fb077a1Smrg    else
2861fb077a1Smrg	test -z "$file" || exec >$file
2871fb077a1Smrg	echo ".ab help2man is required to generate this page"
288a5a92c01Smrg	exit $?
2891fb077a1Smrg    fi
2901fb077a1Smrg    ;;
2911fb077a1Smrg
292a5a92c01Smrg  makeinfo*)
2931fb077a1Smrg    echo 1>&2 "\
2941fb077a1SmrgWARNING: \`$1' is $msg.  You should only need it if
2951fb077a1Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
2961fb077a1Smrg         indirectly affecting the aspect of the manual.  The spurious
2971fb077a1Smrg         call might also be the consequence of using a buggy \`make' (AIX,
2981fb077a1Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
2991fb077a1Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
3001fb077a1Smrg    # The file to touch is that specified with -o ...
3011fb077a1Smrg    file=`echo "$*" | sed -n "$sed_output"`
3021fb077a1Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
3031fb077a1Smrg    if test -z "$file"; then
3041fb077a1Smrg      # ... or it is the one specified with @setfilename ...
3051fb077a1Smrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
3061fb077a1Smrg      file=`sed -n '
3071fb077a1Smrg	/^@setfilename/{
3081fb077a1Smrg	  s/.* \([^ ]*\) *$/\1/
3091fb077a1Smrg	  p
3101fb077a1Smrg	  q
3111fb077a1Smrg	}' $infile`
3121fb077a1Smrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
3131fb077a1Smrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
3141fb077a1Smrg    fi
3151fb077a1Smrg    # If the file does not exist, the user really needs makeinfo;
3161fb077a1Smrg    # let's fail without touching anything.
3171fb077a1Smrg    test -f $file || exit 1
3181fb077a1Smrg    touch $file
3191fb077a1Smrg    ;;
3201fb077a1Smrg
321a5a92c01Smrg  tar*)
3221fb077a1Smrg    shift
3231fb077a1Smrg
3241fb077a1Smrg    # We have already tried tar in the generic part.
3251fb077a1Smrg    # Look for gnutar/gtar before invocation to avoid ugly error
3261fb077a1Smrg    # messages.
3271fb077a1Smrg    if (gnutar --version > /dev/null 2>&1); then
3281fb077a1Smrg       gnutar "$@" && exit 0
3291fb077a1Smrg    fi
3301fb077a1Smrg    if (gtar --version > /dev/null 2>&1); then
3311fb077a1Smrg       gtar "$@" && exit 0
3321fb077a1Smrg    fi
3331fb077a1Smrg    firstarg="$1"
3341fb077a1Smrg    if shift; then
3351fb077a1Smrg	case $firstarg in
3361fb077a1Smrg	*o*)
3371fb077a1Smrg	    firstarg=`echo "$firstarg" | sed s/o//`
3381fb077a1Smrg	    tar "$firstarg" "$@" && exit 0
3391fb077a1Smrg	    ;;
3401fb077a1Smrg	esac
3411fb077a1Smrg	case $firstarg in
3421fb077a1Smrg	*h*)
3431fb077a1Smrg	    firstarg=`echo "$firstarg" | sed s/h//`
3441fb077a1Smrg	    tar "$firstarg" "$@" && exit 0
3451fb077a1Smrg	    ;;
3461fb077a1Smrg	esac
3471fb077a1Smrg    fi
3481fb077a1Smrg
3491fb077a1Smrg    echo 1>&2 "\
3501fb077a1SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
3511fb077a1Smrg         You may want to install GNU tar or Free paxutils, or check the
3521fb077a1Smrg         command line arguments."
3531fb077a1Smrg    exit 1
3541fb077a1Smrg    ;;
3551fb077a1Smrg
3561fb077a1Smrg  *)
3571fb077a1Smrg    echo 1>&2 "\
3581fb077a1SmrgWARNING: \`$1' is needed, and is $msg.
3591fb077a1Smrg         You might have modified some files without having the
3601fb077a1Smrg         proper tools for further handling them.  Check the \`README' file,
3611fb077a1Smrg         it often tells you about the needed prerequisites for installing
3621fb077a1Smrg         this package.  You may also peek at any GNU archive site, in case
3631fb077a1Smrg         some other package would contain this missing \`$1' program."
3641fb077a1Smrg    exit 1
3651fb077a1Smrg    ;;
3661fb077a1Smrgesac
3671fb077a1Smrg
3681fb077a1Smrgexit 0
3691fb077a1Smrg
3701fb077a1Smrg# Local variables:
3711fb077a1Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
3721fb077a1Smrg# time-stamp-start: "scriptversion="
3731fb077a1Smrg# time-stamp-format: "%:y-%02m-%02d.%02H"
374a5a92c01Smrg# time-stamp-time-zone: "UTC"
375a5a92c01Smrg# time-stamp-end: "; # UTC"
3761fb077a1Smrg# End:
377