missing revision 53354cdb
153354cdbSmrg#! /bin/sh
253354cdbSmrg# Common stub for a few missing GNU programs while installing.
353354cdbSmrg
453354cdbSmrgscriptversion=2006-05-10.23
553354cdbSmrg
653354cdbSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
753354cdbSmrg#   Free Software Foundation, Inc.
853354cdbSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
953354cdbSmrg
1053354cdbSmrg# This program is free software; you can redistribute it and/or modify
1153354cdbSmrg# it under the terms of the GNU General Public License as published by
1253354cdbSmrg# the Free Software Foundation; either version 2, or (at your option)
1353354cdbSmrg# any later version.
1453354cdbSmrg
1553354cdbSmrg# This program is distributed in the hope that it will be useful,
1653354cdbSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
1753354cdbSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1853354cdbSmrg# GNU General Public License for more details.
1953354cdbSmrg
2053354cdbSmrg# You should have received a copy of the GNU General Public License
2153354cdbSmrg# along with this program; if not, write to the Free Software
2253354cdbSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
2353354cdbSmrg# 02110-1301, USA.
2453354cdbSmrg
2553354cdbSmrg# As a special exception to the GNU General Public License, if you
2653354cdbSmrg# distribute this file as part of a program that contains a
2753354cdbSmrg# configuration script generated by Autoconf, you may include it under
2853354cdbSmrg# the same distribution terms that you use for the rest of that program.
2953354cdbSmrg
3053354cdbSmrgif test $# -eq 0; then
3153354cdbSmrg  echo 1>&2 "Try \`$0 --help' for more information"
3253354cdbSmrg  exit 1
3353354cdbSmrgfi
3453354cdbSmrg
3553354cdbSmrgrun=:
3653354cdbSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
3753354cdbSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
3853354cdbSmrg
3953354cdbSmrg# In the cases where this matters, `missing' is being run in the
4053354cdbSmrg# srcdir already.
4153354cdbSmrgif test -f configure.ac; then
4253354cdbSmrg  configure_ac=configure.ac
4353354cdbSmrgelse
4453354cdbSmrg  configure_ac=configure.in
4553354cdbSmrgfi
4653354cdbSmrg
4753354cdbSmrgmsg="missing on your system"
4853354cdbSmrg
4953354cdbSmrgcase $1 in
5053354cdbSmrg--run)
5153354cdbSmrg  # Try to run requested program, and just exit if it succeeds.
5253354cdbSmrg  run=
5353354cdbSmrg  shift
5453354cdbSmrg  "$@" && exit 0
5553354cdbSmrg  # Exit code 63 means version mismatch.  This often happens
5653354cdbSmrg  # when the user try to use an ancient version of a tool on
5753354cdbSmrg  # a file that requires a minimum version.  In this case we
5853354cdbSmrg  # we should proceed has if the program had been absent, or
5953354cdbSmrg  # if --run hadn't been passed.
6053354cdbSmrg  if test $? = 63; then
6153354cdbSmrg    run=:
6253354cdbSmrg    msg="probably too old"
6353354cdbSmrg  fi
6453354cdbSmrg  ;;
6553354cdbSmrg
6653354cdbSmrg  -h|--h|--he|--hel|--help)
6753354cdbSmrg    echo "\
6853354cdbSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
6953354cdbSmrg
7053354cdbSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
7153354cdbSmrgerror status if there is no known handling for PROGRAM.
7253354cdbSmrg
7353354cdbSmrgOptions:
7453354cdbSmrg  -h, --help      display this help and exit
7553354cdbSmrg  -v, --version   output version information and exit
7653354cdbSmrg  --run           try to run the given command, and emulate it if it fails
7753354cdbSmrg
7853354cdbSmrgSupported PROGRAM values:
7953354cdbSmrg  aclocal      touch file \`aclocal.m4'
8053354cdbSmrg  autoconf     touch file \`configure'
8153354cdbSmrg  autoheader   touch file \`config.h.in'
8253354cdbSmrg  autom4te     touch the output file, or create a stub one
8353354cdbSmrg  automake     touch all \`Makefile.in' files
8453354cdbSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
8553354cdbSmrg  flex         create \`lex.yy.c', if possible, from existing .c
8653354cdbSmrg  help2man     touch the output file
8753354cdbSmrg  lex          create \`lex.yy.c', if possible, from existing .c
8853354cdbSmrg  makeinfo     touch the output file
8953354cdbSmrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
9053354cdbSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
9153354cdbSmrg
9253354cdbSmrgSend bug reports to <bug-automake@gnu.org>."
9353354cdbSmrg    exit $?
9453354cdbSmrg    ;;
9553354cdbSmrg
9653354cdbSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
9753354cdbSmrg    echo "missing $scriptversion (GNU Automake)"
9853354cdbSmrg    exit $?
9953354cdbSmrg    ;;
10053354cdbSmrg
10153354cdbSmrg  -*)
10253354cdbSmrg    echo 1>&2 "$0: Unknown \`$1' option"
10353354cdbSmrg    echo 1>&2 "Try \`$0 --help' for more information"
10453354cdbSmrg    exit 1
10553354cdbSmrg    ;;
10653354cdbSmrg
10753354cdbSmrgesac
10853354cdbSmrg
10953354cdbSmrg# Now exit if we have it, but it failed.  Also exit now if we
11053354cdbSmrg# don't have it and --version was passed (most likely to detect
11153354cdbSmrg# the program).
11253354cdbSmrgcase $1 in
11353354cdbSmrg  lex|yacc)
11453354cdbSmrg    # Not GNU programs, they don't have --version.
11553354cdbSmrg    ;;
11653354cdbSmrg
11753354cdbSmrg  tar)
11853354cdbSmrg    if test -n "$run"; then
11953354cdbSmrg       echo 1>&2 "ERROR: \`tar' requires --run"
12053354cdbSmrg       exit 1
12153354cdbSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
12253354cdbSmrg       exit 1
12353354cdbSmrg    fi
12453354cdbSmrg    ;;
12553354cdbSmrg
12653354cdbSmrg  *)
12753354cdbSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
12853354cdbSmrg       # We have it, but it failed.
12953354cdbSmrg       exit 1
13053354cdbSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
13153354cdbSmrg       # Could not run --version or --help.  This is probably someone
13253354cdbSmrg       # running `$TOOL --version' or `$TOOL --help' to check whether
13353354cdbSmrg       # $TOOL exists and not knowing $TOOL uses missing.
13453354cdbSmrg       exit 1
13553354cdbSmrg    fi
13653354cdbSmrg    ;;
13753354cdbSmrgesac
13853354cdbSmrg
13953354cdbSmrg# If it does not exist, or fails to run (possibly an outdated version),
14053354cdbSmrg# try to emulate it.
14153354cdbSmrgcase $1 in
14253354cdbSmrg  aclocal*)
14353354cdbSmrg    echo 1>&2 "\
14453354cdbSmrgWARNING: \`$1' is $msg.  You should only need it if
14553354cdbSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
14653354cdbSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
14753354cdbSmrg         any GNU archive site."
14853354cdbSmrg    touch aclocal.m4
14953354cdbSmrg    ;;
15053354cdbSmrg
15153354cdbSmrg  autoconf)
15253354cdbSmrg    echo 1>&2 "\
15353354cdbSmrgWARNING: \`$1' is $msg.  You should only need it if
15453354cdbSmrg         you modified \`${configure_ac}'.  You might want to install the
15553354cdbSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
15653354cdbSmrg         archive site."
15753354cdbSmrg    touch configure
15853354cdbSmrg    ;;
15953354cdbSmrg
16053354cdbSmrg  autoheader)
16153354cdbSmrg    echo 1>&2 "\
16253354cdbSmrgWARNING: \`$1' is $msg.  You should only need it if
16353354cdbSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
16453354cdbSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
16553354cdbSmrg         from any GNU archive site."
16653354cdbSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
16753354cdbSmrg    test -z "$files" && files="config.h"
16853354cdbSmrg    touch_files=
16953354cdbSmrg    for f in $files; do
17053354cdbSmrg      case $f in
17153354cdbSmrg      *:*) touch_files="$touch_files "`echo "$f" |
17253354cdbSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
17353354cdbSmrg      *) touch_files="$touch_files $f.in";;
17453354cdbSmrg      esac
17553354cdbSmrg    done
17653354cdbSmrg    touch $touch_files
17753354cdbSmrg    ;;
17853354cdbSmrg
17953354cdbSmrg  automake*)
18053354cdbSmrg    echo 1>&2 "\
18153354cdbSmrgWARNING: \`$1' is $msg.  You should only need it if
18253354cdbSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
18353354cdbSmrg         You might want to install the \`Automake' and \`Perl' packages.
18453354cdbSmrg         Grab them from any GNU archive site."
18553354cdbSmrg    find . -type f -name Makefile.am -print |
18653354cdbSmrg	   sed 's/\.am$/.in/' |
18753354cdbSmrg	   while read f; do touch "$f"; done
18853354cdbSmrg    ;;
18953354cdbSmrg
19053354cdbSmrg  autom4te)
19153354cdbSmrg    echo 1>&2 "\
19253354cdbSmrgWARNING: \`$1' is needed, but is $msg.
19353354cdbSmrg         You might have modified some files without having the
19453354cdbSmrg         proper tools for further handling them.
19553354cdbSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
19653354cdbSmrg         archive site."
19753354cdbSmrg
19853354cdbSmrg    file=`echo "$*" | sed -n "$sed_output"`
19953354cdbSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
20053354cdbSmrg    if test -f "$file"; then
20153354cdbSmrg	touch $file
20253354cdbSmrg    else
20353354cdbSmrg	test -z "$file" || exec >$file
20453354cdbSmrg	echo "#! /bin/sh"
20553354cdbSmrg	echo "# Created by GNU Automake missing as a replacement of"
20653354cdbSmrg	echo "#  $ $@"
20753354cdbSmrg	echo "exit 0"
20853354cdbSmrg	chmod +x $file
20953354cdbSmrg	exit 1
21053354cdbSmrg    fi
21153354cdbSmrg    ;;
21253354cdbSmrg
21353354cdbSmrg  bison|yacc)
21453354cdbSmrg    echo 1>&2 "\
21553354cdbSmrgWARNING: \`$1' $msg.  You should only need it if
21653354cdbSmrg         you modified a \`.y' file.  You may need the \`Bison' package
21753354cdbSmrg         in order for those modifications to take effect.  You can get
21853354cdbSmrg         \`Bison' from any GNU archive site."
21953354cdbSmrg    rm -f y.tab.c y.tab.h
22053354cdbSmrg    if test $# -ne 1; then
22153354cdbSmrg        eval LASTARG="\${$#}"
22253354cdbSmrg	case $LASTARG in
22353354cdbSmrg	*.y)
22453354cdbSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
22553354cdbSmrg	    if test -f "$SRCFILE"; then
22653354cdbSmrg	         cp "$SRCFILE" y.tab.c
22753354cdbSmrg	    fi
22853354cdbSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
22953354cdbSmrg	    if test -f "$SRCFILE"; then
23053354cdbSmrg	         cp "$SRCFILE" y.tab.h
23153354cdbSmrg	    fi
23253354cdbSmrg	  ;;
23353354cdbSmrg	esac
23453354cdbSmrg    fi
23553354cdbSmrg    if test ! -f y.tab.h; then
23653354cdbSmrg	echo >y.tab.h
23753354cdbSmrg    fi
23853354cdbSmrg    if test ! -f y.tab.c; then
23953354cdbSmrg	echo 'main() { return 0; }' >y.tab.c
24053354cdbSmrg    fi
24153354cdbSmrg    ;;
24253354cdbSmrg
24353354cdbSmrg  lex|flex)
24453354cdbSmrg    echo 1>&2 "\
24553354cdbSmrgWARNING: \`$1' is $msg.  You should only need it if
24653354cdbSmrg         you modified a \`.l' file.  You may need the \`Flex' package
24753354cdbSmrg         in order for those modifications to take effect.  You can get
24853354cdbSmrg         \`Flex' from any GNU archive site."
24953354cdbSmrg    rm -f lex.yy.c
25053354cdbSmrg    if test $# -ne 1; then
25153354cdbSmrg        eval LASTARG="\${$#}"
25253354cdbSmrg	case $LASTARG in
25353354cdbSmrg	*.l)
25453354cdbSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
25553354cdbSmrg	    if test -f "$SRCFILE"; then
25653354cdbSmrg	         cp "$SRCFILE" lex.yy.c
25753354cdbSmrg	    fi
25853354cdbSmrg	  ;;
25953354cdbSmrg	esac
26053354cdbSmrg    fi
26153354cdbSmrg    if test ! -f lex.yy.c; then
26253354cdbSmrg	echo 'main() { return 0; }' >lex.yy.c
26353354cdbSmrg    fi
26453354cdbSmrg    ;;
26553354cdbSmrg
26653354cdbSmrg  help2man)
26753354cdbSmrg    echo 1>&2 "\
26853354cdbSmrgWARNING: \`$1' is $msg.  You should only need it if
26953354cdbSmrg	 you modified a dependency of a manual page.  You may need the
27053354cdbSmrg	 \`Help2man' package in order for those modifications to take
27153354cdbSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
27253354cdbSmrg
27353354cdbSmrg    file=`echo "$*" | sed -n "$sed_output"`
27453354cdbSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
27553354cdbSmrg    if test -f "$file"; then
27653354cdbSmrg	touch $file
27753354cdbSmrg    else
27853354cdbSmrg	test -z "$file" || exec >$file
27953354cdbSmrg	echo ".ab help2man is required to generate this page"
28053354cdbSmrg	exit 1
28153354cdbSmrg    fi
28253354cdbSmrg    ;;
28353354cdbSmrg
28453354cdbSmrg  makeinfo)
28553354cdbSmrg    echo 1>&2 "\
28653354cdbSmrgWARNING: \`$1' is $msg.  You should only need it if
28753354cdbSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
28853354cdbSmrg         indirectly affecting the aspect of the manual.  The spurious
28953354cdbSmrg         call might also be the consequence of using a buggy \`make' (AIX,
29053354cdbSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
29153354cdbSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
29253354cdbSmrg    # The file to touch is that specified with -o ...
29353354cdbSmrg    file=`echo "$*" | sed -n "$sed_output"`
29453354cdbSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
29553354cdbSmrg    if test -z "$file"; then
29653354cdbSmrg      # ... or it is the one specified with @setfilename ...
29753354cdbSmrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
29853354cdbSmrg      file=`sed -n '
29953354cdbSmrg	/^@setfilename/{
30053354cdbSmrg	  s/.* \([^ ]*\) *$/\1/
30153354cdbSmrg	  p
30253354cdbSmrg	  q
30353354cdbSmrg	}' $infile`
30453354cdbSmrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
30553354cdbSmrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
30653354cdbSmrg    fi
30753354cdbSmrg    # If the file does not exist, the user really needs makeinfo;
30853354cdbSmrg    # let's fail without touching anything.
30953354cdbSmrg    test -f $file || exit 1
31053354cdbSmrg    touch $file
31153354cdbSmrg    ;;
31253354cdbSmrg
31353354cdbSmrg  tar)
31453354cdbSmrg    shift
31553354cdbSmrg
31653354cdbSmrg    # We have already tried tar in the generic part.
31753354cdbSmrg    # Look for gnutar/gtar before invocation to avoid ugly error
31853354cdbSmrg    # messages.
31953354cdbSmrg    if (gnutar --version > /dev/null 2>&1); then
32053354cdbSmrg       gnutar "$@" && exit 0
32153354cdbSmrg    fi
32253354cdbSmrg    if (gtar --version > /dev/null 2>&1); then
32353354cdbSmrg       gtar "$@" && exit 0
32453354cdbSmrg    fi
32553354cdbSmrg    firstarg="$1"
32653354cdbSmrg    if shift; then
32753354cdbSmrg	case $firstarg in
32853354cdbSmrg	*o*)
32953354cdbSmrg	    firstarg=`echo "$firstarg" | sed s/o//`
33053354cdbSmrg	    tar "$firstarg" "$@" && exit 0
33153354cdbSmrg	    ;;
33253354cdbSmrg	esac
33353354cdbSmrg	case $firstarg in
33453354cdbSmrg	*h*)
33553354cdbSmrg	    firstarg=`echo "$firstarg" | sed s/h//`
33653354cdbSmrg	    tar "$firstarg" "$@" && exit 0
33753354cdbSmrg	    ;;
33853354cdbSmrg	esac
33953354cdbSmrg    fi
34053354cdbSmrg
34153354cdbSmrg    echo 1>&2 "\
34253354cdbSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
34353354cdbSmrg         You may want to install GNU tar or Free paxutils, or check the
34453354cdbSmrg         command line arguments."
34553354cdbSmrg    exit 1
34653354cdbSmrg    ;;
34753354cdbSmrg
34853354cdbSmrg  *)
34953354cdbSmrg    echo 1>&2 "\
35053354cdbSmrgWARNING: \`$1' is needed, and is $msg.
35153354cdbSmrg         You might have modified some files without having the
35253354cdbSmrg         proper tools for further handling them.  Check the \`README' file,
35353354cdbSmrg         it often tells you about the needed prerequisites for installing
35453354cdbSmrg         this package.  You may also peek at any GNU archive site, in case
35553354cdbSmrg         some other package would contain this missing \`$1' program."
35653354cdbSmrg    exit 1
35753354cdbSmrg    ;;
35853354cdbSmrgesac
35953354cdbSmrg
36053354cdbSmrgexit 0
36153354cdbSmrg
36253354cdbSmrg# Local variables:
36353354cdbSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
36453354cdbSmrg# time-stamp-start: "scriptversion="
36553354cdbSmrg# time-stamp-format: "%:y-%02m-%02d.%02H"
36653354cdbSmrg# time-stamp-end: "$"
36753354cdbSmrg# End:
368