missing revision 8512f934
14d9b34d9Smrg#! /bin/sh
24d9b34d9Smrg# Common stub for a few missing GNU programs while installing.
34d9b34d9Smrg
48512f934Smrgscriptversion=2009-04-28.21; # UTC
54d9b34d9Smrg
68512f934Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
78512f934Smrg# 2008, 2009 Free Software Foundation, Inc.
84d9b34d9Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
94d9b34d9Smrg
104d9b34d9Smrg# This program is free software; you can redistribute it and/or modify
114d9b34d9Smrg# it under the terms of the GNU General Public License as published by
124d9b34d9Smrg# the Free Software Foundation; either version 2, or (at your option)
134d9b34d9Smrg# any later version.
144d9b34d9Smrg
154d9b34d9Smrg# This program is distributed in the hope that it will be useful,
164d9b34d9Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
174d9b34d9Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
184d9b34d9Smrg# GNU General Public License for more details.
194d9b34d9Smrg
204d9b34d9Smrg# You should have received a copy of the GNU General Public License
218512f934Smrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
224d9b34d9Smrg
234d9b34d9Smrg# As a special exception to the GNU General Public License, if you
244d9b34d9Smrg# distribute this file as part of a program that contains a
254d9b34d9Smrg# configuration script generated by Autoconf, you may include it under
264d9b34d9Smrg# the same distribution terms that you use for the rest of that program.
274d9b34d9Smrg
284d9b34d9Smrgif test $# -eq 0; then
294d9b34d9Smrg  echo 1>&2 "Try \`$0 --help' for more information"
304d9b34d9Smrg  exit 1
314d9b34d9Smrgfi
324d9b34d9Smrg
334d9b34d9Smrgrun=:
344d9b34d9Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
354d9b34d9Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
364d9b34d9Smrg
374d9b34d9Smrg# In the cases where this matters, `missing' is being run in the
384d9b34d9Smrg# srcdir already.
394d9b34d9Smrgif test -f configure.ac; then
404d9b34d9Smrg  configure_ac=configure.ac
414d9b34d9Smrgelse
424d9b34d9Smrg  configure_ac=configure.in
434d9b34d9Smrgfi
444d9b34d9Smrg
454d9b34d9Smrgmsg="missing on your system"
464d9b34d9Smrg
474d9b34d9Smrgcase $1 in
484d9b34d9Smrg--run)
494d9b34d9Smrg  # Try to run requested program, and just exit if it succeeds.
504d9b34d9Smrg  run=
514d9b34d9Smrg  shift
524d9b34d9Smrg  "$@" && exit 0
534d9b34d9Smrg  # Exit code 63 means version mismatch.  This often happens
544d9b34d9Smrg  # when the user try to use an ancient version of a tool on
554d9b34d9Smrg  # a file that requires a minimum version.  In this case we
564d9b34d9Smrg  # we should proceed has if the program had been absent, or
574d9b34d9Smrg  # if --run hadn't been passed.
584d9b34d9Smrg  if test $? = 63; then
594d9b34d9Smrg    run=:
604d9b34d9Smrg    msg="probably too old"
614d9b34d9Smrg  fi
624d9b34d9Smrg  ;;
634d9b34d9Smrg
644d9b34d9Smrg  -h|--h|--he|--hel|--help)
654d9b34d9Smrg    echo "\
664d9b34d9Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
674d9b34d9Smrg
684d9b34d9SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
694d9b34d9Smrgerror status if there is no known handling for PROGRAM.
704d9b34d9Smrg
714d9b34d9SmrgOptions:
724d9b34d9Smrg  -h, --help      display this help and exit
734d9b34d9Smrg  -v, --version   output version information and exit
744d9b34d9Smrg  --run           try to run the given command, and emulate it if it fails
754d9b34d9Smrg
764d9b34d9SmrgSupported PROGRAM values:
774d9b34d9Smrg  aclocal      touch file \`aclocal.m4'
784d9b34d9Smrg  autoconf     touch file \`configure'
794d9b34d9Smrg  autoheader   touch file \`config.h.in'
804d9b34d9Smrg  autom4te     touch the output file, or create a stub one
814d9b34d9Smrg  automake     touch all \`Makefile.in' files
824d9b34d9Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
834d9b34d9Smrg  flex         create \`lex.yy.c', if possible, from existing .c
844d9b34d9Smrg  help2man     touch the output file
854d9b34d9Smrg  lex          create \`lex.yy.c', if possible, from existing .c
864d9b34d9Smrg  makeinfo     touch the output file
874d9b34d9Smrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
884d9b34d9Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
894d9b34d9Smrg
908512f934SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
918512f934Smrg\`g' are ignored when checking the name.
928512f934Smrg
934d9b34d9SmrgSend bug reports to <bug-automake@gnu.org>."
944d9b34d9Smrg    exit $?
954d9b34d9Smrg    ;;
964d9b34d9Smrg
974d9b34d9Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
984d9b34d9Smrg    echo "missing $scriptversion (GNU Automake)"
994d9b34d9Smrg    exit $?
1004d9b34d9Smrg    ;;
1014d9b34d9Smrg
1024d9b34d9Smrg  -*)
1034d9b34d9Smrg    echo 1>&2 "$0: Unknown \`$1' option"
1044d9b34d9Smrg    echo 1>&2 "Try \`$0 --help' for more information"
1054d9b34d9Smrg    exit 1
1064d9b34d9Smrg    ;;
1074d9b34d9Smrg
1084d9b34d9Smrgesac
1094d9b34d9Smrg
1108512f934Smrg# normalize program name to check for.
1118512f934Smrgprogram=`echo "$1" | sed '
1128512f934Smrg  s/^gnu-//; t
1138512f934Smrg  s/^gnu//; t
1148512f934Smrg  s/^g//; t'`
1158512f934Smrg
1164d9b34d9Smrg# Now exit if we have it, but it failed.  Also exit now if we
1174d9b34d9Smrg# don't have it and --version was passed (most likely to detect
1188512f934Smrg# the program).  This is about non-GNU programs, so use $1 not
1198512f934Smrg# $program.
1204d9b34d9Smrgcase $1 in
1218512f934Smrg  lex*|yacc*)
1224d9b34d9Smrg    # Not GNU programs, they don't have --version.
1234d9b34d9Smrg    ;;
1244d9b34d9Smrg
1258512f934Smrg  tar*)
1264d9b34d9Smrg    if test -n "$run"; then
1274d9b34d9Smrg       echo 1>&2 "ERROR: \`tar' requires --run"
1284d9b34d9Smrg       exit 1
1294d9b34d9Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1304d9b34d9Smrg       exit 1
1314d9b34d9Smrg    fi
1324d9b34d9Smrg    ;;
1334d9b34d9Smrg
1344d9b34d9Smrg  *)
1354d9b34d9Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1364d9b34d9Smrg       # We have it, but it failed.
1374d9b34d9Smrg       exit 1
1384d9b34d9Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1394d9b34d9Smrg       # Could not run --version or --help.  This is probably someone
1404d9b34d9Smrg       # running `$TOOL --version' or `$TOOL --help' to check whether
1414d9b34d9Smrg       # $TOOL exists and not knowing $TOOL uses missing.
1424d9b34d9Smrg       exit 1
1434d9b34d9Smrg    fi
1444d9b34d9Smrg    ;;
1454d9b34d9Smrgesac
1464d9b34d9Smrg
1474d9b34d9Smrg# If it does not exist, or fails to run (possibly an outdated version),
1484d9b34d9Smrg# try to emulate it.
1498512f934Smrgcase $program in
1504d9b34d9Smrg  aclocal*)
1514d9b34d9Smrg    echo 1>&2 "\
1524d9b34d9SmrgWARNING: \`$1' is $msg.  You should only need it if
1534d9b34d9Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
1544d9b34d9Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
1554d9b34d9Smrg         any GNU archive site."
1564d9b34d9Smrg    touch aclocal.m4
1574d9b34d9Smrg    ;;
1584d9b34d9Smrg
1598512f934Smrg  autoconf*)
1604d9b34d9Smrg    echo 1>&2 "\
1614d9b34d9SmrgWARNING: \`$1' is $msg.  You should only need it if
1624d9b34d9Smrg         you modified \`${configure_ac}'.  You might want to install the
1634d9b34d9Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1644d9b34d9Smrg         archive site."
1654d9b34d9Smrg    touch configure
1664d9b34d9Smrg    ;;
1674d9b34d9Smrg
1688512f934Smrg  autoheader*)
1694d9b34d9Smrg    echo 1>&2 "\
1704d9b34d9SmrgWARNING: \`$1' is $msg.  You should only need it if
1714d9b34d9Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1724d9b34d9Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1734d9b34d9Smrg         from any GNU archive site."
1744d9b34d9Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1754d9b34d9Smrg    test -z "$files" && files="config.h"
1764d9b34d9Smrg    touch_files=
1774d9b34d9Smrg    for f in $files; do
1784d9b34d9Smrg      case $f in
1794d9b34d9Smrg      *:*) touch_files="$touch_files "`echo "$f" |
1804d9b34d9Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1814d9b34d9Smrg      *) touch_files="$touch_files $f.in";;
1824d9b34d9Smrg      esac
1834d9b34d9Smrg    done
1844d9b34d9Smrg    touch $touch_files
1854d9b34d9Smrg    ;;
1864d9b34d9Smrg
1874d9b34d9Smrg  automake*)
1884d9b34d9Smrg    echo 1>&2 "\
1894d9b34d9SmrgWARNING: \`$1' is $msg.  You should only need it if
1904d9b34d9Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1914d9b34d9Smrg         You might want to install the \`Automake' and \`Perl' packages.
1924d9b34d9Smrg         Grab them from any GNU archive site."
1934d9b34d9Smrg    find . -type f -name Makefile.am -print |
1944d9b34d9Smrg	   sed 's/\.am$/.in/' |
1954d9b34d9Smrg	   while read f; do touch "$f"; done
1964d9b34d9Smrg    ;;
1974d9b34d9Smrg
1988512f934Smrg  autom4te*)
1994d9b34d9Smrg    echo 1>&2 "\
2004d9b34d9SmrgWARNING: \`$1' is needed, but is $msg.
2014d9b34d9Smrg         You might have modified some files without having the
2024d9b34d9Smrg         proper tools for further handling them.
2034d9b34d9Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
2044d9b34d9Smrg         archive site."
2054d9b34d9Smrg
2064d9b34d9Smrg    file=`echo "$*" | sed -n "$sed_output"`
2074d9b34d9Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2084d9b34d9Smrg    if test -f "$file"; then
2094d9b34d9Smrg	touch $file
2104d9b34d9Smrg    else
2114d9b34d9Smrg	test -z "$file" || exec >$file
2124d9b34d9Smrg	echo "#! /bin/sh"
2134d9b34d9Smrg	echo "# Created by GNU Automake missing as a replacement of"
2144d9b34d9Smrg	echo "#  $ $@"
2154d9b34d9Smrg	echo "exit 0"
2164d9b34d9Smrg	chmod +x $file
2174d9b34d9Smrg	exit 1
2184d9b34d9Smrg    fi
2194d9b34d9Smrg    ;;
2204d9b34d9Smrg
2218512f934Smrg  bison*|yacc*)
2224d9b34d9Smrg    echo 1>&2 "\
2234d9b34d9SmrgWARNING: \`$1' $msg.  You should only need it if
2244d9b34d9Smrg         you modified a \`.y' file.  You may need the \`Bison' package
2254d9b34d9Smrg         in order for those modifications to take effect.  You can get
2264d9b34d9Smrg         \`Bison' from any GNU archive site."
2274d9b34d9Smrg    rm -f y.tab.c y.tab.h
2284d9b34d9Smrg    if test $# -ne 1; then
2294d9b34d9Smrg        eval LASTARG="\${$#}"
2304d9b34d9Smrg	case $LASTARG in
2314d9b34d9Smrg	*.y)
2324d9b34d9Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
2334d9b34d9Smrg	    if test -f "$SRCFILE"; then
2344d9b34d9Smrg	         cp "$SRCFILE" y.tab.c
2354d9b34d9Smrg	    fi
2364d9b34d9Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2374d9b34d9Smrg	    if test -f "$SRCFILE"; then
2384d9b34d9Smrg	         cp "$SRCFILE" y.tab.h
2394d9b34d9Smrg	    fi
2404d9b34d9Smrg	  ;;
2414d9b34d9Smrg	esac
2424d9b34d9Smrg    fi
2434d9b34d9Smrg    if test ! -f y.tab.h; then
2444d9b34d9Smrg	echo >y.tab.h
2454d9b34d9Smrg    fi
2464d9b34d9Smrg    if test ! -f y.tab.c; then
2474d9b34d9Smrg	echo 'main() { return 0; }' >y.tab.c
2484d9b34d9Smrg    fi
2494d9b34d9Smrg    ;;
2504d9b34d9Smrg
2518512f934Smrg  lex*|flex*)
2524d9b34d9Smrg    echo 1>&2 "\
2534d9b34d9SmrgWARNING: \`$1' is $msg.  You should only need it if
2544d9b34d9Smrg         you modified a \`.l' file.  You may need the \`Flex' package
2554d9b34d9Smrg         in order for those modifications to take effect.  You can get
2564d9b34d9Smrg         \`Flex' from any GNU archive site."
2574d9b34d9Smrg    rm -f lex.yy.c
2584d9b34d9Smrg    if test $# -ne 1; then
2594d9b34d9Smrg        eval LASTARG="\${$#}"
2604d9b34d9Smrg	case $LASTARG in
2614d9b34d9Smrg	*.l)
2624d9b34d9Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2634d9b34d9Smrg	    if test -f "$SRCFILE"; then
2644d9b34d9Smrg	         cp "$SRCFILE" lex.yy.c
2654d9b34d9Smrg	    fi
2664d9b34d9Smrg	  ;;
2674d9b34d9Smrg	esac
2684d9b34d9Smrg    fi
2694d9b34d9Smrg    if test ! -f lex.yy.c; then
2704d9b34d9Smrg	echo 'main() { return 0; }' >lex.yy.c
2714d9b34d9Smrg    fi
2724d9b34d9Smrg    ;;
2734d9b34d9Smrg
2748512f934Smrg  help2man*)
2754d9b34d9Smrg    echo 1>&2 "\
2764d9b34d9SmrgWARNING: \`$1' is $msg.  You should only need it if
2774d9b34d9Smrg	 you modified a dependency of a manual page.  You may need the
2784d9b34d9Smrg	 \`Help2man' package in order for those modifications to take
2794d9b34d9Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
2804d9b34d9Smrg
2814d9b34d9Smrg    file=`echo "$*" | sed -n "$sed_output"`
2824d9b34d9Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2834d9b34d9Smrg    if test -f "$file"; then
2844d9b34d9Smrg	touch $file
2854d9b34d9Smrg    else
2864d9b34d9Smrg	test -z "$file" || exec >$file
2874d9b34d9Smrg	echo ".ab help2man is required to generate this page"
2888512f934Smrg	exit $?
2894d9b34d9Smrg    fi
2904d9b34d9Smrg    ;;
2914d9b34d9Smrg
2928512f934Smrg  makeinfo*)
2934d9b34d9Smrg    echo 1>&2 "\
2944d9b34d9SmrgWARNING: \`$1' is $msg.  You should only need it if
2954d9b34d9Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
2964d9b34d9Smrg         indirectly affecting the aspect of the manual.  The spurious
2974d9b34d9Smrg         call might also be the consequence of using a buggy \`make' (AIX,
2984d9b34d9Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
2994d9b34d9Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
3004d9b34d9Smrg    # The file to touch is that specified with -o ...
3014d9b34d9Smrg    file=`echo "$*" | sed -n "$sed_output"`
3024d9b34d9Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
3034d9b34d9Smrg    if test -z "$file"; then
3044d9b34d9Smrg      # ... or it is the one specified with @setfilename ...
3054d9b34d9Smrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
3064d9b34d9Smrg      file=`sed -n '
3074d9b34d9Smrg	/^@setfilename/{
3084d9b34d9Smrg	  s/.* \([^ ]*\) *$/\1/
3094d9b34d9Smrg	  p
3104d9b34d9Smrg	  q
3114d9b34d9Smrg	}' $infile`
3124d9b34d9Smrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
3134d9b34d9Smrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
3144d9b34d9Smrg    fi
3154d9b34d9Smrg    # If the file does not exist, the user really needs makeinfo;
3164d9b34d9Smrg    # let's fail without touching anything.
3174d9b34d9Smrg    test -f $file || exit 1
3184d9b34d9Smrg    touch $file
3194d9b34d9Smrg    ;;
3204d9b34d9Smrg
3218512f934Smrg  tar*)
3224d9b34d9Smrg    shift
3234d9b34d9Smrg
3244d9b34d9Smrg    # We have already tried tar in the generic part.
3254d9b34d9Smrg    # Look for gnutar/gtar before invocation to avoid ugly error
3264d9b34d9Smrg    # messages.
3274d9b34d9Smrg    if (gnutar --version > /dev/null 2>&1); then
3284d9b34d9Smrg       gnutar "$@" && exit 0
3294d9b34d9Smrg    fi
3304d9b34d9Smrg    if (gtar --version > /dev/null 2>&1); then
3314d9b34d9Smrg       gtar "$@" && exit 0
3324d9b34d9Smrg    fi
3334d9b34d9Smrg    firstarg="$1"
3344d9b34d9Smrg    if shift; then
3354d9b34d9Smrg	case $firstarg in
3364d9b34d9Smrg	*o*)
3374d9b34d9Smrg	    firstarg=`echo "$firstarg" | sed s/o//`
3384d9b34d9Smrg	    tar "$firstarg" "$@" && exit 0
3394d9b34d9Smrg	    ;;
3404d9b34d9Smrg	esac
3414d9b34d9Smrg	case $firstarg in
3424d9b34d9Smrg	*h*)
3434d9b34d9Smrg	    firstarg=`echo "$firstarg" | sed s/h//`
3444d9b34d9Smrg	    tar "$firstarg" "$@" && exit 0
3454d9b34d9Smrg	    ;;
3464d9b34d9Smrg	esac
3474d9b34d9Smrg    fi
3484d9b34d9Smrg
3494d9b34d9Smrg    echo 1>&2 "\
3504d9b34d9SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
3514d9b34d9Smrg         You may want to install GNU tar or Free paxutils, or check the
3524d9b34d9Smrg         command line arguments."
3534d9b34d9Smrg    exit 1
3544d9b34d9Smrg    ;;
3554d9b34d9Smrg
3564d9b34d9Smrg  *)
3574d9b34d9Smrg    echo 1>&2 "\
3584d9b34d9SmrgWARNING: \`$1' is needed, and is $msg.
3594d9b34d9Smrg         You might have modified some files without having the
3604d9b34d9Smrg         proper tools for further handling them.  Check the \`README' file,
3614d9b34d9Smrg         it often tells you about the needed prerequisites for installing
3624d9b34d9Smrg         this package.  You may also peek at any GNU archive site, in case
3634d9b34d9Smrg         some other package would contain this missing \`$1' program."
3644d9b34d9Smrg    exit 1
3654d9b34d9Smrg    ;;
3664d9b34d9Smrgesac
3674d9b34d9Smrg
3684d9b34d9Smrgexit 0
3694d9b34d9Smrg
3704d9b34d9Smrg# Local variables:
3714d9b34d9Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
3724d9b34d9Smrg# time-stamp-start: "scriptversion="
3734d9b34d9Smrg# time-stamp-format: "%:y-%02m-%02d.%02H"
3748512f934Smrg# time-stamp-time-zone: "UTC"
3758512f934Smrg# time-stamp-end: "; # UTC"
3764d9b34d9Smrg# End:
377