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