msousa@353: #! /bin/sh msousa@353: # Common stub for a few missing GNU programs while installing. msousa@353: msousa@353: scriptversion=2006-05-10.23 msousa@353: msousa@353: # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 msousa@353: # Free Software Foundation, Inc. msousa@353: # Originally by Fran,cois Pinard , 1996. msousa@353: msousa@353: # This program is free software; you can redistribute it and/or modify msousa@353: # it under the terms of the GNU General Public License as published by msousa@353: # the Free Software Foundation; either version 2, or (at your option) msousa@353: # any later version. msousa@353: msousa@353: # This program is distributed in the hope that it will be useful, msousa@353: # but WITHOUT ANY WARRANTY; without even the implied warranty of msousa@353: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the msousa@353: # GNU General Public License for more details. msousa@353: msousa@353: # You should have received a copy of the GNU General Public License msousa@353: # along with this program; if not, write to the Free Software msousa@353: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA msousa@353: # 02110-1301, USA. msousa@353: msousa@353: # As a special exception to the GNU General Public License, if you msousa@353: # distribute this file as part of a program that contains a msousa@353: # configuration script generated by Autoconf, you may include it under msousa@353: # the same distribution terms that you use for the rest of that program. msousa@353: msousa@353: if test $# -eq 0; then msousa@353: echo 1>&2 "Try \`$0 --help' for more information" msousa@353: exit 1 msousa@353: fi msousa@353: msousa@353: run=: msousa@353: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' msousa@353: sed_minuso='s/.* -o \([^ ]*\).*/\1/p' msousa@353: msousa@353: # In the cases where this matters, `missing' is being run in the msousa@353: # srcdir already. msousa@353: if test -f configure.ac; then msousa@353: configure_ac=configure.ac msousa@353: else msousa@353: configure_ac=configure.in msousa@353: fi msousa@353: msousa@353: msg="missing on your system" msousa@353: msousa@353: case $1 in msousa@353: --run) msousa@353: # Try to run requested program, and just exit if it succeeds. msousa@353: run= msousa@353: shift msousa@353: "$@" && exit 0 msousa@353: # Exit code 63 means version mismatch. This often happens msousa@353: # when the user try to use an ancient version of a tool on msousa@353: # a file that requires a minimum version. In this case we msousa@353: # we should proceed has if the program had been absent, or msousa@353: # if --run hadn't been passed. msousa@353: if test $? = 63; then msousa@353: run=: msousa@353: msg="probably too old" msousa@353: fi msousa@353: ;; msousa@353: msousa@353: -h|--h|--he|--hel|--help) msousa@353: echo "\ msousa@353: $0 [OPTION]... PROGRAM [ARGUMENT]... msousa@353: msousa@353: Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an msousa@353: error status if there is no known handling for PROGRAM. msousa@353: msousa@353: Options: msousa@353: -h, --help display this help and exit msousa@353: -v, --version output version information and exit msousa@353: --run try to run the given command, and emulate it if it fails msousa@353: msousa@353: Supported PROGRAM values: msousa@353: aclocal touch file \`aclocal.m4' msousa@353: autoconf touch file \`configure' msousa@353: autoheader touch file \`config.h.in' msousa@353: autom4te touch the output file, or create a stub one msousa@353: automake touch all \`Makefile.in' files msousa@353: bison create \`y.tab.[ch]', if possible, from existing .[ch] msousa@353: flex create \`lex.yy.c', if possible, from existing .c msousa@353: help2man touch the output file msousa@353: lex create \`lex.yy.c', if possible, from existing .c msousa@353: makeinfo touch the output file msousa@353: tar try tar, gnutar, gtar, then tar without non-portable flags msousa@353: yacc create \`y.tab.[ch]', if possible, from existing .[ch] msousa@353: msousa@353: Send bug reports to ." msousa@353: exit $? msousa@353: ;; msousa@353: msousa@353: -v|--v|--ve|--ver|--vers|--versi|--versio|--version) msousa@353: echo "missing $scriptversion (GNU Automake)" msousa@353: exit $? msousa@353: ;; msousa@353: msousa@353: -*) msousa@353: echo 1>&2 "$0: Unknown \`$1' option" msousa@353: echo 1>&2 "Try \`$0 --help' for more information" msousa@353: exit 1 msousa@353: ;; msousa@353: msousa@353: esac msousa@353: msousa@353: # Now exit if we have it, but it failed. Also exit now if we msousa@353: # don't have it and --version was passed (most likely to detect msousa@353: # the program). msousa@353: case $1 in msousa@353: lex|yacc) msousa@353: # Not GNU programs, they don't have --version. msousa@353: ;; msousa@353: msousa@353: tar) msousa@353: if test -n "$run"; then msousa@353: echo 1>&2 "ERROR: \`tar' requires --run" msousa@353: exit 1 msousa@353: elif test "x$2" = "x--version" || test "x$2" = "x--help"; then msousa@353: exit 1 msousa@353: fi msousa@353: ;; msousa@353: msousa@353: *) msousa@353: if test -z "$run" && ($1 --version) > /dev/null 2>&1; then msousa@353: # We have it, but it failed. msousa@353: exit 1 msousa@353: elif test "x$2" = "x--version" || test "x$2" = "x--help"; then msousa@353: # Could not run --version or --help. This is probably someone msousa@353: # running `$TOOL --version' or `$TOOL --help' to check whether msousa@353: # $TOOL exists and not knowing $TOOL uses missing. msousa@353: exit 1 msousa@353: fi msousa@353: ;; msousa@353: esac msousa@353: msousa@353: # If it does not exist, or fails to run (possibly an outdated version), msousa@353: # try to emulate it. msousa@353: case $1 in msousa@353: aclocal*) msousa@353: echo 1>&2 "\ msousa@353: WARNING: \`$1' is $msg. You should only need it if msousa@353: you modified \`acinclude.m4' or \`${configure_ac}'. You might want msousa@353: to install the \`Automake' and \`Perl' packages. Grab them from msousa@353: any GNU archive site." msousa@353: touch aclocal.m4 msousa@353: ;; msousa@353: msousa@353: autoconf) msousa@353: echo 1>&2 "\ msousa@353: WARNING: \`$1' is $msg. You should only need it if msousa@353: you modified \`${configure_ac}'. You might want to install the msousa@353: \`Autoconf' and \`GNU m4' packages. Grab them from any GNU msousa@353: archive site." msousa@353: touch configure msousa@353: ;; msousa@353: msousa@353: autoheader) msousa@353: echo 1>&2 "\ msousa@353: WARNING: \`$1' is $msg. You should only need it if msousa@353: you modified \`acconfig.h' or \`${configure_ac}'. You might want msousa@353: to install the \`Autoconf' and \`GNU m4' packages. Grab them msousa@353: from any GNU archive site." msousa@353: files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` msousa@353: test -z "$files" && files="config.h" msousa@353: touch_files= msousa@353: for f in $files; do msousa@353: case $f in msousa@353: *:*) touch_files="$touch_files "`echo "$f" | msousa@353: sed -e 's/^[^:]*://' -e 's/:.*//'`;; msousa@353: *) touch_files="$touch_files $f.in";; msousa@353: esac msousa@353: done msousa@353: touch $touch_files msousa@353: ;; msousa@353: msousa@353: automake*) msousa@353: echo 1>&2 "\ msousa@353: WARNING: \`$1' is $msg. You should only need it if msousa@353: you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. msousa@353: You might want to install the \`Automake' and \`Perl' packages. msousa@353: Grab them from any GNU archive site." msousa@353: find . -type f -name Makefile.am -print | msousa@353: sed 's/\.am$/.in/' | msousa@353: while read f; do touch "$f"; done msousa@353: ;; msousa@353: msousa@353: autom4te) msousa@353: echo 1>&2 "\ msousa@353: WARNING: \`$1' is needed, but is $msg. msousa@353: You might have modified some files without having the msousa@353: proper tools for further handling them. msousa@353: You can get \`$1' as part of \`Autoconf' from any GNU msousa@353: archive site." msousa@353: msousa@353: file=`echo "$*" | sed -n "$sed_output"` msousa@353: test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` msousa@353: if test -f "$file"; then msousa@353: touch $file msousa@353: else msousa@353: test -z "$file" || exec >$file msousa@353: echo "#! /bin/sh" msousa@353: echo "# Created by GNU Automake missing as a replacement of" msousa@353: echo "# $ $@" msousa@353: echo "exit 0" msousa@353: chmod +x $file msousa@353: exit 1 msousa@353: fi msousa@353: ;; msousa@353: msousa@353: bison|yacc) msousa@353: echo 1>&2 "\ msousa@353: WARNING: \`$1' $msg. You should only need it if msousa@353: you modified a \`.y' file. You may need the \`Bison' package msousa@353: in order for those modifications to take effect. You can get msousa@353: \`Bison' from any GNU archive site." msousa@353: rm -f y.tab.c y.tab.h msousa@353: if test $# -ne 1; then msousa@353: eval LASTARG="\${$#}" msousa@353: case $LASTARG in msousa@353: *.y) msousa@353: SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` msousa@353: if test -f "$SRCFILE"; then msousa@353: cp "$SRCFILE" y.tab.c msousa@353: fi msousa@353: SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` msousa@353: if test -f "$SRCFILE"; then msousa@353: cp "$SRCFILE" y.tab.h msousa@353: fi msousa@353: ;; msousa@353: esac msousa@353: fi msousa@353: if test ! -f y.tab.h; then msousa@353: echo >y.tab.h msousa@353: fi msousa@353: if test ! -f y.tab.c; then msousa@353: echo 'main() { return 0; }' >y.tab.c msousa@353: fi msousa@353: ;; msousa@353: msousa@353: lex|flex) msousa@353: echo 1>&2 "\ msousa@353: WARNING: \`$1' is $msg. You should only need it if msousa@353: you modified a \`.l' file. You may need the \`Flex' package msousa@353: in order for those modifications to take effect. You can get msousa@353: \`Flex' from any GNU archive site." msousa@353: rm -f lex.yy.c msousa@353: if test $# -ne 1; then msousa@353: eval LASTARG="\${$#}" msousa@353: case $LASTARG in msousa@353: *.l) msousa@353: SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` msousa@353: if test -f "$SRCFILE"; then msousa@353: cp "$SRCFILE" lex.yy.c msousa@353: fi msousa@353: ;; msousa@353: esac msousa@353: fi msousa@353: if test ! -f lex.yy.c; then msousa@353: echo 'main() { return 0; }' >lex.yy.c msousa@353: fi msousa@353: ;; msousa@353: msousa@353: help2man) msousa@353: echo 1>&2 "\ msousa@353: WARNING: \`$1' is $msg. You should only need it if msousa@353: you modified a dependency of a manual page. You may need the msousa@353: \`Help2man' package in order for those modifications to take msousa@353: effect. You can get \`Help2man' from any GNU archive site." msousa@353: msousa@353: file=`echo "$*" | sed -n "$sed_output"` msousa@353: test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` msousa@353: if test -f "$file"; then msousa@353: touch $file msousa@353: else msousa@353: test -z "$file" || exec >$file msousa@353: echo ".ab help2man is required to generate this page" msousa@353: exit 1 msousa@353: fi msousa@353: ;; msousa@353: msousa@353: makeinfo) msousa@353: echo 1>&2 "\ msousa@353: WARNING: \`$1' is $msg. You should only need it if msousa@353: you modified a \`.texi' or \`.texinfo' file, or any other file msousa@353: indirectly affecting the aspect of the manual. The spurious msousa@353: call might also be the consequence of using a buggy \`make' (AIX, msousa@353: DU, IRIX). You might want to install the \`Texinfo' package or msousa@353: the \`GNU make' package. Grab either from any GNU archive site." msousa@353: # The file to touch is that specified with -o ... msousa@353: file=`echo "$*" | sed -n "$sed_output"` msousa@353: test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` msousa@353: if test -z "$file"; then msousa@353: # ... or it is the one specified with @setfilename ... msousa@353: infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` msousa@353: file=`sed -n ' msousa@353: /^@setfilename/{ msousa@353: s/.* \([^ ]*\) *$/\1/ msousa@353: p msousa@353: q msousa@353: }' $infile` msousa@353: # ... or it is derived from the source name (dir/f.texi becomes f.info) msousa@353: test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info msousa@353: fi msousa@353: # If the file does not exist, the user really needs makeinfo; msousa@353: # let's fail without touching anything. msousa@353: test -f $file || exit 1 msousa@353: touch $file msousa@353: ;; msousa@353: msousa@353: tar) msousa@353: shift msousa@353: msousa@353: # We have already tried tar in the generic part. msousa@353: # Look for gnutar/gtar before invocation to avoid ugly error msousa@353: # messages. msousa@353: if (gnutar --version > /dev/null 2>&1); then msousa@353: gnutar "$@" && exit 0 msousa@353: fi msousa@353: if (gtar --version > /dev/null 2>&1); then msousa@353: gtar "$@" && exit 0 msousa@353: fi msousa@353: firstarg="$1" msousa@353: if shift; then msousa@353: case $firstarg in msousa@353: *o*) msousa@353: firstarg=`echo "$firstarg" | sed s/o//` msousa@353: tar "$firstarg" "$@" && exit 0 msousa@353: ;; msousa@353: esac msousa@353: case $firstarg in msousa@353: *h*) msousa@353: firstarg=`echo "$firstarg" | sed s/h//` msousa@353: tar "$firstarg" "$@" && exit 0 msousa@353: ;; msousa@353: esac msousa@353: fi msousa@353: msousa@353: echo 1>&2 "\ msousa@353: WARNING: I can't seem to be able to run \`tar' with the given arguments. msousa@353: You may want to install GNU tar or Free paxutils, or check the msousa@353: command line arguments." msousa@353: exit 1 msousa@353: ;; msousa@353: msousa@353: *) msousa@353: echo 1>&2 "\ msousa@353: WARNING: \`$1' is needed, and is $msg. msousa@353: You might have modified some files without having the msousa@353: proper tools for further handling them. Check the \`README' file, msousa@353: it often tells you about the needed prerequisites for installing msousa@353: this package. You may also peek at any GNU archive site, in case msousa@353: some other package would contain this missing \`$1' program." msousa@353: exit 1 msousa@353: ;; msousa@353: esac msousa@353: msousa@353: exit 0 msousa@353: msousa@353: # Local variables: msousa@353: # eval: (add-hook 'write-file-hooks 'time-stamp) msousa@353: # time-stamp-start: "scriptversion=" msousa@353: # time-stamp-format: "%:y-%02m-%02d.%02H" msousa@353: # time-stamp-end: "$" msousa@353: # End: