missing revision 02be438a
102be438aSmrg#! /bin/sh
202be438aSmrg# Common stub for a few missing GNU programs while installing.
302be438aSmrg
402be438aSmrgscriptversion=2005-06-08.21
502be438aSmrg
602be438aSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
702be438aSmrg#   Free Software Foundation, Inc.
802be438aSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
902be438aSmrg
1002be438aSmrg# This program is free software; you can redistribute it and/or modify
1102be438aSmrg# it under the terms of the GNU General Public License as published by
1202be438aSmrg# the Free Software Foundation; either version 2, or (at your option)
1302be438aSmrg# any later version.
1402be438aSmrg
1502be438aSmrg# This program is distributed in the hope that it will be useful,
1602be438aSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
1702be438aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1802be438aSmrg# GNU General Public License for more details.
1902be438aSmrg
2002be438aSmrg# You should have received a copy of the GNU General Public License
2102be438aSmrg# along with this program; if not, write to the Free Software
2202be438aSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
2302be438aSmrg# 02110-1301, USA.
2402be438aSmrg
2502be438aSmrg# As a special exception to the GNU General Public License, if you
2602be438aSmrg# distribute this file as part of a program that contains a
2702be438aSmrg# configuration script generated by Autoconf, you may include it under
2802be438aSmrg# the same distribution terms that you use for the rest of that program.
2902be438aSmrg
3002be438aSmrgif test $# -eq 0; then
3102be438aSmrg  echo 1>&2 "Try \`$0 --help' for more information"
3202be438aSmrg  exit 1
3302be438aSmrgfi
3402be438aSmrg
3502be438aSmrgrun=:
3602be438aSmrg
3702be438aSmrg# In the cases where this matters, `missing' is being run in the
3802be438aSmrg# srcdir already.
3902be438aSmrgif test -f configure.ac; then
4002be438aSmrg  configure_ac=configure.ac
4102be438aSmrgelse
4202be438aSmrg  configure_ac=configure.in
4302be438aSmrgfi
4402be438aSmrg
4502be438aSmrgmsg="missing on your system"
4602be438aSmrg
4702be438aSmrgcase "$1" in
4802be438aSmrg--run)
4902be438aSmrg  # Try to run requested program, and just exit if it succeeds.
5002be438aSmrg  run=
5102be438aSmrg  shift
5202be438aSmrg  "$@" && exit 0
5302be438aSmrg  # Exit code 63 means version mismatch.  This often happens
5402be438aSmrg  # when the user try to use an ancient version of a tool on
5502be438aSmrg  # a file that requires a minimum version.  In this case we
5602be438aSmrg  # we should proceed has if the program had been absent, or
5702be438aSmrg  # if --run hadn't been passed.
5802be438aSmrg  if test $? = 63; then
5902be438aSmrg    run=:
6002be438aSmrg    msg="probably too old"
6102be438aSmrg  fi
6202be438aSmrg  ;;
6302be438aSmrg
6402be438aSmrg  -h|--h|--he|--hel|--help)
6502be438aSmrg    echo "\
6602be438aSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
6702be438aSmrg
6802be438aSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
6902be438aSmrgerror status if there is no known handling for PROGRAM.
7002be438aSmrg
7102be438aSmrgOptions:
7202be438aSmrg  -h, --help      display this help and exit
7302be438aSmrg  -v, --version   output version information and exit
7402be438aSmrg  --run           try to run the given command, and emulate it if it fails
7502be438aSmrg
7602be438aSmrgSupported PROGRAM values:
7702be438aSmrg  aclocal      touch file \`aclocal.m4'
7802be438aSmrg  autoconf     touch file \`configure'
7902be438aSmrg  autoheader   touch file \`config.h.in'
8002be438aSmrg  automake     touch all \`Makefile.in' files
8102be438aSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
8202be438aSmrg  flex         create \`lex.yy.c', if possible, from existing .c
8302be438aSmrg  help2man     touch the output file
8402be438aSmrg  lex          create \`lex.yy.c', if possible, from existing .c
8502be438aSmrg  makeinfo     touch the output file
8602be438aSmrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
8702be438aSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
8802be438aSmrg
8902be438aSmrgSend bug reports to <bug-automake@gnu.org>."
9002be438aSmrg    exit $?
9102be438aSmrg    ;;
9202be438aSmrg
9302be438aSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
9402be438aSmrg    echo "missing $scriptversion (GNU Automake)"
9502be438aSmrg    exit $?
9602be438aSmrg    ;;
9702be438aSmrg
9802be438aSmrg  -*)
9902be438aSmrg    echo 1>&2 "$0: Unknown \`$1' option"
10002be438aSmrg    echo 1>&2 "Try \`$0 --help' for more information"
10102be438aSmrg    exit 1
10202be438aSmrg    ;;
10302be438aSmrg
10402be438aSmrgesac
10502be438aSmrg
10602be438aSmrg# Now exit if we have it, but it failed.  Also exit now if we
10702be438aSmrg# don't have it and --version was passed (most likely to detect
10802be438aSmrg# the program).
10902be438aSmrgcase "$1" in
11002be438aSmrg  lex|yacc)
11102be438aSmrg    # Not GNU programs, they don't have --version.
11202be438aSmrg    ;;
11302be438aSmrg
11402be438aSmrg  tar)
11502be438aSmrg    if test -n "$run"; then
11602be438aSmrg       echo 1>&2 "ERROR: \`tar' requires --run"
11702be438aSmrg       exit 1
11802be438aSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
11902be438aSmrg       exit 1
12002be438aSmrg    fi
12102be438aSmrg    ;;
12202be438aSmrg
12302be438aSmrg  *)
12402be438aSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
12502be438aSmrg       # We have it, but it failed.
12602be438aSmrg       exit 1
12702be438aSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
12802be438aSmrg       # Could not run --version or --help.  This is probably someone
12902be438aSmrg       # running `$TOOL --version' or `$TOOL --help' to check whether
13002be438aSmrg       # $TOOL exists and not knowing $TOOL uses missing.
13102be438aSmrg       exit 1
13202be438aSmrg    fi
13302be438aSmrg    ;;
13402be438aSmrgesac
13502be438aSmrg
13602be438aSmrg# If it does not exist, or fails to run (possibly an outdated version),
13702be438aSmrg# try to emulate it.
13802be438aSmrgcase "$1" in
13902be438aSmrg  aclocal*)
14002be438aSmrg    echo 1>&2 "\
14102be438aSmrgWARNING: \`$1' is $msg.  You should only need it if
14202be438aSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
14302be438aSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
14402be438aSmrg         any GNU archive site."
14502be438aSmrg    touch aclocal.m4
14602be438aSmrg    ;;
14702be438aSmrg
14802be438aSmrg  autoconf)
14902be438aSmrg    echo 1>&2 "\
15002be438aSmrgWARNING: \`$1' is $msg.  You should only need it if
15102be438aSmrg         you modified \`${configure_ac}'.  You might want to install the
15202be438aSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
15302be438aSmrg         archive site."
15402be438aSmrg    touch configure
15502be438aSmrg    ;;
15602be438aSmrg
15702be438aSmrg  autoheader)
15802be438aSmrg    echo 1>&2 "\
15902be438aSmrgWARNING: \`$1' is $msg.  You should only need it if
16002be438aSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
16102be438aSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
16202be438aSmrg         from any GNU archive site."
16302be438aSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
16402be438aSmrg    test -z "$files" && files="config.h"
16502be438aSmrg    touch_files=
16602be438aSmrg    for f in $files; do
16702be438aSmrg      case "$f" in
16802be438aSmrg      *:*) touch_files="$touch_files "`echo "$f" |
16902be438aSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
17002be438aSmrg      *) touch_files="$touch_files $f.in";;
17102be438aSmrg      esac
17202be438aSmrg    done
17302be438aSmrg    touch $touch_files
17402be438aSmrg    ;;
17502be438aSmrg
17602be438aSmrg  automake*)
17702be438aSmrg    echo 1>&2 "\
17802be438aSmrgWARNING: \`$1' is $msg.  You should only need it if
17902be438aSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
18002be438aSmrg         You might want to install the \`Automake' and \`Perl' packages.
18102be438aSmrg         Grab them from any GNU archive site."
18202be438aSmrg    find . -type f -name Makefile.am -print |
18302be438aSmrg	   sed 's/\.am$/.in/' |
18402be438aSmrg	   while read f; do touch "$f"; done
18502be438aSmrg    ;;
18602be438aSmrg
18702be438aSmrg  autom4te)
18802be438aSmrg    echo 1>&2 "\
18902be438aSmrgWARNING: \`$1' is needed, but is $msg.
19002be438aSmrg         You might have modified some files without having the
19102be438aSmrg         proper tools for further handling them.
19202be438aSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
19302be438aSmrg         archive site."
19402be438aSmrg
19502be438aSmrg    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
19602be438aSmrg    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
19702be438aSmrg    if test -f "$file"; then
19802be438aSmrg	touch $file
19902be438aSmrg    else
20002be438aSmrg	test -z "$file" || exec >$file
20102be438aSmrg	echo "#! /bin/sh"
20202be438aSmrg	echo "# Created by GNU Automake missing as a replacement of"
20302be438aSmrg	echo "#  $ $@"
20402be438aSmrg	echo "exit 0"
20502be438aSmrg	chmod +x $file
20602be438aSmrg	exit 1
20702be438aSmrg    fi
20802be438aSmrg    ;;
20902be438aSmrg
21002be438aSmrg  bison|yacc)
21102be438aSmrg    echo 1>&2 "\
21202be438aSmrgWARNING: \`$1' $msg.  You should only need it if
21302be438aSmrg         you modified a \`.y' file.  You may need the \`Bison' package
21402be438aSmrg         in order for those modifications to take effect.  You can get
21502be438aSmrg         \`Bison' from any GNU archive site."
21602be438aSmrg    rm -f y.tab.c y.tab.h
21702be438aSmrg    if [ $# -ne 1 ]; then
21802be438aSmrg        eval LASTARG="\${$#}"
21902be438aSmrg	case "$LASTARG" in
22002be438aSmrg	*.y)
22102be438aSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
22202be438aSmrg	    if [ -f "$SRCFILE" ]; then
22302be438aSmrg	         cp "$SRCFILE" y.tab.c
22402be438aSmrg	    fi
22502be438aSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
22602be438aSmrg	    if [ -f "$SRCFILE" ]; then
22702be438aSmrg	         cp "$SRCFILE" y.tab.h
22802be438aSmrg	    fi
22902be438aSmrg	  ;;
23002be438aSmrg	esac
23102be438aSmrg    fi
23202be438aSmrg    if [ ! -f y.tab.h ]; then
23302be438aSmrg	echo >y.tab.h
23402be438aSmrg    fi
23502be438aSmrg    if [ ! -f y.tab.c ]; then
23602be438aSmrg	echo 'main() { return 0; }' >y.tab.c
23702be438aSmrg    fi
23802be438aSmrg    ;;
23902be438aSmrg
24002be438aSmrg  lex|flex)
24102be438aSmrg    echo 1>&2 "\
24202be438aSmrgWARNING: \`$1' is $msg.  You should only need it if
24302be438aSmrg         you modified a \`.l' file.  You may need the \`Flex' package
24402be438aSmrg         in order for those modifications to take effect.  You can get
24502be438aSmrg         \`Flex' from any GNU archive site."
24602be438aSmrg    rm -f lex.yy.c
24702be438aSmrg    if [ $# -ne 1 ]; then
24802be438aSmrg        eval LASTARG="\${$#}"
24902be438aSmrg	case "$LASTARG" in
25002be438aSmrg	*.l)
25102be438aSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
25202be438aSmrg	    if [ -f "$SRCFILE" ]; then
25302be438aSmrg	         cp "$SRCFILE" lex.yy.c
25402be438aSmrg	    fi
25502be438aSmrg	  ;;
25602be438aSmrg	esac
25702be438aSmrg    fi
25802be438aSmrg    if [ ! -f lex.yy.c ]; then
25902be438aSmrg	echo 'main() { return 0; }' >lex.yy.c
26002be438aSmrg    fi
26102be438aSmrg    ;;
26202be438aSmrg
26302be438aSmrg  help2man)
26402be438aSmrg    echo 1>&2 "\
26502be438aSmrgWARNING: \`$1' is $msg.  You should only need it if
26602be438aSmrg	 you modified a dependency of a manual page.  You may need the
26702be438aSmrg	 \`Help2man' package in order for those modifications to take
26802be438aSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
26902be438aSmrg
27002be438aSmrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
27102be438aSmrg    if test -z "$file"; then
27202be438aSmrg	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
27302be438aSmrg    fi
27402be438aSmrg    if [ -f "$file" ]; then
27502be438aSmrg	touch $file
27602be438aSmrg    else
27702be438aSmrg	test -z "$file" || exec >$file
27802be438aSmrg	echo ".ab help2man is required to generate this page"
27902be438aSmrg	exit 1
28002be438aSmrg    fi
28102be438aSmrg    ;;
28202be438aSmrg
28302be438aSmrg  makeinfo)
28402be438aSmrg    echo 1>&2 "\
28502be438aSmrgWARNING: \`$1' is $msg.  You should only need it if
28602be438aSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
28702be438aSmrg         indirectly affecting the aspect of the manual.  The spurious
28802be438aSmrg         call might also be the consequence of using a buggy \`make' (AIX,
28902be438aSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
29002be438aSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
29102be438aSmrg    # The file to touch is that specified with -o ...
29202be438aSmrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
29302be438aSmrg    if test -z "$file"; then
29402be438aSmrg      # ... or it is the one specified with @setfilename ...
29502be438aSmrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
29602be438aSmrg      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
29702be438aSmrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
29802be438aSmrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
29902be438aSmrg    fi
30002be438aSmrg    # If the file does not exist, the user really needs makeinfo;
30102be438aSmrg    # let's fail without touching anything.
30202be438aSmrg    test -f $file || exit 1
30302be438aSmrg    touch $file
30402be438aSmrg    ;;
30502be438aSmrg
30602be438aSmrg  tar)
30702be438aSmrg    shift
30802be438aSmrg
30902be438aSmrg    # We have already tried tar in the generic part.
31002be438aSmrg    # Look for gnutar/gtar before invocation to avoid ugly error
31102be438aSmrg    # messages.
31202be438aSmrg    if (gnutar --version > /dev/null 2>&1); then
31302be438aSmrg       gnutar "$@" && exit 0
31402be438aSmrg    fi
31502be438aSmrg    if (gtar --version > /dev/null 2>&1); then
31602be438aSmrg       gtar "$@" && exit 0
31702be438aSmrg    fi
31802be438aSmrg    firstarg="$1"
31902be438aSmrg    if shift; then
32002be438aSmrg	case "$firstarg" in
32102be438aSmrg	*o*)
32202be438aSmrg	    firstarg=`echo "$firstarg" | sed s/o//`
32302be438aSmrg	    tar "$firstarg" "$@" && exit 0
32402be438aSmrg	    ;;
32502be438aSmrg	esac
32602be438aSmrg	case "$firstarg" in
32702be438aSmrg	*h*)
32802be438aSmrg	    firstarg=`echo "$firstarg" | sed s/h//`
32902be438aSmrg	    tar "$firstarg" "$@" && exit 0
33002be438aSmrg	    ;;
33102be438aSmrg	esac
33202be438aSmrg    fi
33302be438aSmrg
33402be438aSmrg    echo 1>&2 "\
33502be438aSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
33602be438aSmrg         You may want to install GNU tar or Free paxutils, or check the
33702be438aSmrg         command line arguments."
33802be438aSmrg    exit 1
33902be438aSmrg    ;;
34002be438aSmrg
34102be438aSmrg  *)
34202be438aSmrg    echo 1>&2 "\
34302be438aSmrgWARNING: \`$1' is needed, and is $msg.
34402be438aSmrg         You might have modified some files without having the
34502be438aSmrg         proper tools for further handling them.  Check the \`README' file,
34602be438aSmrg         it often tells you about the needed prerequisites for installing
34702be438aSmrg         this package.  You may also peek at any GNU archive site, in case
34802be438aSmrg         some other package would contain this missing \`$1' program."
34902be438aSmrg    exit 1
35002be438aSmrg    ;;
35102be438aSmrgesac
35202be438aSmrg
35302be438aSmrgexit 0
35402be438aSmrg
35502be438aSmrg# Local variables:
35602be438aSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
35702be438aSmrg# time-stamp-start: "scriptversion="
35802be438aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H"
35902be438aSmrg# time-stamp-end: "$"
36002be438aSmrg# End:
361