missing revision 3a72f200
19027f4a0Smrg#! /bin/sh
29027f4a0Smrg# Common stub for a few missing GNU programs while installing.
39027f4a0Smrg
43a72f200Smrgscriptversion=2009-04-28.21; # UTC
59027f4a0Smrg
63a72f200Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
73a72f200Smrg# 2008, 2009 Free Software Foundation, Inc.
89027f4a0Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
99027f4a0Smrg
109027f4a0Smrg# This program is free software; you can redistribute it and/or modify
119027f4a0Smrg# it under the terms of the GNU General Public License as published by
129027f4a0Smrg# the Free Software Foundation; either version 2, or (at your option)
139027f4a0Smrg# any later version.
149027f4a0Smrg
159027f4a0Smrg# This program is distributed in the hope that it will be useful,
169027f4a0Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
179027f4a0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
189027f4a0Smrg# GNU General Public License for more details.
199027f4a0Smrg
209027f4a0Smrg# You should have received a copy of the GNU General Public License
213a72f200Smrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
229027f4a0Smrg
239027f4a0Smrg# As a special exception to the GNU General Public License, if you
249027f4a0Smrg# distribute this file as part of a program that contains a
259027f4a0Smrg# configuration script generated by Autoconf, you may include it under
269027f4a0Smrg# the same distribution terms that you use for the rest of that program.
279027f4a0Smrg
289027f4a0Smrgif test $# -eq 0; then
299027f4a0Smrg  echo 1>&2 "Try \`$0 --help' for more information"
309027f4a0Smrg  exit 1
319027f4a0Smrgfi
329027f4a0Smrg
339027f4a0Smrgrun=:
343a72f200Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
353a72f200Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
369027f4a0Smrg
379027f4a0Smrg# In the cases where this matters, `missing' is being run in the
389027f4a0Smrg# srcdir already.
399027f4a0Smrgif test -f configure.ac; then
409027f4a0Smrg  configure_ac=configure.ac
419027f4a0Smrgelse
429027f4a0Smrg  configure_ac=configure.in
439027f4a0Smrgfi
449027f4a0Smrg
459027f4a0Smrgmsg="missing on your system"
469027f4a0Smrg
473a72f200Smrgcase $1 in
489027f4a0Smrg--run)
499027f4a0Smrg  # Try to run requested program, and just exit if it succeeds.
509027f4a0Smrg  run=
519027f4a0Smrg  shift
529027f4a0Smrg  "$@" && exit 0
539027f4a0Smrg  # Exit code 63 means version mismatch.  This often happens
549027f4a0Smrg  # when the user try to use an ancient version of a tool on
559027f4a0Smrg  # a file that requires a minimum version.  In this case we
569027f4a0Smrg  # we should proceed has if the program had been absent, or
579027f4a0Smrg  # if --run hadn't been passed.
589027f4a0Smrg  if test $? = 63; then
599027f4a0Smrg    run=:
609027f4a0Smrg    msg="probably too old"
619027f4a0Smrg  fi
629027f4a0Smrg  ;;
639027f4a0Smrg
649027f4a0Smrg  -h|--h|--he|--hel|--help)
659027f4a0Smrg    echo "\
669027f4a0Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
679027f4a0Smrg
689027f4a0SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
699027f4a0Smrgerror status if there is no known handling for PROGRAM.
709027f4a0Smrg
719027f4a0SmrgOptions:
729027f4a0Smrg  -h, --help      display this help and exit
739027f4a0Smrg  -v, --version   output version information and exit
749027f4a0Smrg  --run           try to run the given command, and emulate it if it fails
759027f4a0Smrg
769027f4a0SmrgSupported PROGRAM values:
779027f4a0Smrg  aclocal      touch file \`aclocal.m4'
789027f4a0Smrg  autoconf     touch file \`configure'
799027f4a0Smrg  autoheader   touch file \`config.h.in'
803a72f200Smrg  autom4te     touch the output file, or create a stub one
819027f4a0Smrg  automake     touch all \`Makefile.in' files
829027f4a0Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
839027f4a0Smrg  flex         create \`lex.yy.c', if possible, from existing .c
849027f4a0Smrg  help2man     touch the output file
859027f4a0Smrg  lex          create \`lex.yy.c', if possible, from existing .c
869027f4a0Smrg  makeinfo     touch the output file
879027f4a0Smrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
889027f4a0Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
899027f4a0Smrg
903a72f200SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
913a72f200Smrg\`g' are ignored when checking the name.
923a72f200Smrg
939027f4a0SmrgSend bug reports to <bug-automake@gnu.org>."
949027f4a0Smrg    exit $?
959027f4a0Smrg    ;;
969027f4a0Smrg
979027f4a0Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
989027f4a0Smrg    echo "missing $scriptversion (GNU Automake)"
999027f4a0Smrg    exit $?
1009027f4a0Smrg    ;;
1019027f4a0Smrg
1029027f4a0Smrg  -*)
1039027f4a0Smrg    echo 1>&2 "$0: Unknown \`$1' option"
1049027f4a0Smrg    echo 1>&2 "Try \`$0 --help' for more information"
1059027f4a0Smrg    exit 1
1069027f4a0Smrg    ;;
1079027f4a0Smrg
1089027f4a0Smrgesac
1099027f4a0Smrg
1103a72f200Smrg# normalize program name to check for.
1113a72f200Smrgprogram=`echo "$1" | sed '
1123a72f200Smrg  s/^gnu-//; t
1133a72f200Smrg  s/^gnu//; t
1143a72f200Smrg  s/^g//; t'`
1153a72f200Smrg
1169027f4a0Smrg# Now exit if we have it, but it failed.  Also exit now if we
1179027f4a0Smrg# don't have it and --version was passed (most likely to detect
1183a72f200Smrg# the program).  This is about non-GNU programs, so use $1 not
1193a72f200Smrg# $program.
1203a72f200Smrgcase $1 in
1213a72f200Smrg  lex*|yacc*)
1229027f4a0Smrg    # Not GNU programs, they don't have --version.
1239027f4a0Smrg    ;;
1249027f4a0Smrg
1253a72f200Smrg  tar*)
1269027f4a0Smrg    if test -n "$run"; then
1279027f4a0Smrg       echo 1>&2 "ERROR: \`tar' requires --run"
1289027f4a0Smrg       exit 1
1299027f4a0Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1309027f4a0Smrg       exit 1
1319027f4a0Smrg    fi
1329027f4a0Smrg    ;;
1339027f4a0Smrg
1349027f4a0Smrg  *)
1359027f4a0Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1369027f4a0Smrg       # We have it, but it failed.
1379027f4a0Smrg       exit 1
1389027f4a0Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1399027f4a0Smrg       # Could not run --version or --help.  This is probably someone
1409027f4a0Smrg       # running `$TOOL --version' or `$TOOL --help' to check whether
1419027f4a0Smrg       # $TOOL exists and not knowing $TOOL uses missing.
1429027f4a0Smrg       exit 1
1439027f4a0Smrg    fi
1449027f4a0Smrg    ;;
1459027f4a0Smrgesac
1469027f4a0Smrg
1479027f4a0Smrg# If it does not exist, or fails to run (possibly an outdated version),
1489027f4a0Smrg# try to emulate it.
1493a72f200Smrgcase $program in
1509027f4a0Smrg  aclocal*)
1519027f4a0Smrg    echo 1>&2 "\
1529027f4a0SmrgWARNING: \`$1' is $msg.  You should only need it if
1539027f4a0Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
1549027f4a0Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
1559027f4a0Smrg         any GNU archive site."
1569027f4a0Smrg    touch aclocal.m4
1579027f4a0Smrg    ;;
1589027f4a0Smrg
1593a72f200Smrg  autoconf*)
1609027f4a0Smrg    echo 1>&2 "\
1619027f4a0SmrgWARNING: \`$1' is $msg.  You should only need it if
1629027f4a0Smrg         you modified \`${configure_ac}'.  You might want to install the
1639027f4a0Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1649027f4a0Smrg         archive site."
1659027f4a0Smrg    touch configure
1669027f4a0Smrg    ;;
1679027f4a0Smrg
1683a72f200Smrg  autoheader*)
1699027f4a0Smrg    echo 1>&2 "\
1709027f4a0SmrgWARNING: \`$1' is $msg.  You should only need it if
1719027f4a0Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1729027f4a0Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1739027f4a0Smrg         from any GNU archive site."
1749027f4a0Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1759027f4a0Smrg    test -z "$files" && files="config.h"
1769027f4a0Smrg    touch_files=
1779027f4a0Smrg    for f in $files; do
1783a72f200Smrg      case $f in
1799027f4a0Smrg      *:*) touch_files="$touch_files "`echo "$f" |
1809027f4a0Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1819027f4a0Smrg      *) touch_files="$touch_files $f.in";;
1829027f4a0Smrg      esac
1839027f4a0Smrg    done
1849027f4a0Smrg    touch $touch_files
1859027f4a0Smrg    ;;
1869027f4a0Smrg
1879027f4a0Smrg  automake*)
1889027f4a0Smrg    echo 1>&2 "\
1899027f4a0SmrgWARNING: \`$1' is $msg.  You should only need it if
1909027f4a0Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1919027f4a0Smrg         You might want to install the \`Automake' and \`Perl' packages.
1929027f4a0Smrg         Grab them from any GNU archive site."
1939027f4a0Smrg    find . -type f -name Makefile.am -print |
1949027f4a0Smrg	   sed 's/\.am$/.in/' |
1959027f4a0Smrg	   while read f; do touch "$f"; done
1969027f4a0Smrg    ;;
1979027f4a0Smrg
1983a72f200Smrg  autom4te*)
1999027f4a0Smrg    echo 1>&2 "\
2009027f4a0SmrgWARNING: \`$1' is needed, but is $msg.
2019027f4a0Smrg         You might have modified some files without having the
2029027f4a0Smrg         proper tools for further handling them.
2039027f4a0Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
2049027f4a0Smrg         archive site."
2059027f4a0Smrg
2063a72f200Smrg    file=`echo "$*" | sed -n "$sed_output"`
2073a72f200Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2089027f4a0Smrg    if test -f "$file"; then
2099027f4a0Smrg	touch $file
2109027f4a0Smrg    else
2119027f4a0Smrg	test -z "$file" || exec >$file
2129027f4a0Smrg	echo "#! /bin/sh"
2139027f4a0Smrg	echo "# Created by GNU Automake missing as a replacement of"
2149027f4a0Smrg	echo "#  $ $@"
2159027f4a0Smrg	echo "exit 0"
2169027f4a0Smrg	chmod +x $file
2179027f4a0Smrg	exit 1
2189027f4a0Smrg    fi
2199027f4a0Smrg    ;;
2209027f4a0Smrg
2213a72f200Smrg  bison*|yacc*)
2229027f4a0Smrg    echo 1>&2 "\
2239027f4a0SmrgWARNING: \`$1' $msg.  You should only need it if
2249027f4a0Smrg         you modified a \`.y' file.  You may need the \`Bison' package
2259027f4a0Smrg         in order for those modifications to take effect.  You can get
2269027f4a0Smrg         \`Bison' from any GNU archive site."
2279027f4a0Smrg    rm -f y.tab.c y.tab.h
2283a72f200Smrg    if test $# -ne 1; then
2299027f4a0Smrg        eval LASTARG="\${$#}"
2303a72f200Smrg	case $LASTARG in
2319027f4a0Smrg	*.y)
2329027f4a0Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
2333a72f200Smrg	    if test -f "$SRCFILE"; then
2349027f4a0Smrg	         cp "$SRCFILE" y.tab.c
2359027f4a0Smrg	    fi
2369027f4a0Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2373a72f200Smrg	    if test -f "$SRCFILE"; then
2389027f4a0Smrg	         cp "$SRCFILE" y.tab.h
2399027f4a0Smrg	    fi
2409027f4a0Smrg	  ;;
2419027f4a0Smrg	esac
2429027f4a0Smrg    fi
2433a72f200Smrg    if test ! -f y.tab.h; then
2449027f4a0Smrg	echo >y.tab.h
2459027f4a0Smrg    fi
2463a72f200Smrg    if test ! -f y.tab.c; then
2479027f4a0Smrg	echo 'main() { return 0; }' >y.tab.c
2489027f4a0Smrg    fi
2499027f4a0Smrg    ;;
2509027f4a0Smrg
2513a72f200Smrg  lex*|flex*)
2529027f4a0Smrg    echo 1>&2 "\
2539027f4a0SmrgWARNING: \`$1' is $msg.  You should only need it if
2549027f4a0Smrg         you modified a \`.l' file.  You may need the \`Flex' package
2559027f4a0Smrg         in order for those modifications to take effect.  You can get
2569027f4a0Smrg         \`Flex' from any GNU archive site."
2579027f4a0Smrg    rm -f lex.yy.c
2583a72f200Smrg    if test $# -ne 1; then
2599027f4a0Smrg        eval LASTARG="\${$#}"
2603a72f200Smrg	case $LASTARG in
2619027f4a0Smrg	*.l)
2629027f4a0Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2633a72f200Smrg	    if test -f "$SRCFILE"; then
2649027f4a0Smrg	         cp "$SRCFILE" lex.yy.c
2659027f4a0Smrg	    fi
2669027f4a0Smrg	  ;;
2679027f4a0Smrg	esac
2689027f4a0Smrg    fi
2693a72f200Smrg    if test ! -f lex.yy.c; then
2709027f4a0Smrg	echo 'main() { return 0; }' >lex.yy.c
2719027f4a0Smrg    fi
2729027f4a0Smrg    ;;
2739027f4a0Smrg
2743a72f200Smrg  help2man*)
2759027f4a0Smrg    echo 1>&2 "\
2769027f4a0SmrgWARNING: \`$1' is $msg.  You should only need it if
2779027f4a0Smrg	 you modified a dependency of a manual page.  You may need the
2789027f4a0Smrg	 \`Help2man' package in order for those modifications to take
2799027f4a0Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
2809027f4a0Smrg
2813a72f200Smrg    file=`echo "$*" | sed -n "$sed_output"`
2823a72f200Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2833a72f200Smrg    if test -f "$file"; then
2849027f4a0Smrg	touch $file
2859027f4a0Smrg    else
2869027f4a0Smrg	test -z "$file" || exec >$file
2879027f4a0Smrg	echo ".ab help2man is required to generate this page"
2883a72f200Smrg	exit $?
2899027f4a0Smrg    fi
2909027f4a0Smrg    ;;
2919027f4a0Smrg
2923a72f200Smrg  makeinfo*)
2939027f4a0Smrg    echo 1>&2 "\
2949027f4a0SmrgWARNING: \`$1' is $msg.  You should only need it if
2959027f4a0Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
2969027f4a0Smrg         indirectly affecting the aspect of the manual.  The spurious
2979027f4a0Smrg         call might also be the consequence of using a buggy \`make' (AIX,
2989027f4a0Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
2999027f4a0Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
3009027f4a0Smrg    # The file to touch is that specified with -o ...
3013a72f200Smrg    file=`echo "$*" | sed -n "$sed_output"`
3023a72f200Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
3039027f4a0Smrg    if test -z "$file"; then
3049027f4a0Smrg      # ... or it is the one specified with @setfilename ...
3059027f4a0Smrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
3063a72f200Smrg      file=`sed -n '
3073a72f200Smrg	/^@setfilename/{
3083a72f200Smrg	  s/.* \([^ ]*\) *$/\1/
3093a72f200Smrg	  p
3103a72f200Smrg	  q
3113a72f200Smrg	}' $infile`
3129027f4a0Smrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
3139027f4a0Smrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
3149027f4a0Smrg    fi
3159027f4a0Smrg    # If the file does not exist, the user really needs makeinfo;
3169027f4a0Smrg    # let's fail without touching anything.
3179027f4a0Smrg    test -f $file || exit 1
3189027f4a0Smrg    touch $file
3199027f4a0Smrg    ;;
3209027f4a0Smrg
3213a72f200Smrg  tar*)
3229027f4a0Smrg    shift
3239027f4a0Smrg
3249027f4a0Smrg    # We have already tried tar in the generic part.
3259027f4a0Smrg    # Look for gnutar/gtar before invocation to avoid ugly error
3269027f4a0Smrg    # messages.
3279027f4a0Smrg    if (gnutar --version > /dev/null 2>&1); then
3289027f4a0Smrg       gnutar "$@" && exit 0
3299027f4a0Smrg    fi
3309027f4a0Smrg    if (gtar --version > /dev/null 2>&1); then
3319027f4a0Smrg       gtar "$@" && exit 0
3329027f4a0Smrg    fi
3339027f4a0Smrg    firstarg="$1"
3349027f4a0Smrg    if shift; then
3353a72f200Smrg	case $firstarg in
3369027f4a0Smrg	*o*)
3379027f4a0Smrg	    firstarg=`echo "$firstarg" | sed s/o//`
3389027f4a0Smrg	    tar "$firstarg" "$@" && exit 0
3399027f4a0Smrg	    ;;
3409027f4a0Smrg	esac
3413a72f200Smrg	case $firstarg in
3429027f4a0Smrg	*h*)
3439027f4a0Smrg	    firstarg=`echo "$firstarg" | sed s/h//`
3449027f4a0Smrg	    tar "$firstarg" "$@" && exit 0
3459027f4a0Smrg	    ;;
3469027f4a0Smrg	esac
3479027f4a0Smrg    fi
3489027f4a0Smrg
3499027f4a0Smrg    echo 1>&2 "\
3509027f4a0SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
3519027f4a0Smrg         You may want to install GNU tar or Free paxutils, or check the
3529027f4a0Smrg         command line arguments."
3539027f4a0Smrg    exit 1
3549027f4a0Smrg    ;;
3559027f4a0Smrg
3569027f4a0Smrg  *)
3579027f4a0Smrg    echo 1>&2 "\
3589027f4a0SmrgWARNING: \`$1' is needed, and is $msg.
3599027f4a0Smrg         You might have modified some files without having the
3609027f4a0Smrg         proper tools for further handling them.  Check the \`README' file,
3619027f4a0Smrg         it often tells you about the needed prerequisites for installing
3629027f4a0Smrg         this package.  You may also peek at any GNU archive site, in case
3639027f4a0Smrg         some other package would contain this missing \`$1' program."
3649027f4a0Smrg    exit 1
3659027f4a0Smrg    ;;
3669027f4a0Smrgesac
3679027f4a0Smrg
3689027f4a0Smrgexit 0
3699027f4a0Smrg
3709027f4a0Smrg# Local variables:
3719027f4a0Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
3729027f4a0Smrg# time-stamp-start: "scriptversion="
3739027f4a0Smrg# time-stamp-format: "%:y-%02m-%02d.%02H"
3743a72f200Smrg# time-stamp-time-zone: "UTC"
3753a72f200Smrg# time-stamp-end: "; # UTC"
3769027f4a0Smrg# End:
377