missing revision 45bc899b
145bc899bSmrg#! /bin/sh 245bc899bSmrg# Common stub for a few missing GNU programs while installing. 345bc899bSmrg 445bc899bSmrgscriptversion=2005-06-08.21 545bc899bSmrg 645bc899bSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 745bc899bSmrg# Free Software Foundation, Inc. 845bc899bSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 945bc899bSmrg 1045bc899bSmrg# This program is free software; you can redistribute it and/or modify 1145bc899bSmrg# it under the terms of the GNU General Public License as published by 1245bc899bSmrg# the Free Software Foundation; either version 2, or (at your option) 1345bc899bSmrg# any later version. 1445bc899bSmrg 1545bc899bSmrg# This program is distributed in the hope that it will be useful, 1645bc899bSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1745bc899bSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1845bc899bSmrg# GNU General Public License for more details. 1945bc899bSmrg 2045bc899bSmrg# You should have received a copy of the GNU General Public License 2145bc899bSmrg# along with this program; if not, write to the Free Software 2245bc899bSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2345bc899bSmrg# 02110-1301, USA. 2445bc899bSmrg 2545bc899bSmrg# As a special exception to the GNU General Public License, if you 2645bc899bSmrg# distribute this file as part of a program that contains a 2745bc899bSmrg# configuration script generated by Autoconf, you may include it under 2845bc899bSmrg# the same distribution terms that you use for the rest of that program. 2945bc899bSmrg 3045bc899bSmrgif test $# -eq 0; then 3145bc899bSmrg echo 1>&2 "Try \`$0 --help' for more information" 3245bc899bSmrg exit 1 3345bc899bSmrgfi 3445bc899bSmrg 3545bc899bSmrgrun=: 3645bc899bSmrg 3745bc899bSmrg# In the cases where this matters, `missing' is being run in the 3845bc899bSmrg# srcdir already. 3945bc899bSmrgif test -f configure.ac; then 4045bc899bSmrg configure_ac=configure.ac 4145bc899bSmrgelse 4245bc899bSmrg configure_ac=configure.in 4345bc899bSmrgfi 4445bc899bSmrg 4545bc899bSmrgmsg="missing on your system" 4645bc899bSmrg 4745bc899bSmrgcase "$1" in 4845bc899bSmrg--run) 4945bc899bSmrg # Try to run requested program, and just exit if it succeeds. 5045bc899bSmrg run= 5145bc899bSmrg shift 5245bc899bSmrg "$@" && exit 0 5345bc899bSmrg # Exit code 63 means version mismatch. This often happens 5445bc899bSmrg # when the user try to use an ancient version of a tool on 5545bc899bSmrg # a file that requires a minimum version. In this case we 5645bc899bSmrg # we should proceed has if the program had been absent, or 5745bc899bSmrg # if --run hadn't been passed. 5845bc899bSmrg if test $? = 63; then 5945bc899bSmrg run=: 6045bc899bSmrg msg="probably too old" 6145bc899bSmrg fi 6245bc899bSmrg ;; 6345bc899bSmrg 6445bc899bSmrg -h|--h|--he|--hel|--help) 6545bc899bSmrg echo "\ 6645bc899bSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6745bc899bSmrg 6845bc899bSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6945bc899bSmrgerror status if there is no known handling for PROGRAM. 7045bc899bSmrg 7145bc899bSmrgOptions: 7245bc899bSmrg -h, --help display this help and exit 7345bc899bSmrg -v, --version output version information and exit 7445bc899bSmrg --run try to run the given command, and emulate it if it fails 7545bc899bSmrg 7645bc899bSmrgSupported PROGRAM values: 7745bc899bSmrg aclocal touch file \`aclocal.m4' 7845bc899bSmrg autoconf touch file \`configure' 7945bc899bSmrg autoheader touch file \`config.h.in' 8045bc899bSmrg automake touch all \`Makefile.in' files 8145bc899bSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8245bc899bSmrg flex create \`lex.yy.c', if possible, from existing .c 8345bc899bSmrg help2man touch the output file 8445bc899bSmrg lex create \`lex.yy.c', if possible, from existing .c 8545bc899bSmrg makeinfo touch the output file 8645bc899bSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 8745bc899bSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8845bc899bSmrg 8945bc899bSmrgSend bug reports to <bug-automake@gnu.org>." 9045bc899bSmrg exit $? 9145bc899bSmrg ;; 9245bc899bSmrg 9345bc899bSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9445bc899bSmrg echo "missing $scriptversion (GNU Automake)" 9545bc899bSmrg exit $? 9645bc899bSmrg ;; 9745bc899bSmrg 9845bc899bSmrg -*) 9945bc899bSmrg echo 1>&2 "$0: Unknown \`$1' option" 10045bc899bSmrg echo 1>&2 "Try \`$0 --help' for more information" 10145bc899bSmrg exit 1 10245bc899bSmrg ;; 10345bc899bSmrg 10445bc899bSmrgesac 10545bc899bSmrg 10645bc899bSmrg# Now exit if we have it, but it failed. Also exit now if we 10745bc899bSmrg# don't have it and --version was passed (most likely to detect 10845bc899bSmrg# the program). 10945bc899bSmrgcase "$1" in 11045bc899bSmrg lex|yacc) 11145bc899bSmrg # Not GNU programs, they don't have --version. 11245bc899bSmrg ;; 11345bc899bSmrg 11445bc899bSmrg tar) 11545bc899bSmrg if test -n "$run"; then 11645bc899bSmrg echo 1>&2 "ERROR: \`tar' requires --run" 11745bc899bSmrg exit 1 11845bc899bSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 11945bc899bSmrg exit 1 12045bc899bSmrg fi 12145bc899bSmrg ;; 12245bc899bSmrg 12345bc899bSmrg *) 12445bc899bSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 12545bc899bSmrg # We have it, but it failed. 12645bc899bSmrg exit 1 12745bc899bSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 12845bc899bSmrg # Could not run --version or --help. This is probably someone 12945bc899bSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 13045bc899bSmrg # $TOOL exists and not knowing $TOOL uses missing. 13145bc899bSmrg exit 1 13245bc899bSmrg fi 13345bc899bSmrg ;; 13445bc899bSmrgesac 13545bc899bSmrg 13645bc899bSmrg# If it does not exist, or fails to run (possibly an outdated version), 13745bc899bSmrg# try to emulate it. 13845bc899bSmrgcase "$1" in 13945bc899bSmrg aclocal*) 14045bc899bSmrg echo 1>&2 "\ 14145bc899bSmrgWARNING: \`$1' is $msg. You should only need it if 14245bc899bSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 14345bc899bSmrg to install the \`Automake' and \`Perl' packages. Grab them from 14445bc899bSmrg any GNU archive site." 14545bc899bSmrg touch aclocal.m4 14645bc899bSmrg ;; 14745bc899bSmrg 14845bc899bSmrg autoconf) 14945bc899bSmrg echo 1>&2 "\ 15045bc899bSmrgWARNING: \`$1' is $msg. You should only need it if 15145bc899bSmrg you modified \`${configure_ac}'. You might want to install the 15245bc899bSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 15345bc899bSmrg archive site." 15445bc899bSmrg touch configure 15545bc899bSmrg ;; 15645bc899bSmrg 15745bc899bSmrg autoheader) 15845bc899bSmrg echo 1>&2 "\ 15945bc899bSmrgWARNING: \`$1' is $msg. You should only need it if 16045bc899bSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 16145bc899bSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 16245bc899bSmrg from any GNU archive site." 16345bc899bSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 16445bc899bSmrg test -z "$files" && files="config.h" 16545bc899bSmrg touch_files= 16645bc899bSmrg for f in $files; do 16745bc899bSmrg case "$f" in 16845bc899bSmrg *:*) touch_files="$touch_files "`echo "$f" | 16945bc899bSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 17045bc899bSmrg *) touch_files="$touch_files $f.in";; 17145bc899bSmrg esac 17245bc899bSmrg done 17345bc899bSmrg touch $touch_files 17445bc899bSmrg ;; 17545bc899bSmrg 17645bc899bSmrg automake*) 17745bc899bSmrg echo 1>&2 "\ 17845bc899bSmrgWARNING: \`$1' is $msg. You should only need it if 17945bc899bSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 18045bc899bSmrg You might want to install the \`Automake' and \`Perl' packages. 18145bc899bSmrg Grab them from any GNU archive site." 18245bc899bSmrg find . -type f -name Makefile.am -print | 18345bc899bSmrg sed 's/\.am$/.in/' | 18445bc899bSmrg while read f; do touch "$f"; done 18545bc899bSmrg ;; 18645bc899bSmrg 18745bc899bSmrg autom4te) 18845bc899bSmrg echo 1>&2 "\ 18945bc899bSmrgWARNING: \`$1' is needed, but is $msg. 19045bc899bSmrg You might have modified some files without having the 19145bc899bSmrg proper tools for further handling them. 19245bc899bSmrg You can get \`$1' as part of \`Autoconf' from any GNU 19345bc899bSmrg archive site." 19445bc899bSmrg 19545bc899bSmrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 19645bc899bSmrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 19745bc899bSmrg if test -f "$file"; then 19845bc899bSmrg touch $file 19945bc899bSmrg else 20045bc899bSmrg test -z "$file" || exec >$file 20145bc899bSmrg echo "#! /bin/sh" 20245bc899bSmrg echo "# Created by GNU Automake missing as a replacement of" 20345bc899bSmrg echo "# $ $@" 20445bc899bSmrg echo "exit 0" 20545bc899bSmrg chmod +x $file 20645bc899bSmrg exit 1 20745bc899bSmrg fi 20845bc899bSmrg ;; 20945bc899bSmrg 21045bc899bSmrg bison|yacc) 21145bc899bSmrg echo 1>&2 "\ 21245bc899bSmrgWARNING: \`$1' $msg. You should only need it if 21345bc899bSmrg you modified a \`.y' file. You may need the \`Bison' package 21445bc899bSmrg in order for those modifications to take effect. You can get 21545bc899bSmrg \`Bison' from any GNU archive site." 21645bc899bSmrg rm -f y.tab.c y.tab.h 21745bc899bSmrg if [ $# -ne 1 ]; then 21845bc899bSmrg eval LASTARG="\${$#}" 21945bc899bSmrg case "$LASTARG" in 22045bc899bSmrg *.y) 22145bc899bSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 22245bc899bSmrg if [ -f "$SRCFILE" ]; then 22345bc899bSmrg cp "$SRCFILE" y.tab.c 22445bc899bSmrg fi 22545bc899bSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 22645bc899bSmrg if [ -f "$SRCFILE" ]; then 22745bc899bSmrg cp "$SRCFILE" y.tab.h 22845bc899bSmrg fi 22945bc899bSmrg ;; 23045bc899bSmrg esac 23145bc899bSmrg fi 23245bc899bSmrg if [ ! -f y.tab.h ]; then 23345bc899bSmrg echo >y.tab.h 23445bc899bSmrg fi 23545bc899bSmrg if [ ! -f y.tab.c ]; then 23645bc899bSmrg echo 'main() { return 0; }' >y.tab.c 23745bc899bSmrg fi 23845bc899bSmrg ;; 23945bc899bSmrg 24045bc899bSmrg lex|flex) 24145bc899bSmrg echo 1>&2 "\ 24245bc899bSmrgWARNING: \`$1' is $msg. You should only need it if 24345bc899bSmrg you modified a \`.l' file. You may need the \`Flex' package 24445bc899bSmrg in order for those modifications to take effect. You can get 24545bc899bSmrg \`Flex' from any GNU archive site." 24645bc899bSmrg rm -f lex.yy.c 24745bc899bSmrg if [ $# -ne 1 ]; then 24845bc899bSmrg eval LASTARG="\${$#}" 24945bc899bSmrg case "$LASTARG" in 25045bc899bSmrg *.l) 25145bc899bSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 25245bc899bSmrg if [ -f "$SRCFILE" ]; then 25345bc899bSmrg cp "$SRCFILE" lex.yy.c 25445bc899bSmrg fi 25545bc899bSmrg ;; 25645bc899bSmrg esac 25745bc899bSmrg fi 25845bc899bSmrg if [ ! -f lex.yy.c ]; then 25945bc899bSmrg echo 'main() { return 0; }' >lex.yy.c 26045bc899bSmrg fi 26145bc899bSmrg ;; 26245bc899bSmrg 26345bc899bSmrg help2man) 26445bc899bSmrg echo 1>&2 "\ 26545bc899bSmrgWARNING: \`$1' is $msg. You should only need it if 26645bc899bSmrg you modified a dependency of a manual page. You may need the 26745bc899bSmrg \`Help2man' package in order for those modifications to take 26845bc899bSmrg effect. You can get \`Help2man' from any GNU archive site." 26945bc899bSmrg 27045bc899bSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 27145bc899bSmrg if test -z "$file"; then 27245bc899bSmrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 27345bc899bSmrg fi 27445bc899bSmrg if [ -f "$file" ]; then 27545bc899bSmrg touch $file 27645bc899bSmrg else 27745bc899bSmrg test -z "$file" || exec >$file 27845bc899bSmrg echo ".ab help2man is required to generate this page" 27945bc899bSmrg exit 1 28045bc899bSmrg fi 28145bc899bSmrg ;; 28245bc899bSmrg 28345bc899bSmrg makeinfo) 28445bc899bSmrg echo 1>&2 "\ 28545bc899bSmrgWARNING: \`$1' is $msg. You should only need it if 28645bc899bSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 28745bc899bSmrg indirectly affecting the aspect of the manual. The spurious 28845bc899bSmrg call might also be the consequence of using a buggy \`make' (AIX, 28945bc899bSmrg DU, IRIX). You might want to install the \`Texinfo' package or 29045bc899bSmrg the \`GNU make' package. Grab either from any GNU archive site." 29145bc899bSmrg # The file to touch is that specified with -o ... 29245bc899bSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 29345bc899bSmrg if test -z "$file"; then 29445bc899bSmrg # ... or it is the one specified with @setfilename ... 29545bc899bSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 29645bc899bSmrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 29745bc899bSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 29845bc899bSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 29945bc899bSmrg fi 30045bc899bSmrg # If the file does not exist, the user really needs makeinfo; 30145bc899bSmrg # let's fail without touching anything. 30245bc899bSmrg test -f $file || exit 1 30345bc899bSmrg touch $file 30445bc899bSmrg ;; 30545bc899bSmrg 30645bc899bSmrg tar) 30745bc899bSmrg shift 30845bc899bSmrg 30945bc899bSmrg # We have already tried tar in the generic part. 31045bc899bSmrg # Look for gnutar/gtar before invocation to avoid ugly error 31145bc899bSmrg # messages. 31245bc899bSmrg if (gnutar --version > /dev/null 2>&1); then 31345bc899bSmrg gnutar "$@" && exit 0 31445bc899bSmrg fi 31545bc899bSmrg if (gtar --version > /dev/null 2>&1); then 31645bc899bSmrg gtar "$@" && exit 0 31745bc899bSmrg fi 31845bc899bSmrg firstarg="$1" 31945bc899bSmrg if shift; then 32045bc899bSmrg case "$firstarg" in 32145bc899bSmrg *o*) 32245bc899bSmrg firstarg=`echo "$firstarg" | sed s/o//` 32345bc899bSmrg tar "$firstarg" "$@" && exit 0 32445bc899bSmrg ;; 32545bc899bSmrg esac 32645bc899bSmrg case "$firstarg" in 32745bc899bSmrg *h*) 32845bc899bSmrg firstarg=`echo "$firstarg" | sed s/h//` 32945bc899bSmrg tar "$firstarg" "$@" && exit 0 33045bc899bSmrg ;; 33145bc899bSmrg esac 33245bc899bSmrg fi 33345bc899bSmrg 33445bc899bSmrg echo 1>&2 "\ 33545bc899bSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 33645bc899bSmrg You may want to install GNU tar or Free paxutils, or check the 33745bc899bSmrg command line arguments." 33845bc899bSmrg exit 1 33945bc899bSmrg ;; 34045bc899bSmrg 34145bc899bSmrg *) 34245bc899bSmrg echo 1>&2 "\ 34345bc899bSmrgWARNING: \`$1' is needed, and is $msg. 34445bc899bSmrg You might have modified some files without having the 34545bc899bSmrg proper tools for further handling them. Check the \`README' file, 34645bc899bSmrg it often tells you about the needed prerequisites for installing 34745bc899bSmrg this package. You may also peek at any GNU archive site, in case 34845bc899bSmrg some other package would contain this missing \`$1' program." 34945bc899bSmrg exit 1 35045bc899bSmrg ;; 35145bc899bSmrgesac 35245bc899bSmrg 35345bc899bSmrgexit 0 35445bc899bSmrg 35545bc899bSmrg# Local variables: 35645bc899bSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 35745bc899bSmrg# time-stamp-start: "scriptversion=" 35845bc899bSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 35945bc899bSmrg# time-stamp-end: "$" 36045bc899bSmrg# End: 361