paulo@0: #! /bin/sh paulo@0: # Common stub for a few missing GNU programs while installing. paulo@0: # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. paulo@0: # Originally by Fran,cois Pinard , 1996. paulo@0: paulo@0: # This program is free software; you can redistribute it and/or modify paulo@0: # it under the terms of the GNU General Public License as published by paulo@0: # the Free Software Foundation; either version 2, or (at your option) paulo@0: # any later version. paulo@0: paulo@0: # This program is distributed in the hope that it will be useful, paulo@0: # but WITHOUT ANY WARRANTY; without even the implied warranty of paulo@0: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the paulo@0: # GNU General Public License for more details. paulo@0: paulo@0: # You should have received a copy of the GNU General Public License paulo@0: # along with this program; if not, write to the Free Software paulo@0: # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA paulo@0: # 02111-1307, USA. paulo@0: paulo@0: # As a special exception to the GNU General Public License, if you paulo@0: # distribute this file as part of a program that contains a paulo@0: # configuration script generated by Autoconf, you may include it under paulo@0: # the same distribution terms that you use for the rest of that program. paulo@0: paulo@0: if test $# -eq 0; then paulo@0: echo 1>&2 "Try \`$0 --help' for more information" paulo@0: exit 1 paulo@0: fi paulo@0: paulo@0: run=: paulo@0: paulo@0: # In the cases where this matters, `missing' is being run in the paulo@0: # srcdir already. paulo@0: if test -f configure.ac; then paulo@0: configure_ac=configure.ac paulo@0: else paulo@0: configure_ac=configure.in paulo@0: fi paulo@0: paulo@0: case "$1" in paulo@0: --run) paulo@0: # Try to run requested program, and just exit if it succeeds. paulo@0: run= paulo@0: shift paulo@0: "$@" && exit 0 paulo@0: ;; paulo@0: esac paulo@0: paulo@0: # If it does not exist, or fails to run (possibly an outdated version), paulo@0: # try to emulate it. paulo@0: case "$1" in paulo@0: paulo@0: -h|--h|--he|--hel|--help) paulo@0: echo "\ paulo@0: $0 [OPTION]... PROGRAM [ARGUMENT]... paulo@0: paulo@0: Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an paulo@0: error status if there is no known handling for PROGRAM. paulo@0: paulo@0: Options: paulo@0: -h, --help display this help and exit paulo@0: -v, --version output version information and exit paulo@0: --run try to run the given command, and emulate it if it fails paulo@0: paulo@0: Supported PROGRAM values: paulo@0: aclocal touch file \`aclocal.m4' paulo@0: autoconf touch file \`configure' paulo@0: autoheader touch file \`config.h.in' paulo@0: automake touch all \`Makefile.in' files paulo@0: bison create \`y.tab.[ch]', if possible, from existing .[ch] paulo@0: flex create \`lex.yy.c', if possible, from existing .c paulo@0: help2man touch the output file paulo@0: lex create \`lex.yy.c', if possible, from existing .c paulo@0: makeinfo touch the output file paulo@0: tar try tar, gnutar, gtar, then tar without non-portable flags paulo@0: yacc create \`y.tab.[ch]', if possible, from existing .[ch]" paulo@0: ;; paulo@0: paulo@0: -v|--v|--ve|--ver|--vers|--versi|--versio|--version) paulo@0: echo "missing 0.4 - GNU automake" paulo@0: ;; paulo@0: paulo@0: -*) paulo@0: echo 1>&2 "$0: Unknown \`$1' option" paulo@0: echo 1>&2 "Try \`$0 --help' for more information" paulo@0: exit 1 paulo@0: ;; paulo@0: paulo@0: aclocal*) paulo@0: if test -z "$run" && ($1 --version) > /dev/null 2>&1; then paulo@0: # We have it, but it failed. paulo@0: exit 1 paulo@0: fi paulo@0: paulo@0: echo 1>&2 "\ paulo@0: WARNING: \`$1' is missing on your system. You should only need it if paulo@0: you modified \`acinclude.m4' or \`${configure_ac}'. You might want paulo@0: to install the \`Automake' and \`Perl' packages. Grab them from paulo@0: any GNU archive site." paulo@0: touch aclocal.m4 paulo@0: ;; paulo@0: paulo@0: autoconf) paulo@0: if test -z "$run" && ($1 --version) > /dev/null 2>&1; then paulo@0: # We have it, but it failed. paulo@0: exit 1 paulo@0: fi paulo@0: paulo@0: echo 1>&2 "\ paulo@0: WARNING: \`$1' is missing on your system. You should only need it if paulo@0: you modified \`${configure_ac}'. You might want to install the paulo@0: \`Autoconf' and \`GNU m4' packages. Grab them from any GNU paulo@0: archive site." paulo@0: touch configure paulo@0: ;; paulo@0: paulo@0: autoheader) paulo@0: if test -z "$run" && ($1 --version) > /dev/null 2>&1; then paulo@0: # We have it, but it failed. paulo@0: exit 1 paulo@0: fi paulo@0: paulo@0: echo 1>&2 "\ paulo@0: WARNING: \`$1' is missing on your system. You should only need it if paulo@0: you modified \`acconfig.h' or \`${configure_ac}'. You might want paulo@0: to install the \`Autoconf' and \`GNU m4' packages. Grab them paulo@0: from any GNU archive site." paulo@0: files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` paulo@0: test -z "$files" && files="config.h" paulo@0: touch_files= paulo@0: for f in $files; do paulo@0: case "$f" in paulo@0: *:*) touch_files="$touch_files "`echo "$f" | paulo@0: sed -e 's/^[^:]*://' -e 's/:.*//'`;; paulo@0: *) touch_files="$touch_files $f.in";; paulo@0: esac paulo@0: done paulo@0: touch $touch_files paulo@0: ;; paulo@0: paulo@0: automake*) paulo@0: if test -z "$run" && ($1 --version) > /dev/null 2>&1; then paulo@0: # We have it, but it failed. paulo@0: exit 1 paulo@0: fi paulo@0: paulo@0: echo 1>&2 "\ paulo@0: WARNING: \`$1' is missing on your system. You should only need it if paulo@0: you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. paulo@0: You might want to install the \`Automake' and \`Perl' packages. paulo@0: Grab them from any GNU archive site." paulo@0: find . -type f -name Makefile.am -print | paulo@0: sed 's/\.am$/.in/' | paulo@0: while read f; do touch "$f"; done paulo@0: ;; paulo@0: paulo@0: autom4te) paulo@0: if test -z "$run" && ($1 --version) > /dev/null 2>&1; then paulo@0: # We have it, but it failed. paulo@0: exit 1 paulo@0: fi paulo@0: paulo@0: echo 1>&2 "\ paulo@0: WARNING: \`$1' is needed, and you do not seem to have it handy on your paulo@0: system. You might have modified some files without having the paulo@0: proper tools for further handling them. paulo@0: You can get \`$1' as part of \`Autoconf' from any GNU paulo@0: archive site." paulo@0: paulo@0: file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` paulo@0: test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` paulo@0: if test -f "$file"; then paulo@0: touch $file paulo@0: else paulo@0: test -z "$file" || exec >$file paulo@0: echo "#! /bin/sh" paulo@0: echo "# Created by GNU Automake missing as a replacement of" paulo@0: echo "# $ $@" paulo@0: echo "exit 0" paulo@0: chmod +x $file paulo@0: exit 1 paulo@0: fi paulo@0: ;; paulo@0: paulo@0: bison|yacc) paulo@0: echo 1>&2 "\ paulo@0: WARNING: \`$1' is missing on your system. You should only need it if paulo@0: you modified a \`.y' file. You may need the \`Bison' package paulo@0: in order for those modifications to take effect. You can get paulo@0: \`Bison' from any GNU archive site." paulo@0: rm -f y.tab.c y.tab.h paulo@0: if [ $# -ne 1 ]; then paulo@0: eval LASTARG="\${$#}" paulo@0: case "$LASTARG" in paulo@0: *.y) paulo@0: SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` paulo@0: if [ -f "$SRCFILE" ]; then paulo@0: cp "$SRCFILE" y.tab.c paulo@0: fi paulo@0: SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` paulo@0: if [ -f "$SRCFILE" ]; then paulo@0: cp "$SRCFILE" y.tab.h paulo@0: fi paulo@0: ;; paulo@0: esac paulo@0: fi paulo@0: if [ ! -f y.tab.h ]; then paulo@0: echo >y.tab.h paulo@0: fi paulo@0: if [ ! -f y.tab.c ]; then paulo@0: echo 'main() { return 0; }' >y.tab.c paulo@0: fi paulo@0: ;; paulo@0: paulo@0: lex|flex) paulo@0: echo 1>&2 "\ paulo@0: WARNING: \`$1' is missing on your system. You should only need it if paulo@0: you modified a \`.l' file. You may need the \`Flex' package paulo@0: in order for those modifications to take effect. You can get paulo@0: \`Flex' from any GNU archive site." paulo@0: rm -f lex.yy.c paulo@0: if [ $# -ne 1 ]; then paulo@0: eval LASTARG="\${$#}" paulo@0: case "$LASTARG" in paulo@0: *.l) paulo@0: SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` paulo@0: if [ -f "$SRCFILE" ]; then paulo@0: cp "$SRCFILE" lex.yy.c paulo@0: fi paulo@0: ;; paulo@0: esac paulo@0: fi paulo@0: if [ ! -f lex.yy.c ]; then paulo@0: echo 'main() { return 0; }' >lex.yy.c paulo@0: fi paulo@0: ;; paulo@0: paulo@0: help2man) paulo@0: if test -z "$run" && ($1 --version) > /dev/null 2>&1; then paulo@0: # We have it, but it failed. paulo@0: exit 1 paulo@0: fi paulo@0: paulo@0: echo 1>&2 "\ paulo@0: WARNING: \`$1' is missing on your system. You should only need it if paulo@0: you modified a dependency of a manual page. You may need the paulo@0: \`Help2man' package in order for those modifications to take paulo@0: effect. You can get \`Help2man' from any GNU archive site." paulo@0: paulo@0: file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` paulo@0: if test -z "$file"; then paulo@0: file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` paulo@0: fi paulo@0: if [ -f "$file" ]; then paulo@0: touch $file paulo@0: else paulo@0: test -z "$file" || exec >$file paulo@0: echo ".ab help2man is required to generate this page" paulo@0: exit 1 paulo@0: fi paulo@0: ;; paulo@0: paulo@0: makeinfo) paulo@0: if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then paulo@0: # We have makeinfo, but it failed. paulo@0: exit 1 paulo@0: fi paulo@0: paulo@0: echo 1>&2 "\ paulo@0: WARNING: \`$1' is missing on your system. You should only need it if paulo@0: you modified a \`.texi' or \`.texinfo' file, or any other file paulo@0: indirectly affecting the aspect of the manual. The spurious paulo@0: call might also be the consequence of using a buggy \`make' (AIX, paulo@0: DU, IRIX). You might want to install the \`Texinfo' package or paulo@0: the \`GNU make' package. Grab either from any GNU archive site." paulo@0: file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` paulo@0: if test -z "$file"; then paulo@0: file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` paulo@0: file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` paulo@0: fi paulo@0: touch $file paulo@0: ;; paulo@0: paulo@0: tar) paulo@0: shift paulo@0: if test -n "$run"; then paulo@0: echo 1>&2 "ERROR: \`tar' requires --run" paulo@0: exit 1 paulo@0: fi paulo@0: paulo@0: # We have already tried tar in the generic part. paulo@0: # Look for gnutar/gtar before invocation to avoid ugly error paulo@0: # messages. paulo@0: if (gnutar --version > /dev/null 2>&1); then paulo@0: gnutar "$@" && exit 0 paulo@0: fi paulo@0: if (gtar --version > /dev/null 2>&1); then paulo@0: gtar "$@" && exit 0 paulo@0: fi paulo@0: firstarg="$1" paulo@0: if shift; then paulo@0: case "$firstarg" in paulo@0: *o*) paulo@0: firstarg=`echo "$firstarg" | sed s/o//` paulo@0: tar "$firstarg" "$@" && exit 0 paulo@0: ;; paulo@0: esac paulo@0: case "$firstarg" in paulo@0: *h*) paulo@0: firstarg=`echo "$firstarg" | sed s/h//` paulo@0: tar "$firstarg" "$@" && exit 0 paulo@0: ;; paulo@0: esac paulo@0: fi paulo@0: paulo@0: echo 1>&2 "\ paulo@0: WARNING: I can't seem to be able to run \`tar' with the given arguments. paulo@0: You may want to install GNU tar or Free paxutils, or check the paulo@0: command line arguments." paulo@0: exit 1 paulo@0: ;; paulo@0: paulo@0: *) paulo@0: echo 1>&2 "\ paulo@0: WARNING: \`$1' is needed, and you do not seem to have it handy on your paulo@0: system. You might have modified some files without having the paulo@0: proper tools for further handling them. Check the \`README' file, paulo@0: it often tells you about the needed prerequisites for installing paulo@0: this package. You may also peek at any GNU archive site, in case paulo@0: some other package would contain this missing \`$1' program." paulo@0: exit 1 paulo@0: ;; paulo@0: esac paulo@0: paulo@0: exit 0