missing revision 7e6fb56f
17e6fb56fSmrg#! /bin/sh
27e6fb56fSmrg# Common stub for a few missing GNU programs while installing.
37e6fb56fSmrg
47e6fb56fSmrgscriptversion=2009-04-28.21; # UTC
57e6fb56fSmrg
67e6fb56fSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
77e6fb56fSmrg# 2008, 2009 Free Software Foundation, Inc.
87e6fb56fSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
97e6fb56fSmrg
107e6fb56fSmrg# This program is free software; you can redistribute it and/or modify
117e6fb56fSmrg# it under the terms of the GNU General Public License as published by
127e6fb56fSmrg# the Free Software Foundation; either version 2, or (at your option)
137e6fb56fSmrg# any later version.
147e6fb56fSmrg
157e6fb56fSmrg# This program is distributed in the hope that it will be useful,
167e6fb56fSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
177e6fb56fSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
187e6fb56fSmrg# GNU General Public License for more details.
197e6fb56fSmrg
207e6fb56fSmrg# You should have received a copy of the GNU General Public License
217e6fb56fSmrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
227e6fb56fSmrg
237e6fb56fSmrg# As a special exception to the GNU General Public License, if you
247e6fb56fSmrg# distribute this file as part of a program that contains a
257e6fb56fSmrg# configuration script generated by Autoconf, you may include it under
267e6fb56fSmrg# the same distribution terms that you use for the rest of that program.
277e6fb56fSmrg
287e6fb56fSmrgif test $# -eq 0; then
297e6fb56fSmrg  echo 1>&2 "Try \`$0 --help' for more information"
307e6fb56fSmrg  exit 1
317e6fb56fSmrgfi
327e6fb56fSmrg
337e6fb56fSmrgrun=:
347e6fb56fSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
357e6fb56fSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
367e6fb56fSmrg
377e6fb56fSmrg# In the cases where this matters, `missing' is being run in the
387e6fb56fSmrg# srcdir already.
397e6fb56fSmrgif test -f configure.ac; then
407e6fb56fSmrg  configure_ac=configure.ac
417e6fb56fSmrgelse
427e6fb56fSmrg  configure_ac=configure.in
437e6fb56fSmrgfi
447e6fb56fSmrg
457e6fb56fSmrgmsg="missing on your system"
467e6fb56fSmrg
477e6fb56fSmrgcase $1 in
487e6fb56fSmrg--run)
497e6fb56fSmrg  # Try to run requested program, and just exit if it succeeds.
507e6fb56fSmrg  run=
517e6fb56fSmrg  shift
527e6fb56fSmrg  "$@" && exit 0
537e6fb56fSmrg  # Exit code 63 means version mismatch.  This often happens
547e6fb56fSmrg  # when the user try to use an ancient version of a tool on
557e6fb56fSmrg  # a file that requires a minimum version.  In this case we
567e6fb56fSmrg  # we should proceed has if the program had been absent, or
577e6fb56fSmrg  # if --run hadn't been passed.
587e6fb56fSmrg  if test $? = 63; then
597e6fb56fSmrg    run=:
607e6fb56fSmrg    msg="probably too old"
617e6fb56fSmrg  fi
627e6fb56fSmrg  ;;
637e6fb56fSmrg
647e6fb56fSmrg  -h|--h|--he|--hel|--help)
657e6fb56fSmrg    echo "\
667e6fb56fSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
677e6fb56fSmrg
687e6fb56fSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
697e6fb56fSmrgerror status if there is no known handling for PROGRAM.
707e6fb56fSmrg
717e6fb56fSmrgOptions:
727e6fb56fSmrg  -h, --help      display this help and exit
737e6fb56fSmrg  -v, --version   output version information and exit
747e6fb56fSmrg  --run           try to run the given command, and emulate it if it fails
757e6fb56fSmrg
767e6fb56fSmrgSupported PROGRAM values:
777e6fb56fSmrg  aclocal      touch file \`aclocal.m4'
787e6fb56fSmrg  autoconf     touch file \`configure'
797e6fb56fSmrg  autoheader   touch file \`config.h.in'
807e6fb56fSmrg  autom4te     touch the output file, or create a stub one
817e6fb56fSmrg  automake     touch all \`Makefile.in' files
827e6fb56fSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
837e6fb56fSmrg  flex         create \`lex.yy.c', if possible, from existing .c
847e6fb56fSmrg  help2man     touch the output file
857e6fb56fSmrg  lex          create \`lex.yy.c', if possible, from existing .c
867e6fb56fSmrg  makeinfo     touch the output file
877e6fb56fSmrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
887e6fb56fSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
897e6fb56fSmrg
907e6fb56fSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
917e6fb56fSmrg\`g' are ignored when checking the name.
927e6fb56fSmrg
937e6fb56fSmrgSend bug reports to <bug-automake@gnu.org>."
947e6fb56fSmrg    exit $?
957e6fb56fSmrg    ;;
967e6fb56fSmrg
977e6fb56fSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
987e6fb56fSmrg    echo "missing $scriptversion (GNU Automake)"
997e6fb56fSmrg    exit $?
1007e6fb56fSmrg    ;;
1017e6fb56fSmrg
1027e6fb56fSmrg  -*)
1037e6fb56fSmrg    echo 1>&2 "$0: Unknown \`$1' option"
1047e6fb56fSmrg    echo 1>&2 "Try \`$0 --help' for more information"
1057e6fb56fSmrg    exit 1
1067e6fb56fSmrg    ;;
1077e6fb56fSmrg
1087e6fb56fSmrgesac
1097e6fb56fSmrg
1107e6fb56fSmrg# normalize program name to check for.
1117e6fb56fSmrgprogram=`echo "$1" | sed '
1127e6fb56fSmrg  s/^gnu-//; t
1137e6fb56fSmrg  s/^gnu//; t
1147e6fb56fSmrg  s/^g//; t'`
1157e6fb56fSmrg
1167e6fb56fSmrg# Now exit if we have it, but it failed.  Also exit now if we
1177e6fb56fSmrg# don't have it and --version was passed (most likely to detect
1187e6fb56fSmrg# the program).  This is about non-GNU programs, so use $1 not
1197e6fb56fSmrg# $program.
1207e6fb56fSmrgcase $1 in
1217e6fb56fSmrg  lex*|yacc*)
1227e6fb56fSmrg    # Not GNU programs, they don't have --version.
1237e6fb56fSmrg    ;;
1247e6fb56fSmrg
1257e6fb56fSmrg  tar*)
1267e6fb56fSmrg    if test -n "$run"; then
1277e6fb56fSmrg       echo 1>&2 "ERROR: \`tar' requires --run"
1287e6fb56fSmrg       exit 1
1297e6fb56fSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1307e6fb56fSmrg       exit 1
1317e6fb56fSmrg    fi
1327e6fb56fSmrg    ;;
1337e6fb56fSmrg
1347e6fb56fSmrg  *)
1357e6fb56fSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1367e6fb56fSmrg       # We have it, but it failed.
1377e6fb56fSmrg       exit 1
1387e6fb56fSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1397e6fb56fSmrg       # Could not run --version or --help.  This is probably someone
1407e6fb56fSmrg       # running `$TOOL --version' or `$TOOL --help' to check whether
1417e6fb56fSmrg       # $TOOL exists and not knowing $TOOL uses missing.
1427e6fb56fSmrg       exit 1
1437e6fb56fSmrg    fi
1447e6fb56fSmrg    ;;
1457e6fb56fSmrgesac
1467e6fb56fSmrg
1477e6fb56fSmrg# If it does not exist, or fails to run (possibly an outdated version),
1487e6fb56fSmrg# try to emulate it.
1497e6fb56fSmrgcase $program in
1507e6fb56fSmrg  aclocal*)
1517e6fb56fSmrg    echo 1>&2 "\
1527e6fb56fSmrgWARNING: \`$1' is $msg.  You should only need it if
1537e6fb56fSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
1547e6fb56fSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
1557e6fb56fSmrg         any GNU archive site."
1567e6fb56fSmrg    touch aclocal.m4
1577e6fb56fSmrg    ;;
1587e6fb56fSmrg
1597e6fb56fSmrg  autoconf*)
1607e6fb56fSmrg    echo 1>&2 "\
1617e6fb56fSmrgWARNING: \`$1' is $msg.  You should only need it if
1627e6fb56fSmrg         you modified \`${configure_ac}'.  You might want to install the
1637e6fb56fSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1647e6fb56fSmrg         archive site."
1657e6fb56fSmrg    touch configure
1667e6fb56fSmrg    ;;
1677e6fb56fSmrg
1687e6fb56fSmrg  autoheader*)
1697e6fb56fSmrg    echo 1>&2 "\
1707e6fb56fSmrgWARNING: \`$1' is $msg.  You should only need it if
1717e6fb56fSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1727e6fb56fSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1737e6fb56fSmrg         from any GNU archive site."
1747e6fb56fSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1757e6fb56fSmrg    test -z "$files" && files="config.h"
1767e6fb56fSmrg    touch_files=
1777e6fb56fSmrg    for f in $files; do
1787e6fb56fSmrg      case $f in
1797e6fb56fSmrg      *:*) touch_files="$touch_files "`echo "$f" |
1807e6fb56fSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1817e6fb56fSmrg      *) touch_files="$touch_files $f.in";;
1827e6fb56fSmrg      esac
1837e6fb56fSmrg    done
1847e6fb56fSmrg    touch $touch_files
1857e6fb56fSmrg    ;;
1867e6fb56fSmrg
1877e6fb56fSmrg  automake*)
1887e6fb56fSmrg    echo 1>&2 "\
1897e6fb56fSmrgWARNING: \`$1' is $msg.  You should only need it if
1907e6fb56fSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1917e6fb56fSmrg         You might want to install the \`Automake' and \`Perl' packages.
1927e6fb56fSmrg         Grab them from any GNU archive site."
1937e6fb56fSmrg    find . -type f -name Makefile.am -print |
1947e6fb56fSmrg	   sed 's/\.am$/.in/' |
1957e6fb56fSmrg	   while read f; do touch "$f"; done
1967e6fb56fSmrg    ;;
1977e6fb56fSmrg
1987e6fb56fSmrg  autom4te*)
1997e6fb56fSmrg    echo 1>&2 "\
2007e6fb56fSmrgWARNING: \`$1' is needed, but is $msg.
2017e6fb56fSmrg         You might have modified some files without having the
2027e6fb56fSmrg         proper tools for further handling them.
2037e6fb56fSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
2047e6fb56fSmrg         archive site."
2057e6fb56fSmrg
2067e6fb56fSmrg    file=`echo "$*" | sed -n "$sed_output"`
2077e6fb56fSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2087e6fb56fSmrg    if test -f "$file"; then
2097e6fb56fSmrg	touch $file
2107e6fb56fSmrg    else
2117e6fb56fSmrg	test -z "$file" || exec >$file
2127e6fb56fSmrg	echo "#! /bin/sh"
2137e6fb56fSmrg	echo "# Created by GNU Automake missing as a replacement of"
2147e6fb56fSmrg	echo "#  $ $@"
2157e6fb56fSmrg	echo "exit 0"
2167e6fb56fSmrg	chmod +x $file
2177e6fb56fSmrg	exit 1
2187e6fb56fSmrg    fi
2197e6fb56fSmrg    ;;
2207e6fb56fSmrg
2217e6fb56fSmrg  bison*|yacc*)
2227e6fb56fSmrg    echo 1>&2 "\
2237e6fb56fSmrgWARNING: \`$1' $msg.  You should only need it if
2247e6fb56fSmrg         you modified a \`.y' file.  You may need the \`Bison' package
2257e6fb56fSmrg         in order for those modifications to take effect.  You can get
2267e6fb56fSmrg         \`Bison' from any GNU archive site."
2277e6fb56fSmrg    rm -f y.tab.c y.tab.h
2287e6fb56fSmrg    if test $# -ne 1; then
2297e6fb56fSmrg        eval LASTARG="\${$#}"
2307e6fb56fSmrg	case $LASTARG in
2317e6fb56fSmrg	*.y)
2327e6fb56fSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
2337e6fb56fSmrg	    if test -f "$SRCFILE"; then
2347e6fb56fSmrg	         cp "$SRCFILE" y.tab.c
2357e6fb56fSmrg	    fi
2367e6fb56fSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2377e6fb56fSmrg	    if test -f "$SRCFILE"; then
2387e6fb56fSmrg	         cp "$SRCFILE" y.tab.h
2397e6fb56fSmrg	    fi
2407e6fb56fSmrg	  ;;
2417e6fb56fSmrg	esac
2427e6fb56fSmrg    fi
2437e6fb56fSmrg    if test ! -f y.tab.h; then
2447e6fb56fSmrg	echo >y.tab.h
2457e6fb56fSmrg    fi
2467e6fb56fSmrg    if test ! -f y.tab.c; then
2477e6fb56fSmrg	echo 'main() { return 0; }' >y.tab.c
2487e6fb56fSmrg    fi
2497e6fb56fSmrg    ;;
2507e6fb56fSmrg
2517e6fb56fSmrg  lex*|flex*)
2527e6fb56fSmrg    echo 1>&2 "\
2537e6fb56fSmrgWARNING: \`$1' is $msg.  You should only need it if
2547e6fb56fSmrg         you modified a \`.l' file.  You may need the \`Flex' package
2557e6fb56fSmrg         in order for those modifications to take effect.  You can get
2567e6fb56fSmrg         \`Flex' from any GNU archive site."
2577e6fb56fSmrg    rm -f lex.yy.c
2587e6fb56fSmrg    if test $# -ne 1; then
2597e6fb56fSmrg        eval LASTARG="\${$#}"
2607e6fb56fSmrg	case $LASTARG in
2617e6fb56fSmrg	*.l)
2627e6fb56fSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2637e6fb56fSmrg	    if test -f "$SRCFILE"; then
2647e6fb56fSmrg	         cp "$SRCFILE" lex.yy.c
2657e6fb56fSmrg	    fi
2667e6fb56fSmrg	  ;;
2677e6fb56fSmrg	esac
2687e6fb56fSmrg    fi
2697e6fb56fSmrg    if test ! -f lex.yy.c; then
2707e6fb56fSmrg	echo 'main() { return 0; }' >lex.yy.c
2717e6fb56fSmrg    fi
2727e6fb56fSmrg    ;;
2737e6fb56fSmrg
2747e6fb56fSmrg  help2man*)
2757e6fb56fSmrg    echo 1>&2 "\
2767e6fb56fSmrgWARNING: \`$1' is $msg.  You should only need it if
2777e6fb56fSmrg	 you modified a dependency of a manual page.  You may need the
2787e6fb56fSmrg	 \`Help2man' package in order for those modifications to take
2797e6fb56fSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
2807e6fb56fSmrg
2817e6fb56fSmrg    file=`echo "$*" | sed -n "$sed_output"`
2827e6fb56fSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2837e6fb56fSmrg    if test -f "$file"; then
2847e6fb56fSmrg	touch $file
2857e6fb56fSmrg    else
2867e6fb56fSmrg	test -z "$file" || exec >$file
2877e6fb56fSmrg	echo ".ab help2man is required to generate this page"
2887e6fb56fSmrg	exit $?
2897e6fb56fSmrg    fi
2907e6fb56fSmrg    ;;
2917e6fb56fSmrg
2927e6fb56fSmrg  makeinfo*)
2937e6fb56fSmrg    echo 1>&2 "\
2947e6fb56fSmrgWARNING: \`$1' is $msg.  You should only need it if
2957e6fb56fSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
2967e6fb56fSmrg         indirectly affecting the aspect of the manual.  The spurious
2977e6fb56fSmrg         call might also be the consequence of using a buggy \`make' (AIX,
2987e6fb56fSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
2997e6fb56fSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
3007e6fb56fSmrg    # The file to touch is that specified with -o ...
3017e6fb56fSmrg    file=`echo "$*" | sed -n "$sed_output"`
3027e6fb56fSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
3037e6fb56fSmrg    if test -z "$file"; then
3047e6fb56fSmrg      # ... or it is the one specified with @setfilename ...
3057e6fb56fSmrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
3067e6fb56fSmrg      file=`sed -n '
3077e6fb56fSmrg	/^@setfilename/{
3087e6fb56fSmrg	  s/.* \([^ ]*\) *$/\1/
3097e6fb56fSmrg	  p
3107e6fb56fSmrg	  q
3117e6fb56fSmrg	}' $infile`
3127e6fb56fSmrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
3137e6fb56fSmrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
3147e6fb56fSmrg    fi
3157e6fb56fSmrg    # If the file does not exist, the user really needs makeinfo;
3167e6fb56fSmrg    # let's fail without touching anything.
3177e6fb56fSmrg    test -f $file || exit 1
3187e6fb56fSmrg    touch $file
3197e6fb56fSmrg    ;;
3207e6fb56fSmrg
3217e6fb56fSmrg  tar*)
3227e6fb56fSmrg    shift
3237e6fb56fSmrg
3247e6fb56fSmrg    # We have already tried tar in the generic part.
3257e6fb56fSmrg    # Look for gnutar/gtar before invocation to avoid ugly error
3267e6fb56fSmrg    # messages.
3277e6fb56fSmrg    if (gnutar --version > /dev/null 2>&1); then
3287e6fb56fSmrg       gnutar "$@" && exit 0
3297e6fb56fSmrg    fi
3307e6fb56fSmrg    if (gtar --version > /dev/null 2>&1); then
3317e6fb56fSmrg       gtar "$@" && exit 0
3327e6fb56fSmrg    fi
3337e6fb56fSmrg    firstarg="$1"
3347e6fb56fSmrg    if shift; then
3357e6fb56fSmrg	case $firstarg in
3367e6fb56fSmrg	*o*)
3377e6fb56fSmrg	    firstarg=`echo "$firstarg" | sed s/o//`
3387e6fb56fSmrg	    tar "$firstarg" "$@" && exit 0
3397e6fb56fSmrg	    ;;
3407e6fb56fSmrg	esac
3417e6fb56fSmrg	case $firstarg in
3427e6fb56fSmrg	*h*)
3437e6fb56fSmrg	    firstarg=`echo "$firstarg" | sed s/h//`
3447e6fb56fSmrg	    tar "$firstarg" "$@" && exit 0
3457e6fb56fSmrg	    ;;
3467e6fb56fSmrg	esac
3477e6fb56fSmrg    fi
3487e6fb56fSmrg
3497e6fb56fSmrg    echo 1>&2 "\
3507e6fb56fSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
3517e6fb56fSmrg         You may want to install GNU tar or Free paxutils, or check the
3527e6fb56fSmrg         command line arguments."
3537e6fb56fSmrg    exit 1
3547e6fb56fSmrg    ;;
3557e6fb56fSmrg
3567e6fb56fSmrg  *)
3577e6fb56fSmrg    echo 1>&2 "\
3587e6fb56fSmrgWARNING: \`$1' is needed, and is $msg.
3597e6fb56fSmrg         You might have modified some files without having the
3607e6fb56fSmrg         proper tools for further handling them.  Check the \`README' file,
3617e6fb56fSmrg         it often tells you about the needed prerequisites for installing
3627e6fb56fSmrg         this package.  You may also peek at any GNU archive site, in case
3637e6fb56fSmrg         some other package would contain this missing \`$1' program."
3647e6fb56fSmrg    exit 1
3657e6fb56fSmrg    ;;
3667e6fb56fSmrgesac
3677e6fb56fSmrg
3687e6fb56fSmrgexit 0
3697e6fb56fSmrg
3707e6fb56fSmrg# Local variables:
3717e6fb56fSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
3727e6fb56fSmrg# time-stamp-start: "scriptversion="
3737e6fb56fSmrg# time-stamp-format: "%:y-%02m-%02d.%02H"
3747e6fb56fSmrg# time-stamp-time-zone: "UTC"
3757e6fb56fSmrg# time-stamp-end: "; # UTC"
3767e6fb56fSmrg# End:
377