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