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