missing revision 5c10afb9
15c10afb9Smrg#! /bin/sh
25c10afb9Smrg# Common stub for a few missing GNU programs while installing.
35c10afb9Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
45c10afb9Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
55c10afb9Smrg
65c10afb9Smrg# This program is free software; you can redistribute it and/or modify
75c10afb9Smrg# it under the terms of the GNU General Public License as published by
85c10afb9Smrg# the Free Software Foundation; either version 2, or (at your option)
95c10afb9Smrg# any later version.
105c10afb9Smrg
115c10afb9Smrg# This program is distributed in the hope that it will be useful,
125c10afb9Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
135c10afb9Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
145c10afb9Smrg# GNU General Public License for more details.
155c10afb9Smrg
165c10afb9Smrg# You should have received a copy of the GNU General Public License
175c10afb9Smrg# along with this program; if not, write to the Free Software
185c10afb9Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
195c10afb9Smrg# 02111-1307, USA.
205c10afb9Smrg
215c10afb9Smrg# As a special exception to the GNU General Public License, if you
225c10afb9Smrg# distribute this file as part of a program that contains a
235c10afb9Smrg# configuration script generated by Autoconf, you may include it under
245c10afb9Smrg# the same distribution terms that you use for the rest of that program.
255c10afb9Smrg
265c10afb9Smrgif test $# -eq 0; then
275c10afb9Smrg  echo 1>&2 "Try \`$0 --help' for more information"
285c10afb9Smrg  exit 1
295c10afb9Smrgfi
305c10afb9Smrg
315c10afb9Smrgrun=:
325c10afb9Smrg
335c10afb9Smrg# In the cases where this matters, `missing' is being run in the
345c10afb9Smrg# srcdir already.
355c10afb9Smrgif test -f configure.ac; then
365c10afb9Smrg  configure_ac=configure.ac
375c10afb9Smrgelse
385c10afb9Smrg  configure_ac=configure.in
395c10afb9Smrgfi
405c10afb9Smrg
415c10afb9Smrgcase "$1" in
425c10afb9Smrg--run)
435c10afb9Smrg  # Try to run requested program, and just exit if it succeeds.
445c10afb9Smrg  run=
455c10afb9Smrg  shift
465c10afb9Smrg  "$@" && exit 0
475c10afb9Smrg  ;;
485c10afb9Smrgesac
495c10afb9Smrg
505c10afb9Smrg# If it does not exist, or fails to run (possibly an outdated version),
515c10afb9Smrg# try to emulate it.
525c10afb9Smrgcase "$1" in
535c10afb9Smrg
545c10afb9Smrg  -h|--h|--he|--hel|--help)
555c10afb9Smrg    echo "\
565c10afb9Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
575c10afb9Smrg
585c10afb9SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
595c10afb9Smrgerror status if there is no known handling for PROGRAM.
605c10afb9Smrg
615c10afb9SmrgOptions:
625c10afb9Smrg  -h, --help      display this help and exit
635c10afb9Smrg  -v, --version   output version information and exit
645c10afb9Smrg  --run           try to run the given command, and emulate it if it fails
655c10afb9Smrg
665c10afb9SmrgSupported PROGRAM values:
675c10afb9Smrg  aclocal      touch file \`aclocal.m4'
685c10afb9Smrg  autoconf     touch file \`configure'
695c10afb9Smrg  autoheader   touch file \`config.h.in'
705c10afb9Smrg  automake     touch all \`Makefile.in' files
715c10afb9Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
725c10afb9Smrg  flex         create \`lex.yy.c', if possible, from existing .c
735c10afb9Smrg  help2man     touch the output file
745c10afb9Smrg  lex          create \`lex.yy.c', if possible, from existing .c
755c10afb9Smrg  makeinfo     touch the output file
765c10afb9Smrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
775c10afb9Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
785c10afb9Smrg    ;;
795c10afb9Smrg
805c10afb9Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
815c10afb9Smrg    echo "missing 0.4 - GNU automake"
825c10afb9Smrg    ;;
835c10afb9Smrg
845c10afb9Smrg  -*)
855c10afb9Smrg    echo 1>&2 "$0: Unknown \`$1' option"
865c10afb9Smrg    echo 1>&2 "Try \`$0 --help' for more information"
875c10afb9Smrg    exit 1
885c10afb9Smrg    ;;
895c10afb9Smrg
905c10afb9Smrg  aclocal*)
915c10afb9Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
925c10afb9Smrg       # We have it, but it failed.
935c10afb9Smrg       exit 1
945c10afb9Smrg    fi
955c10afb9Smrg
965c10afb9Smrg    echo 1>&2 "\
975c10afb9SmrgWARNING: \`$1' is missing on your system.  You should only need it if
985c10afb9Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
995c10afb9Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
1005c10afb9Smrg         any GNU archive site."
1015c10afb9Smrg    touch aclocal.m4
1025c10afb9Smrg    ;;
1035c10afb9Smrg
1045c10afb9Smrg  autoconf)
1055c10afb9Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1065c10afb9Smrg       # We have it, but it failed.
1075c10afb9Smrg       exit 1
1085c10afb9Smrg    fi
1095c10afb9Smrg
1105c10afb9Smrg    echo 1>&2 "\
1115c10afb9SmrgWARNING: \`$1' is missing on your system.  You should only need it if
1125c10afb9Smrg         you modified \`${configure_ac}'.  You might want to install the
1135c10afb9Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1145c10afb9Smrg         archive site."
1155c10afb9Smrg    touch configure
1165c10afb9Smrg    ;;
1175c10afb9Smrg
1185c10afb9Smrg  autoheader)
1195c10afb9Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1205c10afb9Smrg       # We have it, but it failed.
1215c10afb9Smrg       exit 1
1225c10afb9Smrg    fi
1235c10afb9Smrg
1245c10afb9Smrg    echo 1>&2 "\
1255c10afb9SmrgWARNING: \`$1' is missing on your system.  You should only need it if
1265c10afb9Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1275c10afb9Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1285c10afb9Smrg         from any GNU archive site."
1295c10afb9Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1305c10afb9Smrg    test -z "$files" && files="config.h"
1315c10afb9Smrg    touch_files=
1325c10afb9Smrg    for f in $files; do
1335c10afb9Smrg      case "$f" in
1345c10afb9Smrg      *:*) touch_files="$touch_files "`echo "$f" |
1355c10afb9Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1365c10afb9Smrg      *) touch_files="$touch_files $f.in";;
1375c10afb9Smrg      esac
1385c10afb9Smrg    done
1395c10afb9Smrg    touch $touch_files
1405c10afb9Smrg    ;;
1415c10afb9Smrg
1425c10afb9Smrg  automake*)
1435c10afb9Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1445c10afb9Smrg       # We have it, but it failed.
1455c10afb9Smrg       exit 1
1465c10afb9Smrg    fi
1475c10afb9Smrg
1485c10afb9Smrg    echo 1>&2 "\
1495c10afb9SmrgWARNING: \`$1' is missing on your system.  You should only need it if
1505c10afb9Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1515c10afb9Smrg         You might want to install the \`Automake' and \`Perl' packages.
1525c10afb9Smrg         Grab them from any GNU archive site."
1535c10afb9Smrg    find . -type f -name Makefile.am -print |
1545c10afb9Smrg	   sed 's/\.am$/.in/' |
1555c10afb9Smrg	   while read f; do touch "$f"; done
1565c10afb9Smrg    ;;
1575c10afb9Smrg
1585c10afb9Smrg  autom4te)
1595c10afb9Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1605c10afb9Smrg       # We have it, but it failed.
1615c10afb9Smrg       exit 1
1625c10afb9Smrg    fi
1635c10afb9Smrg
1645c10afb9Smrg    echo 1>&2 "\
1655c10afb9SmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
1665c10afb9Smrg         system.  You might have modified some files without having the
1675c10afb9Smrg         proper tools for further handling them.
1685c10afb9Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
1695c10afb9Smrg         archive site."
1705c10afb9Smrg
1715c10afb9Smrg    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
1725c10afb9Smrg    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
1735c10afb9Smrg    if test -f "$file"; then
1745c10afb9Smrg	touch $file
1755c10afb9Smrg    else
1765c10afb9Smrg	test -z "$file" || exec >$file
1775c10afb9Smrg	echo "#! /bin/sh"
1785c10afb9Smrg	echo "# Created by GNU Automake missing as a replacement of"
1795c10afb9Smrg	echo "#  $ $@"
1805c10afb9Smrg	echo "exit 0"
1815c10afb9Smrg	chmod +x $file
1825c10afb9Smrg	exit 1
1835c10afb9Smrg    fi
1845c10afb9Smrg    ;;
1855c10afb9Smrg
1865c10afb9Smrg  bison|yacc)
1875c10afb9Smrg    echo 1>&2 "\
1885c10afb9SmrgWARNING: \`$1' is missing on your system.  You should only need it if
1895c10afb9Smrg         you modified a \`.y' file.  You may need the \`Bison' package
1905c10afb9Smrg         in order for those modifications to take effect.  You can get
1915c10afb9Smrg         \`Bison' from any GNU archive site."
1925c10afb9Smrg    rm -f y.tab.c y.tab.h
1935c10afb9Smrg    if [ $# -ne 1 ]; then
1945c10afb9Smrg        eval LASTARG="\${$#}"
1955c10afb9Smrg	case "$LASTARG" in
1965c10afb9Smrg	*.y)
1975c10afb9Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
1985c10afb9Smrg	    if [ -f "$SRCFILE" ]; then
1995c10afb9Smrg	         cp "$SRCFILE" y.tab.c
2005c10afb9Smrg	    fi
2015c10afb9Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2025c10afb9Smrg	    if [ -f "$SRCFILE" ]; then
2035c10afb9Smrg	         cp "$SRCFILE" y.tab.h
2045c10afb9Smrg	    fi
2055c10afb9Smrg	  ;;
2065c10afb9Smrg	esac
2075c10afb9Smrg    fi
2085c10afb9Smrg    if [ ! -f y.tab.h ]; then
2095c10afb9Smrg	echo >y.tab.h
2105c10afb9Smrg    fi
2115c10afb9Smrg    if [ ! -f y.tab.c ]; then
2125c10afb9Smrg	echo 'main() { return 0; }' >y.tab.c
2135c10afb9Smrg    fi
2145c10afb9Smrg    ;;
2155c10afb9Smrg
2165c10afb9Smrg  lex|flex)
2175c10afb9Smrg    echo 1>&2 "\
2185c10afb9SmrgWARNING: \`$1' is missing on your system.  You should only need it if
2195c10afb9Smrg         you modified a \`.l' file.  You may need the \`Flex' package
2205c10afb9Smrg         in order for those modifications to take effect.  You can get
2215c10afb9Smrg         \`Flex' from any GNU archive site."
2225c10afb9Smrg    rm -f lex.yy.c
2235c10afb9Smrg    if [ $# -ne 1 ]; then
2245c10afb9Smrg        eval LASTARG="\${$#}"
2255c10afb9Smrg	case "$LASTARG" in
2265c10afb9Smrg	*.l)
2275c10afb9Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2285c10afb9Smrg	    if [ -f "$SRCFILE" ]; then
2295c10afb9Smrg	         cp "$SRCFILE" lex.yy.c
2305c10afb9Smrg	    fi
2315c10afb9Smrg	  ;;
2325c10afb9Smrg	esac
2335c10afb9Smrg    fi
2345c10afb9Smrg    if [ ! -f lex.yy.c ]; then
2355c10afb9Smrg	echo 'main() { return 0; }' >lex.yy.c
2365c10afb9Smrg    fi
2375c10afb9Smrg    ;;
2385c10afb9Smrg
2395c10afb9Smrg  help2man)
2405c10afb9Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
2415c10afb9Smrg       # We have it, but it failed.
2425c10afb9Smrg       exit 1
2435c10afb9Smrg    fi
2445c10afb9Smrg
2455c10afb9Smrg    echo 1>&2 "\
2465c10afb9SmrgWARNING: \`$1' is missing on your system.  You should only need it if
2475c10afb9Smrg	 you modified a dependency of a manual page.  You may need the
2485c10afb9Smrg	 \`Help2man' package in order for those modifications to take
2495c10afb9Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
2505c10afb9Smrg
2515c10afb9Smrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
2525c10afb9Smrg    if test -z "$file"; then
2535c10afb9Smrg	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
2545c10afb9Smrg    fi
2555c10afb9Smrg    if [ -f "$file" ]; then
2565c10afb9Smrg	touch $file
2575c10afb9Smrg    else
2585c10afb9Smrg	test -z "$file" || exec >$file
2595c10afb9Smrg	echo ".ab help2man is required to generate this page"
2605c10afb9Smrg	exit 1
2615c10afb9Smrg    fi
2625c10afb9Smrg    ;;
2635c10afb9Smrg
2645c10afb9Smrg  makeinfo)
2655c10afb9Smrg    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
2665c10afb9Smrg       # We have makeinfo, but it failed.
2675c10afb9Smrg       exit 1
2685c10afb9Smrg    fi
2695c10afb9Smrg
2705c10afb9Smrg    echo 1>&2 "\
2715c10afb9SmrgWARNING: \`$1' is missing on your system.  You should only need it if
2725c10afb9Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
2735c10afb9Smrg         indirectly affecting the aspect of the manual.  The spurious
2745c10afb9Smrg         call might also be the consequence of using a buggy \`make' (AIX,
2755c10afb9Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
2765c10afb9Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
2775c10afb9Smrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
2785c10afb9Smrg    if test -z "$file"; then
2795c10afb9Smrg      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
2805c10afb9Smrg      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
2815c10afb9Smrg    fi
2825c10afb9Smrg    touch $file
2835c10afb9Smrg    ;;
2845c10afb9Smrg
2855c10afb9Smrg  tar)
2865c10afb9Smrg    shift
2875c10afb9Smrg    if test -n "$run"; then
2885c10afb9Smrg      echo 1>&2 "ERROR: \`tar' requires --run"
2895c10afb9Smrg      exit 1
2905c10afb9Smrg    fi
2915c10afb9Smrg
2925c10afb9Smrg    # We have already tried tar in the generic part.
2935c10afb9Smrg    # Look for gnutar/gtar before invocation to avoid ugly error
2945c10afb9Smrg    # messages.
2955c10afb9Smrg    if (gnutar --version > /dev/null 2>&1); then
2965c10afb9Smrg       gnutar "$@" && exit 0
2975c10afb9Smrg    fi
2985c10afb9Smrg    if (gtar --version > /dev/null 2>&1); then
2995c10afb9Smrg       gtar "$@" && exit 0
3005c10afb9Smrg    fi
3015c10afb9Smrg    firstarg="$1"
3025c10afb9Smrg    if shift; then
3035c10afb9Smrg	case "$firstarg" in
3045c10afb9Smrg	*o*)
3055c10afb9Smrg	    firstarg=`echo "$firstarg" | sed s/o//`
3065c10afb9Smrg	    tar "$firstarg" "$@" && exit 0
3075c10afb9Smrg	    ;;
3085c10afb9Smrg	esac
3095c10afb9Smrg	case "$firstarg" in
3105c10afb9Smrg	*h*)
3115c10afb9Smrg	    firstarg=`echo "$firstarg" | sed s/h//`
3125c10afb9Smrg	    tar "$firstarg" "$@" && exit 0
3135c10afb9Smrg	    ;;
3145c10afb9Smrg	esac
3155c10afb9Smrg    fi
3165c10afb9Smrg
3175c10afb9Smrg    echo 1>&2 "\
3185c10afb9SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
3195c10afb9Smrg         You may want to install GNU tar or Free paxutils, or check the
3205c10afb9Smrg         command line arguments."
3215c10afb9Smrg    exit 1
3225c10afb9Smrg    ;;
3235c10afb9Smrg
3245c10afb9Smrg  *)
3255c10afb9Smrg    echo 1>&2 "\
3265c10afb9SmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
3275c10afb9Smrg         system.  You might have modified some files without having the
3285c10afb9Smrg         proper tools for further handling them.  Check the \`README' file,
3295c10afb9Smrg         it often tells you about the needed prerequisites for installing
3305c10afb9Smrg         this package.  You may also peek at any GNU archive site, in case
3315c10afb9Smrg         some other package would contain this missing \`$1' program."
3325c10afb9Smrg    exit 1
3335c10afb9Smrg    ;;
3345c10afb9Smrgesac
3355c10afb9Smrg
3365c10afb9Smrgexit 0
337