missing revision 76888252
176888252Smrg#! /bin/sh
276888252Smrg# Common stub for a few missing GNU programs while installing.
376888252Smrg
476888252Smrgscriptversion=2005-06-08.21
576888252Smrg
676888252Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
776888252Smrg#   Free Software Foundation, Inc.
876888252Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
976888252Smrg
1076888252Smrg# This program is free software; you can redistribute it and/or modify
1176888252Smrg# it under the terms of the GNU General Public License as published by
1276888252Smrg# the Free Software Foundation; either version 2, or (at your option)
1376888252Smrg# any later version.
1476888252Smrg
1576888252Smrg# This program is distributed in the hope that it will be useful,
1676888252Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
1776888252Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1876888252Smrg# GNU General Public License for more details.
1976888252Smrg
2076888252Smrg# You should have received a copy of the GNU General Public License
2176888252Smrg# along with this program; if not, write to the Free Software
2276888252Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
2376888252Smrg# 02110-1301, USA.
2476888252Smrg
2576888252Smrg# As a special exception to the GNU General Public License, if you
2676888252Smrg# distribute this file as part of a program that contains a
2776888252Smrg# configuration script generated by Autoconf, you may include it under
2876888252Smrg# the same distribution terms that you use for the rest of that program.
2976888252Smrg
3076888252Smrgif test $# -eq 0; then
3176888252Smrg  echo 1>&2 "Try \`$0 --help' for more information"
3276888252Smrg  exit 1
3376888252Smrgfi
3476888252Smrg
3576888252Smrgrun=:
3676888252Smrg
3776888252Smrg# In the cases where this matters, `missing' is being run in the
3876888252Smrg# srcdir already.
3976888252Smrgif test -f configure.ac; then
4076888252Smrg  configure_ac=configure.ac
4176888252Smrgelse
4276888252Smrg  configure_ac=configure.in
4376888252Smrgfi
4476888252Smrg
4576888252Smrgmsg="missing on your system"
4676888252Smrg
4776888252Smrgcase "$1" in
4876888252Smrg--run)
4976888252Smrg  # Try to run requested program, and just exit if it succeeds.
5076888252Smrg  run=
5176888252Smrg  shift
5276888252Smrg  "$@" && exit 0
5376888252Smrg  # Exit code 63 means version mismatch.  This often happens
5476888252Smrg  # when the user try to use an ancient version of a tool on
5576888252Smrg  # a file that requires a minimum version.  In this case we
5676888252Smrg  # we should proceed has if the program had been absent, or
5776888252Smrg  # if --run hadn't been passed.
5876888252Smrg  if test $? = 63; then
5976888252Smrg    run=:
6076888252Smrg    msg="probably too old"
6176888252Smrg  fi
6276888252Smrg  ;;
6376888252Smrg
6476888252Smrg  -h|--h|--he|--hel|--help)
6576888252Smrg    echo "\
6676888252Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
6776888252Smrg
6876888252SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
6976888252Smrgerror status if there is no known handling for PROGRAM.
7076888252Smrg
7176888252SmrgOptions:
7276888252Smrg  -h, --help      display this help and exit
7376888252Smrg  -v, --version   output version information and exit
7476888252Smrg  --run           try to run the given command, and emulate it if it fails
7576888252Smrg
7676888252SmrgSupported PROGRAM values:
7776888252Smrg  aclocal      touch file \`aclocal.m4'
7876888252Smrg  autoconf     touch file \`configure'
7976888252Smrg  autoheader   touch file \`config.h.in'
8076888252Smrg  automake     touch all \`Makefile.in' files
8176888252Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
8276888252Smrg  flex         create \`lex.yy.c', if possible, from existing .c
8376888252Smrg  help2man     touch the output file
8476888252Smrg  lex          create \`lex.yy.c', if possible, from existing .c
8576888252Smrg  makeinfo     touch the output file
8676888252Smrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
8776888252Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
8876888252Smrg
8976888252SmrgSend bug reports to <bug-automake@gnu.org>."
9076888252Smrg    exit $?
9176888252Smrg    ;;
9276888252Smrg
9376888252Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
9476888252Smrg    echo "missing $scriptversion (GNU Automake)"
9576888252Smrg    exit $?
9676888252Smrg    ;;
9776888252Smrg
9876888252Smrg  -*)
9976888252Smrg    echo 1>&2 "$0: Unknown \`$1' option"
10076888252Smrg    echo 1>&2 "Try \`$0 --help' for more information"
10176888252Smrg    exit 1
10276888252Smrg    ;;
10376888252Smrg
10476888252Smrgesac
10576888252Smrg
10676888252Smrg# Now exit if we have it, but it failed.  Also exit now if we
10776888252Smrg# don't have it and --version was passed (most likely to detect
10876888252Smrg# the program).
10976888252Smrgcase "$1" in
11076888252Smrg  lex|yacc)
11176888252Smrg    # Not GNU programs, they don't have --version.
11276888252Smrg    ;;
11376888252Smrg
11476888252Smrg  tar)
11576888252Smrg    if test -n "$run"; then
11676888252Smrg       echo 1>&2 "ERROR: \`tar' requires --run"
11776888252Smrg       exit 1
11876888252Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
11976888252Smrg       exit 1
12076888252Smrg    fi
12176888252Smrg    ;;
12276888252Smrg
12376888252Smrg  *)
12476888252Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
12576888252Smrg       # We have it, but it failed.
12676888252Smrg       exit 1
12776888252Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
12876888252Smrg       # Could not run --version or --help.  This is probably someone
12976888252Smrg       # running `$TOOL --version' or `$TOOL --help' to check whether
13076888252Smrg       # $TOOL exists and not knowing $TOOL uses missing.
13176888252Smrg       exit 1
13276888252Smrg    fi
13376888252Smrg    ;;
13476888252Smrgesac
13576888252Smrg
13676888252Smrg# If it does not exist, or fails to run (possibly an outdated version),
13776888252Smrg# try to emulate it.
13876888252Smrgcase "$1" in
13976888252Smrg  aclocal*)
14076888252Smrg    echo 1>&2 "\
14176888252SmrgWARNING: \`$1' is $msg.  You should only need it if
14276888252Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
14376888252Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
14476888252Smrg         any GNU archive site."
14576888252Smrg    touch aclocal.m4
14676888252Smrg    ;;
14776888252Smrg
14876888252Smrg  autoconf)
14976888252Smrg    echo 1>&2 "\
15076888252SmrgWARNING: \`$1' is $msg.  You should only need it if
15176888252Smrg         you modified \`${configure_ac}'.  You might want to install the
15276888252Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
15376888252Smrg         archive site."
15476888252Smrg    touch configure
15576888252Smrg    ;;
15676888252Smrg
15776888252Smrg  autoheader)
15876888252Smrg    echo 1>&2 "\
15976888252SmrgWARNING: \`$1' is $msg.  You should only need it if
16076888252Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
16176888252Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
16276888252Smrg         from any GNU archive site."
16376888252Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
16476888252Smrg    test -z "$files" && files="config.h"
16576888252Smrg    touch_files=
16676888252Smrg    for f in $files; do
16776888252Smrg      case "$f" in
16876888252Smrg      *:*) touch_files="$touch_files "`echo "$f" |
16976888252Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
17076888252Smrg      *) touch_files="$touch_files $f.in";;
17176888252Smrg      esac
17276888252Smrg    done
17376888252Smrg    touch $touch_files
17476888252Smrg    ;;
17576888252Smrg
17676888252Smrg  automake*)
17776888252Smrg    echo 1>&2 "\
17876888252SmrgWARNING: \`$1' is $msg.  You should only need it if
17976888252Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
18076888252Smrg         You might want to install the \`Automake' and \`Perl' packages.
18176888252Smrg         Grab them from any GNU archive site."
18276888252Smrg    find . -type f -name Makefile.am -print |
18376888252Smrg	   sed 's/\.am$/.in/' |
18476888252Smrg	   while read f; do touch "$f"; done
18576888252Smrg    ;;
18676888252Smrg
18776888252Smrg  autom4te)
18876888252Smrg    echo 1>&2 "\
18976888252SmrgWARNING: \`$1' is needed, but is $msg.
19076888252Smrg         You might have modified some files without having the
19176888252Smrg         proper tools for further handling them.
19276888252Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
19376888252Smrg         archive site."
19476888252Smrg
19576888252Smrg    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
19676888252Smrg    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
19776888252Smrg    if test -f "$file"; then
19876888252Smrg	touch $file
19976888252Smrg    else
20076888252Smrg	test -z "$file" || exec >$file
20176888252Smrg	echo "#! /bin/sh"
20276888252Smrg	echo "# Created by GNU Automake missing as a replacement of"
20376888252Smrg	echo "#  $ $@"
20476888252Smrg	echo "exit 0"
20576888252Smrg	chmod +x $file
20676888252Smrg	exit 1
20776888252Smrg    fi
20876888252Smrg    ;;
20976888252Smrg
21076888252Smrg  bison|yacc)
21176888252Smrg    echo 1>&2 "\
21276888252SmrgWARNING: \`$1' $msg.  You should only need it if
21376888252Smrg         you modified a \`.y' file.  You may need the \`Bison' package
21476888252Smrg         in order for those modifications to take effect.  You can get
21576888252Smrg         \`Bison' from any GNU archive site."
21676888252Smrg    rm -f y.tab.c y.tab.h
21776888252Smrg    if [ $# -ne 1 ]; then
21876888252Smrg        eval LASTARG="\${$#}"
21976888252Smrg	case "$LASTARG" in
22076888252Smrg	*.y)
22176888252Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
22276888252Smrg	    if [ -f "$SRCFILE" ]; then
22376888252Smrg	         cp "$SRCFILE" y.tab.c
22476888252Smrg	    fi
22576888252Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
22676888252Smrg	    if [ -f "$SRCFILE" ]; then
22776888252Smrg	         cp "$SRCFILE" y.tab.h
22876888252Smrg	    fi
22976888252Smrg	  ;;
23076888252Smrg	esac
23176888252Smrg    fi
23276888252Smrg    if [ ! -f y.tab.h ]; then
23376888252Smrg	echo >y.tab.h
23476888252Smrg    fi
23576888252Smrg    if [ ! -f y.tab.c ]; then
23676888252Smrg	echo 'main() { return 0; }' >y.tab.c
23776888252Smrg    fi
23876888252Smrg    ;;
23976888252Smrg
24076888252Smrg  lex|flex)
24176888252Smrg    echo 1>&2 "\
24276888252SmrgWARNING: \`$1' is $msg.  You should only need it if
24376888252Smrg         you modified a \`.l' file.  You may need the \`Flex' package
24476888252Smrg         in order for those modifications to take effect.  You can get
24576888252Smrg         \`Flex' from any GNU archive site."
24676888252Smrg    rm -f lex.yy.c
24776888252Smrg    if [ $# -ne 1 ]; then
24876888252Smrg        eval LASTARG="\${$#}"
24976888252Smrg	case "$LASTARG" in
25076888252Smrg	*.l)
25176888252Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
25276888252Smrg	    if [ -f "$SRCFILE" ]; then
25376888252Smrg	         cp "$SRCFILE" lex.yy.c
25476888252Smrg	    fi
25576888252Smrg	  ;;
25676888252Smrg	esac
25776888252Smrg    fi
25876888252Smrg    if [ ! -f lex.yy.c ]; then
25976888252Smrg	echo 'main() { return 0; }' >lex.yy.c
26076888252Smrg    fi
26176888252Smrg    ;;
26276888252Smrg
26376888252Smrg  help2man)
26476888252Smrg    echo 1>&2 "\
26576888252SmrgWARNING: \`$1' is $msg.  You should only need it if
26676888252Smrg	 you modified a dependency of a manual page.  You may need the
26776888252Smrg	 \`Help2man' package in order for those modifications to take
26876888252Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
26976888252Smrg
27076888252Smrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
27176888252Smrg    if test -z "$file"; then
27276888252Smrg	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
27376888252Smrg    fi
27476888252Smrg    if [ -f "$file" ]; then
27576888252Smrg	touch $file
27676888252Smrg    else
27776888252Smrg	test -z "$file" || exec >$file
27876888252Smrg	echo ".ab help2man is required to generate this page"
27976888252Smrg	exit 1
28076888252Smrg    fi
28176888252Smrg    ;;
28276888252Smrg
28376888252Smrg  makeinfo)
28476888252Smrg    echo 1>&2 "\
28576888252SmrgWARNING: \`$1' is $msg.  You should only need it if
28676888252Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
28776888252Smrg         indirectly affecting the aspect of the manual.  The spurious
28876888252Smrg         call might also be the consequence of using a buggy \`make' (AIX,
28976888252Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
29076888252Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
29176888252Smrg    # The file to touch is that specified with -o ...
29276888252Smrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
29376888252Smrg    if test -z "$file"; then
29476888252Smrg      # ... or it is the one specified with @setfilename ...
29576888252Smrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
29676888252Smrg      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
29776888252Smrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
29876888252Smrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
29976888252Smrg    fi
30076888252Smrg    # If the file does not exist, the user really needs makeinfo;
30176888252Smrg    # let's fail without touching anything.
30276888252Smrg    test -f $file || exit 1
30376888252Smrg    touch $file
30476888252Smrg    ;;
30576888252Smrg
30676888252Smrg  tar)
30776888252Smrg    shift
30876888252Smrg
30976888252Smrg    # We have already tried tar in the generic part.
31076888252Smrg    # Look for gnutar/gtar before invocation to avoid ugly error
31176888252Smrg    # messages.
31276888252Smrg    if (gnutar --version > /dev/null 2>&1); then
31376888252Smrg       gnutar "$@" && exit 0
31476888252Smrg    fi
31576888252Smrg    if (gtar --version > /dev/null 2>&1); then
31676888252Smrg       gtar "$@" && exit 0
31776888252Smrg    fi
31876888252Smrg    firstarg="$1"
31976888252Smrg    if shift; then
32076888252Smrg	case "$firstarg" in
32176888252Smrg	*o*)
32276888252Smrg	    firstarg=`echo "$firstarg" | sed s/o//`
32376888252Smrg	    tar "$firstarg" "$@" && exit 0
32476888252Smrg	    ;;
32576888252Smrg	esac
32676888252Smrg	case "$firstarg" in
32776888252Smrg	*h*)
32876888252Smrg	    firstarg=`echo "$firstarg" | sed s/h//`
32976888252Smrg	    tar "$firstarg" "$@" && exit 0
33076888252Smrg	    ;;
33176888252Smrg	esac
33276888252Smrg    fi
33376888252Smrg
33476888252Smrg    echo 1>&2 "\
33576888252SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
33676888252Smrg         You may want to install GNU tar or Free paxutils, or check the
33776888252Smrg         command line arguments."
33876888252Smrg    exit 1
33976888252Smrg    ;;
34076888252Smrg
34176888252Smrg  *)
34276888252Smrg    echo 1>&2 "\
34376888252SmrgWARNING: \`$1' is needed, and is $msg.
34476888252Smrg         You might have modified some files without having the
34576888252Smrg         proper tools for further handling them.  Check the \`README' file,
34676888252Smrg         it often tells you about the needed prerequisites for installing
34776888252Smrg         this package.  You may also peek at any GNU archive site, in case
34876888252Smrg         some other package would contain this missing \`$1' program."
34976888252Smrg    exit 1
35076888252Smrg    ;;
35176888252Smrgesac
35276888252Smrg
35376888252Smrgexit 0
35476888252Smrg
35576888252Smrg# Local variables:
35676888252Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
35776888252Smrg# time-stamp-start: "scriptversion="
35876888252Smrg# time-stamp-format: "%:y-%02m-%02d.%02H"
35976888252Smrg# time-stamp-end: "$"
36076888252Smrg# End:
361