missing revision b53e5eea
173143b9aSmrg#! /bin/sh
273143b9aSmrg# Common stub for a few missing GNU programs while installing.
373143b9aSmrg
4b53e5eeaSmrgscriptversion=2009-04-28.21; # UTC
573143b9aSmrg
6b53e5eeaSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
7b53e5eeaSmrg# 2008, 2009 Free Software Foundation, Inc.
873143b9aSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
973143b9aSmrg
1073143b9aSmrg# This program is free software; you can redistribute it and/or modify
1173143b9aSmrg# it under the terms of the GNU General Public License as published by
1273143b9aSmrg# the Free Software Foundation; either version 2, or (at your option)
1373143b9aSmrg# any later version.
1473143b9aSmrg
1573143b9aSmrg# This program is distributed in the hope that it will be useful,
1673143b9aSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
1773143b9aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1873143b9aSmrg# GNU General Public License for more details.
1973143b9aSmrg
2073143b9aSmrg# You should have received a copy of the GNU General Public License
21b53e5eeaSmrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
2273143b9aSmrg
2373143b9aSmrg# As a special exception to the GNU General Public License, if you
2473143b9aSmrg# distribute this file as part of a program that contains a
2573143b9aSmrg# configuration script generated by Autoconf, you may include it under
2673143b9aSmrg# the same distribution terms that you use for the rest of that program.
2773143b9aSmrg
2873143b9aSmrgif test $# -eq 0; then
2973143b9aSmrg  echo 1>&2 "Try \`$0 --help' for more information"
3073143b9aSmrg  exit 1
3173143b9aSmrgfi
3273143b9aSmrg
3373143b9aSmrgrun=:
3473143b9aSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
3573143b9aSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
3673143b9aSmrg
3773143b9aSmrg# In the cases where this matters, `missing' is being run in the
3873143b9aSmrg# srcdir already.
3973143b9aSmrgif test -f configure.ac; then
4073143b9aSmrg  configure_ac=configure.ac
4173143b9aSmrgelse
4273143b9aSmrg  configure_ac=configure.in
4373143b9aSmrgfi
4473143b9aSmrg
4573143b9aSmrgmsg="missing on your system"
4673143b9aSmrg
4773143b9aSmrgcase $1 in
4873143b9aSmrg--run)
4973143b9aSmrg  # Try to run requested program, and just exit if it succeeds.
5073143b9aSmrg  run=
5173143b9aSmrg  shift
5273143b9aSmrg  "$@" && exit 0
5373143b9aSmrg  # Exit code 63 means version mismatch.  This often happens
5473143b9aSmrg  # when the user try to use an ancient version of a tool on
5573143b9aSmrg  # a file that requires a minimum version.  In this case we
5673143b9aSmrg  # we should proceed has if the program had been absent, or
5773143b9aSmrg  # if --run hadn't been passed.
5873143b9aSmrg  if test $? = 63; then
5973143b9aSmrg    run=:
6073143b9aSmrg    msg="probably too old"
6173143b9aSmrg  fi
6273143b9aSmrg  ;;
6373143b9aSmrg
6473143b9aSmrg  -h|--h|--he|--hel|--help)
6573143b9aSmrg    echo "\
6673143b9aSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
6773143b9aSmrg
6873143b9aSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
6973143b9aSmrgerror status if there is no known handling for PROGRAM.
7073143b9aSmrg
7173143b9aSmrgOptions:
7273143b9aSmrg  -h, --help      display this help and exit
7373143b9aSmrg  -v, --version   output version information and exit
7473143b9aSmrg  --run           try to run the given command, and emulate it if it fails
7573143b9aSmrg
7673143b9aSmrgSupported PROGRAM values:
7773143b9aSmrg  aclocal      touch file \`aclocal.m4'
7873143b9aSmrg  autoconf     touch file \`configure'
7973143b9aSmrg  autoheader   touch file \`config.h.in'
8073143b9aSmrg  autom4te     touch the output file, or create a stub one
8173143b9aSmrg  automake     touch all \`Makefile.in' files
8273143b9aSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
8373143b9aSmrg  flex         create \`lex.yy.c', if possible, from existing .c
8473143b9aSmrg  help2man     touch the output file
8573143b9aSmrg  lex          create \`lex.yy.c', if possible, from existing .c
8673143b9aSmrg  makeinfo     touch the output file
8773143b9aSmrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
8873143b9aSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
8973143b9aSmrg
90b53e5eeaSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
91b53e5eeaSmrg\`g' are ignored when checking the name.
92b53e5eeaSmrg
9373143b9aSmrgSend bug reports to <bug-automake@gnu.org>."
9473143b9aSmrg    exit $?
9573143b9aSmrg    ;;
9673143b9aSmrg
9773143b9aSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
9873143b9aSmrg    echo "missing $scriptversion (GNU Automake)"
9973143b9aSmrg    exit $?
10073143b9aSmrg    ;;
10173143b9aSmrg
10273143b9aSmrg  -*)
10373143b9aSmrg    echo 1>&2 "$0: Unknown \`$1' option"
10473143b9aSmrg    echo 1>&2 "Try \`$0 --help' for more information"
10573143b9aSmrg    exit 1
10673143b9aSmrg    ;;
10773143b9aSmrg
10873143b9aSmrgesac
10973143b9aSmrg
110b53e5eeaSmrg# normalize program name to check for.
111b53e5eeaSmrgprogram=`echo "$1" | sed '
112b53e5eeaSmrg  s/^gnu-//; t
113b53e5eeaSmrg  s/^gnu//; t
114b53e5eeaSmrg  s/^g//; t'`
115b53e5eeaSmrg
11673143b9aSmrg# Now exit if we have it, but it failed.  Also exit now if we
11773143b9aSmrg# don't have it and --version was passed (most likely to detect
118b53e5eeaSmrg# the program).  This is about non-GNU programs, so use $1 not
119b53e5eeaSmrg# $program.
12073143b9aSmrgcase $1 in
121b53e5eeaSmrg  lex*|yacc*)
12273143b9aSmrg    # Not GNU programs, they don't have --version.
12373143b9aSmrg    ;;
12473143b9aSmrg
125b53e5eeaSmrg  tar*)
12673143b9aSmrg    if test -n "$run"; then
12773143b9aSmrg       echo 1>&2 "ERROR: \`tar' requires --run"
12873143b9aSmrg       exit 1
12973143b9aSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
13073143b9aSmrg       exit 1
13173143b9aSmrg    fi
13273143b9aSmrg    ;;
13373143b9aSmrg
13473143b9aSmrg  *)
13573143b9aSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
13673143b9aSmrg       # We have it, but it failed.
13773143b9aSmrg       exit 1
13873143b9aSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
13973143b9aSmrg       # Could not run --version or --help.  This is probably someone
14073143b9aSmrg       # running `$TOOL --version' or `$TOOL --help' to check whether
14173143b9aSmrg       # $TOOL exists and not knowing $TOOL uses missing.
14273143b9aSmrg       exit 1
14373143b9aSmrg    fi
14473143b9aSmrg    ;;
14573143b9aSmrgesac
14673143b9aSmrg
14773143b9aSmrg# If it does not exist, or fails to run (possibly an outdated version),
14873143b9aSmrg# try to emulate it.
149b53e5eeaSmrgcase $program in
15073143b9aSmrg  aclocal*)
15173143b9aSmrg    echo 1>&2 "\
15273143b9aSmrgWARNING: \`$1' is $msg.  You should only need it if
15373143b9aSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
15473143b9aSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
15573143b9aSmrg         any GNU archive site."
15673143b9aSmrg    touch aclocal.m4
15773143b9aSmrg    ;;
15873143b9aSmrg
159b53e5eeaSmrg  autoconf*)
16073143b9aSmrg    echo 1>&2 "\
16173143b9aSmrgWARNING: \`$1' is $msg.  You should only need it if
16273143b9aSmrg         you modified \`${configure_ac}'.  You might want to install the
16373143b9aSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
16473143b9aSmrg         archive site."
16573143b9aSmrg    touch configure
16673143b9aSmrg    ;;
16773143b9aSmrg
168b53e5eeaSmrg  autoheader*)
16973143b9aSmrg    echo 1>&2 "\
17073143b9aSmrgWARNING: \`$1' is $msg.  You should only need it if
17173143b9aSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
17273143b9aSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
17373143b9aSmrg         from any GNU archive site."
17473143b9aSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
17573143b9aSmrg    test -z "$files" && files="config.h"
17673143b9aSmrg    touch_files=
17773143b9aSmrg    for f in $files; do
17873143b9aSmrg      case $f in
17973143b9aSmrg      *:*) touch_files="$touch_files "`echo "$f" |
18073143b9aSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
18173143b9aSmrg      *) touch_files="$touch_files $f.in";;
18273143b9aSmrg      esac
18373143b9aSmrg    done
18473143b9aSmrg    touch $touch_files
18573143b9aSmrg    ;;
18673143b9aSmrg
18773143b9aSmrg  automake*)
18873143b9aSmrg    echo 1>&2 "\
18973143b9aSmrgWARNING: \`$1' is $msg.  You should only need it if
19073143b9aSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
19173143b9aSmrg         You might want to install the \`Automake' and \`Perl' packages.
19273143b9aSmrg         Grab them from any GNU archive site."
19373143b9aSmrg    find . -type f -name Makefile.am -print |
19473143b9aSmrg	   sed 's/\.am$/.in/' |
19573143b9aSmrg	   while read f; do touch "$f"; done
19673143b9aSmrg    ;;
19773143b9aSmrg
198b53e5eeaSmrg  autom4te*)
19973143b9aSmrg    echo 1>&2 "\
20073143b9aSmrgWARNING: \`$1' is needed, but is $msg.
20173143b9aSmrg         You might have modified some files without having the
20273143b9aSmrg         proper tools for further handling them.
20373143b9aSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
20473143b9aSmrg         archive site."
20573143b9aSmrg
20673143b9aSmrg    file=`echo "$*" | sed -n "$sed_output"`
20773143b9aSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
20873143b9aSmrg    if test -f "$file"; then
20973143b9aSmrg	touch $file
21073143b9aSmrg    else
21173143b9aSmrg	test -z "$file" || exec >$file
21273143b9aSmrg	echo "#! /bin/sh"
21373143b9aSmrg	echo "# Created by GNU Automake missing as a replacement of"
21473143b9aSmrg	echo "#  $ $@"
21573143b9aSmrg	echo "exit 0"
21673143b9aSmrg	chmod +x $file
21773143b9aSmrg	exit 1
21873143b9aSmrg    fi
21973143b9aSmrg    ;;
22073143b9aSmrg
221b53e5eeaSmrg  bison*|yacc*)
22273143b9aSmrg    echo 1>&2 "\
22373143b9aSmrgWARNING: \`$1' $msg.  You should only need it if
22473143b9aSmrg         you modified a \`.y' file.  You may need the \`Bison' package
22573143b9aSmrg         in order for those modifications to take effect.  You can get
22673143b9aSmrg         \`Bison' from any GNU archive site."
22773143b9aSmrg    rm -f y.tab.c y.tab.h
22873143b9aSmrg    if test $# -ne 1; then
22973143b9aSmrg        eval LASTARG="\${$#}"
23073143b9aSmrg	case $LASTARG in
23173143b9aSmrg	*.y)
23273143b9aSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
23373143b9aSmrg	    if test -f "$SRCFILE"; then
23473143b9aSmrg	         cp "$SRCFILE" y.tab.c
23573143b9aSmrg	    fi
23673143b9aSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
23773143b9aSmrg	    if test -f "$SRCFILE"; then
23873143b9aSmrg	         cp "$SRCFILE" y.tab.h
23973143b9aSmrg	    fi
24073143b9aSmrg	  ;;
24173143b9aSmrg	esac
24273143b9aSmrg    fi
24373143b9aSmrg    if test ! -f y.tab.h; then
24473143b9aSmrg	echo >y.tab.h
24573143b9aSmrg    fi
24673143b9aSmrg    if test ! -f y.tab.c; then
24773143b9aSmrg	echo 'main() { return 0; }' >y.tab.c
24873143b9aSmrg    fi
24973143b9aSmrg    ;;
25073143b9aSmrg
251b53e5eeaSmrg  lex*|flex*)
25273143b9aSmrg    echo 1>&2 "\
25373143b9aSmrgWARNING: \`$1' is $msg.  You should only need it if
25473143b9aSmrg         you modified a \`.l' file.  You may need the \`Flex' package
25573143b9aSmrg         in order for those modifications to take effect.  You can get
25673143b9aSmrg         \`Flex' from any GNU archive site."
25773143b9aSmrg    rm -f lex.yy.c
25873143b9aSmrg    if test $# -ne 1; then
25973143b9aSmrg        eval LASTARG="\${$#}"
26073143b9aSmrg	case $LASTARG in
26173143b9aSmrg	*.l)
26273143b9aSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
26373143b9aSmrg	    if test -f "$SRCFILE"; then
26473143b9aSmrg	         cp "$SRCFILE" lex.yy.c
26573143b9aSmrg	    fi
26673143b9aSmrg	  ;;
26773143b9aSmrg	esac
26873143b9aSmrg    fi
26973143b9aSmrg    if test ! -f lex.yy.c; then
27073143b9aSmrg	echo 'main() { return 0; }' >lex.yy.c
27173143b9aSmrg    fi
27273143b9aSmrg    ;;
27373143b9aSmrg
274b53e5eeaSmrg  help2man*)
27573143b9aSmrg    echo 1>&2 "\
27673143b9aSmrgWARNING: \`$1' is $msg.  You should only need it if
27773143b9aSmrg	 you modified a dependency of a manual page.  You may need the
27873143b9aSmrg	 \`Help2man' package in order for those modifications to take
27973143b9aSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
28073143b9aSmrg
28173143b9aSmrg    file=`echo "$*" | sed -n "$sed_output"`
28273143b9aSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
28373143b9aSmrg    if test -f "$file"; then
28473143b9aSmrg	touch $file
28573143b9aSmrg    else
28673143b9aSmrg	test -z "$file" || exec >$file
28773143b9aSmrg	echo ".ab help2man is required to generate this page"
288b53e5eeaSmrg	exit $?
28973143b9aSmrg    fi
29073143b9aSmrg    ;;
29173143b9aSmrg
292b53e5eeaSmrg  makeinfo*)
29373143b9aSmrg    echo 1>&2 "\
29473143b9aSmrgWARNING: \`$1' is $msg.  You should only need it if
29573143b9aSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
29673143b9aSmrg         indirectly affecting the aspect of the manual.  The spurious
29773143b9aSmrg         call might also be the consequence of using a buggy \`make' (AIX,
29873143b9aSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
29973143b9aSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
30073143b9aSmrg    # The file to touch is that specified with -o ...
30173143b9aSmrg    file=`echo "$*" | sed -n "$sed_output"`
30273143b9aSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
30373143b9aSmrg    if test -z "$file"; then
30473143b9aSmrg      # ... or it is the one specified with @setfilename ...
30573143b9aSmrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
30673143b9aSmrg      file=`sed -n '
30773143b9aSmrg	/^@setfilename/{
30873143b9aSmrg	  s/.* \([^ ]*\) *$/\1/
30973143b9aSmrg	  p
31073143b9aSmrg	  q
31173143b9aSmrg	}' $infile`
31273143b9aSmrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
31373143b9aSmrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
31473143b9aSmrg    fi
31573143b9aSmrg    # If the file does not exist, the user really needs makeinfo;
31673143b9aSmrg    # let's fail without touching anything.
31773143b9aSmrg    test -f $file || exit 1
31873143b9aSmrg    touch $file
31973143b9aSmrg    ;;
32073143b9aSmrg
321b53e5eeaSmrg  tar*)
32273143b9aSmrg    shift
32373143b9aSmrg
32473143b9aSmrg    # We have already tried tar in the generic part.
32573143b9aSmrg    # Look for gnutar/gtar before invocation to avoid ugly error
32673143b9aSmrg    # messages.
32773143b9aSmrg    if (gnutar --version > /dev/null 2>&1); then
32873143b9aSmrg       gnutar "$@" && exit 0
32973143b9aSmrg    fi
33073143b9aSmrg    if (gtar --version > /dev/null 2>&1); then
33173143b9aSmrg       gtar "$@" && exit 0
33273143b9aSmrg    fi
33373143b9aSmrg    firstarg="$1"
33473143b9aSmrg    if shift; then
33573143b9aSmrg	case $firstarg in
33673143b9aSmrg	*o*)
33773143b9aSmrg	    firstarg=`echo "$firstarg" | sed s/o//`
33873143b9aSmrg	    tar "$firstarg" "$@" && exit 0
33973143b9aSmrg	    ;;
34073143b9aSmrg	esac
34173143b9aSmrg	case $firstarg in
34273143b9aSmrg	*h*)
34373143b9aSmrg	    firstarg=`echo "$firstarg" | sed s/h//`
34473143b9aSmrg	    tar "$firstarg" "$@" && exit 0
34573143b9aSmrg	    ;;
34673143b9aSmrg	esac
34773143b9aSmrg    fi
34873143b9aSmrg
34973143b9aSmrg    echo 1>&2 "\
35073143b9aSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
35173143b9aSmrg         You may want to install GNU tar or Free paxutils, or check the
35273143b9aSmrg         command line arguments."
35373143b9aSmrg    exit 1
35473143b9aSmrg    ;;
35573143b9aSmrg
35673143b9aSmrg  *)
35773143b9aSmrg    echo 1>&2 "\
35873143b9aSmrgWARNING: \`$1' is needed, and is $msg.
35973143b9aSmrg         You might have modified some files without having the
36073143b9aSmrg         proper tools for further handling them.  Check the \`README' file,
36173143b9aSmrg         it often tells you about the needed prerequisites for installing
36273143b9aSmrg         this package.  You may also peek at any GNU archive site, in case
36373143b9aSmrg         some other package would contain this missing \`$1' program."
36473143b9aSmrg    exit 1
36573143b9aSmrg    ;;
36673143b9aSmrgesac
36773143b9aSmrg
36873143b9aSmrgexit 0
36973143b9aSmrg
37073143b9aSmrg# Local variables:
37173143b9aSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
37273143b9aSmrg# time-stamp-start: "scriptversion="
37373143b9aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H"
374b53e5eeaSmrg# time-stamp-time-zone: "UTC"
375b53e5eeaSmrg# time-stamp-end: "; # UTC"
37673143b9aSmrg# End:
377