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