missing revision 41b2f0bd
141b2f0bdSmrg#! /bin/sh
241b2f0bdSmrg# Common stub for a few missing GNU programs while installing.
341b2f0bdSmrg
441b2f0bdSmrgscriptversion=2005-06-08.21
541b2f0bdSmrg
641b2f0bdSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
741b2f0bdSmrg#   Free Software Foundation, Inc.
841b2f0bdSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
941b2f0bdSmrg
1041b2f0bdSmrg# This program is free software; you can redistribute it and/or modify
1141b2f0bdSmrg# it under the terms of the GNU General Public License as published by
1241b2f0bdSmrg# the Free Software Foundation; either version 2, or (at your option)
1341b2f0bdSmrg# any later version.
1441b2f0bdSmrg
1541b2f0bdSmrg# This program is distributed in the hope that it will be useful,
1641b2f0bdSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
1741b2f0bdSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1841b2f0bdSmrg# GNU General Public License for more details.
1941b2f0bdSmrg
2041b2f0bdSmrg# You should have received a copy of the GNU General Public License
2141b2f0bdSmrg# along with this program; if not, write to the Free Software
2241b2f0bdSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
2341b2f0bdSmrg# 02110-1301, USA.
2441b2f0bdSmrg
2541b2f0bdSmrg# As a special exception to the GNU General Public License, if you
2641b2f0bdSmrg# distribute this file as part of a program that contains a
2741b2f0bdSmrg# configuration script generated by Autoconf, you may include it under
2841b2f0bdSmrg# the same distribution terms that you use for the rest of that program.
2941b2f0bdSmrg
3041b2f0bdSmrgif test $# -eq 0; then
3141b2f0bdSmrg  echo 1>&2 "Try \`$0 --help' for more information"
3241b2f0bdSmrg  exit 1
3341b2f0bdSmrgfi
3441b2f0bdSmrg
3541b2f0bdSmrgrun=:
3641b2f0bdSmrg
3741b2f0bdSmrg# In the cases where this matters, `missing' is being run in the
3841b2f0bdSmrg# srcdir already.
3941b2f0bdSmrgif test -f configure.ac; then
4041b2f0bdSmrg  configure_ac=configure.ac
4141b2f0bdSmrgelse
4241b2f0bdSmrg  configure_ac=configure.in
4341b2f0bdSmrgfi
4441b2f0bdSmrg
4541b2f0bdSmrgmsg="missing on your system"
4641b2f0bdSmrg
4741b2f0bdSmrgcase "$1" in
4841b2f0bdSmrg--run)
4941b2f0bdSmrg  # Try to run requested program, and just exit if it succeeds.
5041b2f0bdSmrg  run=
5141b2f0bdSmrg  shift
5241b2f0bdSmrg  "$@" && exit 0
5341b2f0bdSmrg  # Exit code 63 means version mismatch.  This often happens
5441b2f0bdSmrg  # when the user try to use an ancient version of a tool on
5541b2f0bdSmrg  # a file that requires a minimum version.  In this case we
5641b2f0bdSmrg  # we should proceed has if the program had been absent, or
5741b2f0bdSmrg  # if --run hadn't been passed.
5841b2f0bdSmrg  if test $? = 63; then
5941b2f0bdSmrg    run=:
6041b2f0bdSmrg    msg="probably too old"
6141b2f0bdSmrg  fi
6241b2f0bdSmrg  ;;
6341b2f0bdSmrg
6441b2f0bdSmrg  -h|--h|--he|--hel|--help)
6541b2f0bdSmrg    echo "\
6641b2f0bdSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
6741b2f0bdSmrg
6841b2f0bdSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
6941b2f0bdSmrgerror status if there is no known handling for PROGRAM.
7041b2f0bdSmrg
7141b2f0bdSmrgOptions:
7241b2f0bdSmrg  -h, --help      display this help and exit
7341b2f0bdSmrg  -v, --version   output version information and exit
7441b2f0bdSmrg  --run           try to run the given command, and emulate it if it fails
7541b2f0bdSmrg
7641b2f0bdSmrgSupported PROGRAM values:
7741b2f0bdSmrg  aclocal      touch file \`aclocal.m4'
7841b2f0bdSmrg  autoconf     touch file \`configure'
7941b2f0bdSmrg  autoheader   touch file \`config.h.in'
8041b2f0bdSmrg  automake     touch all \`Makefile.in' files
8141b2f0bdSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
8241b2f0bdSmrg  flex         create \`lex.yy.c', if possible, from existing .c
8341b2f0bdSmrg  help2man     touch the output file
8441b2f0bdSmrg  lex          create \`lex.yy.c', if possible, from existing .c
8541b2f0bdSmrg  makeinfo     touch the output file
8641b2f0bdSmrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
8741b2f0bdSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
8841b2f0bdSmrg
8941b2f0bdSmrgSend bug reports to <bug-automake@gnu.org>."
9041b2f0bdSmrg    exit $?
9141b2f0bdSmrg    ;;
9241b2f0bdSmrg
9341b2f0bdSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
9441b2f0bdSmrg    echo "missing $scriptversion (GNU Automake)"
9541b2f0bdSmrg    exit $?
9641b2f0bdSmrg    ;;
9741b2f0bdSmrg
9841b2f0bdSmrg  -*)
9941b2f0bdSmrg    echo 1>&2 "$0: Unknown \`$1' option"
10041b2f0bdSmrg    echo 1>&2 "Try \`$0 --help' for more information"
10141b2f0bdSmrg    exit 1
10241b2f0bdSmrg    ;;
10341b2f0bdSmrg
10441b2f0bdSmrgesac
10541b2f0bdSmrg
10641b2f0bdSmrg# Now exit if we have it, but it failed.  Also exit now if we
10741b2f0bdSmrg# don't have it and --version was passed (most likely to detect
10841b2f0bdSmrg# the program).
10941b2f0bdSmrgcase "$1" in
11041b2f0bdSmrg  lex|yacc)
11141b2f0bdSmrg    # Not GNU programs, they don't have --version.
11241b2f0bdSmrg    ;;
11341b2f0bdSmrg
11441b2f0bdSmrg  tar)
11541b2f0bdSmrg    if test -n "$run"; then
11641b2f0bdSmrg       echo 1>&2 "ERROR: \`tar' requires --run"
11741b2f0bdSmrg       exit 1
11841b2f0bdSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
11941b2f0bdSmrg       exit 1
12041b2f0bdSmrg    fi
12141b2f0bdSmrg    ;;
12241b2f0bdSmrg
12341b2f0bdSmrg  *)
12441b2f0bdSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
12541b2f0bdSmrg       # We have it, but it failed.
12641b2f0bdSmrg       exit 1
12741b2f0bdSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
12841b2f0bdSmrg       # Could not run --version or --help.  This is probably someone
12941b2f0bdSmrg       # running `$TOOL --version' or `$TOOL --help' to check whether
13041b2f0bdSmrg       # $TOOL exists and not knowing $TOOL uses missing.
13141b2f0bdSmrg       exit 1
13241b2f0bdSmrg    fi
13341b2f0bdSmrg    ;;
13441b2f0bdSmrgesac
13541b2f0bdSmrg
13641b2f0bdSmrg# If it does not exist, or fails to run (possibly an outdated version),
13741b2f0bdSmrg# try to emulate it.
13841b2f0bdSmrgcase "$1" in
13941b2f0bdSmrg  aclocal*)
14041b2f0bdSmrg    echo 1>&2 "\
14141b2f0bdSmrgWARNING: \`$1' is $msg.  You should only need it if
14241b2f0bdSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
14341b2f0bdSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
14441b2f0bdSmrg         any GNU archive site."
14541b2f0bdSmrg    touch aclocal.m4
14641b2f0bdSmrg    ;;
14741b2f0bdSmrg
14841b2f0bdSmrg  autoconf)
14941b2f0bdSmrg    echo 1>&2 "\
15041b2f0bdSmrgWARNING: \`$1' is $msg.  You should only need it if
15141b2f0bdSmrg         you modified \`${configure_ac}'.  You might want to install the
15241b2f0bdSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
15341b2f0bdSmrg         archive site."
15441b2f0bdSmrg    touch configure
15541b2f0bdSmrg    ;;
15641b2f0bdSmrg
15741b2f0bdSmrg  autoheader)
15841b2f0bdSmrg    echo 1>&2 "\
15941b2f0bdSmrgWARNING: \`$1' is $msg.  You should only need it if
16041b2f0bdSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
16141b2f0bdSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
16241b2f0bdSmrg         from any GNU archive site."
16341b2f0bdSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
16441b2f0bdSmrg    test -z "$files" && files="config.h"
16541b2f0bdSmrg    touch_files=
16641b2f0bdSmrg    for f in $files; do
16741b2f0bdSmrg      case "$f" in
16841b2f0bdSmrg      *:*) touch_files="$touch_files "`echo "$f" |
16941b2f0bdSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
17041b2f0bdSmrg      *) touch_files="$touch_files $f.in";;
17141b2f0bdSmrg      esac
17241b2f0bdSmrg    done
17341b2f0bdSmrg    touch $touch_files
17441b2f0bdSmrg    ;;
17541b2f0bdSmrg
17641b2f0bdSmrg  automake*)
17741b2f0bdSmrg    echo 1>&2 "\
17841b2f0bdSmrgWARNING: \`$1' is $msg.  You should only need it if
17941b2f0bdSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
18041b2f0bdSmrg         You might want to install the \`Automake' and \`Perl' packages.
18141b2f0bdSmrg         Grab them from any GNU archive site."
18241b2f0bdSmrg    find . -type f -name Makefile.am -print |
18341b2f0bdSmrg	   sed 's/\.am$/.in/' |
18441b2f0bdSmrg	   while read f; do touch "$f"; done
18541b2f0bdSmrg    ;;
18641b2f0bdSmrg
18741b2f0bdSmrg  autom4te)
18841b2f0bdSmrg    echo 1>&2 "\
18941b2f0bdSmrgWARNING: \`$1' is needed, but is $msg.
19041b2f0bdSmrg         You might have modified some files without having the
19141b2f0bdSmrg         proper tools for further handling them.
19241b2f0bdSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
19341b2f0bdSmrg         archive site."
19441b2f0bdSmrg
19541b2f0bdSmrg    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
19641b2f0bdSmrg    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
19741b2f0bdSmrg    if test -f "$file"; then
19841b2f0bdSmrg	touch $file
19941b2f0bdSmrg    else
20041b2f0bdSmrg	test -z "$file" || exec >$file
20141b2f0bdSmrg	echo "#! /bin/sh"
20241b2f0bdSmrg	echo "# Created by GNU Automake missing as a replacement of"
20341b2f0bdSmrg	echo "#  $ $@"
20441b2f0bdSmrg	echo "exit 0"
20541b2f0bdSmrg	chmod +x $file
20641b2f0bdSmrg	exit 1
20741b2f0bdSmrg    fi
20841b2f0bdSmrg    ;;
20941b2f0bdSmrg
21041b2f0bdSmrg  bison|yacc)
21141b2f0bdSmrg    echo 1>&2 "\
21241b2f0bdSmrgWARNING: \`$1' $msg.  You should only need it if
21341b2f0bdSmrg         you modified a \`.y' file.  You may need the \`Bison' package
21441b2f0bdSmrg         in order for those modifications to take effect.  You can get
21541b2f0bdSmrg         \`Bison' from any GNU archive site."
21641b2f0bdSmrg    rm -f y.tab.c y.tab.h
21741b2f0bdSmrg    if [ $# -ne 1 ]; then
21841b2f0bdSmrg        eval LASTARG="\${$#}"
21941b2f0bdSmrg	case "$LASTARG" in
22041b2f0bdSmrg	*.y)
22141b2f0bdSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
22241b2f0bdSmrg	    if [ -f "$SRCFILE" ]; then
22341b2f0bdSmrg	         cp "$SRCFILE" y.tab.c
22441b2f0bdSmrg	    fi
22541b2f0bdSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
22641b2f0bdSmrg	    if [ -f "$SRCFILE" ]; then
22741b2f0bdSmrg	         cp "$SRCFILE" y.tab.h
22841b2f0bdSmrg	    fi
22941b2f0bdSmrg	  ;;
23041b2f0bdSmrg	esac
23141b2f0bdSmrg    fi
23241b2f0bdSmrg    if [ ! -f y.tab.h ]; then
23341b2f0bdSmrg	echo >y.tab.h
23441b2f0bdSmrg    fi
23541b2f0bdSmrg    if [ ! -f y.tab.c ]; then
23641b2f0bdSmrg	echo 'main() { return 0; }' >y.tab.c
23741b2f0bdSmrg    fi
23841b2f0bdSmrg    ;;
23941b2f0bdSmrg
24041b2f0bdSmrg  lex|flex)
24141b2f0bdSmrg    echo 1>&2 "\
24241b2f0bdSmrgWARNING: \`$1' is $msg.  You should only need it if
24341b2f0bdSmrg         you modified a \`.l' file.  You may need the \`Flex' package
24441b2f0bdSmrg         in order for those modifications to take effect.  You can get
24541b2f0bdSmrg         \`Flex' from any GNU archive site."
24641b2f0bdSmrg    rm -f lex.yy.c
24741b2f0bdSmrg    if [ $# -ne 1 ]; then
24841b2f0bdSmrg        eval LASTARG="\${$#}"
24941b2f0bdSmrg	case "$LASTARG" in
25041b2f0bdSmrg	*.l)
25141b2f0bdSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
25241b2f0bdSmrg	    if [ -f "$SRCFILE" ]; then
25341b2f0bdSmrg	         cp "$SRCFILE" lex.yy.c
25441b2f0bdSmrg	    fi
25541b2f0bdSmrg	  ;;
25641b2f0bdSmrg	esac
25741b2f0bdSmrg    fi
25841b2f0bdSmrg    if [ ! -f lex.yy.c ]; then
25941b2f0bdSmrg	echo 'main() { return 0; }' >lex.yy.c
26041b2f0bdSmrg    fi
26141b2f0bdSmrg    ;;
26241b2f0bdSmrg
26341b2f0bdSmrg  help2man)
26441b2f0bdSmrg    echo 1>&2 "\
26541b2f0bdSmrgWARNING: \`$1' is $msg.  You should only need it if
26641b2f0bdSmrg	 you modified a dependency of a manual page.  You may need the
26741b2f0bdSmrg	 \`Help2man' package in order for those modifications to take
26841b2f0bdSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
26941b2f0bdSmrg
27041b2f0bdSmrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
27141b2f0bdSmrg    if test -z "$file"; then
27241b2f0bdSmrg	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
27341b2f0bdSmrg    fi
27441b2f0bdSmrg    if [ -f "$file" ]; then
27541b2f0bdSmrg	touch $file
27641b2f0bdSmrg    else
27741b2f0bdSmrg	test -z "$file" || exec >$file
27841b2f0bdSmrg	echo ".ab help2man is required to generate this page"
27941b2f0bdSmrg	exit 1
28041b2f0bdSmrg    fi
28141b2f0bdSmrg    ;;
28241b2f0bdSmrg
28341b2f0bdSmrg  makeinfo)
28441b2f0bdSmrg    echo 1>&2 "\
28541b2f0bdSmrgWARNING: \`$1' is $msg.  You should only need it if
28641b2f0bdSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
28741b2f0bdSmrg         indirectly affecting the aspect of the manual.  The spurious
28841b2f0bdSmrg         call might also be the consequence of using a buggy \`make' (AIX,
28941b2f0bdSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
29041b2f0bdSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
29141b2f0bdSmrg    # The file to touch is that specified with -o ...
29241b2f0bdSmrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
29341b2f0bdSmrg    if test -z "$file"; then
29441b2f0bdSmrg      # ... or it is the one specified with @setfilename ...
29541b2f0bdSmrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
29641b2f0bdSmrg      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
29741b2f0bdSmrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
29841b2f0bdSmrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
29941b2f0bdSmrg    fi
30041b2f0bdSmrg    # If the file does not exist, the user really needs makeinfo;
30141b2f0bdSmrg    # let's fail without touching anything.
30241b2f0bdSmrg    test -f $file || exit 1
30341b2f0bdSmrg    touch $file
30441b2f0bdSmrg    ;;
30541b2f0bdSmrg
30641b2f0bdSmrg  tar)
30741b2f0bdSmrg    shift
30841b2f0bdSmrg
30941b2f0bdSmrg    # We have already tried tar in the generic part.
31041b2f0bdSmrg    # Look for gnutar/gtar before invocation to avoid ugly error
31141b2f0bdSmrg    # messages.
31241b2f0bdSmrg    if (gnutar --version > /dev/null 2>&1); then
31341b2f0bdSmrg       gnutar "$@" && exit 0
31441b2f0bdSmrg    fi
31541b2f0bdSmrg    if (gtar --version > /dev/null 2>&1); then
31641b2f0bdSmrg       gtar "$@" && exit 0
31741b2f0bdSmrg    fi
31841b2f0bdSmrg    firstarg="$1"
31941b2f0bdSmrg    if shift; then
32041b2f0bdSmrg	case "$firstarg" in
32141b2f0bdSmrg	*o*)
32241b2f0bdSmrg	    firstarg=`echo "$firstarg" | sed s/o//`
32341b2f0bdSmrg	    tar "$firstarg" "$@" && exit 0
32441b2f0bdSmrg	    ;;
32541b2f0bdSmrg	esac
32641b2f0bdSmrg	case "$firstarg" in
32741b2f0bdSmrg	*h*)
32841b2f0bdSmrg	    firstarg=`echo "$firstarg" | sed s/h//`
32941b2f0bdSmrg	    tar "$firstarg" "$@" && exit 0
33041b2f0bdSmrg	    ;;
33141b2f0bdSmrg	esac
33241b2f0bdSmrg    fi
33341b2f0bdSmrg
33441b2f0bdSmrg    echo 1>&2 "\
33541b2f0bdSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
33641b2f0bdSmrg         You may want to install GNU tar or Free paxutils, or check the
33741b2f0bdSmrg         command line arguments."
33841b2f0bdSmrg    exit 1
33941b2f0bdSmrg    ;;
34041b2f0bdSmrg
34141b2f0bdSmrg  *)
34241b2f0bdSmrg    echo 1>&2 "\
34341b2f0bdSmrgWARNING: \`$1' is needed, and is $msg.
34441b2f0bdSmrg         You might have modified some files without having the
34541b2f0bdSmrg         proper tools for further handling them.  Check the \`README' file,
34641b2f0bdSmrg         it often tells you about the needed prerequisites for installing
34741b2f0bdSmrg         this package.  You may also peek at any GNU archive site, in case
34841b2f0bdSmrg         some other package would contain this missing \`$1' program."
34941b2f0bdSmrg    exit 1
35041b2f0bdSmrg    ;;
35141b2f0bdSmrgesac
35241b2f0bdSmrg
35341b2f0bdSmrgexit 0
35441b2f0bdSmrg
35541b2f0bdSmrg# Local variables:
35641b2f0bdSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
35741b2f0bdSmrg# time-stamp-start: "scriptversion="
35841b2f0bdSmrg# time-stamp-format: "%:y-%02m-%02d.%02H"
35941b2f0bdSmrg# time-stamp-end: "$"
36041b2f0bdSmrg# End:
361