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