missing revision a73423d7
150806d53Smrg#! /bin/sh
250806d53Smrg# Common stub for a few missing GNU programs while installing.
350806d53Smrg
4a73423d7Smrgscriptversion=2012-01-06.13; # UTC
550806d53Smrg
6a73423d7Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
7a73423d7Smrg# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
850806d53Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
950806d53Smrg
1050806d53Smrg# This program is free software; you can redistribute it and/or modify
1150806d53Smrg# it under the terms of the GNU General Public License as published by
1250806d53Smrg# the Free Software Foundation; either version 2, or (at your option)
1350806d53Smrg# any later version.
1450806d53Smrg
1550806d53Smrg# This program is distributed in the hope that it will be useful,
1650806d53Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
1750806d53Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1850806d53Smrg# GNU General Public License for more details.
1950806d53Smrg
2050806d53Smrg# You should have received a copy of the GNU General Public License
21a73423d7Smrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
2250806d53Smrg
2350806d53Smrg# As a special exception to the GNU General Public License, if you
2450806d53Smrg# distribute this file as part of a program that contains a
2550806d53Smrg# configuration script generated by Autoconf, you may include it under
2650806d53Smrg# the same distribution terms that you use for the rest of that program.
2750806d53Smrg
2850806d53Smrgif test $# -eq 0; then
2950806d53Smrg  echo 1>&2 "Try \`$0 --help' for more information"
3050806d53Smrg  exit 1
3150806d53Smrgfi
3250806d53Smrg
3350806d53Smrgrun=:
347965d9acSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
357965d9acSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
3650806d53Smrg
3750806d53Smrg# In the cases where this matters, `missing' is being run in the
3850806d53Smrg# srcdir already.
3950806d53Smrgif test -f configure.ac; then
4050806d53Smrg  configure_ac=configure.ac
4150806d53Smrgelse
4250806d53Smrg  configure_ac=configure.in
4350806d53Smrgfi
4450806d53Smrg
4550806d53Smrgmsg="missing on your system"
4650806d53Smrg
477965d9acSmrgcase $1 in
4850806d53Smrg--run)
4950806d53Smrg  # Try to run requested program, and just exit if it succeeds.
5050806d53Smrg  run=
5150806d53Smrg  shift
5250806d53Smrg  "$@" && exit 0
5350806d53Smrg  # Exit code 63 means version mismatch.  This often happens
5450806d53Smrg  # when the user try to use an ancient version of a tool on
5550806d53Smrg  # a file that requires a minimum version.  In this case we
5650806d53Smrg  # we should proceed has if the program had been absent, or
5750806d53Smrg  # if --run hadn't been passed.
5850806d53Smrg  if test $? = 63; then
5950806d53Smrg    run=:
6050806d53Smrg    msg="probably too old"
6150806d53Smrg  fi
6250806d53Smrg  ;;
6350806d53Smrg
6450806d53Smrg  -h|--h|--he|--hel|--help)
6550806d53Smrg    echo "\
6650806d53Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
6750806d53Smrg
6850806d53SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
6950806d53Smrgerror status if there is no known handling for PROGRAM.
7050806d53Smrg
7150806d53SmrgOptions:
7250806d53Smrg  -h, --help      display this help and exit
7350806d53Smrg  -v, --version   output version information and exit
7450806d53Smrg  --run           try to run the given command, and emulate it if it fails
7550806d53Smrg
7650806d53SmrgSupported PROGRAM values:
7750806d53Smrg  aclocal      touch file \`aclocal.m4'
7850806d53Smrg  autoconf     touch file \`configure'
7950806d53Smrg  autoheader   touch file \`config.h.in'
807965d9acSmrg  autom4te     touch the output file, or create a stub one
8150806d53Smrg  automake     touch all \`Makefile.in' files
8250806d53Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
8350806d53Smrg  flex         create \`lex.yy.c', if possible, from existing .c
8450806d53Smrg  help2man     touch the output file
8550806d53Smrg  lex          create \`lex.yy.c', if possible, from existing .c
8650806d53Smrg  makeinfo     touch the output file
8750806d53Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
8850806d53Smrg
89a73423d7SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
90a73423d7Smrg\`g' are ignored when checking the name.
91a73423d7Smrg
9250806d53SmrgSend bug reports to <bug-automake@gnu.org>."
9350806d53Smrg    exit $?
9450806d53Smrg    ;;
9550806d53Smrg
9650806d53Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
9750806d53Smrg    echo "missing $scriptversion (GNU Automake)"
9850806d53Smrg    exit $?
9950806d53Smrg    ;;
10050806d53Smrg
10150806d53Smrg  -*)
10250806d53Smrg    echo 1>&2 "$0: Unknown \`$1' option"
10350806d53Smrg    echo 1>&2 "Try \`$0 --help' for more information"
10450806d53Smrg    exit 1
10550806d53Smrg    ;;
10650806d53Smrg
10750806d53Smrgesac
10850806d53Smrg
109a73423d7Smrg# normalize program name to check for.
110a73423d7Smrgprogram=`echo "$1" | sed '
111a73423d7Smrg  s/^gnu-//; t
112a73423d7Smrg  s/^gnu//; t
113a73423d7Smrg  s/^g//; t'`
114a73423d7Smrg
11550806d53Smrg# Now exit if we have it, but it failed.  Also exit now if we
11650806d53Smrg# don't have it and --version was passed (most likely to detect
117a73423d7Smrg# the program).  This is about non-GNU programs, so use $1 not
118a73423d7Smrg# $program.
1197965d9acSmrgcase $1 in
120a73423d7Smrg  lex*|yacc*)
12150806d53Smrg    # Not GNU programs, they don't have --version.
12250806d53Smrg    ;;
12350806d53Smrg
12450806d53Smrg  *)
12550806d53Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
12650806d53Smrg       # We have it, but it failed.
12750806d53Smrg       exit 1
12850806d53Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
12950806d53Smrg       # Could not run --version or --help.  This is probably someone
13050806d53Smrg       # running `$TOOL --version' or `$TOOL --help' to check whether
13150806d53Smrg       # $TOOL exists and not knowing $TOOL uses missing.
13250806d53Smrg       exit 1
13350806d53Smrg    fi
13450806d53Smrg    ;;
13550806d53Smrgesac
13650806d53Smrg
13750806d53Smrg# If it does not exist, or fails to run (possibly an outdated version),
13850806d53Smrg# try to emulate it.
139a73423d7Smrgcase $program in
14050806d53Smrg  aclocal*)
14150806d53Smrg    echo 1>&2 "\
14250806d53SmrgWARNING: \`$1' is $msg.  You should only need it if
14350806d53Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
14450806d53Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
14550806d53Smrg         any GNU archive site."
14650806d53Smrg    touch aclocal.m4
14750806d53Smrg    ;;
14850806d53Smrg
149a73423d7Smrg  autoconf*)
15050806d53Smrg    echo 1>&2 "\
15150806d53SmrgWARNING: \`$1' is $msg.  You should only need it if
15250806d53Smrg         you modified \`${configure_ac}'.  You might want to install the
15350806d53Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
15450806d53Smrg         archive site."
15550806d53Smrg    touch configure
15650806d53Smrg    ;;
15750806d53Smrg
158a73423d7Smrg  autoheader*)
15950806d53Smrg    echo 1>&2 "\
16050806d53SmrgWARNING: \`$1' is $msg.  You should only need it if
16150806d53Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
16250806d53Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
16350806d53Smrg         from any GNU archive site."
16450806d53Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
16550806d53Smrg    test -z "$files" && files="config.h"
16650806d53Smrg    touch_files=
16750806d53Smrg    for f in $files; do
1687965d9acSmrg      case $f in
16950806d53Smrg      *:*) touch_files="$touch_files "`echo "$f" |
17050806d53Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
17150806d53Smrg      *) touch_files="$touch_files $f.in";;
17250806d53Smrg      esac
17350806d53Smrg    done
17450806d53Smrg    touch $touch_files
17550806d53Smrg    ;;
17650806d53Smrg
17750806d53Smrg  automake*)
17850806d53Smrg    echo 1>&2 "\
17950806d53SmrgWARNING: \`$1' is $msg.  You should only need it if
18050806d53Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
18150806d53Smrg         You might want to install the \`Automake' and \`Perl' packages.
18250806d53Smrg         Grab them from any GNU archive site."
18350806d53Smrg    find . -type f -name Makefile.am -print |
18450806d53Smrg	   sed 's/\.am$/.in/' |
18550806d53Smrg	   while read f; do touch "$f"; done
18650806d53Smrg    ;;
18750806d53Smrg
188a73423d7Smrg  autom4te*)
18950806d53Smrg    echo 1>&2 "\
19050806d53SmrgWARNING: \`$1' is needed, but is $msg.
19150806d53Smrg         You might have modified some files without having the
19250806d53Smrg         proper tools for further handling them.
19350806d53Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
19450806d53Smrg         archive site."
19550806d53Smrg
1967965d9acSmrg    file=`echo "$*" | sed -n "$sed_output"`
1977965d9acSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
19850806d53Smrg    if test -f "$file"; then
19950806d53Smrg	touch $file
20050806d53Smrg    else
20150806d53Smrg	test -z "$file" || exec >$file
20250806d53Smrg	echo "#! /bin/sh"
20350806d53Smrg	echo "# Created by GNU Automake missing as a replacement of"
20450806d53Smrg	echo "#  $ $@"
20550806d53Smrg	echo "exit 0"
20650806d53Smrg	chmod +x $file
20750806d53Smrg	exit 1
20850806d53Smrg    fi
20950806d53Smrg    ;;
21050806d53Smrg
211a73423d7Smrg  bison*|yacc*)
21250806d53Smrg    echo 1>&2 "\
21350806d53SmrgWARNING: \`$1' $msg.  You should only need it if
21450806d53Smrg         you modified a \`.y' file.  You may need the \`Bison' package
21550806d53Smrg         in order for those modifications to take effect.  You can get
21650806d53Smrg         \`Bison' from any GNU archive site."
21750806d53Smrg    rm -f y.tab.c y.tab.h
2187965d9acSmrg    if test $# -ne 1; then
219a73423d7Smrg        eval LASTARG=\${$#}
2207965d9acSmrg	case $LASTARG in
22150806d53Smrg	*.y)
22250806d53Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
2237965d9acSmrg	    if test -f "$SRCFILE"; then
22450806d53Smrg	         cp "$SRCFILE" y.tab.c
22550806d53Smrg	    fi
22650806d53Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2277965d9acSmrg	    if test -f "$SRCFILE"; then
22850806d53Smrg	         cp "$SRCFILE" y.tab.h
22950806d53Smrg	    fi
23050806d53Smrg	  ;;
23150806d53Smrg	esac
23250806d53Smrg    fi
2337965d9acSmrg    if test ! -f y.tab.h; then
23450806d53Smrg	echo >y.tab.h
23550806d53Smrg    fi
2367965d9acSmrg    if test ! -f y.tab.c; then
23750806d53Smrg	echo 'main() { return 0; }' >y.tab.c
23850806d53Smrg    fi
23950806d53Smrg    ;;
24050806d53Smrg
241a73423d7Smrg  lex*|flex*)
24250806d53Smrg    echo 1>&2 "\
24350806d53SmrgWARNING: \`$1' is $msg.  You should only need it if
24450806d53Smrg         you modified a \`.l' file.  You may need the \`Flex' package
24550806d53Smrg         in order for those modifications to take effect.  You can get
24650806d53Smrg         \`Flex' from any GNU archive site."
24750806d53Smrg    rm -f lex.yy.c
2487965d9acSmrg    if test $# -ne 1; then
249a73423d7Smrg        eval LASTARG=\${$#}
2507965d9acSmrg	case $LASTARG in
25150806d53Smrg	*.l)
25250806d53Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2537965d9acSmrg	    if test -f "$SRCFILE"; then
25450806d53Smrg	         cp "$SRCFILE" lex.yy.c
25550806d53Smrg	    fi
25650806d53Smrg	  ;;
25750806d53Smrg	esac
25850806d53Smrg    fi
2597965d9acSmrg    if test ! -f lex.yy.c; then
26050806d53Smrg	echo 'main() { return 0; }' >lex.yy.c
26150806d53Smrg    fi
26250806d53Smrg    ;;
26350806d53Smrg
264a73423d7Smrg  help2man*)
26550806d53Smrg    echo 1>&2 "\
26650806d53SmrgWARNING: \`$1' is $msg.  You should only need it if
26750806d53Smrg	 you modified a dependency of a manual page.  You may need the
26850806d53Smrg	 \`Help2man' package in order for those modifications to take
26950806d53Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
27050806d53Smrg
2717965d9acSmrg    file=`echo "$*" | sed -n "$sed_output"`
2727965d9acSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2737965d9acSmrg    if test -f "$file"; then
27450806d53Smrg	touch $file
27550806d53Smrg    else
27650806d53Smrg	test -z "$file" || exec >$file
27750806d53Smrg	echo ".ab help2man is required to generate this page"
278a73423d7Smrg	exit $?
27950806d53Smrg    fi
28050806d53Smrg    ;;
28150806d53Smrg
282a73423d7Smrg  makeinfo*)
28350806d53Smrg    echo 1>&2 "\
28450806d53SmrgWARNING: \`$1' is $msg.  You should only need it if
28550806d53Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
28650806d53Smrg         indirectly affecting the aspect of the manual.  The spurious
28750806d53Smrg         call might also be the consequence of using a buggy \`make' (AIX,
28850806d53Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
28950806d53Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
29050806d53Smrg    # The file to touch is that specified with -o ...
2917965d9acSmrg    file=`echo "$*" | sed -n "$sed_output"`
2927965d9acSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
29350806d53Smrg    if test -z "$file"; then
29450806d53Smrg      # ... or it is the one specified with @setfilename ...
29550806d53Smrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
2967965d9acSmrg      file=`sed -n '
2977965d9acSmrg	/^@setfilename/{
2987965d9acSmrg	  s/.* \([^ ]*\) *$/\1/
2997965d9acSmrg	  p
3007965d9acSmrg	  q
3017965d9acSmrg	}' $infile`
30250806d53Smrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
30350806d53Smrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
30450806d53Smrg    fi
30550806d53Smrg    # If the file does not exist, the user really needs makeinfo;
30650806d53Smrg    # let's fail without touching anything.
30750806d53Smrg    test -f $file || exit 1
30850806d53Smrg    touch $file
30950806d53Smrg    ;;
31050806d53Smrg
31150806d53Smrg  *)
31250806d53Smrg    echo 1>&2 "\
31350806d53SmrgWARNING: \`$1' is needed, and is $msg.
31450806d53Smrg         You might have modified some files without having the
31550806d53Smrg         proper tools for further handling them.  Check the \`README' file,
31650806d53Smrg         it often tells you about the needed prerequisites for installing
31750806d53Smrg         this package.  You may also peek at any GNU archive site, in case
31850806d53Smrg         some other package would contain this missing \`$1' program."
31950806d53Smrg    exit 1
32050806d53Smrg    ;;
32150806d53Smrgesac
32250806d53Smrg
32350806d53Smrgexit 0
32450806d53Smrg
32550806d53Smrg# Local variables:
32650806d53Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
32750806d53Smrg# time-stamp-start: "scriptversion="
32850806d53Smrg# time-stamp-format: "%:y-%02m-%02d.%02H"
329a73423d7Smrg# time-stamp-time-zone: "UTC"
330a73423d7Smrg# time-stamp-end: "; # UTC"
33150806d53Smrg# End:
332