missing revision 8ae04fa6
18ae04fa6Smrg#! /bin/sh
28ae04fa6Smrg# Common stub for a few missing GNU programs while installing.
38ae04fa6Smrg
48ae04fa6Smrgscriptversion=2006-05-10.23
58ae04fa6Smrg
68ae04fa6Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
78ae04fa6Smrg#   Free Software Foundation, Inc.
88ae04fa6Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
98ae04fa6Smrg
108ae04fa6Smrg# This program is free software; you can redistribute it and/or modify
118ae04fa6Smrg# it under the terms of the GNU General Public License as published by
128ae04fa6Smrg# the Free Software Foundation; either version 2, or (at your option)
138ae04fa6Smrg# any later version.
148ae04fa6Smrg
158ae04fa6Smrg# This program is distributed in the hope that it will be useful,
168ae04fa6Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
178ae04fa6Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
188ae04fa6Smrg# GNU General Public License for more details.
198ae04fa6Smrg
208ae04fa6Smrg# You should have received a copy of the GNU General Public License
218ae04fa6Smrg# along with this program; if not, write to the Free Software
228ae04fa6Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
238ae04fa6Smrg# 02110-1301, USA.
248ae04fa6Smrg
258ae04fa6Smrg# As a special exception to the GNU General Public License, if you
268ae04fa6Smrg# distribute this file as part of a program that contains a
278ae04fa6Smrg# configuration script generated by Autoconf, you may include it under
288ae04fa6Smrg# the same distribution terms that you use for the rest of that program.
298ae04fa6Smrg
308ae04fa6Smrgif test $# -eq 0; then
318ae04fa6Smrg  echo 1>&2 "Try \`$0 --help' for more information"
328ae04fa6Smrg  exit 1
338ae04fa6Smrgfi
348ae04fa6Smrg
358ae04fa6Smrgrun=:
368ae04fa6Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
378ae04fa6Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
388ae04fa6Smrg
398ae04fa6Smrg# In the cases where this matters, `missing' is being run in the
408ae04fa6Smrg# srcdir already.
418ae04fa6Smrgif test -f configure.ac; then
428ae04fa6Smrg  configure_ac=configure.ac
438ae04fa6Smrgelse
448ae04fa6Smrg  configure_ac=configure.in
458ae04fa6Smrgfi
468ae04fa6Smrg
478ae04fa6Smrgmsg="missing on your system"
488ae04fa6Smrg
498ae04fa6Smrgcase $1 in
508ae04fa6Smrg--run)
518ae04fa6Smrg  # Try to run requested program, and just exit if it succeeds.
528ae04fa6Smrg  run=
538ae04fa6Smrg  shift
548ae04fa6Smrg  "$@" && exit 0
558ae04fa6Smrg  # Exit code 63 means version mismatch.  This often happens
568ae04fa6Smrg  # when the user try to use an ancient version of a tool on
578ae04fa6Smrg  # a file that requires a minimum version.  In this case we
588ae04fa6Smrg  # we should proceed has if the program had been absent, or
598ae04fa6Smrg  # if --run hadn't been passed.
608ae04fa6Smrg  if test $? = 63; then
618ae04fa6Smrg    run=:
628ae04fa6Smrg    msg="probably too old"
638ae04fa6Smrg  fi
648ae04fa6Smrg  ;;
658ae04fa6Smrg
668ae04fa6Smrg  -h|--h|--he|--hel|--help)
678ae04fa6Smrg    echo "\
688ae04fa6Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
698ae04fa6Smrg
708ae04fa6SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
718ae04fa6Smrgerror status if there is no known handling for PROGRAM.
728ae04fa6Smrg
738ae04fa6SmrgOptions:
748ae04fa6Smrg  -h, --help      display this help and exit
758ae04fa6Smrg  -v, --version   output version information and exit
768ae04fa6Smrg  --run           try to run the given command, and emulate it if it fails
778ae04fa6Smrg
788ae04fa6SmrgSupported PROGRAM values:
798ae04fa6Smrg  aclocal      touch file \`aclocal.m4'
808ae04fa6Smrg  autoconf     touch file \`configure'
818ae04fa6Smrg  autoheader   touch file \`config.h.in'
828ae04fa6Smrg  autom4te     touch the output file, or create a stub one
838ae04fa6Smrg  automake     touch all \`Makefile.in' files
848ae04fa6Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
858ae04fa6Smrg  flex         create \`lex.yy.c', if possible, from existing .c
868ae04fa6Smrg  help2man     touch the output file
878ae04fa6Smrg  lex          create \`lex.yy.c', if possible, from existing .c
888ae04fa6Smrg  makeinfo     touch the output file
898ae04fa6Smrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
908ae04fa6Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
918ae04fa6Smrg
928ae04fa6SmrgSend bug reports to <bug-automake@gnu.org>."
938ae04fa6Smrg    exit $?
948ae04fa6Smrg    ;;
958ae04fa6Smrg
968ae04fa6Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
978ae04fa6Smrg    echo "missing $scriptversion (GNU Automake)"
988ae04fa6Smrg    exit $?
998ae04fa6Smrg    ;;
1008ae04fa6Smrg
1018ae04fa6Smrg  -*)
1028ae04fa6Smrg    echo 1>&2 "$0: Unknown \`$1' option"
1038ae04fa6Smrg    echo 1>&2 "Try \`$0 --help' for more information"
1048ae04fa6Smrg    exit 1
1058ae04fa6Smrg    ;;
1068ae04fa6Smrg
1078ae04fa6Smrgesac
1088ae04fa6Smrg
1098ae04fa6Smrg# Now exit if we have it, but it failed.  Also exit now if we
1108ae04fa6Smrg# don't have it and --version was passed (most likely to detect
1118ae04fa6Smrg# the program).
1128ae04fa6Smrgcase $1 in
1138ae04fa6Smrg  lex|yacc)
1148ae04fa6Smrg    # Not GNU programs, they don't have --version.
1158ae04fa6Smrg    ;;
1168ae04fa6Smrg
1178ae04fa6Smrg  tar)
1188ae04fa6Smrg    if test -n "$run"; then
1198ae04fa6Smrg       echo 1>&2 "ERROR: \`tar' requires --run"
1208ae04fa6Smrg       exit 1
1218ae04fa6Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1228ae04fa6Smrg       exit 1
1238ae04fa6Smrg    fi
1248ae04fa6Smrg    ;;
1258ae04fa6Smrg
1268ae04fa6Smrg  *)
1278ae04fa6Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1288ae04fa6Smrg       # We have it, but it failed.
1298ae04fa6Smrg       exit 1
1308ae04fa6Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1318ae04fa6Smrg       # Could not run --version or --help.  This is probably someone
1328ae04fa6Smrg       # running `$TOOL --version' or `$TOOL --help' to check whether
1338ae04fa6Smrg       # $TOOL exists and not knowing $TOOL uses missing.
1348ae04fa6Smrg       exit 1
1358ae04fa6Smrg    fi
1368ae04fa6Smrg    ;;
1378ae04fa6Smrgesac
1388ae04fa6Smrg
1398ae04fa6Smrg# If it does not exist, or fails to run (possibly an outdated version),
1408ae04fa6Smrg# try to emulate it.
1418ae04fa6Smrgcase $1 in
1428ae04fa6Smrg  aclocal*)
1438ae04fa6Smrg    echo 1>&2 "\
1448ae04fa6SmrgWARNING: \`$1' is $msg.  You should only need it if
1458ae04fa6Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
1468ae04fa6Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
1478ae04fa6Smrg         any GNU archive site."
1488ae04fa6Smrg    touch aclocal.m4
1498ae04fa6Smrg    ;;
1508ae04fa6Smrg
1518ae04fa6Smrg  autoconf)
1528ae04fa6Smrg    echo 1>&2 "\
1538ae04fa6SmrgWARNING: \`$1' is $msg.  You should only need it if
1548ae04fa6Smrg         you modified \`${configure_ac}'.  You might want to install the
1558ae04fa6Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1568ae04fa6Smrg         archive site."
1578ae04fa6Smrg    touch configure
1588ae04fa6Smrg    ;;
1598ae04fa6Smrg
1608ae04fa6Smrg  autoheader)
1618ae04fa6Smrg    echo 1>&2 "\
1628ae04fa6SmrgWARNING: \`$1' is $msg.  You should only need it if
1638ae04fa6Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1648ae04fa6Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1658ae04fa6Smrg         from any GNU archive site."
1668ae04fa6Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1678ae04fa6Smrg    test -z "$files" && files="config.h"
1688ae04fa6Smrg    touch_files=
1698ae04fa6Smrg    for f in $files; do
1708ae04fa6Smrg      case $f in
1718ae04fa6Smrg      *:*) touch_files="$touch_files "`echo "$f" |
1728ae04fa6Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1738ae04fa6Smrg      *) touch_files="$touch_files $f.in";;
1748ae04fa6Smrg      esac
1758ae04fa6Smrg    done
1768ae04fa6Smrg    touch $touch_files
1778ae04fa6Smrg    ;;
1788ae04fa6Smrg
1798ae04fa6Smrg  automake*)
1808ae04fa6Smrg    echo 1>&2 "\
1818ae04fa6SmrgWARNING: \`$1' is $msg.  You should only need it if
1828ae04fa6Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1838ae04fa6Smrg         You might want to install the \`Automake' and \`Perl' packages.
1848ae04fa6Smrg         Grab them from any GNU archive site."
1858ae04fa6Smrg    find . -type f -name Makefile.am -print |
1868ae04fa6Smrg	   sed 's/\.am$/.in/' |
1878ae04fa6Smrg	   while read f; do touch "$f"; done
1888ae04fa6Smrg    ;;
1898ae04fa6Smrg
1908ae04fa6Smrg  autom4te)
1918ae04fa6Smrg    echo 1>&2 "\
1928ae04fa6SmrgWARNING: \`$1' is needed, but is $msg.
1938ae04fa6Smrg         You might have modified some files without having the
1948ae04fa6Smrg         proper tools for further handling them.
1958ae04fa6Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
1968ae04fa6Smrg         archive site."
1978ae04fa6Smrg
1988ae04fa6Smrg    file=`echo "$*" | sed -n "$sed_output"`
1998ae04fa6Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2008ae04fa6Smrg    if test -f "$file"; then
2018ae04fa6Smrg	touch $file
2028ae04fa6Smrg    else
2038ae04fa6Smrg	test -z "$file" || exec >$file
2048ae04fa6Smrg	echo "#! /bin/sh"
2058ae04fa6Smrg	echo "# Created by GNU Automake missing as a replacement of"
2068ae04fa6Smrg	echo "#  $ $@"
2078ae04fa6Smrg	echo "exit 0"
2088ae04fa6Smrg	chmod +x $file
2098ae04fa6Smrg	exit 1
2108ae04fa6Smrg    fi
2118ae04fa6Smrg    ;;
2128ae04fa6Smrg
2138ae04fa6Smrg  bison|yacc)
2148ae04fa6Smrg    echo 1>&2 "\
2158ae04fa6SmrgWARNING: \`$1' $msg.  You should only need it if
2168ae04fa6Smrg         you modified a \`.y' file.  You may need the \`Bison' package
2178ae04fa6Smrg         in order for those modifications to take effect.  You can get
2188ae04fa6Smrg         \`Bison' from any GNU archive site."
2198ae04fa6Smrg    rm -f y.tab.c y.tab.h
2208ae04fa6Smrg    if test $# -ne 1; then
2218ae04fa6Smrg        eval LASTARG="\${$#}"
2228ae04fa6Smrg	case $LASTARG in
2238ae04fa6Smrg	*.y)
2248ae04fa6Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
2258ae04fa6Smrg	    if test -f "$SRCFILE"; then
2268ae04fa6Smrg	         cp "$SRCFILE" y.tab.c
2278ae04fa6Smrg	    fi
2288ae04fa6Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2298ae04fa6Smrg	    if test -f "$SRCFILE"; then
2308ae04fa6Smrg	         cp "$SRCFILE" y.tab.h
2318ae04fa6Smrg	    fi
2328ae04fa6Smrg	  ;;
2338ae04fa6Smrg	esac
2348ae04fa6Smrg    fi
2358ae04fa6Smrg    if test ! -f y.tab.h; then
2368ae04fa6Smrg	echo >y.tab.h
2378ae04fa6Smrg    fi
2388ae04fa6Smrg    if test ! -f y.tab.c; then
2398ae04fa6Smrg	echo 'main() { return 0; }' >y.tab.c
2408ae04fa6Smrg    fi
2418ae04fa6Smrg    ;;
2428ae04fa6Smrg
2438ae04fa6Smrg  lex|flex)
2448ae04fa6Smrg    echo 1>&2 "\
2458ae04fa6SmrgWARNING: \`$1' is $msg.  You should only need it if
2468ae04fa6Smrg         you modified a \`.l' file.  You may need the \`Flex' package
2478ae04fa6Smrg         in order for those modifications to take effect.  You can get
2488ae04fa6Smrg         \`Flex' from any GNU archive site."
2498ae04fa6Smrg    rm -f lex.yy.c
2508ae04fa6Smrg    if test $# -ne 1; then
2518ae04fa6Smrg        eval LASTARG="\${$#}"
2528ae04fa6Smrg	case $LASTARG in
2538ae04fa6Smrg	*.l)
2548ae04fa6Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2558ae04fa6Smrg	    if test -f "$SRCFILE"; then
2568ae04fa6Smrg	         cp "$SRCFILE" lex.yy.c
2578ae04fa6Smrg	    fi
2588ae04fa6Smrg	  ;;
2598ae04fa6Smrg	esac
2608ae04fa6Smrg    fi
2618ae04fa6Smrg    if test ! -f lex.yy.c; then
2628ae04fa6Smrg	echo 'main() { return 0; }' >lex.yy.c
2638ae04fa6Smrg    fi
2648ae04fa6Smrg    ;;
2658ae04fa6Smrg
2668ae04fa6Smrg  help2man)
2678ae04fa6Smrg    echo 1>&2 "\
2688ae04fa6SmrgWARNING: \`$1' is $msg.  You should only need it if
2698ae04fa6Smrg	 you modified a dependency of a manual page.  You may need the
2708ae04fa6Smrg	 \`Help2man' package in order for those modifications to take
2718ae04fa6Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
2728ae04fa6Smrg
2738ae04fa6Smrg    file=`echo "$*" | sed -n "$sed_output"`
2748ae04fa6Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2758ae04fa6Smrg    if test -f "$file"; then
2768ae04fa6Smrg	touch $file
2778ae04fa6Smrg    else
2788ae04fa6Smrg	test -z "$file" || exec >$file
2798ae04fa6Smrg	echo ".ab help2man is required to generate this page"
2808ae04fa6Smrg	exit 1
2818ae04fa6Smrg    fi
2828ae04fa6Smrg    ;;
2838ae04fa6Smrg
2848ae04fa6Smrg  makeinfo)
2858ae04fa6Smrg    echo 1>&2 "\
2868ae04fa6SmrgWARNING: \`$1' is $msg.  You should only need it if
2878ae04fa6Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
2888ae04fa6Smrg         indirectly affecting the aspect of the manual.  The spurious
2898ae04fa6Smrg         call might also be the consequence of using a buggy \`make' (AIX,
2908ae04fa6Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
2918ae04fa6Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
2928ae04fa6Smrg    # The file to touch is that specified with -o ...
2938ae04fa6Smrg    file=`echo "$*" | sed -n "$sed_output"`
2948ae04fa6Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2958ae04fa6Smrg    if test -z "$file"; then
2968ae04fa6Smrg      # ... or it is the one specified with @setfilename ...
2978ae04fa6Smrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
2988ae04fa6Smrg      file=`sed -n '
2998ae04fa6Smrg	/^@setfilename/{
3008ae04fa6Smrg	  s/.* \([^ ]*\) *$/\1/
3018ae04fa6Smrg	  p
3028ae04fa6Smrg	  q
3038ae04fa6Smrg	}' $infile`
3048ae04fa6Smrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
3058ae04fa6Smrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
3068ae04fa6Smrg    fi
3078ae04fa6Smrg    # If the file does not exist, the user really needs makeinfo;
3088ae04fa6Smrg    # let's fail without touching anything.
3098ae04fa6Smrg    test -f $file || exit 1
3108ae04fa6Smrg    touch $file
3118ae04fa6Smrg    ;;
3128ae04fa6Smrg
3138ae04fa6Smrg  tar)
3148ae04fa6Smrg    shift
3158ae04fa6Smrg
3168ae04fa6Smrg    # We have already tried tar in the generic part.
3178ae04fa6Smrg    # Look for gnutar/gtar before invocation to avoid ugly error
3188ae04fa6Smrg    # messages.
3198ae04fa6Smrg    if (gnutar --version > /dev/null 2>&1); then
3208ae04fa6Smrg       gnutar "$@" && exit 0
3218ae04fa6Smrg    fi
3228ae04fa6Smrg    if (gtar --version > /dev/null 2>&1); then
3238ae04fa6Smrg       gtar "$@" && exit 0
3248ae04fa6Smrg    fi
3258ae04fa6Smrg    firstarg="$1"
3268ae04fa6Smrg    if shift; then
3278ae04fa6Smrg	case $firstarg in
3288ae04fa6Smrg	*o*)
3298ae04fa6Smrg	    firstarg=`echo "$firstarg" | sed s/o//`
3308ae04fa6Smrg	    tar "$firstarg" "$@" && exit 0
3318ae04fa6Smrg	    ;;
3328ae04fa6Smrg	esac
3338ae04fa6Smrg	case $firstarg in
3348ae04fa6Smrg	*h*)
3358ae04fa6Smrg	    firstarg=`echo "$firstarg" | sed s/h//`
3368ae04fa6Smrg	    tar "$firstarg" "$@" && exit 0
3378ae04fa6Smrg	    ;;
3388ae04fa6Smrg	esac
3398ae04fa6Smrg    fi
3408ae04fa6Smrg
3418ae04fa6Smrg    echo 1>&2 "\
3428ae04fa6SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
3438ae04fa6Smrg         You may want to install GNU tar or Free paxutils, or check the
3448ae04fa6Smrg         command line arguments."
3458ae04fa6Smrg    exit 1
3468ae04fa6Smrg    ;;
3478ae04fa6Smrg
3488ae04fa6Smrg  *)
3498ae04fa6Smrg    echo 1>&2 "\
3508ae04fa6SmrgWARNING: \`$1' is needed, and is $msg.
3518ae04fa6Smrg         You might have modified some files without having the
3528ae04fa6Smrg         proper tools for further handling them.  Check the \`README' file,
3538ae04fa6Smrg         it often tells you about the needed prerequisites for installing
3548ae04fa6Smrg         this package.  You may also peek at any GNU archive site, in case
3558ae04fa6Smrg         some other package would contain this missing \`$1' program."
3568ae04fa6Smrg    exit 1
3578ae04fa6Smrg    ;;
3588ae04fa6Smrgesac
3598ae04fa6Smrg
3608ae04fa6Smrgexit 0
3618ae04fa6Smrg
3628ae04fa6Smrg# Local variables:
3638ae04fa6Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
3648ae04fa6Smrg# time-stamp-start: "scriptversion="
3658ae04fa6Smrg# time-stamp-format: "%:y-%02m-%02d.%02H"
3668ae04fa6Smrg# time-stamp-end: "$"
3678ae04fa6Smrg# End:
368