missing revision 41c30155
123a0898aSmrg#! /bin/sh
223a0898aSmrg# Common stub for a few missing GNU programs while installing.
323a0898aSmrg
441c30155Smrgscriptversion=2009-04-28.21; # UTC
523a0898aSmrg
641c30155Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
741c30155Smrg# 2008, 2009 Free Software Foundation, Inc.
823a0898aSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
923a0898aSmrg
1023a0898aSmrg# This program is free software; you can redistribute it and/or modify
1123a0898aSmrg# it under the terms of the GNU General Public License as published by
1223a0898aSmrg# the Free Software Foundation; either version 2, or (at your option)
1323a0898aSmrg# any later version.
1423a0898aSmrg
1523a0898aSmrg# This program is distributed in the hope that it will be useful,
1623a0898aSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
1723a0898aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1823a0898aSmrg# GNU General Public License for more details.
1923a0898aSmrg
2023a0898aSmrg# You should have received a copy of the GNU General Public License
2141c30155Smrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
2223a0898aSmrg
2323a0898aSmrg# As a special exception to the GNU General Public License, if you
2423a0898aSmrg# distribute this file as part of a program that contains a
2523a0898aSmrg# configuration script generated by Autoconf, you may include it under
2623a0898aSmrg# the same distribution terms that you use for the rest of that program.
2723a0898aSmrg
2823a0898aSmrgif test $# -eq 0; then
2923a0898aSmrg  echo 1>&2 "Try \`$0 --help' for more information"
3023a0898aSmrg  exit 1
3123a0898aSmrgfi
3223a0898aSmrg
3323a0898aSmrgrun=:
3423a0898aSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
3523a0898aSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
3623a0898aSmrg
3723a0898aSmrg# In the cases where this matters, `missing' is being run in the
3823a0898aSmrg# srcdir already.
3923a0898aSmrgif test -f configure.ac; then
4023a0898aSmrg  configure_ac=configure.ac
4123a0898aSmrgelse
4223a0898aSmrg  configure_ac=configure.in
4323a0898aSmrgfi
4423a0898aSmrg
4523a0898aSmrgmsg="missing on your system"
4623a0898aSmrg
4723a0898aSmrgcase $1 in
4823a0898aSmrg--run)
4923a0898aSmrg  # Try to run requested program, and just exit if it succeeds.
5023a0898aSmrg  run=
5123a0898aSmrg  shift
5223a0898aSmrg  "$@" && exit 0
5323a0898aSmrg  # Exit code 63 means version mismatch.  This often happens
5423a0898aSmrg  # when the user try to use an ancient version of a tool on
5523a0898aSmrg  # a file that requires a minimum version.  In this case we
5623a0898aSmrg  # we should proceed has if the program had been absent, or
5723a0898aSmrg  # if --run hadn't been passed.
5823a0898aSmrg  if test $? = 63; then
5923a0898aSmrg    run=:
6023a0898aSmrg    msg="probably too old"
6123a0898aSmrg  fi
6223a0898aSmrg  ;;
6323a0898aSmrg
6423a0898aSmrg  -h|--h|--he|--hel|--help)
6523a0898aSmrg    echo "\
6623a0898aSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
6723a0898aSmrg
6823a0898aSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
6923a0898aSmrgerror status if there is no known handling for PROGRAM.
7023a0898aSmrg
7123a0898aSmrgOptions:
7223a0898aSmrg  -h, --help      display this help and exit
7323a0898aSmrg  -v, --version   output version information and exit
7423a0898aSmrg  --run           try to run the given command, and emulate it if it fails
7523a0898aSmrg
7623a0898aSmrgSupported PROGRAM values:
7723a0898aSmrg  aclocal      touch file \`aclocal.m4'
7823a0898aSmrg  autoconf     touch file \`configure'
7923a0898aSmrg  autoheader   touch file \`config.h.in'
8023a0898aSmrg  autom4te     touch the output file, or create a stub one
8123a0898aSmrg  automake     touch all \`Makefile.in' files
8223a0898aSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
8323a0898aSmrg  flex         create \`lex.yy.c', if possible, from existing .c
8423a0898aSmrg  help2man     touch the output file
8523a0898aSmrg  lex          create \`lex.yy.c', if possible, from existing .c
8623a0898aSmrg  makeinfo     touch the output file
8723a0898aSmrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
8823a0898aSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
8923a0898aSmrg
9041c30155SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
9141c30155Smrg\`g' are ignored when checking the name.
9241c30155Smrg
9323a0898aSmrgSend bug reports to <bug-automake@gnu.org>."
9423a0898aSmrg    exit $?
9523a0898aSmrg    ;;
9623a0898aSmrg
9723a0898aSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
9823a0898aSmrg    echo "missing $scriptversion (GNU Automake)"
9923a0898aSmrg    exit $?
10023a0898aSmrg    ;;
10123a0898aSmrg
10223a0898aSmrg  -*)
10323a0898aSmrg    echo 1>&2 "$0: Unknown \`$1' option"
10423a0898aSmrg    echo 1>&2 "Try \`$0 --help' for more information"
10523a0898aSmrg    exit 1
10623a0898aSmrg    ;;
10723a0898aSmrg
10823a0898aSmrgesac
10923a0898aSmrg
11041c30155Smrg# normalize program name to check for.
11141c30155Smrgprogram=`echo "$1" | sed '
11241c30155Smrg  s/^gnu-//; t
11341c30155Smrg  s/^gnu//; t
11441c30155Smrg  s/^g//; t'`
11541c30155Smrg
11623a0898aSmrg# Now exit if we have it, but it failed.  Also exit now if we
11723a0898aSmrg# don't have it and --version was passed (most likely to detect
11841c30155Smrg# the program).  This is about non-GNU programs, so use $1 not
11941c30155Smrg# $program.
12023a0898aSmrgcase $1 in
12141c30155Smrg  lex*|yacc*)
12223a0898aSmrg    # Not GNU programs, they don't have --version.
12323a0898aSmrg    ;;
12423a0898aSmrg
12541c30155Smrg  tar*)
12623a0898aSmrg    if test -n "$run"; then
12723a0898aSmrg       echo 1>&2 "ERROR: \`tar' requires --run"
12823a0898aSmrg       exit 1
12923a0898aSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
13023a0898aSmrg       exit 1
13123a0898aSmrg    fi
13223a0898aSmrg    ;;
13323a0898aSmrg
13423a0898aSmrg  *)
13523a0898aSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
13623a0898aSmrg       # We have it, but it failed.
13723a0898aSmrg       exit 1
13823a0898aSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
13923a0898aSmrg       # Could not run --version or --help.  This is probably someone
14023a0898aSmrg       # running `$TOOL --version' or `$TOOL --help' to check whether
14123a0898aSmrg       # $TOOL exists and not knowing $TOOL uses missing.
14223a0898aSmrg       exit 1
14323a0898aSmrg    fi
14423a0898aSmrg    ;;
14523a0898aSmrgesac
14623a0898aSmrg
14723a0898aSmrg# If it does not exist, or fails to run (possibly an outdated version),
14823a0898aSmrg# try to emulate it.
14941c30155Smrgcase $program in
15023a0898aSmrg  aclocal*)
15123a0898aSmrg    echo 1>&2 "\
15223a0898aSmrgWARNING: \`$1' is $msg.  You should only need it if
15323a0898aSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
15423a0898aSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
15523a0898aSmrg         any GNU archive site."
15623a0898aSmrg    touch aclocal.m4
15723a0898aSmrg    ;;
15823a0898aSmrg
15941c30155Smrg  autoconf*)
16023a0898aSmrg    echo 1>&2 "\
16123a0898aSmrgWARNING: \`$1' is $msg.  You should only need it if
16223a0898aSmrg         you modified \`${configure_ac}'.  You might want to install the
16323a0898aSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
16423a0898aSmrg         archive site."
16523a0898aSmrg    touch configure
16623a0898aSmrg    ;;
16723a0898aSmrg
16841c30155Smrg  autoheader*)
16923a0898aSmrg    echo 1>&2 "\
17023a0898aSmrgWARNING: \`$1' is $msg.  You should only need it if
17123a0898aSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
17223a0898aSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
17323a0898aSmrg         from any GNU archive site."
17423a0898aSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
17523a0898aSmrg    test -z "$files" && files="config.h"
17623a0898aSmrg    touch_files=
17723a0898aSmrg    for f in $files; do
17823a0898aSmrg      case $f in
17923a0898aSmrg      *:*) touch_files="$touch_files "`echo "$f" |
18023a0898aSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
18123a0898aSmrg      *) touch_files="$touch_files $f.in";;
18223a0898aSmrg      esac
18323a0898aSmrg    done
18423a0898aSmrg    touch $touch_files
18523a0898aSmrg    ;;
18623a0898aSmrg
18723a0898aSmrg  automake*)
18823a0898aSmrg    echo 1>&2 "\
18923a0898aSmrgWARNING: \`$1' is $msg.  You should only need it if
19023a0898aSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
19123a0898aSmrg         You might want to install the \`Automake' and \`Perl' packages.
19223a0898aSmrg         Grab them from any GNU archive site."
19323a0898aSmrg    find . -type f -name Makefile.am -print |
19423a0898aSmrg	   sed 's/\.am$/.in/' |
19523a0898aSmrg	   while read f; do touch "$f"; done
19623a0898aSmrg    ;;
19723a0898aSmrg
19841c30155Smrg  autom4te*)
19923a0898aSmrg    echo 1>&2 "\
20023a0898aSmrgWARNING: \`$1' is needed, but is $msg.
20123a0898aSmrg         You might have modified some files without having the
20223a0898aSmrg         proper tools for further handling them.
20323a0898aSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
20423a0898aSmrg         archive site."
20523a0898aSmrg
20623a0898aSmrg    file=`echo "$*" | sed -n "$sed_output"`
20723a0898aSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
20823a0898aSmrg    if test -f "$file"; then
20923a0898aSmrg	touch $file
21023a0898aSmrg    else
21123a0898aSmrg	test -z "$file" || exec >$file
21223a0898aSmrg	echo "#! /bin/sh"
21323a0898aSmrg	echo "# Created by GNU Automake missing as a replacement of"
21423a0898aSmrg	echo "#  $ $@"
21523a0898aSmrg	echo "exit 0"
21623a0898aSmrg	chmod +x $file
21723a0898aSmrg	exit 1
21823a0898aSmrg    fi
21923a0898aSmrg    ;;
22023a0898aSmrg
22141c30155Smrg  bison*|yacc*)
22223a0898aSmrg    echo 1>&2 "\
22323a0898aSmrgWARNING: \`$1' $msg.  You should only need it if
22423a0898aSmrg         you modified a \`.y' file.  You may need the \`Bison' package
22523a0898aSmrg         in order for those modifications to take effect.  You can get
22623a0898aSmrg         \`Bison' from any GNU archive site."
22723a0898aSmrg    rm -f y.tab.c y.tab.h
22823a0898aSmrg    if test $# -ne 1; then
22923a0898aSmrg        eval LASTARG="\${$#}"
23023a0898aSmrg	case $LASTARG in
23123a0898aSmrg	*.y)
23223a0898aSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
23323a0898aSmrg	    if test -f "$SRCFILE"; then
23423a0898aSmrg	         cp "$SRCFILE" y.tab.c
23523a0898aSmrg	    fi
23623a0898aSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
23723a0898aSmrg	    if test -f "$SRCFILE"; then
23823a0898aSmrg	         cp "$SRCFILE" y.tab.h
23923a0898aSmrg	    fi
24023a0898aSmrg	  ;;
24123a0898aSmrg	esac
24223a0898aSmrg    fi
24323a0898aSmrg    if test ! -f y.tab.h; then
24423a0898aSmrg	echo >y.tab.h
24523a0898aSmrg    fi
24623a0898aSmrg    if test ! -f y.tab.c; then
24723a0898aSmrg	echo 'main() { return 0; }' >y.tab.c
24823a0898aSmrg    fi
24923a0898aSmrg    ;;
25023a0898aSmrg
25141c30155Smrg  lex*|flex*)
25223a0898aSmrg    echo 1>&2 "\
25323a0898aSmrgWARNING: \`$1' is $msg.  You should only need it if
25423a0898aSmrg         you modified a \`.l' file.  You may need the \`Flex' package
25523a0898aSmrg         in order for those modifications to take effect.  You can get
25623a0898aSmrg         \`Flex' from any GNU archive site."
25723a0898aSmrg    rm -f lex.yy.c
25823a0898aSmrg    if test $# -ne 1; then
25923a0898aSmrg        eval LASTARG="\${$#}"
26023a0898aSmrg	case $LASTARG in
26123a0898aSmrg	*.l)
26223a0898aSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
26323a0898aSmrg	    if test -f "$SRCFILE"; then
26423a0898aSmrg	         cp "$SRCFILE" lex.yy.c
26523a0898aSmrg	    fi
26623a0898aSmrg	  ;;
26723a0898aSmrg	esac
26823a0898aSmrg    fi
26923a0898aSmrg    if test ! -f lex.yy.c; then
27023a0898aSmrg	echo 'main() { return 0; }' >lex.yy.c
27123a0898aSmrg    fi
27223a0898aSmrg    ;;
27323a0898aSmrg
27441c30155Smrg  help2man*)
27523a0898aSmrg    echo 1>&2 "\
27623a0898aSmrgWARNING: \`$1' is $msg.  You should only need it if
27723a0898aSmrg	 you modified a dependency of a manual page.  You may need the
27823a0898aSmrg	 \`Help2man' package in order for those modifications to take
27923a0898aSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
28023a0898aSmrg
28123a0898aSmrg    file=`echo "$*" | sed -n "$sed_output"`
28223a0898aSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
28323a0898aSmrg    if test -f "$file"; then
28423a0898aSmrg	touch $file
28523a0898aSmrg    else
28623a0898aSmrg	test -z "$file" || exec >$file
28723a0898aSmrg	echo ".ab help2man is required to generate this page"
28841c30155Smrg	exit $?
28923a0898aSmrg    fi
29023a0898aSmrg    ;;
29123a0898aSmrg
29241c30155Smrg  makeinfo*)
29323a0898aSmrg    echo 1>&2 "\
29423a0898aSmrgWARNING: \`$1' is $msg.  You should only need it if
29523a0898aSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
29623a0898aSmrg         indirectly affecting the aspect of the manual.  The spurious
29723a0898aSmrg         call might also be the consequence of using a buggy \`make' (AIX,
29823a0898aSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
29923a0898aSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
30023a0898aSmrg    # The file to touch is that specified with -o ...
30123a0898aSmrg    file=`echo "$*" | sed -n "$sed_output"`
30223a0898aSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
30323a0898aSmrg    if test -z "$file"; then
30423a0898aSmrg      # ... or it is the one specified with @setfilename ...
30523a0898aSmrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
30623a0898aSmrg      file=`sed -n '
30723a0898aSmrg	/^@setfilename/{
30823a0898aSmrg	  s/.* \([^ ]*\) *$/\1/
30923a0898aSmrg	  p
31023a0898aSmrg	  q
31123a0898aSmrg	}' $infile`
31223a0898aSmrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
31323a0898aSmrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
31423a0898aSmrg    fi
31523a0898aSmrg    # If the file does not exist, the user really needs makeinfo;
31623a0898aSmrg    # let's fail without touching anything.
31723a0898aSmrg    test -f $file || exit 1
31823a0898aSmrg    touch $file
31923a0898aSmrg    ;;
32023a0898aSmrg
32141c30155Smrg  tar*)
32223a0898aSmrg    shift
32323a0898aSmrg
32423a0898aSmrg    # We have already tried tar in the generic part.
32523a0898aSmrg    # Look for gnutar/gtar before invocation to avoid ugly error
32623a0898aSmrg    # messages.
32723a0898aSmrg    if (gnutar --version > /dev/null 2>&1); then
32823a0898aSmrg       gnutar "$@" && exit 0
32923a0898aSmrg    fi
33023a0898aSmrg    if (gtar --version > /dev/null 2>&1); then
33123a0898aSmrg       gtar "$@" && exit 0
33223a0898aSmrg    fi
33323a0898aSmrg    firstarg="$1"
33423a0898aSmrg    if shift; then
33523a0898aSmrg	case $firstarg in
33623a0898aSmrg	*o*)
33723a0898aSmrg	    firstarg=`echo "$firstarg" | sed s/o//`
33823a0898aSmrg	    tar "$firstarg" "$@" && exit 0
33923a0898aSmrg	    ;;
34023a0898aSmrg	esac
34123a0898aSmrg	case $firstarg in
34223a0898aSmrg	*h*)
34323a0898aSmrg	    firstarg=`echo "$firstarg" | sed s/h//`
34423a0898aSmrg	    tar "$firstarg" "$@" && exit 0
34523a0898aSmrg	    ;;
34623a0898aSmrg	esac
34723a0898aSmrg    fi
34823a0898aSmrg
34923a0898aSmrg    echo 1>&2 "\
35023a0898aSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
35123a0898aSmrg         You may want to install GNU tar or Free paxutils, or check the
35223a0898aSmrg         command line arguments."
35323a0898aSmrg    exit 1
35423a0898aSmrg    ;;
35523a0898aSmrg
35623a0898aSmrg  *)
35723a0898aSmrg    echo 1>&2 "\
35823a0898aSmrgWARNING: \`$1' is needed, and is $msg.
35923a0898aSmrg         You might have modified some files without having the
36023a0898aSmrg         proper tools for further handling them.  Check the \`README' file,
36123a0898aSmrg         it often tells you about the needed prerequisites for installing
36223a0898aSmrg         this package.  You may also peek at any GNU archive site, in case
36323a0898aSmrg         some other package would contain this missing \`$1' program."
36423a0898aSmrg    exit 1
36523a0898aSmrg    ;;
36623a0898aSmrgesac
36723a0898aSmrg
36823a0898aSmrgexit 0
36923a0898aSmrg
37023a0898aSmrg# Local variables:
37123a0898aSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
37223a0898aSmrg# time-stamp-start: "scriptversion="
37323a0898aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H"
37441c30155Smrg# time-stamp-time-zone: "UTC"
37541c30155Smrg# time-stamp-end: "; # UTC"
37623a0898aSmrg# End:
377