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