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