missing revision 880ed95a
102be438aSmrg#! /bin/sh
202be438aSmrg# Common stub for a few missing GNU programs while installing.
302be438aSmrg
4880ed95aSmrgscriptversion=2006-05-10.23
502be438aSmrg
6880ed95aSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
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=:
36880ed95aSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
37880ed95aSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
3802be438aSmrg
3902be438aSmrg# In the cases where this matters, `missing' is being run in the
4002be438aSmrg# srcdir already.
4102be438aSmrgif test -f configure.ac; then
4202be438aSmrg  configure_ac=configure.ac
4302be438aSmrgelse
4402be438aSmrg  configure_ac=configure.in
4502be438aSmrgfi
4602be438aSmrg
4702be438aSmrgmsg="missing on your system"
4802be438aSmrg
49880ed95aSmrgcase $1 in
5002be438aSmrg--run)
5102be438aSmrg  # Try to run requested program, and just exit if it succeeds.
5202be438aSmrg  run=
5302be438aSmrg  shift
5402be438aSmrg  "$@" && exit 0
5502be438aSmrg  # Exit code 63 means version mismatch.  This often happens
5602be438aSmrg  # when the user try to use an ancient version of a tool on
5702be438aSmrg  # a file that requires a minimum version.  In this case we
5802be438aSmrg  # we should proceed has if the program had been absent, or
5902be438aSmrg  # if --run hadn't been passed.
6002be438aSmrg  if test $? = 63; then
6102be438aSmrg    run=:
6202be438aSmrg    msg="probably too old"
6302be438aSmrg  fi
6402be438aSmrg  ;;
6502be438aSmrg
6602be438aSmrg  -h|--h|--he|--hel|--help)
6702be438aSmrg    echo "\
6802be438aSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
6902be438aSmrg
7002be438aSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
7102be438aSmrgerror status if there is no known handling for PROGRAM.
7202be438aSmrg
7302be438aSmrgOptions:
7402be438aSmrg  -h, --help      display this help and exit
7502be438aSmrg  -v, --version   output version information and exit
7602be438aSmrg  --run           try to run the given command, and emulate it if it fails
7702be438aSmrg
7802be438aSmrgSupported PROGRAM values:
7902be438aSmrg  aclocal      touch file \`aclocal.m4'
8002be438aSmrg  autoconf     touch file \`configure'
8102be438aSmrg  autoheader   touch file \`config.h.in'
82880ed95aSmrg  autom4te     touch the output file, or create a stub one
8302be438aSmrg  automake     touch all \`Makefile.in' files
8402be438aSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
8502be438aSmrg  flex         create \`lex.yy.c', if possible, from existing .c
8602be438aSmrg  help2man     touch the output file
8702be438aSmrg  lex          create \`lex.yy.c', if possible, from existing .c
8802be438aSmrg  makeinfo     touch the output file
8902be438aSmrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
9002be438aSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
9102be438aSmrg
9202be438aSmrgSend bug reports to <bug-automake@gnu.org>."
9302be438aSmrg    exit $?
9402be438aSmrg    ;;
9502be438aSmrg
9602be438aSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
9702be438aSmrg    echo "missing $scriptversion (GNU Automake)"
9802be438aSmrg    exit $?
9902be438aSmrg    ;;
10002be438aSmrg
10102be438aSmrg  -*)
10202be438aSmrg    echo 1>&2 "$0: Unknown \`$1' option"
10302be438aSmrg    echo 1>&2 "Try \`$0 --help' for more information"
10402be438aSmrg    exit 1
10502be438aSmrg    ;;
10602be438aSmrg
10702be438aSmrgesac
10802be438aSmrg
10902be438aSmrg# Now exit if we have it, but it failed.  Also exit now if we
11002be438aSmrg# don't have it and --version was passed (most likely to detect
11102be438aSmrg# the program).
112880ed95aSmrgcase $1 in
11302be438aSmrg  lex|yacc)
11402be438aSmrg    # Not GNU programs, they don't have --version.
11502be438aSmrg    ;;
11602be438aSmrg
11702be438aSmrg  tar)
11802be438aSmrg    if test -n "$run"; then
11902be438aSmrg       echo 1>&2 "ERROR: \`tar' requires --run"
12002be438aSmrg       exit 1
12102be438aSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
12202be438aSmrg       exit 1
12302be438aSmrg    fi
12402be438aSmrg    ;;
12502be438aSmrg
12602be438aSmrg  *)
12702be438aSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
12802be438aSmrg       # We have it, but it failed.
12902be438aSmrg       exit 1
13002be438aSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
13102be438aSmrg       # Could not run --version or --help.  This is probably someone
13202be438aSmrg       # running `$TOOL --version' or `$TOOL --help' to check whether
13302be438aSmrg       # $TOOL exists and not knowing $TOOL uses missing.
13402be438aSmrg       exit 1
13502be438aSmrg    fi
13602be438aSmrg    ;;
13702be438aSmrgesac
13802be438aSmrg
13902be438aSmrg# If it does not exist, or fails to run (possibly an outdated version),
14002be438aSmrg# try to emulate it.
141880ed95aSmrgcase $1 in
14202be438aSmrg  aclocal*)
14302be438aSmrg    echo 1>&2 "\
14402be438aSmrgWARNING: \`$1' is $msg.  You should only need it if
14502be438aSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
14602be438aSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
14702be438aSmrg         any GNU archive site."
14802be438aSmrg    touch aclocal.m4
14902be438aSmrg    ;;
15002be438aSmrg
15102be438aSmrg  autoconf)
15202be438aSmrg    echo 1>&2 "\
15302be438aSmrgWARNING: \`$1' is $msg.  You should only need it if
15402be438aSmrg         you modified \`${configure_ac}'.  You might want to install the
15502be438aSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
15602be438aSmrg         archive site."
15702be438aSmrg    touch configure
15802be438aSmrg    ;;
15902be438aSmrg
16002be438aSmrg  autoheader)
16102be438aSmrg    echo 1>&2 "\
16202be438aSmrgWARNING: \`$1' is $msg.  You should only need it if
16302be438aSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
16402be438aSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
16502be438aSmrg         from any GNU archive site."
16602be438aSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
16702be438aSmrg    test -z "$files" && files="config.h"
16802be438aSmrg    touch_files=
16902be438aSmrg    for f in $files; do
170880ed95aSmrg      case $f in
17102be438aSmrg      *:*) touch_files="$touch_files "`echo "$f" |
17202be438aSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
17302be438aSmrg      *) touch_files="$touch_files $f.in";;
17402be438aSmrg      esac
17502be438aSmrg    done
17602be438aSmrg    touch $touch_files
17702be438aSmrg    ;;
17802be438aSmrg
17902be438aSmrg  automake*)
18002be438aSmrg    echo 1>&2 "\
18102be438aSmrgWARNING: \`$1' is $msg.  You should only need it if
18202be438aSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
18302be438aSmrg         You might want to install the \`Automake' and \`Perl' packages.
18402be438aSmrg         Grab them from any GNU archive site."
18502be438aSmrg    find . -type f -name Makefile.am -print |
18602be438aSmrg	   sed 's/\.am$/.in/' |
18702be438aSmrg	   while read f; do touch "$f"; done
18802be438aSmrg    ;;
18902be438aSmrg
19002be438aSmrg  autom4te)
19102be438aSmrg    echo 1>&2 "\
19202be438aSmrgWARNING: \`$1' is needed, but is $msg.
19302be438aSmrg         You might have modified some files without having the
19402be438aSmrg         proper tools for further handling them.
19502be438aSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
19602be438aSmrg         archive site."
19702be438aSmrg
198880ed95aSmrg    file=`echo "$*" | sed -n "$sed_output"`
199880ed95aSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
20002be438aSmrg    if test -f "$file"; then
20102be438aSmrg	touch $file
20202be438aSmrg    else
20302be438aSmrg	test -z "$file" || exec >$file
20402be438aSmrg	echo "#! /bin/sh"
20502be438aSmrg	echo "# Created by GNU Automake missing as a replacement of"
20602be438aSmrg	echo "#  $ $@"
20702be438aSmrg	echo "exit 0"
20802be438aSmrg	chmod +x $file
20902be438aSmrg	exit 1
21002be438aSmrg    fi
21102be438aSmrg    ;;
21202be438aSmrg
21302be438aSmrg  bison|yacc)
21402be438aSmrg    echo 1>&2 "\
21502be438aSmrgWARNING: \`$1' $msg.  You should only need it if
21602be438aSmrg         you modified a \`.y' file.  You may need the \`Bison' package
21702be438aSmrg         in order for those modifications to take effect.  You can get
21802be438aSmrg         \`Bison' from any GNU archive site."
21902be438aSmrg    rm -f y.tab.c y.tab.h
220880ed95aSmrg    if test $# -ne 1; then
22102be438aSmrg        eval LASTARG="\${$#}"
222880ed95aSmrg	case $LASTARG in
22302be438aSmrg	*.y)
22402be438aSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
225880ed95aSmrg	    if test -f "$SRCFILE"; then
22602be438aSmrg	         cp "$SRCFILE" y.tab.c
22702be438aSmrg	    fi
22802be438aSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
229880ed95aSmrg	    if test -f "$SRCFILE"; then
23002be438aSmrg	         cp "$SRCFILE" y.tab.h
23102be438aSmrg	    fi
23202be438aSmrg	  ;;
23302be438aSmrg	esac
23402be438aSmrg    fi
235880ed95aSmrg    if test ! -f y.tab.h; then
23602be438aSmrg	echo >y.tab.h
23702be438aSmrg    fi
238880ed95aSmrg    if test ! -f y.tab.c; then
23902be438aSmrg	echo 'main() { return 0; }' >y.tab.c
24002be438aSmrg    fi
24102be438aSmrg    ;;
24202be438aSmrg
24302be438aSmrg  lex|flex)
24402be438aSmrg    echo 1>&2 "\
24502be438aSmrgWARNING: \`$1' is $msg.  You should only need it if
24602be438aSmrg         you modified a \`.l' file.  You may need the \`Flex' package
24702be438aSmrg         in order for those modifications to take effect.  You can get
24802be438aSmrg         \`Flex' from any GNU archive site."
24902be438aSmrg    rm -f lex.yy.c
250880ed95aSmrg    if test $# -ne 1; then
25102be438aSmrg        eval LASTARG="\${$#}"
252880ed95aSmrg	case $LASTARG in
25302be438aSmrg	*.l)
25402be438aSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
255880ed95aSmrg	    if test -f "$SRCFILE"; then
25602be438aSmrg	         cp "$SRCFILE" lex.yy.c
25702be438aSmrg	    fi
25802be438aSmrg	  ;;
25902be438aSmrg	esac
26002be438aSmrg    fi
261880ed95aSmrg    if test ! -f lex.yy.c; then
26202be438aSmrg	echo 'main() { return 0; }' >lex.yy.c
26302be438aSmrg    fi
26402be438aSmrg    ;;
26502be438aSmrg
26602be438aSmrg  help2man)
26702be438aSmrg    echo 1>&2 "\
26802be438aSmrgWARNING: \`$1' is $msg.  You should only need it if
26902be438aSmrg	 you modified a dependency of a manual page.  You may need the
27002be438aSmrg	 \`Help2man' package in order for those modifications to take
27102be438aSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
27202be438aSmrg
273880ed95aSmrg    file=`echo "$*" | sed -n "$sed_output"`
274880ed95aSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
275880ed95aSmrg    if test -f "$file"; then
27602be438aSmrg	touch $file
27702be438aSmrg    else
27802be438aSmrg	test -z "$file" || exec >$file
27902be438aSmrg	echo ".ab help2man is required to generate this page"
28002be438aSmrg	exit 1
28102be438aSmrg    fi
28202be438aSmrg    ;;
28302be438aSmrg
28402be438aSmrg  makeinfo)
28502be438aSmrg    echo 1>&2 "\
28602be438aSmrgWARNING: \`$1' is $msg.  You should only need it if
28702be438aSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
28802be438aSmrg         indirectly affecting the aspect of the manual.  The spurious
28902be438aSmrg         call might also be the consequence of using a buggy \`make' (AIX,
29002be438aSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
29102be438aSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
29202be438aSmrg    # The file to touch is that specified with -o ...
293880ed95aSmrg    file=`echo "$*" | sed -n "$sed_output"`
294880ed95aSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
29502be438aSmrg    if test -z "$file"; then
29602be438aSmrg      # ... or it is the one specified with @setfilename ...
29702be438aSmrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
298880ed95aSmrg      file=`sed -n '
299880ed95aSmrg	/^@setfilename/{
300880ed95aSmrg	  s/.* \([^ ]*\) *$/\1/
301880ed95aSmrg	  p
302880ed95aSmrg	  q
303880ed95aSmrg	}' $infile`
30402be438aSmrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
30502be438aSmrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
30602be438aSmrg    fi
30702be438aSmrg    # If the file does not exist, the user really needs makeinfo;
30802be438aSmrg    # let's fail without touching anything.
30902be438aSmrg    test -f $file || exit 1
31002be438aSmrg    touch $file
31102be438aSmrg    ;;
31202be438aSmrg
31302be438aSmrg  tar)
31402be438aSmrg    shift
31502be438aSmrg
31602be438aSmrg    # We have already tried tar in the generic part.
31702be438aSmrg    # Look for gnutar/gtar before invocation to avoid ugly error
31802be438aSmrg    # messages.
31902be438aSmrg    if (gnutar --version > /dev/null 2>&1); then
32002be438aSmrg       gnutar "$@" && exit 0
32102be438aSmrg    fi
32202be438aSmrg    if (gtar --version > /dev/null 2>&1); then
32302be438aSmrg       gtar "$@" && exit 0
32402be438aSmrg    fi
32502be438aSmrg    firstarg="$1"
32602be438aSmrg    if shift; then
327880ed95aSmrg	case $firstarg in
32802be438aSmrg	*o*)
32902be438aSmrg	    firstarg=`echo "$firstarg" | sed s/o//`
33002be438aSmrg	    tar "$firstarg" "$@" && exit 0
33102be438aSmrg	    ;;
33202be438aSmrg	esac
333880ed95aSmrg	case $firstarg in
33402be438aSmrg	*h*)
33502be438aSmrg	    firstarg=`echo "$firstarg" | sed s/h//`
33602be438aSmrg	    tar "$firstarg" "$@" && exit 0
33702be438aSmrg	    ;;
33802be438aSmrg	esac
33902be438aSmrg    fi
34002be438aSmrg
34102be438aSmrg    echo 1>&2 "\
34202be438aSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
34302be438aSmrg         You may want to install GNU tar or Free paxutils, or check the
34402be438aSmrg         command line arguments."
34502be438aSmrg    exit 1
34602be438aSmrg    ;;
34702be438aSmrg
34802be438aSmrg  *)
34902be438aSmrg    echo 1>&2 "\
35002be438aSmrgWARNING: \`$1' is needed, and is $msg.
35102be438aSmrg         You might have modified some files without having the
35202be438aSmrg         proper tools for further handling them.  Check the \`README' file,
35302be438aSmrg         it often tells you about the needed prerequisites for installing
35402be438aSmrg         this package.  You may also peek at any GNU archive site, in case
35502be438aSmrg         some other package would contain this missing \`$1' program."
35602be438aSmrg    exit 1
35702be438aSmrg    ;;
35802be438aSmrgesac
35902be438aSmrg
36002be438aSmrgexit 0
36102be438aSmrg
36202be438aSmrg# Local variables:
36302be438aSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
36402be438aSmrg# time-stamp-start: "scriptversion="
36502be438aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H"
36602be438aSmrg# time-stamp-end: "$"
36702be438aSmrg# End:
368