missing revision 7366012a
17a0395d0Smrg#! /bin/sh
27a0395d0Smrg# Common stub for a few missing GNU programs while installing.
37a0395d0Smrg
47366012aSmrgscriptversion=2009-04-28.21; # UTC
57a0395d0Smrg
67366012aSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
77366012aSmrg# 2008, 2009 Free Software Foundation, Inc.
87a0395d0Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
97a0395d0Smrg
107a0395d0Smrg# This program is free software; you can redistribute it and/or modify
117a0395d0Smrg# it under the terms of the GNU General Public License as published by
127a0395d0Smrg# the Free Software Foundation; either version 2, or (at your option)
137a0395d0Smrg# any later version.
147a0395d0Smrg
157a0395d0Smrg# This program is distributed in the hope that it will be useful,
167a0395d0Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
177a0395d0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
187a0395d0Smrg# GNU General Public License for more details.
197a0395d0Smrg
207a0395d0Smrg# You should have received a copy of the GNU General Public License
217366012aSmrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
227a0395d0Smrg
237a0395d0Smrg# As a special exception to the GNU General Public License, if you
247a0395d0Smrg# distribute this file as part of a program that contains a
257a0395d0Smrg# configuration script generated by Autoconf, you may include it under
267a0395d0Smrg# the same distribution terms that you use for the rest of that program.
277a0395d0Smrg
287a0395d0Smrgif test $# -eq 0; then
297a0395d0Smrg  echo 1>&2 "Try \`$0 --help' for more information"
307a0395d0Smrg  exit 1
317a0395d0Smrgfi
327a0395d0Smrg
337a0395d0Smrgrun=:
347a0395d0Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
357a0395d0Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
367a0395d0Smrg
377a0395d0Smrg# In the cases where this matters, `missing' is being run in the
387a0395d0Smrg# srcdir already.
397a0395d0Smrgif test -f configure.ac; then
407a0395d0Smrg  configure_ac=configure.ac
417a0395d0Smrgelse
427a0395d0Smrg  configure_ac=configure.in
437a0395d0Smrgfi
447a0395d0Smrg
457a0395d0Smrgmsg="missing on your system"
467a0395d0Smrg
477a0395d0Smrgcase $1 in
487a0395d0Smrg--run)
497a0395d0Smrg  # Try to run requested program, and just exit if it succeeds.
507a0395d0Smrg  run=
517a0395d0Smrg  shift
527a0395d0Smrg  "$@" && exit 0
537a0395d0Smrg  # Exit code 63 means version mismatch.  This often happens
547a0395d0Smrg  # when the user try to use an ancient version of a tool on
557a0395d0Smrg  # a file that requires a minimum version.  In this case we
567a0395d0Smrg  # we should proceed has if the program had been absent, or
577a0395d0Smrg  # if --run hadn't been passed.
587a0395d0Smrg  if test $? = 63; then
597a0395d0Smrg    run=:
607a0395d0Smrg    msg="probably too old"
617a0395d0Smrg  fi
627a0395d0Smrg  ;;
637a0395d0Smrg
647a0395d0Smrg  -h|--h|--he|--hel|--help)
657a0395d0Smrg    echo "\
667a0395d0Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
677a0395d0Smrg
687a0395d0SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
697a0395d0Smrgerror status if there is no known handling for PROGRAM.
707a0395d0Smrg
717a0395d0SmrgOptions:
727a0395d0Smrg  -h, --help      display this help and exit
737a0395d0Smrg  -v, --version   output version information and exit
747a0395d0Smrg  --run           try to run the given command, and emulate it if it fails
757a0395d0Smrg
767a0395d0SmrgSupported PROGRAM values:
777a0395d0Smrg  aclocal      touch file \`aclocal.m4'
787a0395d0Smrg  autoconf     touch file \`configure'
797a0395d0Smrg  autoheader   touch file \`config.h.in'
807a0395d0Smrg  autom4te     touch the output file, or create a stub one
817a0395d0Smrg  automake     touch all \`Makefile.in' files
827a0395d0Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
837a0395d0Smrg  flex         create \`lex.yy.c', if possible, from existing .c
847a0395d0Smrg  help2man     touch the output file
857a0395d0Smrg  lex          create \`lex.yy.c', if possible, from existing .c
867a0395d0Smrg  makeinfo     touch the output file
877a0395d0Smrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
887a0395d0Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
897a0395d0Smrg
907366012aSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
917366012aSmrg\`g' are ignored when checking the name.
927366012aSmrg
937a0395d0SmrgSend bug reports to <bug-automake@gnu.org>."
947a0395d0Smrg    exit $?
957a0395d0Smrg    ;;
967a0395d0Smrg
977a0395d0Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
987a0395d0Smrg    echo "missing $scriptversion (GNU Automake)"
997a0395d0Smrg    exit $?
1007a0395d0Smrg    ;;
1017a0395d0Smrg
1027a0395d0Smrg  -*)
1037a0395d0Smrg    echo 1>&2 "$0: Unknown \`$1' option"
1047a0395d0Smrg    echo 1>&2 "Try \`$0 --help' for more information"
1057a0395d0Smrg    exit 1
1067a0395d0Smrg    ;;
1077a0395d0Smrg
1087a0395d0Smrgesac
1097a0395d0Smrg
1107366012aSmrg# normalize program name to check for.
1117366012aSmrgprogram=`echo "$1" | sed '
1127366012aSmrg  s/^gnu-//; t
1137366012aSmrg  s/^gnu//; t
1147366012aSmrg  s/^g//; t'`
1157366012aSmrg
1167a0395d0Smrg# Now exit if we have it, but it failed.  Also exit now if we
1177a0395d0Smrg# don't have it and --version was passed (most likely to detect
1187366012aSmrg# the program).  This is about non-GNU programs, so use $1 not
1197366012aSmrg# $program.
1207a0395d0Smrgcase $1 in
1217366012aSmrg  lex*|yacc*)
1227a0395d0Smrg    # Not GNU programs, they don't have --version.
1237a0395d0Smrg    ;;
1247a0395d0Smrg
1257366012aSmrg  tar*)
1267a0395d0Smrg    if test -n "$run"; then
1277a0395d0Smrg       echo 1>&2 "ERROR: \`tar' requires --run"
1287a0395d0Smrg       exit 1
1297a0395d0Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1307a0395d0Smrg       exit 1
1317a0395d0Smrg    fi
1327a0395d0Smrg    ;;
1337a0395d0Smrg
1347a0395d0Smrg  *)
1357a0395d0Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1367a0395d0Smrg       # We have it, but it failed.
1377a0395d0Smrg       exit 1
1387a0395d0Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1397a0395d0Smrg       # Could not run --version or --help.  This is probably someone
1407a0395d0Smrg       # running `$TOOL --version' or `$TOOL --help' to check whether
1417a0395d0Smrg       # $TOOL exists and not knowing $TOOL uses missing.
1427a0395d0Smrg       exit 1
1437a0395d0Smrg    fi
1447a0395d0Smrg    ;;
1457a0395d0Smrgesac
1467a0395d0Smrg
1477a0395d0Smrg# If it does not exist, or fails to run (possibly an outdated version),
1487a0395d0Smrg# try to emulate it.
1497366012aSmrgcase $program in
1507a0395d0Smrg  aclocal*)
1517a0395d0Smrg    echo 1>&2 "\
1527a0395d0SmrgWARNING: \`$1' is $msg.  You should only need it if
1537a0395d0Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
1547a0395d0Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
1557a0395d0Smrg         any GNU archive site."
1567a0395d0Smrg    touch aclocal.m4
1577a0395d0Smrg    ;;
1587a0395d0Smrg
1597366012aSmrg  autoconf*)
1607a0395d0Smrg    echo 1>&2 "\
1617a0395d0SmrgWARNING: \`$1' is $msg.  You should only need it if
1627a0395d0Smrg         you modified \`${configure_ac}'.  You might want to install the
1637a0395d0Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1647a0395d0Smrg         archive site."
1657a0395d0Smrg    touch configure
1667a0395d0Smrg    ;;
1677a0395d0Smrg
1687366012aSmrg  autoheader*)
1697a0395d0Smrg    echo 1>&2 "\
1707a0395d0SmrgWARNING: \`$1' is $msg.  You should only need it if
1717a0395d0Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1727a0395d0Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1737a0395d0Smrg         from any GNU archive site."
1747a0395d0Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1757a0395d0Smrg    test -z "$files" && files="config.h"
1767a0395d0Smrg    touch_files=
1777a0395d0Smrg    for f in $files; do
1787a0395d0Smrg      case $f in
1797a0395d0Smrg      *:*) touch_files="$touch_files "`echo "$f" |
1807a0395d0Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1817a0395d0Smrg      *) touch_files="$touch_files $f.in";;
1827a0395d0Smrg      esac
1837a0395d0Smrg    done
1847a0395d0Smrg    touch $touch_files
1857a0395d0Smrg    ;;
1867a0395d0Smrg
1877a0395d0Smrg  automake*)
1887a0395d0Smrg    echo 1>&2 "\
1897a0395d0SmrgWARNING: \`$1' is $msg.  You should only need it if
1907a0395d0Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1917a0395d0Smrg         You might want to install the \`Automake' and \`Perl' packages.
1927a0395d0Smrg         Grab them from any GNU archive site."
1937a0395d0Smrg    find . -type f -name Makefile.am -print |
1947a0395d0Smrg	   sed 's/\.am$/.in/' |
1957a0395d0Smrg	   while read f; do touch "$f"; done
1967a0395d0Smrg    ;;
1977a0395d0Smrg
1987366012aSmrg  autom4te*)
1997a0395d0Smrg    echo 1>&2 "\
2007a0395d0SmrgWARNING: \`$1' is needed, but is $msg.
2017a0395d0Smrg         You might have modified some files without having the
2027a0395d0Smrg         proper tools for further handling them.
2037a0395d0Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
2047a0395d0Smrg         archive site."
2057a0395d0Smrg
2067a0395d0Smrg    file=`echo "$*" | sed -n "$sed_output"`
2077a0395d0Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2087a0395d0Smrg    if test -f "$file"; then
2097a0395d0Smrg	touch $file
2107a0395d0Smrg    else
2117a0395d0Smrg	test -z "$file" || exec >$file
2127a0395d0Smrg	echo "#! /bin/sh"
2137a0395d0Smrg	echo "# Created by GNU Automake missing as a replacement of"
2147a0395d0Smrg	echo "#  $ $@"
2157a0395d0Smrg	echo "exit 0"
2167a0395d0Smrg	chmod +x $file
2177a0395d0Smrg	exit 1
2187a0395d0Smrg    fi
2197a0395d0Smrg    ;;
2207a0395d0Smrg
2217366012aSmrg  bison*|yacc*)
2227a0395d0Smrg    echo 1>&2 "\
2237a0395d0SmrgWARNING: \`$1' $msg.  You should only need it if
2247a0395d0Smrg         you modified a \`.y' file.  You may need the \`Bison' package
2257a0395d0Smrg         in order for those modifications to take effect.  You can get
2267a0395d0Smrg         \`Bison' from any GNU archive site."
2277a0395d0Smrg    rm -f y.tab.c y.tab.h
2287a0395d0Smrg    if test $# -ne 1; then
2297a0395d0Smrg        eval LASTARG="\${$#}"
2307a0395d0Smrg	case $LASTARG in
2317a0395d0Smrg	*.y)
2327a0395d0Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
2337a0395d0Smrg	    if test -f "$SRCFILE"; then
2347a0395d0Smrg	         cp "$SRCFILE" y.tab.c
2357a0395d0Smrg	    fi
2367a0395d0Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2377a0395d0Smrg	    if test -f "$SRCFILE"; then
2387a0395d0Smrg	         cp "$SRCFILE" y.tab.h
2397a0395d0Smrg	    fi
2407a0395d0Smrg	  ;;
2417a0395d0Smrg	esac
2427a0395d0Smrg    fi
2437a0395d0Smrg    if test ! -f y.tab.h; then
2447a0395d0Smrg	echo >y.tab.h
2457a0395d0Smrg    fi
2467a0395d0Smrg    if test ! -f y.tab.c; then
2477a0395d0Smrg	echo 'main() { return 0; }' >y.tab.c
2487a0395d0Smrg    fi
2497a0395d0Smrg    ;;
2507a0395d0Smrg
2517366012aSmrg  lex*|flex*)
2527a0395d0Smrg    echo 1>&2 "\
2537a0395d0SmrgWARNING: \`$1' is $msg.  You should only need it if
2547a0395d0Smrg         you modified a \`.l' file.  You may need the \`Flex' package
2557a0395d0Smrg         in order for those modifications to take effect.  You can get
2567a0395d0Smrg         \`Flex' from any GNU archive site."
2577a0395d0Smrg    rm -f lex.yy.c
2587a0395d0Smrg    if test $# -ne 1; then
2597a0395d0Smrg        eval LASTARG="\${$#}"
2607a0395d0Smrg	case $LASTARG in
2617a0395d0Smrg	*.l)
2627a0395d0Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2637a0395d0Smrg	    if test -f "$SRCFILE"; then
2647a0395d0Smrg	         cp "$SRCFILE" lex.yy.c
2657a0395d0Smrg	    fi
2667a0395d0Smrg	  ;;
2677a0395d0Smrg	esac
2687a0395d0Smrg    fi
2697a0395d0Smrg    if test ! -f lex.yy.c; then
2707a0395d0Smrg	echo 'main() { return 0; }' >lex.yy.c
2717a0395d0Smrg    fi
2727a0395d0Smrg    ;;
2737a0395d0Smrg
2747366012aSmrg  help2man*)
2757a0395d0Smrg    echo 1>&2 "\
2767a0395d0SmrgWARNING: \`$1' is $msg.  You should only need it if
2777a0395d0Smrg	 you modified a dependency of a manual page.  You may need the
2787a0395d0Smrg	 \`Help2man' package in order for those modifications to take
2797a0395d0Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
2807a0395d0Smrg
2817a0395d0Smrg    file=`echo "$*" | sed -n "$sed_output"`
2827a0395d0Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2837a0395d0Smrg    if test -f "$file"; then
2847a0395d0Smrg	touch $file
2857a0395d0Smrg    else
2867a0395d0Smrg	test -z "$file" || exec >$file
2877a0395d0Smrg	echo ".ab help2man is required to generate this page"
2887366012aSmrg	exit $?
2897a0395d0Smrg    fi
2907a0395d0Smrg    ;;
2917a0395d0Smrg
2927366012aSmrg  makeinfo*)
2937a0395d0Smrg    echo 1>&2 "\
2947a0395d0SmrgWARNING: \`$1' is $msg.  You should only need it if
2957a0395d0Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
2967a0395d0Smrg         indirectly affecting the aspect of the manual.  The spurious
2977a0395d0Smrg         call might also be the consequence of using a buggy \`make' (AIX,
2987a0395d0Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
2997a0395d0Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
3007a0395d0Smrg    # The file to touch is that specified with -o ...
3017a0395d0Smrg    file=`echo "$*" | sed -n "$sed_output"`
3027a0395d0Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
3037a0395d0Smrg    if test -z "$file"; then
3047a0395d0Smrg      # ... or it is the one specified with @setfilename ...
3057a0395d0Smrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
3067a0395d0Smrg      file=`sed -n '
3077a0395d0Smrg	/^@setfilename/{
3087a0395d0Smrg	  s/.* \([^ ]*\) *$/\1/
3097a0395d0Smrg	  p
3107a0395d0Smrg	  q
3117a0395d0Smrg	}' $infile`
3127a0395d0Smrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
3137a0395d0Smrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
3147a0395d0Smrg    fi
3157a0395d0Smrg    # If the file does not exist, the user really needs makeinfo;
3167a0395d0Smrg    # let's fail without touching anything.
3177a0395d0Smrg    test -f $file || exit 1
3187a0395d0Smrg    touch $file
3197a0395d0Smrg    ;;
3207a0395d0Smrg
3217366012aSmrg  tar*)
3227a0395d0Smrg    shift
3237a0395d0Smrg
3247a0395d0Smrg    # We have already tried tar in the generic part.
3257a0395d0Smrg    # Look for gnutar/gtar before invocation to avoid ugly error
3267a0395d0Smrg    # messages.
3277a0395d0Smrg    if (gnutar --version > /dev/null 2>&1); then
3287a0395d0Smrg       gnutar "$@" && exit 0
3297a0395d0Smrg    fi
3307a0395d0Smrg    if (gtar --version > /dev/null 2>&1); then
3317a0395d0Smrg       gtar "$@" && exit 0
3327a0395d0Smrg    fi
3337a0395d0Smrg    firstarg="$1"
3347a0395d0Smrg    if shift; then
3357a0395d0Smrg	case $firstarg in
3367a0395d0Smrg	*o*)
3377a0395d0Smrg	    firstarg=`echo "$firstarg" | sed s/o//`
3387a0395d0Smrg	    tar "$firstarg" "$@" && exit 0
3397a0395d0Smrg	    ;;
3407a0395d0Smrg	esac
3417a0395d0Smrg	case $firstarg in
3427a0395d0Smrg	*h*)
3437a0395d0Smrg	    firstarg=`echo "$firstarg" | sed s/h//`
3447a0395d0Smrg	    tar "$firstarg" "$@" && exit 0
3457a0395d0Smrg	    ;;
3467a0395d0Smrg	esac
3477a0395d0Smrg    fi
3487a0395d0Smrg
3497a0395d0Smrg    echo 1>&2 "\
3507a0395d0SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
3517a0395d0Smrg         You may want to install GNU tar or Free paxutils, or check the
3527a0395d0Smrg         command line arguments."
3537a0395d0Smrg    exit 1
3547a0395d0Smrg    ;;
3557a0395d0Smrg
3567a0395d0Smrg  *)
3577a0395d0Smrg    echo 1>&2 "\
3587a0395d0SmrgWARNING: \`$1' is needed, and is $msg.
3597a0395d0Smrg         You might have modified some files without having the
3607a0395d0Smrg         proper tools for further handling them.  Check the \`README' file,
3617a0395d0Smrg         it often tells you about the needed prerequisites for installing
3627a0395d0Smrg         this package.  You may also peek at any GNU archive site, in case
3637a0395d0Smrg         some other package would contain this missing \`$1' program."
3647a0395d0Smrg    exit 1
3657a0395d0Smrg    ;;
3667a0395d0Smrgesac
3677a0395d0Smrg
3687a0395d0Smrgexit 0
3697a0395d0Smrg
3707a0395d0Smrg# Local variables:
3717a0395d0Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
3727a0395d0Smrg# time-stamp-start: "scriptversion="
3737a0395d0Smrg# time-stamp-format: "%:y-%02m-%02d.%02H"
3747366012aSmrg# time-stamp-time-zone: "UTC"
3757366012aSmrg# time-stamp-end: "; # UTC"
3767a0395d0Smrg# End:
377