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