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