missing revision 32b578d3
132b578d3Smrg#! /bin/sh
232b578d3Smrg# Common stub for a few missing GNU programs while installing.
332b578d3Smrg
432b578d3Smrgscriptversion=2006-05-10.23
532b578d3Smrg
632b578d3Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
732b578d3Smrg#   Free Software Foundation, Inc.
832b578d3Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
932b578d3Smrg
1032b578d3Smrg# This program is free software; you can redistribute it and/or modify
1132b578d3Smrg# it under the terms of the GNU General Public License as published by
1232b578d3Smrg# the Free Software Foundation; either version 2, or (at your option)
1332b578d3Smrg# any later version.
1432b578d3Smrg
1532b578d3Smrg# This program is distributed in the hope that it will be useful,
1632b578d3Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
1732b578d3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1832b578d3Smrg# GNU General Public License for more details.
1932b578d3Smrg
2032b578d3Smrg# You should have received a copy of the GNU General Public License
2132b578d3Smrg# along with this program; if not, write to the Free Software
2232b578d3Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
2332b578d3Smrg# 02110-1301, USA.
2432b578d3Smrg
2532b578d3Smrg# As a special exception to the GNU General Public License, if you
2632b578d3Smrg# distribute this file as part of a program that contains a
2732b578d3Smrg# configuration script generated by Autoconf, you may include it under
2832b578d3Smrg# the same distribution terms that you use for the rest of that program.
2932b578d3Smrg
3032b578d3Smrgif test $# -eq 0; then
3132b578d3Smrg  echo 1>&2 "Try \`$0 --help' for more information"
3232b578d3Smrg  exit 1
3332b578d3Smrgfi
3432b578d3Smrg
3532b578d3Smrgrun=:
3632b578d3Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
3732b578d3Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
3832b578d3Smrg
3932b578d3Smrg# In the cases where this matters, `missing' is being run in the
4032b578d3Smrg# srcdir already.
4132b578d3Smrgif test -f configure.ac; then
4232b578d3Smrg  configure_ac=configure.ac
4332b578d3Smrgelse
4432b578d3Smrg  configure_ac=configure.in
4532b578d3Smrgfi
4632b578d3Smrg
4732b578d3Smrgmsg="missing on your system"
4832b578d3Smrg
4932b578d3Smrgcase $1 in
5032b578d3Smrg--run)
5132b578d3Smrg  # Try to run requested program, and just exit if it succeeds.
5232b578d3Smrg  run=
5332b578d3Smrg  shift
5432b578d3Smrg  "$@" && exit 0
5532b578d3Smrg  # Exit code 63 means version mismatch.  This often happens
5632b578d3Smrg  # when the user try to use an ancient version of a tool on
5732b578d3Smrg  # a file that requires a minimum version.  In this case we
5832b578d3Smrg  # we should proceed has if the program had been absent, or
5932b578d3Smrg  # if --run hadn't been passed.
6032b578d3Smrg  if test $? = 63; then
6132b578d3Smrg    run=:
6232b578d3Smrg    msg="probably too old"
6332b578d3Smrg  fi
6432b578d3Smrg  ;;
6532b578d3Smrg
6632b578d3Smrg  -h|--h|--he|--hel|--help)
6732b578d3Smrg    echo "\
6832b578d3Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
6932b578d3Smrg
7032b578d3SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
7132b578d3Smrgerror status if there is no known handling for PROGRAM.
7232b578d3Smrg
7332b578d3SmrgOptions:
7432b578d3Smrg  -h, --help      display this help and exit
7532b578d3Smrg  -v, --version   output version information and exit
7632b578d3Smrg  --run           try to run the given command, and emulate it if it fails
7732b578d3Smrg
7832b578d3SmrgSupported PROGRAM values:
7932b578d3Smrg  aclocal      touch file \`aclocal.m4'
8032b578d3Smrg  autoconf     touch file \`configure'
8132b578d3Smrg  autoheader   touch file \`config.h.in'
8232b578d3Smrg  autom4te     touch the output file, or create a stub one
8332b578d3Smrg  automake     touch all \`Makefile.in' files
8432b578d3Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
8532b578d3Smrg  flex         create \`lex.yy.c', if possible, from existing .c
8632b578d3Smrg  help2man     touch the output file
8732b578d3Smrg  lex          create \`lex.yy.c', if possible, from existing .c
8832b578d3Smrg  makeinfo     touch the output file
8932b578d3Smrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
9032b578d3Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
9132b578d3Smrg
9232b578d3SmrgSend bug reports to <bug-automake@gnu.org>."
9332b578d3Smrg    exit $?
9432b578d3Smrg    ;;
9532b578d3Smrg
9632b578d3Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
9732b578d3Smrg    echo "missing $scriptversion (GNU Automake)"
9832b578d3Smrg    exit $?
9932b578d3Smrg    ;;
10032b578d3Smrg
10132b578d3Smrg  -*)
10232b578d3Smrg    echo 1>&2 "$0: Unknown \`$1' option"
10332b578d3Smrg    echo 1>&2 "Try \`$0 --help' for more information"
10432b578d3Smrg    exit 1
10532b578d3Smrg    ;;
10632b578d3Smrg
10732b578d3Smrgesac
10832b578d3Smrg
10932b578d3Smrg# Now exit if we have it, but it failed.  Also exit now if we
11032b578d3Smrg# don't have it and --version was passed (most likely to detect
11132b578d3Smrg# the program).
11232b578d3Smrgcase $1 in
11332b578d3Smrg  lex|yacc)
11432b578d3Smrg    # Not GNU programs, they don't have --version.
11532b578d3Smrg    ;;
11632b578d3Smrg
11732b578d3Smrg  tar)
11832b578d3Smrg    if test -n "$run"; then
11932b578d3Smrg       echo 1>&2 "ERROR: \`tar' requires --run"
12032b578d3Smrg       exit 1
12132b578d3Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
12232b578d3Smrg       exit 1
12332b578d3Smrg    fi
12432b578d3Smrg    ;;
12532b578d3Smrg
12632b578d3Smrg  *)
12732b578d3Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
12832b578d3Smrg       # We have it, but it failed.
12932b578d3Smrg       exit 1
13032b578d3Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
13132b578d3Smrg       # Could not run --version or --help.  This is probably someone
13232b578d3Smrg       # running `$TOOL --version' or `$TOOL --help' to check whether
13332b578d3Smrg       # $TOOL exists and not knowing $TOOL uses missing.
13432b578d3Smrg       exit 1
13532b578d3Smrg    fi
13632b578d3Smrg    ;;
13732b578d3Smrgesac
13832b578d3Smrg
13932b578d3Smrg# If it does not exist, or fails to run (possibly an outdated version),
14032b578d3Smrg# try to emulate it.
14132b578d3Smrgcase $1 in
14232b578d3Smrg  aclocal*)
14332b578d3Smrg    echo 1>&2 "\
14432b578d3SmrgWARNING: \`$1' is $msg.  You should only need it if
14532b578d3Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
14632b578d3Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
14732b578d3Smrg         any GNU archive site."
14832b578d3Smrg    touch aclocal.m4
14932b578d3Smrg    ;;
15032b578d3Smrg
15132b578d3Smrg  autoconf)
15232b578d3Smrg    echo 1>&2 "\
15332b578d3SmrgWARNING: \`$1' is $msg.  You should only need it if
15432b578d3Smrg         you modified \`${configure_ac}'.  You might want to install the
15532b578d3Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
15632b578d3Smrg         archive site."
15732b578d3Smrg    touch configure
15832b578d3Smrg    ;;
15932b578d3Smrg
16032b578d3Smrg  autoheader)
16132b578d3Smrg    echo 1>&2 "\
16232b578d3SmrgWARNING: \`$1' is $msg.  You should only need it if
16332b578d3Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
16432b578d3Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
16532b578d3Smrg         from any GNU archive site."
16632b578d3Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
16732b578d3Smrg    test -z "$files" && files="config.h"
16832b578d3Smrg    touch_files=
16932b578d3Smrg    for f in $files; do
17032b578d3Smrg      case $f in
17132b578d3Smrg      *:*) touch_files="$touch_files "`echo "$f" |
17232b578d3Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
17332b578d3Smrg      *) touch_files="$touch_files $f.in";;
17432b578d3Smrg      esac
17532b578d3Smrg    done
17632b578d3Smrg    touch $touch_files
17732b578d3Smrg    ;;
17832b578d3Smrg
17932b578d3Smrg  automake*)
18032b578d3Smrg    echo 1>&2 "\
18132b578d3SmrgWARNING: \`$1' is $msg.  You should only need it if
18232b578d3Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
18332b578d3Smrg         You might want to install the \`Automake' and \`Perl' packages.
18432b578d3Smrg         Grab them from any GNU archive site."
18532b578d3Smrg    find . -type f -name Makefile.am -print |
18632b578d3Smrg	   sed 's/\.am$/.in/' |
18732b578d3Smrg	   while read f; do touch "$f"; done
18832b578d3Smrg    ;;
18932b578d3Smrg
19032b578d3Smrg  autom4te)
19132b578d3Smrg    echo 1>&2 "\
19232b578d3SmrgWARNING: \`$1' is needed, but is $msg.
19332b578d3Smrg         You might have modified some files without having the
19432b578d3Smrg         proper tools for further handling them.
19532b578d3Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
19632b578d3Smrg         archive site."
19732b578d3Smrg
19832b578d3Smrg    file=`echo "$*" | sed -n "$sed_output"`
19932b578d3Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
20032b578d3Smrg    if test -f "$file"; then
20132b578d3Smrg	touch $file
20232b578d3Smrg    else
20332b578d3Smrg	test -z "$file" || exec >$file
20432b578d3Smrg	echo "#! /bin/sh"
20532b578d3Smrg	echo "# Created by GNU Automake missing as a replacement of"
20632b578d3Smrg	echo "#  $ $@"
20732b578d3Smrg	echo "exit 0"
20832b578d3Smrg	chmod +x $file
20932b578d3Smrg	exit 1
21032b578d3Smrg    fi
21132b578d3Smrg    ;;
21232b578d3Smrg
21332b578d3Smrg  bison|yacc)
21432b578d3Smrg    echo 1>&2 "\
21532b578d3SmrgWARNING: \`$1' $msg.  You should only need it if
21632b578d3Smrg         you modified a \`.y' file.  You may need the \`Bison' package
21732b578d3Smrg         in order for those modifications to take effect.  You can get
21832b578d3Smrg         \`Bison' from any GNU archive site."
21932b578d3Smrg    rm -f y.tab.c y.tab.h
22032b578d3Smrg    if test $# -ne 1; then
22132b578d3Smrg        eval LASTARG="\${$#}"
22232b578d3Smrg	case $LASTARG in
22332b578d3Smrg	*.y)
22432b578d3Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
22532b578d3Smrg	    if test -f "$SRCFILE"; then
22632b578d3Smrg	         cp "$SRCFILE" y.tab.c
22732b578d3Smrg	    fi
22832b578d3Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
22932b578d3Smrg	    if test -f "$SRCFILE"; then
23032b578d3Smrg	         cp "$SRCFILE" y.tab.h
23132b578d3Smrg	    fi
23232b578d3Smrg	  ;;
23332b578d3Smrg	esac
23432b578d3Smrg    fi
23532b578d3Smrg    if test ! -f y.tab.h; then
23632b578d3Smrg	echo >y.tab.h
23732b578d3Smrg    fi
23832b578d3Smrg    if test ! -f y.tab.c; then
23932b578d3Smrg	echo 'main() { return 0; }' >y.tab.c
24032b578d3Smrg    fi
24132b578d3Smrg    ;;
24232b578d3Smrg
24332b578d3Smrg  lex|flex)
24432b578d3Smrg    echo 1>&2 "\
24532b578d3SmrgWARNING: \`$1' is $msg.  You should only need it if
24632b578d3Smrg         you modified a \`.l' file.  You may need the \`Flex' package
24732b578d3Smrg         in order for those modifications to take effect.  You can get
24832b578d3Smrg         \`Flex' from any GNU archive site."
24932b578d3Smrg    rm -f lex.yy.c
25032b578d3Smrg    if test $# -ne 1; then
25132b578d3Smrg        eval LASTARG="\${$#}"
25232b578d3Smrg	case $LASTARG in
25332b578d3Smrg	*.l)
25432b578d3Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
25532b578d3Smrg	    if test -f "$SRCFILE"; then
25632b578d3Smrg	         cp "$SRCFILE" lex.yy.c
25732b578d3Smrg	    fi
25832b578d3Smrg	  ;;
25932b578d3Smrg	esac
26032b578d3Smrg    fi
26132b578d3Smrg    if test ! -f lex.yy.c; then
26232b578d3Smrg	echo 'main() { return 0; }' >lex.yy.c
26332b578d3Smrg    fi
26432b578d3Smrg    ;;
26532b578d3Smrg
26632b578d3Smrg  help2man)
26732b578d3Smrg    echo 1>&2 "\
26832b578d3SmrgWARNING: \`$1' is $msg.  You should only need it if
26932b578d3Smrg	 you modified a dependency of a manual page.  You may need the
27032b578d3Smrg	 \`Help2man' package in order for those modifications to take
27132b578d3Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
27232b578d3Smrg
27332b578d3Smrg    file=`echo "$*" | sed -n "$sed_output"`
27432b578d3Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
27532b578d3Smrg    if test -f "$file"; then
27632b578d3Smrg	touch $file
27732b578d3Smrg    else
27832b578d3Smrg	test -z "$file" || exec >$file
27932b578d3Smrg	echo ".ab help2man is required to generate this page"
28032b578d3Smrg	exit 1
28132b578d3Smrg    fi
28232b578d3Smrg    ;;
28332b578d3Smrg
28432b578d3Smrg  makeinfo)
28532b578d3Smrg    echo 1>&2 "\
28632b578d3SmrgWARNING: \`$1' is $msg.  You should only need it if
28732b578d3Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
28832b578d3Smrg         indirectly affecting the aspect of the manual.  The spurious
28932b578d3Smrg         call might also be the consequence of using a buggy \`make' (AIX,
29032b578d3Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
29132b578d3Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
29232b578d3Smrg    # The file to touch is that specified with -o ...
29332b578d3Smrg    file=`echo "$*" | sed -n "$sed_output"`
29432b578d3Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
29532b578d3Smrg    if test -z "$file"; then
29632b578d3Smrg      # ... or it is the one specified with @setfilename ...
29732b578d3Smrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
29832b578d3Smrg      file=`sed -n '
29932b578d3Smrg	/^@setfilename/{
30032b578d3Smrg	  s/.* \([^ ]*\) *$/\1/
30132b578d3Smrg	  p
30232b578d3Smrg	  q
30332b578d3Smrg	}' $infile`
30432b578d3Smrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
30532b578d3Smrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
30632b578d3Smrg    fi
30732b578d3Smrg    # If the file does not exist, the user really needs makeinfo;
30832b578d3Smrg    # let's fail without touching anything.
30932b578d3Smrg    test -f $file || exit 1
31032b578d3Smrg    touch $file
31132b578d3Smrg    ;;
31232b578d3Smrg
31332b578d3Smrg  tar)
31432b578d3Smrg    shift
31532b578d3Smrg
31632b578d3Smrg    # We have already tried tar in the generic part.
31732b578d3Smrg    # Look for gnutar/gtar before invocation to avoid ugly error
31832b578d3Smrg    # messages.
31932b578d3Smrg    if (gnutar --version > /dev/null 2>&1); then
32032b578d3Smrg       gnutar "$@" && exit 0
32132b578d3Smrg    fi
32232b578d3Smrg    if (gtar --version > /dev/null 2>&1); then
32332b578d3Smrg       gtar "$@" && exit 0
32432b578d3Smrg    fi
32532b578d3Smrg    firstarg="$1"
32632b578d3Smrg    if shift; then
32732b578d3Smrg	case $firstarg in
32832b578d3Smrg	*o*)
32932b578d3Smrg	    firstarg=`echo "$firstarg" | sed s/o//`
33032b578d3Smrg	    tar "$firstarg" "$@" && exit 0
33132b578d3Smrg	    ;;
33232b578d3Smrg	esac
33332b578d3Smrg	case $firstarg in
33432b578d3Smrg	*h*)
33532b578d3Smrg	    firstarg=`echo "$firstarg" | sed s/h//`
33632b578d3Smrg	    tar "$firstarg" "$@" && exit 0
33732b578d3Smrg	    ;;
33832b578d3Smrg	esac
33932b578d3Smrg    fi
34032b578d3Smrg
34132b578d3Smrg    echo 1>&2 "\
34232b578d3SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
34332b578d3Smrg         You may want to install GNU tar or Free paxutils, or check the
34432b578d3Smrg         command line arguments."
34532b578d3Smrg    exit 1
34632b578d3Smrg    ;;
34732b578d3Smrg
34832b578d3Smrg  *)
34932b578d3Smrg    echo 1>&2 "\
35032b578d3SmrgWARNING: \`$1' is needed, and is $msg.
35132b578d3Smrg         You might have modified some files without having the
35232b578d3Smrg         proper tools for further handling them.  Check the \`README' file,
35332b578d3Smrg         it often tells you about the needed prerequisites for installing
35432b578d3Smrg         this package.  You may also peek at any GNU archive site, in case
35532b578d3Smrg         some other package would contain this missing \`$1' program."
35632b578d3Smrg    exit 1
35732b578d3Smrg    ;;
35832b578d3Smrgesac
35932b578d3Smrg
36032b578d3Smrgexit 0
36132b578d3Smrg
36232b578d3Smrg# Local variables:
36332b578d3Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
36432b578d3Smrg# time-stamp-start: "scriptversion="
36532b578d3Smrg# time-stamp-format: "%:y-%02m-%02d.%02H"
36632b578d3Smrg# time-stamp-end: "$"
36732b578d3Smrg# End:
368