missing revision 9aa228fd
19aa228fdSmrg#! /bin/sh
29aa228fdSmrg# Common stub for a few missing GNU programs while installing.
39aa228fdSmrg
49aa228fdSmrgscriptversion=2006-05-10.23
59aa228fdSmrg
69aa228fdSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
79aa228fdSmrg#   Free Software Foundation, Inc.
89aa228fdSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
99aa228fdSmrg
109aa228fdSmrg# This program is free software; you can redistribute it and/or modify
119aa228fdSmrg# it under the terms of the GNU General Public License as published by
129aa228fdSmrg# the Free Software Foundation; either version 2, or (at your option)
139aa228fdSmrg# any later version.
149aa228fdSmrg
159aa228fdSmrg# This program is distributed in the hope that it will be useful,
169aa228fdSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
179aa228fdSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
189aa228fdSmrg# GNU General Public License for more details.
199aa228fdSmrg
209aa228fdSmrg# You should have received a copy of the GNU General Public License
219aa228fdSmrg# along with this program; if not, write to the Free Software
229aa228fdSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
239aa228fdSmrg# 02110-1301, USA.
249aa228fdSmrg
259aa228fdSmrg# As a special exception to the GNU General Public License, if you
269aa228fdSmrg# distribute this file as part of a program that contains a
279aa228fdSmrg# configuration script generated by Autoconf, you may include it under
289aa228fdSmrg# the same distribution terms that you use for the rest of that program.
299aa228fdSmrg
309aa228fdSmrgif test $# -eq 0; then
319aa228fdSmrg  echo 1>&2 "Try \`$0 --help' for more information"
329aa228fdSmrg  exit 1
339aa228fdSmrgfi
349aa228fdSmrg
359aa228fdSmrgrun=:
369aa228fdSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
379aa228fdSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
389aa228fdSmrg
399aa228fdSmrg# In the cases where this matters, `missing' is being run in the
409aa228fdSmrg# srcdir already.
419aa228fdSmrgif test -f configure.ac; then
429aa228fdSmrg  configure_ac=configure.ac
439aa228fdSmrgelse
449aa228fdSmrg  configure_ac=configure.in
459aa228fdSmrgfi
469aa228fdSmrg
479aa228fdSmrgmsg="missing on your system"
489aa228fdSmrg
499aa228fdSmrgcase $1 in
509aa228fdSmrg--run)
519aa228fdSmrg  # Try to run requested program, and just exit if it succeeds.
529aa228fdSmrg  run=
539aa228fdSmrg  shift
549aa228fdSmrg  "$@" && exit 0
559aa228fdSmrg  # Exit code 63 means version mismatch.  This often happens
569aa228fdSmrg  # when the user try to use an ancient version of a tool on
579aa228fdSmrg  # a file that requires a minimum version.  In this case we
589aa228fdSmrg  # we should proceed has if the program had been absent, or
599aa228fdSmrg  # if --run hadn't been passed.
609aa228fdSmrg  if test $? = 63; then
619aa228fdSmrg    run=:
629aa228fdSmrg    msg="probably too old"
639aa228fdSmrg  fi
649aa228fdSmrg  ;;
659aa228fdSmrg
669aa228fdSmrg  -h|--h|--he|--hel|--help)
679aa228fdSmrg    echo "\
689aa228fdSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
699aa228fdSmrg
709aa228fdSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
719aa228fdSmrgerror status if there is no known handling for PROGRAM.
729aa228fdSmrg
739aa228fdSmrgOptions:
749aa228fdSmrg  -h, --help      display this help and exit
759aa228fdSmrg  -v, --version   output version information and exit
769aa228fdSmrg  --run           try to run the given command, and emulate it if it fails
779aa228fdSmrg
789aa228fdSmrgSupported PROGRAM values:
799aa228fdSmrg  aclocal      touch file \`aclocal.m4'
809aa228fdSmrg  autoconf     touch file \`configure'
819aa228fdSmrg  autoheader   touch file \`config.h.in'
829aa228fdSmrg  autom4te     touch the output file, or create a stub one
839aa228fdSmrg  automake     touch all \`Makefile.in' files
849aa228fdSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
859aa228fdSmrg  flex         create \`lex.yy.c', if possible, from existing .c
869aa228fdSmrg  help2man     touch the output file
879aa228fdSmrg  lex          create \`lex.yy.c', if possible, from existing .c
889aa228fdSmrg  makeinfo     touch the output file
899aa228fdSmrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
909aa228fdSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
919aa228fdSmrg
929aa228fdSmrgSend bug reports to <bug-automake@gnu.org>."
939aa228fdSmrg    exit $?
949aa228fdSmrg    ;;
959aa228fdSmrg
969aa228fdSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
979aa228fdSmrg    echo "missing $scriptversion (GNU Automake)"
989aa228fdSmrg    exit $?
999aa228fdSmrg    ;;
1009aa228fdSmrg
1019aa228fdSmrg  -*)
1029aa228fdSmrg    echo 1>&2 "$0: Unknown \`$1' option"
1039aa228fdSmrg    echo 1>&2 "Try \`$0 --help' for more information"
1049aa228fdSmrg    exit 1
1059aa228fdSmrg    ;;
1069aa228fdSmrg
1079aa228fdSmrgesac
1089aa228fdSmrg
1099aa228fdSmrg# Now exit if we have it, but it failed.  Also exit now if we
1109aa228fdSmrg# don't have it and --version was passed (most likely to detect
1119aa228fdSmrg# the program).
1129aa228fdSmrgcase $1 in
1139aa228fdSmrg  lex|yacc)
1149aa228fdSmrg    # Not GNU programs, they don't have --version.
1159aa228fdSmrg    ;;
1169aa228fdSmrg
1179aa228fdSmrg  tar)
1189aa228fdSmrg    if test -n "$run"; then
1199aa228fdSmrg       echo 1>&2 "ERROR: \`tar' requires --run"
1209aa228fdSmrg       exit 1
1219aa228fdSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1229aa228fdSmrg       exit 1
1239aa228fdSmrg    fi
1249aa228fdSmrg    ;;
1259aa228fdSmrg
1269aa228fdSmrg  *)
1279aa228fdSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1289aa228fdSmrg       # We have it, but it failed.
1299aa228fdSmrg       exit 1
1309aa228fdSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1319aa228fdSmrg       # Could not run --version or --help.  This is probably someone
1329aa228fdSmrg       # running `$TOOL --version' or `$TOOL --help' to check whether
1339aa228fdSmrg       # $TOOL exists and not knowing $TOOL uses missing.
1349aa228fdSmrg       exit 1
1359aa228fdSmrg    fi
1369aa228fdSmrg    ;;
1379aa228fdSmrgesac
1389aa228fdSmrg
1399aa228fdSmrg# If it does not exist, or fails to run (possibly an outdated version),
1409aa228fdSmrg# try to emulate it.
1419aa228fdSmrgcase $1 in
1429aa228fdSmrg  aclocal*)
1439aa228fdSmrg    echo 1>&2 "\
1449aa228fdSmrgWARNING: \`$1' is $msg.  You should only need it if
1459aa228fdSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
1469aa228fdSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
1479aa228fdSmrg         any GNU archive site."
1489aa228fdSmrg    touch aclocal.m4
1499aa228fdSmrg    ;;
1509aa228fdSmrg
1519aa228fdSmrg  autoconf)
1529aa228fdSmrg    echo 1>&2 "\
1539aa228fdSmrgWARNING: \`$1' is $msg.  You should only need it if
1549aa228fdSmrg         you modified \`${configure_ac}'.  You might want to install the
1559aa228fdSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1569aa228fdSmrg         archive site."
1579aa228fdSmrg    touch configure
1589aa228fdSmrg    ;;
1599aa228fdSmrg
1609aa228fdSmrg  autoheader)
1619aa228fdSmrg    echo 1>&2 "\
1629aa228fdSmrgWARNING: \`$1' is $msg.  You should only need it if
1639aa228fdSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1649aa228fdSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1659aa228fdSmrg         from any GNU archive site."
1669aa228fdSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1679aa228fdSmrg    test -z "$files" && files="config.h"
1689aa228fdSmrg    touch_files=
1699aa228fdSmrg    for f in $files; do
1709aa228fdSmrg      case $f in
1719aa228fdSmrg      *:*) touch_files="$touch_files "`echo "$f" |
1729aa228fdSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1739aa228fdSmrg      *) touch_files="$touch_files $f.in";;
1749aa228fdSmrg      esac
1759aa228fdSmrg    done
1769aa228fdSmrg    touch $touch_files
1779aa228fdSmrg    ;;
1789aa228fdSmrg
1799aa228fdSmrg  automake*)
1809aa228fdSmrg    echo 1>&2 "\
1819aa228fdSmrgWARNING: \`$1' is $msg.  You should only need it if
1829aa228fdSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1839aa228fdSmrg         You might want to install the \`Automake' and \`Perl' packages.
1849aa228fdSmrg         Grab them from any GNU archive site."
1859aa228fdSmrg    find . -type f -name Makefile.am -print |
1869aa228fdSmrg	   sed 's/\.am$/.in/' |
1879aa228fdSmrg	   while read f; do touch "$f"; done
1889aa228fdSmrg    ;;
1899aa228fdSmrg
1909aa228fdSmrg  autom4te)
1919aa228fdSmrg    echo 1>&2 "\
1929aa228fdSmrgWARNING: \`$1' is needed, but is $msg.
1939aa228fdSmrg         You might have modified some files without having the
1949aa228fdSmrg         proper tools for further handling them.
1959aa228fdSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
1969aa228fdSmrg         archive site."
1979aa228fdSmrg
1989aa228fdSmrg    file=`echo "$*" | sed -n "$sed_output"`
1999aa228fdSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2009aa228fdSmrg    if test -f "$file"; then
2019aa228fdSmrg	touch $file
2029aa228fdSmrg    else
2039aa228fdSmrg	test -z "$file" || exec >$file
2049aa228fdSmrg	echo "#! /bin/sh"
2059aa228fdSmrg	echo "# Created by GNU Automake missing as a replacement of"
2069aa228fdSmrg	echo "#  $ $@"
2079aa228fdSmrg	echo "exit 0"
2089aa228fdSmrg	chmod +x $file
2099aa228fdSmrg	exit 1
2109aa228fdSmrg    fi
2119aa228fdSmrg    ;;
2129aa228fdSmrg
2139aa228fdSmrg  bison|yacc)
2149aa228fdSmrg    echo 1>&2 "\
2159aa228fdSmrgWARNING: \`$1' $msg.  You should only need it if
2169aa228fdSmrg         you modified a \`.y' file.  You may need the \`Bison' package
2179aa228fdSmrg         in order for those modifications to take effect.  You can get
2189aa228fdSmrg         \`Bison' from any GNU archive site."
2199aa228fdSmrg    rm -f y.tab.c y.tab.h
2209aa228fdSmrg    if test $# -ne 1; then
2219aa228fdSmrg        eval LASTARG="\${$#}"
2229aa228fdSmrg	case $LASTARG in
2239aa228fdSmrg	*.y)
2249aa228fdSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
2259aa228fdSmrg	    if test -f "$SRCFILE"; then
2269aa228fdSmrg	         cp "$SRCFILE" y.tab.c
2279aa228fdSmrg	    fi
2289aa228fdSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2299aa228fdSmrg	    if test -f "$SRCFILE"; then
2309aa228fdSmrg	         cp "$SRCFILE" y.tab.h
2319aa228fdSmrg	    fi
2329aa228fdSmrg	  ;;
2339aa228fdSmrg	esac
2349aa228fdSmrg    fi
2359aa228fdSmrg    if test ! -f y.tab.h; then
2369aa228fdSmrg	echo >y.tab.h
2379aa228fdSmrg    fi
2389aa228fdSmrg    if test ! -f y.tab.c; then
2399aa228fdSmrg	echo 'main() { return 0; }' >y.tab.c
2409aa228fdSmrg    fi
2419aa228fdSmrg    ;;
2429aa228fdSmrg
2439aa228fdSmrg  lex|flex)
2449aa228fdSmrg    echo 1>&2 "\
2459aa228fdSmrgWARNING: \`$1' is $msg.  You should only need it if
2469aa228fdSmrg         you modified a \`.l' file.  You may need the \`Flex' package
2479aa228fdSmrg         in order for those modifications to take effect.  You can get
2489aa228fdSmrg         \`Flex' from any GNU archive site."
2499aa228fdSmrg    rm -f lex.yy.c
2509aa228fdSmrg    if test $# -ne 1; then
2519aa228fdSmrg        eval LASTARG="\${$#}"
2529aa228fdSmrg	case $LASTARG in
2539aa228fdSmrg	*.l)
2549aa228fdSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2559aa228fdSmrg	    if test -f "$SRCFILE"; then
2569aa228fdSmrg	         cp "$SRCFILE" lex.yy.c
2579aa228fdSmrg	    fi
2589aa228fdSmrg	  ;;
2599aa228fdSmrg	esac
2609aa228fdSmrg    fi
2619aa228fdSmrg    if test ! -f lex.yy.c; then
2629aa228fdSmrg	echo 'main() { return 0; }' >lex.yy.c
2639aa228fdSmrg    fi
2649aa228fdSmrg    ;;
2659aa228fdSmrg
2669aa228fdSmrg  help2man)
2679aa228fdSmrg    echo 1>&2 "\
2689aa228fdSmrgWARNING: \`$1' is $msg.  You should only need it if
2699aa228fdSmrg	 you modified a dependency of a manual page.  You may need the
2709aa228fdSmrg	 \`Help2man' package in order for those modifications to take
2719aa228fdSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
2729aa228fdSmrg
2739aa228fdSmrg    file=`echo "$*" | sed -n "$sed_output"`
2749aa228fdSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2759aa228fdSmrg    if test -f "$file"; then
2769aa228fdSmrg	touch $file
2779aa228fdSmrg    else
2789aa228fdSmrg	test -z "$file" || exec >$file
2799aa228fdSmrg	echo ".ab help2man is required to generate this page"
2809aa228fdSmrg	exit 1
2819aa228fdSmrg    fi
2829aa228fdSmrg    ;;
2839aa228fdSmrg
2849aa228fdSmrg  makeinfo)
2859aa228fdSmrg    echo 1>&2 "\
2869aa228fdSmrgWARNING: \`$1' is $msg.  You should only need it if
2879aa228fdSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
2889aa228fdSmrg         indirectly affecting the aspect of the manual.  The spurious
2899aa228fdSmrg         call might also be the consequence of using a buggy \`make' (AIX,
2909aa228fdSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
2919aa228fdSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
2929aa228fdSmrg    # The file to touch is that specified with -o ...
2939aa228fdSmrg    file=`echo "$*" | sed -n "$sed_output"`
2949aa228fdSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2959aa228fdSmrg    if test -z "$file"; then
2969aa228fdSmrg      # ... or it is the one specified with @setfilename ...
2979aa228fdSmrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
2989aa228fdSmrg      file=`sed -n '
2999aa228fdSmrg	/^@setfilename/{
3009aa228fdSmrg	  s/.* \([^ ]*\) *$/\1/
3019aa228fdSmrg	  p
3029aa228fdSmrg	  q
3039aa228fdSmrg	}' $infile`
3049aa228fdSmrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
3059aa228fdSmrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
3069aa228fdSmrg    fi
3079aa228fdSmrg    # If the file does not exist, the user really needs makeinfo;
3089aa228fdSmrg    # let's fail without touching anything.
3099aa228fdSmrg    test -f $file || exit 1
3109aa228fdSmrg    touch $file
3119aa228fdSmrg    ;;
3129aa228fdSmrg
3139aa228fdSmrg  tar)
3149aa228fdSmrg    shift
3159aa228fdSmrg
3169aa228fdSmrg    # We have already tried tar in the generic part.
3179aa228fdSmrg    # Look for gnutar/gtar before invocation to avoid ugly error
3189aa228fdSmrg    # messages.
3199aa228fdSmrg    if (gnutar --version > /dev/null 2>&1); then
3209aa228fdSmrg       gnutar "$@" && exit 0
3219aa228fdSmrg    fi
3229aa228fdSmrg    if (gtar --version > /dev/null 2>&1); then
3239aa228fdSmrg       gtar "$@" && exit 0
3249aa228fdSmrg    fi
3259aa228fdSmrg    firstarg="$1"
3269aa228fdSmrg    if shift; then
3279aa228fdSmrg	case $firstarg in
3289aa228fdSmrg	*o*)
3299aa228fdSmrg	    firstarg=`echo "$firstarg" | sed s/o//`
3309aa228fdSmrg	    tar "$firstarg" "$@" && exit 0
3319aa228fdSmrg	    ;;
3329aa228fdSmrg	esac
3339aa228fdSmrg	case $firstarg in
3349aa228fdSmrg	*h*)
3359aa228fdSmrg	    firstarg=`echo "$firstarg" | sed s/h//`
3369aa228fdSmrg	    tar "$firstarg" "$@" && exit 0
3379aa228fdSmrg	    ;;
3389aa228fdSmrg	esac
3399aa228fdSmrg    fi
3409aa228fdSmrg
3419aa228fdSmrg    echo 1>&2 "\
3429aa228fdSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
3439aa228fdSmrg         You may want to install GNU tar or Free paxutils, or check the
3449aa228fdSmrg         command line arguments."
3459aa228fdSmrg    exit 1
3469aa228fdSmrg    ;;
3479aa228fdSmrg
3489aa228fdSmrg  *)
3499aa228fdSmrg    echo 1>&2 "\
3509aa228fdSmrgWARNING: \`$1' is needed, and is $msg.
3519aa228fdSmrg         You might have modified some files without having the
3529aa228fdSmrg         proper tools for further handling them.  Check the \`README' file,
3539aa228fdSmrg         it often tells you about the needed prerequisites for installing
3549aa228fdSmrg         this package.  You may also peek at any GNU archive site, in case
3559aa228fdSmrg         some other package would contain this missing \`$1' program."
3569aa228fdSmrg    exit 1
3579aa228fdSmrg    ;;
3589aa228fdSmrgesac
3599aa228fdSmrg
3609aa228fdSmrgexit 0
3619aa228fdSmrg
3629aa228fdSmrg# Local variables:
3639aa228fdSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
3649aa228fdSmrg# time-stamp-start: "scriptversion="
3659aa228fdSmrg# time-stamp-format: "%:y-%02m-%02d.%02H"
3669aa228fdSmrg# time-stamp-end: "$"
3679aa228fdSmrg# End:
368