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