missing revision 16910e25
116910e25Smrg#! /bin/sh
216910e25Smrg# Common stub for a few missing GNU programs while installing.
316910e25Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
416910e25Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
516910e25Smrg
616910e25Smrg# This program is free software; you can redistribute it and/or modify
716910e25Smrg# it under the terms of the GNU General Public License as published by
816910e25Smrg# the Free Software Foundation; either version 2, or (at your option)
916910e25Smrg# any later version.
1016910e25Smrg
1116910e25Smrg# This program is distributed in the hope that it will be useful,
1216910e25Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
1316910e25Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1416910e25Smrg# GNU General Public License for more details.
1516910e25Smrg
1616910e25Smrg# You should have received a copy of the GNU General Public License
1716910e25Smrg# along with this program; if not, write to the Free Software
1816910e25Smrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1916910e25Smrg# 02111-1307, USA.
2016910e25Smrg
2116910e25Smrg# As a special exception to the GNU General Public License, if you
2216910e25Smrg# distribute this file as part of a program that contains a
2316910e25Smrg# configuration script generated by Autoconf, you may include it under
2416910e25Smrg# the same distribution terms that you use for the rest of that program.
2516910e25Smrg
2616910e25Smrgif test $# -eq 0; then
2716910e25Smrg  echo 1>&2 "Try \`$0 --help' for more information"
2816910e25Smrg  exit 1
2916910e25Smrgfi
3016910e25Smrg
3116910e25Smrgrun=:
3216910e25Smrg
3316910e25Smrg# In the cases where this matters, `missing' is being run in the
3416910e25Smrg# srcdir already.
3516910e25Smrgif test -f configure.ac; then
3616910e25Smrg  configure_ac=configure.ac
3716910e25Smrgelse
3816910e25Smrg  configure_ac=configure.in
3916910e25Smrgfi
4016910e25Smrg
4116910e25Smrgcase "$1" in
4216910e25Smrg--run)
4316910e25Smrg  # Try to run requested program, and just exit if it succeeds.
4416910e25Smrg  run=
4516910e25Smrg  shift
4616910e25Smrg  "$@" && exit 0
4716910e25Smrg  ;;
4816910e25Smrgesac
4916910e25Smrg
5016910e25Smrg# If it does not exist, or fails to run (possibly an outdated version),
5116910e25Smrg# try to emulate it.
5216910e25Smrgcase "$1" in
5316910e25Smrg
5416910e25Smrg  -h|--h|--he|--hel|--help)
5516910e25Smrg    echo "\
5616910e25Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
5716910e25Smrg
5816910e25SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
5916910e25Smrgerror status if there is no known handling for PROGRAM.
6016910e25Smrg
6116910e25SmrgOptions:
6216910e25Smrg  -h, --help      display this help and exit
6316910e25Smrg  -v, --version   output version information and exit
6416910e25Smrg  --run           try to run the given command, and emulate it if it fails
6516910e25Smrg
6616910e25SmrgSupported PROGRAM values:
6716910e25Smrg  aclocal      touch file \`aclocal.m4'
6816910e25Smrg  autoconf     touch file \`configure'
6916910e25Smrg  autoheader   touch file \`config.h.in'
7016910e25Smrg  automake     touch all \`Makefile.in' files
7116910e25Smrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
7216910e25Smrg  flex         create \`lex.yy.c', if possible, from existing .c
7316910e25Smrg  help2man     touch the output file
7416910e25Smrg  lex          create \`lex.yy.c', if possible, from existing .c
7516910e25Smrg  makeinfo     touch the output file
7616910e25Smrg  tar          try tar, gnutar, gtar, then tar without non-portable flags
7716910e25Smrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
7816910e25Smrg    ;;
7916910e25Smrg
8016910e25Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
8116910e25Smrg    echo "missing 0.4 - GNU automake"
8216910e25Smrg    ;;
8316910e25Smrg
8416910e25Smrg  -*)
8516910e25Smrg    echo 1>&2 "$0: Unknown \`$1' option"
8616910e25Smrg    echo 1>&2 "Try \`$0 --help' for more information"
8716910e25Smrg    exit 1
8816910e25Smrg    ;;
8916910e25Smrg
9016910e25Smrg  aclocal*)
9116910e25Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
9216910e25Smrg       # We have it, but it failed.
9316910e25Smrg       exit 1
9416910e25Smrg    fi
9516910e25Smrg
9616910e25Smrg    echo 1>&2 "\
9716910e25SmrgWARNING: \`$1' is missing on your system.  You should only need it if
9816910e25Smrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
9916910e25Smrg         to install the \`Automake' and \`Perl' packages.  Grab them from
10016910e25Smrg         any GNU archive site."
10116910e25Smrg    touch aclocal.m4
10216910e25Smrg    ;;
10316910e25Smrg
10416910e25Smrg  autoconf)
10516910e25Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
10616910e25Smrg       # We have it, but it failed.
10716910e25Smrg       exit 1
10816910e25Smrg    fi
10916910e25Smrg
11016910e25Smrg    echo 1>&2 "\
11116910e25SmrgWARNING: \`$1' is missing on your system.  You should only need it if
11216910e25Smrg         you modified \`${configure_ac}'.  You might want to install the
11316910e25Smrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
11416910e25Smrg         archive site."
11516910e25Smrg    touch configure
11616910e25Smrg    ;;
11716910e25Smrg
11816910e25Smrg  autoheader)
11916910e25Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
12016910e25Smrg       # We have it, but it failed.
12116910e25Smrg       exit 1
12216910e25Smrg    fi
12316910e25Smrg
12416910e25Smrg    echo 1>&2 "\
12516910e25SmrgWARNING: \`$1' is missing on your system.  You should only need it if
12616910e25Smrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
12716910e25Smrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
12816910e25Smrg         from any GNU archive site."
12916910e25Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
13016910e25Smrg    test -z "$files" && files="config.h"
13116910e25Smrg    touch_files=
13216910e25Smrg    for f in $files; do
13316910e25Smrg      case "$f" in
13416910e25Smrg      *:*) touch_files="$touch_files "`echo "$f" |
13516910e25Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
13616910e25Smrg      *) touch_files="$touch_files $f.in";;
13716910e25Smrg      esac
13816910e25Smrg    done
13916910e25Smrg    touch $touch_files
14016910e25Smrg    ;;
14116910e25Smrg
14216910e25Smrg  automake*)
14316910e25Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
14416910e25Smrg       # We have it, but it failed.
14516910e25Smrg       exit 1
14616910e25Smrg    fi
14716910e25Smrg
14816910e25Smrg    echo 1>&2 "\
14916910e25SmrgWARNING: \`$1' is missing on your system.  You should only need it if
15016910e25Smrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
15116910e25Smrg         You might want to install the \`Automake' and \`Perl' packages.
15216910e25Smrg         Grab them from any GNU archive site."
15316910e25Smrg    find . -type f -name Makefile.am -print |
15416910e25Smrg	   sed 's/\.am$/.in/' |
15516910e25Smrg	   while read f; do touch "$f"; done
15616910e25Smrg    ;;
15716910e25Smrg
15816910e25Smrg  autom4te)
15916910e25Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
16016910e25Smrg       # We have it, but it failed.
16116910e25Smrg       exit 1
16216910e25Smrg    fi
16316910e25Smrg
16416910e25Smrg    echo 1>&2 "\
16516910e25SmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
16616910e25Smrg         system.  You might have modified some files without having the
16716910e25Smrg         proper tools for further handling them.
16816910e25Smrg         You can get \`$1' as part of \`Autoconf' from any GNU
16916910e25Smrg         archive site."
17016910e25Smrg
17116910e25Smrg    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
17216910e25Smrg    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
17316910e25Smrg    if test -f "$file"; then
17416910e25Smrg	touch $file
17516910e25Smrg    else
17616910e25Smrg	test -z "$file" || exec >$file
17716910e25Smrg	echo "#! /bin/sh"
17816910e25Smrg	echo "# Created by GNU Automake missing as a replacement of"
17916910e25Smrg	echo "#  $ $@"
18016910e25Smrg	echo "exit 0"
18116910e25Smrg	chmod +x $file
18216910e25Smrg	exit 1
18316910e25Smrg    fi
18416910e25Smrg    ;;
18516910e25Smrg
18616910e25Smrg  bison|yacc)
18716910e25Smrg    echo 1>&2 "\
18816910e25SmrgWARNING: \`$1' is missing on your system.  You should only need it if
18916910e25Smrg         you modified a \`.y' file.  You may need the \`Bison' package
19016910e25Smrg         in order for those modifications to take effect.  You can get
19116910e25Smrg         \`Bison' from any GNU archive site."
19216910e25Smrg    rm -f y.tab.c y.tab.h
19316910e25Smrg    if [ $# -ne 1 ]; then
19416910e25Smrg        eval LASTARG="\${$#}"
19516910e25Smrg	case "$LASTARG" in
19616910e25Smrg	*.y)
19716910e25Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
19816910e25Smrg	    if [ -f "$SRCFILE" ]; then
19916910e25Smrg	         cp "$SRCFILE" y.tab.c
20016910e25Smrg	    fi
20116910e25Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
20216910e25Smrg	    if [ -f "$SRCFILE" ]; then
20316910e25Smrg	         cp "$SRCFILE" y.tab.h
20416910e25Smrg	    fi
20516910e25Smrg	  ;;
20616910e25Smrg	esac
20716910e25Smrg    fi
20816910e25Smrg    if [ ! -f y.tab.h ]; then
20916910e25Smrg	echo >y.tab.h
21016910e25Smrg    fi
21116910e25Smrg    if [ ! -f y.tab.c ]; then
21216910e25Smrg	echo 'main() { return 0; }' >y.tab.c
21316910e25Smrg    fi
21416910e25Smrg    ;;
21516910e25Smrg
21616910e25Smrg  lex|flex)
21716910e25Smrg    echo 1>&2 "\
21816910e25SmrgWARNING: \`$1' is missing on your system.  You should only need it if
21916910e25Smrg         you modified a \`.l' file.  You may need the \`Flex' package
22016910e25Smrg         in order for those modifications to take effect.  You can get
22116910e25Smrg         \`Flex' from any GNU archive site."
22216910e25Smrg    rm -f lex.yy.c
22316910e25Smrg    if [ $# -ne 1 ]; then
22416910e25Smrg        eval LASTARG="\${$#}"
22516910e25Smrg	case "$LASTARG" in
22616910e25Smrg	*.l)
22716910e25Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
22816910e25Smrg	    if [ -f "$SRCFILE" ]; then
22916910e25Smrg	         cp "$SRCFILE" lex.yy.c
23016910e25Smrg	    fi
23116910e25Smrg	  ;;
23216910e25Smrg	esac
23316910e25Smrg    fi
23416910e25Smrg    if [ ! -f lex.yy.c ]; then
23516910e25Smrg	echo 'main() { return 0; }' >lex.yy.c
23616910e25Smrg    fi
23716910e25Smrg    ;;
23816910e25Smrg
23916910e25Smrg  help2man)
24016910e25Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
24116910e25Smrg       # We have it, but it failed.
24216910e25Smrg       exit 1
24316910e25Smrg    fi
24416910e25Smrg
24516910e25Smrg    echo 1>&2 "\
24616910e25SmrgWARNING: \`$1' is missing on your system.  You should only need it if
24716910e25Smrg	 you modified a dependency of a manual page.  You may need the
24816910e25Smrg	 \`Help2man' package in order for those modifications to take
24916910e25Smrg	 effect.  You can get \`Help2man' from any GNU archive site."
25016910e25Smrg
25116910e25Smrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
25216910e25Smrg    if test -z "$file"; then
25316910e25Smrg	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
25416910e25Smrg    fi
25516910e25Smrg    if [ -f "$file" ]; then
25616910e25Smrg	touch $file
25716910e25Smrg    else
25816910e25Smrg	test -z "$file" || exec >$file
25916910e25Smrg	echo ".ab help2man is required to generate this page"
26016910e25Smrg	exit 1
26116910e25Smrg    fi
26216910e25Smrg    ;;
26316910e25Smrg
26416910e25Smrg  makeinfo)
26516910e25Smrg    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
26616910e25Smrg       # We have makeinfo, but it failed.
26716910e25Smrg       exit 1
26816910e25Smrg    fi
26916910e25Smrg
27016910e25Smrg    echo 1>&2 "\
27116910e25SmrgWARNING: \`$1' is missing on your system.  You should only need it if
27216910e25Smrg         you modified a \`.texi' or \`.texinfo' file, or any other file
27316910e25Smrg         indirectly affecting the aspect of the manual.  The spurious
27416910e25Smrg         call might also be the consequence of using a buggy \`make' (AIX,
27516910e25Smrg         DU, IRIX).  You might want to install the \`Texinfo' package or
27616910e25Smrg         the \`GNU make' package.  Grab either from any GNU archive site."
27716910e25Smrg    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
27816910e25Smrg    if test -z "$file"; then
27916910e25Smrg      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
28016910e25Smrg      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
28116910e25Smrg    fi
28216910e25Smrg    touch $file
28316910e25Smrg    ;;
28416910e25Smrg
28516910e25Smrg  tar)
28616910e25Smrg    shift
28716910e25Smrg    if test -n "$run"; then
28816910e25Smrg      echo 1>&2 "ERROR: \`tar' requires --run"
28916910e25Smrg      exit 1
29016910e25Smrg    fi
29116910e25Smrg
29216910e25Smrg    # We have already tried tar in the generic part.
29316910e25Smrg    # Look for gnutar/gtar before invocation to avoid ugly error
29416910e25Smrg    # messages.
29516910e25Smrg    if (gnutar --version > /dev/null 2>&1); then
29616910e25Smrg       gnutar "$@" && exit 0
29716910e25Smrg    fi
29816910e25Smrg    if (gtar --version > /dev/null 2>&1); then
29916910e25Smrg       gtar "$@" && exit 0
30016910e25Smrg    fi
30116910e25Smrg    firstarg="$1"
30216910e25Smrg    if shift; then
30316910e25Smrg	case "$firstarg" in
30416910e25Smrg	*o*)
30516910e25Smrg	    firstarg=`echo "$firstarg" | sed s/o//`
30616910e25Smrg	    tar "$firstarg" "$@" && exit 0
30716910e25Smrg	    ;;
30816910e25Smrg	esac
30916910e25Smrg	case "$firstarg" in
31016910e25Smrg	*h*)
31116910e25Smrg	    firstarg=`echo "$firstarg" | sed s/h//`
31216910e25Smrg	    tar "$firstarg" "$@" && exit 0
31316910e25Smrg	    ;;
31416910e25Smrg	esac
31516910e25Smrg    fi
31616910e25Smrg
31716910e25Smrg    echo 1>&2 "\
31816910e25SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments.
31916910e25Smrg         You may want to install GNU tar or Free paxutils, or check the
32016910e25Smrg         command line arguments."
32116910e25Smrg    exit 1
32216910e25Smrg    ;;
32316910e25Smrg
32416910e25Smrg  *)
32516910e25Smrg    echo 1>&2 "\
32616910e25SmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your
32716910e25Smrg         system.  You might have modified some files without having the
32816910e25Smrg         proper tools for further handling them.  Check the \`README' file,
32916910e25Smrg         it often tells you about the needed prerequisites for installing
33016910e25Smrg         this package.  You may also peek at any GNU archive site, in case
33116910e25Smrg         some other package would contain this missing \`$1' program."
33216910e25Smrg    exit 1
33316910e25Smrg    ;;
33416910e25Smrgesac
33516910e25Smrg
33616910e25Smrgexit 0
337