missing revision 15fb4814
115fb4814Smrg#! /bin/sh 215fb4814Smrg# Common stub for a few missing GNU programs while installing. 315fb4814Smrg 415fb4814Smrgscriptversion=2005-06-08.21 515fb4814Smrg 615fb4814Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 715fb4814Smrg# Free Software Foundation, Inc. 815fb4814Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 915fb4814Smrg 1015fb4814Smrg# This program is free software; you can redistribute it and/or modify 1115fb4814Smrg# it under the terms of the GNU General Public License as published by 1215fb4814Smrg# the Free Software Foundation; either version 2, or (at your option) 1315fb4814Smrg# any later version. 1415fb4814Smrg 1515fb4814Smrg# This program is distributed in the hope that it will be useful, 1615fb4814Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1715fb4814Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1815fb4814Smrg# GNU General Public License for more details. 1915fb4814Smrg 2015fb4814Smrg# You should have received a copy of the GNU General Public License 2115fb4814Smrg# along with this program; if not, write to the Free Software 2215fb4814Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2315fb4814Smrg# 02110-1301, USA. 2415fb4814Smrg 2515fb4814Smrg# As a special exception to the GNU General Public License, if you 2615fb4814Smrg# distribute this file as part of a program that contains a 2715fb4814Smrg# configuration script generated by Autoconf, you may include it under 2815fb4814Smrg# the same distribution terms that you use for the rest of that program. 2915fb4814Smrg 3015fb4814Smrgif test $# -eq 0; then 3115fb4814Smrg echo 1>&2 "Try \`$0 --help' for more information" 3215fb4814Smrg exit 1 3315fb4814Smrgfi 3415fb4814Smrg 3515fb4814Smrgrun=: 3615fb4814Smrg 3715fb4814Smrg# In the cases where this matters, `missing' is being run in the 3815fb4814Smrg# srcdir already. 3915fb4814Smrgif test -f configure.ac; then 4015fb4814Smrg configure_ac=configure.ac 4115fb4814Smrgelse 4215fb4814Smrg configure_ac=configure.in 4315fb4814Smrgfi 4415fb4814Smrg 4515fb4814Smrgmsg="missing on your system" 4615fb4814Smrg 4715fb4814Smrgcase "$1" in 4815fb4814Smrg--run) 4915fb4814Smrg # Try to run requested program, and just exit if it succeeds. 5015fb4814Smrg run= 5115fb4814Smrg shift 5215fb4814Smrg "$@" && exit 0 5315fb4814Smrg # Exit code 63 means version mismatch. This often happens 5415fb4814Smrg # when the user try to use an ancient version of a tool on 5515fb4814Smrg # a file that requires a minimum version. In this case we 5615fb4814Smrg # we should proceed has if the program had been absent, or 5715fb4814Smrg # if --run hadn't been passed. 5815fb4814Smrg if test $? = 63; then 5915fb4814Smrg run=: 6015fb4814Smrg msg="probably too old" 6115fb4814Smrg fi 6215fb4814Smrg ;; 6315fb4814Smrg 6415fb4814Smrg -h|--h|--he|--hel|--help) 6515fb4814Smrg echo "\ 6615fb4814Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6715fb4814Smrg 6815fb4814SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6915fb4814Smrgerror status if there is no known handling for PROGRAM. 7015fb4814Smrg 7115fb4814SmrgOptions: 7215fb4814Smrg -h, --help display this help and exit 7315fb4814Smrg -v, --version output version information and exit 7415fb4814Smrg --run try to run the given command, and emulate it if it fails 7515fb4814Smrg 7615fb4814SmrgSupported PROGRAM values: 7715fb4814Smrg aclocal touch file \`aclocal.m4' 7815fb4814Smrg autoconf touch file \`configure' 7915fb4814Smrg autoheader touch file \`config.h.in' 8015fb4814Smrg automake touch all \`Makefile.in' files 8115fb4814Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8215fb4814Smrg flex create \`lex.yy.c', if possible, from existing .c 8315fb4814Smrg help2man touch the output file 8415fb4814Smrg lex create \`lex.yy.c', if possible, from existing .c 8515fb4814Smrg makeinfo touch the output file 8615fb4814Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 8715fb4814Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8815fb4814Smrg 8915fb4814SmrgSend bug reports to <bug-automake@gnu.org>." 9015fb4814Smrg exit $? 9115fb4814Smrg ;; 9215fb4814Smrg 9315fb4814Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9415fb4814Smrg echo "missing $scriptversion (GNU Automake)" 9515fb4814Smrg exit $? 9615fb4814Smrg ;; 9715fb4814Smrg 9815fb4814Smrg -*) 9915fb4814Smrg echo 1>&2 "$0: Unknown \`$1' option" 10015fb4814Smrg echo 1>&2 "Try \`$0 --help' for more information" 10115fb4814Smrg exit 1 10215fb4814Smrg ;; 10315fb4814Smrg 10415fb4814Smrgesac 10515fb4814Smrg 10615fb4814Smrg# Now exit if we have it, but it failed. Also exit now if we 10715fb4814Smrg# don't have it and --version was passed (most likely to detect 10815fb4814Smrg# the program). 10915fb4814Smrgcase "$1" in 11015fb4814Smrg lex|yacc) 11115fb4814Smrg # Not GNU programs, they don't have --version. 11215fb4814Smrg ;; 11315fb4814Smrg 11415fb4814Smrg tar) 11515fb4814Smrg if test -n "$run"; then 11615fb4814Smrg echo 1>&2 "ERROR: \`tar' requires --run" 11715fb4814Smrg exit 1 11815fb4814Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 11915fb4814Smrg exit 1 12015fb4814Smrg fi 12115fb4814Smrg ;; 12215fb4814Smrg 12315fb4814Smrg *) 12415fb4814Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 12515fb4814Smrg # We have it, but it failed. 12615fb4814Smrg exit 1 12715fb4814Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 12815fb4814Smrg # Could not run --version or --help. This is probably someone 12915fb4814Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 13015fb4814Smrg # $TOOL exists and not knowing $TOOL uses missing. 13115fb4814Smrg exit 1 13215fb4814Smrg fi 13315fb4814Smrg ;; 13415fb4814Smrgesac 13515fb4814Smrg 13615fb4814Smrg# If it does not exist, or fails to run (possibly an outdated version), 13715fb4814Smrg# try to emulate it. 13815fb4814Smrgcase "$1" in 13915fb4814Smrg aclocal*) 14015fb4814Smrg echo 1>&2 "\ 14115fb4814SmrgWARNING: \`$1' is $msg. You should only need it if 14215fb4814Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 14315fb4814Smrg to install the \`Automake' and \`Perl' packages. Grab them from 14415fb4814Smrg any GNU archive site." 14515fb4814Smrg touch aclocal.m4 14615fb4814Smrg ;; 14715fb4814Smrg 14815fb4814Smrg autoconf) 14915fb4814Smrg echo 1>&2 "\ 15015fb4814SmrgWARNING: \`$1' is $msg. You should only need it if 15115fb4814Smrg you modified \`${configure_ac}'. You might want to install the 15215fb4814Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 15315fb4814Smrg archive site." 15415fb4814Smrg touch configure 15515fb4814Smrg ;; 15615fb4814Smrg 15715fb4814Smrg autoheader) 15815fb4814Smrg echo 1>&2 "\ 15915fb4814SmrgWARNING: \`$1' is $msg. You should only need it if 16015fb4814Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 16115fb4814Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 16215fb4814Smrg from any GNU archive site." 16315fb4814Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 16415fb4814Smrg test -z "$files" && files="config.h" 16515fb4814Smrg touch_files= 16615fb4814Smrg for f in $files; do 16715fb4814Smrg case "$f" in 16815fb4814Smrg *:*) touch_files="$touch_files "`echo "$f" | 16915fb4814Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 17015fb4814Smrg *) touch_files="$touch_files $f.in";; 17115fb4814Smrg esac 17215fb4814Smrg done 17315fb4814Smrg touch $touch_files 17415fb4814Smrg ;; 17515fb4814Smrg 17615fb4814Smrg automake*) 17715fb4814Smrg echo 1>&2 "\ 17815fb4814SmrgWARNING: \`$1' is $msg. You should only need it if 17915fb4814Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 18015fb4814Smrg You might want to install the \`Automake' and \`Perl' packages. 18115fb4814Smrg Grab them from any GNU archive site." 18215fb4814Smrg find . -type f -name Makefile.am -print | 18315fb4814Smrg sed 's/\.am$/.in/' | 18415fb4814Smrg while read f; do touch "$f"; done 18515fb4814Smrg ;; 18615fb4814Smrg 18715fb4814Smrg autom4te) 18815fb4814Smrg echo 1>&2 "\ 18915fb4814SmrgWARNING: \`$1' is needed, but is $msg. 19015fb4814Smrg You might have modified some files without having the 19115fb4814Smrg proper tools for further handling them. 19215fb4814Smrg You can get \`$1' as part of \`Autoconf' from any GNU 19315fb4814Smrg archive site." 19415fb4814Smrg 19515fb4814Smrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 19615fb4814Smrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 19715fb4814Smrg if test -f "$file"; then 19815fb4814Smrg touch $file 19915fb4814Smrg else 20015fb4814Smrg test -z "$file" || exec >$file 20115fb4814Smrg echo "#! /bin/sh" 20215fb4814Smrg echo "# Created by GNU Automake missing as a replacement of" 20315fb4814Smrg echo "# $ $@" 20415fb4814Smrg echo "exit 0" 20515fb4814Smrg chmod +x $file 20615fb4814Smrg exit 1 20715fb4814Smrg fi 20815fb4814Smrg ;; 20915fb4814Smrg 21015fb4814Smrg bison|yacc) 21115fb4814Smrg echo 1>&2 "\ 21215fb4814SmrgWARNING: \`$1' $msg. You should only need it if 21315fb4814Smrg you modified a \`.y' file. You may need the \`Bison' package 21415fb4814Smrg in order for those modifications to take effect. You can get 21515fb4814Smrg \`Bison' from any GNU archive site." 21615fb4814Smrg rm -f y.tab.c y.tab.h 21715fb4814Smrg if [ $# -ne 1 ]; then 21815fb4814Smrg eval LASTARG="\${$#}" 21915fb4814Smrg case "$LASTARG" in 22015fb4814Smrg *.y) 22115fb4814Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 22215fb4814Smrg if [ -f "$SRCFILE" ]; then 22315fb4814Smrg cp "$SRCFILE" y.tab.c 22415fb4814Smrg fi 22515fb4814Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 22615fb4814Smrg if [ -f "$SRCFILE" ]; then 22715fb4814Smrg cp "$SRCFILE" y.tab.h 22815fb4814Smrg fi 22915fb4814Smrg ;; 23015fb4814Smrg esac 23115fb4814Smrg fi 23215fb4814Smrg if [ ! -f y.tab.h ]; then 23315fb4814Smrg echo >y.tab.h 23415fb4814Smrg fi 23515fb4814Smrg if [ ! -f y.tab.c ]; then 23615fb4814Smrg echo 'main() { return 0; }' >y.tab.c 23715fb4814Smrg fi 23815fb4814Smrg ;; 23915fb4814Smrg 24015fb4814Smrg lex|flex) 24115fb4814Smrg echo 1>&2 "\ 24215fb4814SmrgWARNING: \`$1' is $msg. You should only need it if 24315fb4814Smrg you modified a \`.l' file. You may need the \`Flex' package 24415fb4814Smrg in order for those modifications to take effect. You can get 24515fb4814Smrg \`Flex' from any GNU archive site." 24615fb4814Smrg rm -f lex.yy.c 24715fb4814Smrg if [ $# -ne 1 ]; then 24815fb4814Smrg eval LASTARG="\${$#}" 24915fb4814Smrg case "$LASTARG" in 25015fb4814Smrg *.l) 25115fb4814Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 25215fb4814Smrg if [ -f "$SRCFILE" ]; then 25315fb4814Smrg cp "$SRCFILE" lex.yy.c 25415fb4814Smrg fi 25515fb4814Smrg ;; 25615fb4814Smrg esac 25715fb4814Smrg fi 25815fb4814Smrg if [ ! -f lex.yy.c ]; then 25915fb4814Smrg echo 'main() { return 0; }' >lex.yy.c 26015fb4814Smrg fi 26115fb4814Smrg ;; 26215fb4814Smrg 26315fb4814Smrg help2man) 26415fb4814Smrg echo 1>&2 "\ 26515fb4814SmrgWARNING: \`$1' is $msg. You should only need it if 26615fb4814Smrg you modified a dependency of a manual page. You may need the 26715fb4814Smrg \`Help2man' package in order for those modifications to take 26815fb4814Smrg effect. You can get \`Help2man' from any GNU archive site." 26915fb4814Smrg 27015fb4814Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 27115fb4814Smrg if test -z "$file"; then 27215fb4814Smrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 27315fb4814Smrg fi 27415fb4814Smrg if [ -f "$file" ]; then 27515fb4814Smrg touch $file 27615fb4814Smrg else 27715fb4814Smrg test -z "$file" || exec >$file 27815fb4814Smrg echo ".ab help2man is required to generate this page" 27915fb4814Smrg exit 1 28015fb4814Smrg fi 28115fb4814Smrg ;; 28215fb4814Smrg 28315fb4814Smrg makeinfo) 28415fb4814Smrg echo 1>&2 "\ 28515fb4814SmrgWARNING: \`$1' is $msg. You should only need it if 28615fb4814Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 28715fb4814Smrg indirectly affecting the aspect of the manual. The spurious 28815fb4814Smrg call might also be the consequence of using a buggy \`make' (AIX, 28915fb4814Smrg DU, IRIX). You might want to install the \`Texinfo' package or 29015fb4814Smrg the \`GNU make' package. Grab either from any GNU archive site." 29115fb4814Smrg # The file to touch is that specified with -o ... 29215fb4814Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 29315fb4814Smrg if test -z "$file"; then 29415fb4814Smrg # ... or it is the one specified with @setfilename ... 29515fb4814Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 29615fb4814Smrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 29715fb4814Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 29815fb4814Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 29915fb4814Smrg fi 30015fb4814Smrg # If the file does not exist, the user really needs makeinfo; 30115fb4814Smrg # let's fail without touching anything. 30215fb4814Smrg test -f $file || exit 1 30315fb4814Smrg touch $file 30415fb4814Smrg ;; 30515fb4814Smrg 30615fb4814Smrg tar) 30715fb4814Smrg shift 30815fb4814Smrg 30915fb4814Smrg # We have already tried tar in the generic part. 31015fb4814Smrg # Look for gnutar/gtar before invocation to avoid ugly error 31115fb4814Smrg # messages. 31215fb4814Smrg if (gnutar --version > /dev/null 2>&1); then 31315fb4814Smrg gnutar "$@" && exit 0 31415fb4814Smrg fi 31515fb4814Smrg if (gtar --version > /dev/null 2>&1); then 31615fb4814Smrg gtar "$@" && exit 0 31715fb4814Smrg fi 31815fb4814Smrg firstarg="$1" 31915fb4814Smrg if shift; then 32015fb4814Smrg case "$firstarg" in 32115fb4814Smrg *o*) 32215fb4814Smrg firstarg=`echo "$firstarg" | sed s/o//` 32315fb4814Smrg tar "$firstarg" "$@" && exit 0 32415fb4814Smrg ;; 32515fb4814Smrg esac 32615fb4814Smrg case "$firstarg" in 32715fb4814Smrg *h*) 32815fb4814Smrg firstarg=`echo "$firstarg" | sed s/h//` 32915fb4814Smrg tar "$firstarg" "$@" && exit 0 33015fb4814Smrg ;; 33115fb4814Smrg esac 33215fb4814Smrg fi 33315fb4814Smrg 33415fb4814Smrg echo 1>&2 "\ 33515fb4814SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 33615fb4814Smrg You may want to install GNU tar or Free paxutils, or check the 33715fb4814Smrg command line arguments." 33815fb4814Smrg exit 1 33915fb4814Smrg ;; 34015fb4814Smrg 34115fb4814Smrg *) 34215fb4814Smrg echo 1>&2 "\ 34315fb4814SmrgWARNING: \`$1' is needed, and is $msg. 34415fb4814Smrg You might have modified some files without having the 34515fb4814Smrg proper tools for further handling them. Check the \`README' file, 34615fb4814Smrg it often tells you about the needed prerequisites for installing 34715fb4814Smrg this package. You may also peek at any GNU archive site, in case 34815fb4814Smrg some other package would contain this missing \`$1' program." 34915fb4814Smrg exit 1 35015fb4814Smrg ;; 35115fb4814Smrgesac 35215fb4814Smrg 35315fb4814Smrgexit 0 35415fb4814Smrg 35515fb4814Smrg# Local variables: 35615fb4814Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 35715fb4814Smrg# time-stamp-start: "scriptversion=" 35815fb4814Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 35915fb4814Smrg# time-stamp-end: "$" 36015fb4814Smrg# End: 361