missing revision 50806d53
150806d53Smrg#! /bin/sh 250806d53Smrg# Common stub for a few missing GNU programs while installing. 350806d53Smrg 450806d53Smrgscriptversion=2005-06-08.21 550806d53Smrg 650806d53Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 750806d53Smrg# Free Software Foundation, Inc. 850806d53Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 950806d53Smrg 1050806d53Smrg# This program is free software; you can redistribute it and/or modify 1150806d53Smrg# it under the terms of the GNU General Public License as published by 1250806d53Smrg# the Free Software Foundation; either version 2, or (at your option) 1350806d53Smrg# any later version. 1450806d53Smrg 1550806d53Smrg# This program is distributed in the hope that it will be useful, 1650806d53Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1750806d53Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1850806d53Smrg# GNU General Public License for more details. 1950806d53Smrg 2050806d53Smrg# You should have received a copy of the GNU General Public License 2150806d53Smrg# along with this program; if not, write to the Free Software 2250806d53Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2350806d53Smrg# 02110-1301, USA. 2450806d53Smrg 2550806d53Smrg# As a special exception to the GNU General Public License, if you 2650806d53Smrg# distribute this file as part of a program that contains a 2750806d53Smrg# configuration script generated by Autoconf, you may include it under 2850806d53Smrg# the same distribution terms that you use for the rest of that program. 2950806d53Smrg 3050806d53Smrgif test $# -eq 0; then 3150806d53Smrg echo 1>&2 "Try \`$0 --help' for more information" 3250806d53Smrg exit 1 3350806d53Smrgfi 3450806d53Smrg 3550806d53Smrgrun=: 3650806d53Smrg 3750806d53Smrg# In the cases where this matters, `missing' is being run in the 3850806d53Smrg# srcdir already. 3950806d53Smrgif test -f configure.ac; then 4050806d53Smrg configure_ac=configure.ac 4150806d53Smrgelse 4250806d53Smrg configure_ac=configure.in 4350806d53Smrgfi 4450806d53Smrg 4550806d53Smrgmsg="missing on your system" 4650806d53Smrg 4750806d53Smrgcase "$1" in 4850806d53Smrg--run) 4950806d53Smrg # Try to run requested program, and just exit if it succeeds. 5050806d53Smrg run= 5150806d53Smrg shift 5250806d53Smrg "$@" && exit 0 5350806d53Smrg # Exit code 63 means version mismatch. This often happens 5450806d53Smrg # when the user try to use an ancient version of a tool on 5550806d53Smrg # a file that requires a minimum version. In this case we 5650806d53Smrg # we should proceed has if the program had been absent, or 5750806d53Smrg # if --run hadn't been passed. 5850806d53Smrg if test $? = 63; then 5950806d53Smrg run=: 6050806d53Smrg msg="probably too old" 6150806d53Smrg fi 6250806d53Smrg ;; 6350806d53Smrg 6450806d53Smrg -h|--h|--he|--hel|--help) 6550806d53Smrg echo "\ 6650806d53Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6750806d53Smrg 6850806d53SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6950806d53Smrgerror status if there is no known handling for PROGRAM. 7050806d53Smrg 7150806d53SmrgOptions: 7250806d53Smrg -h, --help display this help and exit 7350806d53Smrg -v, --version output version information and exit 7450806d53Smrg --run try to run the given command, and emulate it if it fails 7550806d53Smrg 7650806d53SmrgSupported PROGRAM values: 7750806d53Smrg aclocal touch file \`aclocal.m4' 7850806d53Smrg autoconf touch file \`configure' 7950806d53Smrg autoheader touch file \`config.h.in' 8050806d53Smrg automake touch all \`Makefile.in' files 8150806d53Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8250806d53Smrg flex create \`lex.yy.c', if possible, from existing .c 8350806d53Smrg help2man touch the output file 8450806d53Smrg lex create \`lex.yy.c', if possible, from existing .c 8550806d53Smrg makeinfo touch the output file 8650806d53Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 8750806d53Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8850806d53Smrg 8950806d53SmrgSend bug reports to <bug-automake@gnu.org>." 9050806d53Smrg exit $? 9150806d53Smrg ;; 9250806d53Smrg 9350806d53Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9450806d53Smrg echo "missing $scriptversion (GNU Automake)" 9550806d53Smrg exit $? 9650806d53Smrg ;; 9750806d53Smrg 9850806d53Smrg -*) 9950806d53Smrg echo 1>&2 "$0: Unknown \`$1' option" 10050806d53Smrg echo 1>&2 "Try \`$0 --help' for more information" 10150806d53Smrg exit 1 10250806d53Smrg ;; 10350806d53Smrg 10450806d53Smrgesac 10550806d53Smrg 10650806d53Smrg# Now exit if we have it, but it failed. Also exit now if we 10750806d53Smrg# don't have it and --version was passed (most likely to detect 10850806d53Smrg# the program). 10950806d53Smrgcase "$1" in 11050806d53Smrg lex|yacc) 11150806d53Smrg # Not GNU programs, they don't have --version. 11250806d53Smrg ;; 11350806d53Smrg 11450806d53Smrg tar) 11550806d53Smrg if test -n "$run"; then 11650806d53Smrg echo 1>&2 "ERROR: \`tar' requires --run" 11750806d53Smrg exit 1 11850806d53Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 11950806d53Smrg exit 1 12050806d53Smrg fi 12150806d53Smrg ;; 12250806d53Smrg 12350806d53Smrg *) 12450806d53Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 12550806d53Smrg # We have it, but it failed. 12650806d53Smrg exit 1 12750806d53Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 12850806d53Smrg # Could not run --version or --help. This is probably someone 12950806d53Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 13050806d53Smrg # $TOOL exists and not knowing $TOOL uses missing. 13150806d53Smrg exit 1 13250806d53Smrg fi 13350806d53Smrg ;; 13450806d53Smrgesac 13550806d53Smrg 13650806d53Smrg# If it does not exist, or fails to run (possibly an outdated version), 13750806d53Smrg# try to emulate it. 13850806d53Smrgcase "$1" in 13950806d53Smrg aclocal*) 14050806d53Smrg echo 1>&2 "\ 14150806d53SmrgWARNING: \`$1' is $msg. You should only need it if 14250806d53Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 14350806d53Smrg to install the \`Automake' and \`Perl' packages. Grab them from 14450806d53Smrg any GNU archive site." 14550806d53Smrg touch aclocal.m4 14650806d53Smrg ;; 14750806d53Smrg 14850806d53Smrg autoconf) 14950806d53Smrg echo 1>&2 "\ 15050806d53SmrgWARNING: \`$1' is $msg. You should only need it if 15150806d53Smrg you modified \`${configure_ac}'. You might want to install the 15250806d53Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 15350806d53Smrg archive site." 15450806d53Smrg touch configure 15550806d53Smrg ;; 15650806d53Smrg 15750806d53Smrg autoheader) 15850806d53Smrg echo 1>&2 "\ 15950806d53SmrgWARNING: \`$1' is $msg. You should only need it if 16050806d53Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 16150806d53Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 16250806d53Smrg from any GNU archive site." 16350806d53Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 16450806d53Smrg test -z "$files" && files="config.h" 16550806d53Smrg touch_files= 16650806d53Smrg for f in $files; do 16750806d53Smrg case "$f" in 16850806d53Smrg *:*) touch_files="$touch_files "`echo "$f" | 16950806d53Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 17050806d53Smrg *) touch_files="$touch_files $f.in";; 17150806d53Smrg esac 17250806d53Smrg done 17350806d53Smrg touch $touch_files 17450806d53Smrg ;; 17550806d53Smrg 17650806d53Smrg automake*) 17750806d53Smrg echo 1>&2 "\ 17850806d53SmrgWARNING: \`$1' is $msg. You should only need it if 17950806d53Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 18050806d53Smrg You might want to install the \`Automake' and \`Perl' packages. 18150806d53Smrg Grab them from any GNU archive site." 18250806d53Smrg find . -type f -name Makefile.am -print | 18350806d53Smrg sed 's/\.am$/.in/' | 18450806d53Smrg while read f; do touch "$f"; done 18550806d53Smrg ;; 18650806d53Smrg 18750806d53Smrg autom4te) 18850806d53Smrg echo 1>&2 "\ 18950806d53SmrgWARNING: \`$1' is needed, but is $msg. 19050806d53Smrg You might have modified some files without having the 19150806d53Smrg proper tools for further handling them. 19250806d53Smrg You can get \`$1' as part of \`Autoconf' from any GNU 19350806d53Smrg archive site." 19450806d53Smrg 19550806d53Smrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 19650806d53Smrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 19750806d53Smrg if test -f "$file"; then 19850806d53Smrg touch $file 19950806d53Smrg else 20050806d53Smrg test -z "$file" || exec >$file 20150806d53Smrg echo "#! /bin/sh" 20250806d53Smrg echo "# Created by GNU Automake missing as a replacement of" 20350806d53Smrg echo "# $ $@" 20450806d53Smrg echo "exit 0" 20550806d53Smrg chmod +x $file 20650806d53Smrg exit 1 20750806d53Smrg fi 20850806d53Smrg ;; 20950806d53Smrg 21050806d53Smrg bison|yacc) 21150806d53Smrg echo 1>&2 "\ 21250806d53SmrgWARNING: \`$1' $msg. You should only need it if 21350806d53Smrg you modified a \`.y' file. You may need the \`Bison' package 21450806d53Smrg in order for those modifications to take effect. You can get 21550806d53Smrg \`Bison' from any GNU archive site." 21650806d53Smrg rm -f y.tab.c y.tab.h 21750806d53Smrg if [ $# -ne 1 ]; then 21850806d53Smrg eval LASTARG="\${$#}" 21950806d53Smrg case "$LASTARG" in 22050806d53Smrg *.y) 22150806d53Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 22250806d53Smrg if [ -f "$SRCFILE" ]; then 22350806d53Smrg cp "$SRCFILE" y.tab.c 22450806d53Smrg fi 22550806d53Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 22650806d53Smrg if [ -f "$SRCFILE" ]; then 22750806d53Smrg cp "$SRCFILE" y.tab.h 22850806d53Smrg fi 22950806d53Smrg ;; 23050806d53Smrg esac 23150806d53Smrg fi 23250806d53Smrg if [ ! -f y.tab.h ]; then 23350806d53Smrg echo >y.tab.h 23450806d53Smrg fi 23550806d53Smrg if [ ! -f y.tab.c ]; then 23650806d53Smrg echo 'main() { return 0; }' >y.tab.c 23750806d53Smrg fi 23850806d53Smrg ;; 23950806d53Smrg 24050806d53Smrg lex|flex) 24150806d53Smrg echo 1>&2 "\ 24250806d53SmrgWARNING: \`$1' is $msg. You should only need it if 24350806d53Smrg you modified a \`.l' file. You may need the \`Flex' package 24450806d53Smrg in order for those modifications to take effect. You can get 24550806d53Smrg \`Flex' from any GNU archive site." 24650806d53Smrg rm -f lex.yy.c 24750806d53Smrg if [ $# -ne 1 ]; then 24850806d53Smrg eval LASTARG="\${$#}" 24950806d53Smrg case "$LASTARG" in 25050806d53Smrg *.l) 25150806d53Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 25250806d53Smrg if [ -f "$SRCFILE" ]; then 25350806d53Smrg cp "$SRCFILE" lex.yy.c 25450806d53Smrg fi 25550806d53Smrg ;; 25650806d53Smrg esac 25750806d53Smrg fi 25850806d53Smrg if [ ! -f lex.yy.c ]; then 25950806d53Smrg echo 'main() { return 0; }' >lex.yy.c 26050806d53Smrg fi 26150806d53Smrg ;; 26250806d53Smrg 26350806d53Smrg help2man) 26450806d53Smrg echo 1>&2 "\ 26550806d53SmrgWARNING: \`$1' is $msg. You should only need it if 26650806d53Smrg you modified a dependency of a manual page. You may need the 26750806d53Smrg \`Help2man' package in order for those modifications to take 26850806d53Smrg effect. You can get \`Help2man' from any GNU archive site." 26950806d53Smrg 27050806d53Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 27150806d53Smrg if test -z "$file"; then 27250806d53Smrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 27350806d53Smrg fi 27450806d53Smrg if [ -f "$file" ]; then 27550806d53Smrg touch $file 27650806d53Smrg else 27750806d53Smrg test -z "$file" || exec >$file 27850806d53Smrg echo ".ab help2man is required to generate this page" 27950806d53Smrg exit 1 28050806d53Smrg fi 28150806d53Smrg ;; 28250806d53Smrg 28350806d53Smrg makeinfo) 28450806d53Smrg echo 1>&2 "\ 28550806d53SmrgWARNING: \`$1' is $msg. You should only need it if 28650806d53Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 28750806d53Smrg indirectly affecting the aspect of the manual. The spurious 28850806d53Smrg call might also be the consequence of using a buggy \`make' (AIX, 28950806d53Smrg DU, IRIX). You might want to install the \`Texinfo' package or 29050806d53Smrg the \`GNU make' package. Grab either from any GNU archive site." 29150806d53Smrg # The file to touch is that specified with -o ... 29250806d53Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 29350806d53Smrg if test -z "$file"; then 29450806d53Smrg # ... or it is the one specified with @setfilename ... 29550806d53Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 29650806d53Smrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 29750806d53Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 29850806d53Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 29950806d53Smrg fi 30050806d53Smrg # If the file does not exist, the user really needs makeinfo; 30150806d53Smrg # let's fail without touching anything. 30250806d53Smrg test -f $file || exit 1 30350806d53Smrg touch $file 30450806d53Smrg ;; 30550806d53Smrg 30650806d53Smrg tar) 30750806d53Smrg shift 30850806d53Smrg 30950806d53Smrg # We have already tried tar in the generic part. 31050806d53Smrg # Look for gnutar/gtar before invocation to avoid ugly error 31150806d53Smrg # messages. 31250806d53Smrg if (gnutar --version > /dev/null 2>&1); then 31350806d53Smrg gnutar "$@" && exit 0 31450806d53Smrg fi 31550806d53Smrg if (gtar --version > /dev/null 2>&1); then 31650806d53Smrg gtar "$@" && exit 0 31750806d53Smrg fi 31850806d53Smrg firstarg="$1" 31950806d53Smrg if shift; then 32050806d53Smrg case "$firstarg" in 32150806d53Smrg *o*) 32250806d53Smrg firstarg=`echo "$firstarg" | sed s/o//` 32350806d53Smrg tar "$firstarg" "$@" && exit 0 32450806d53Smrg ;; 32550806d53Smrg esac 32650806d53Smrg case "$firstarg" in 32750806d53Smrg *h*) 32850806d53Smrg firstarg=`echo "$firstarg" | sed s/h//` 32950806d53Smrg tar "$firstarg" "$@" && exit 0 33050806d53Smrg ;; 33150806d53Smrg esac 33250806d53Smrg fi 33350806d53Smrg 33450806d53Smrg echo 1>&2 "\ 33550806d53SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 33650806d53Smrg You may want to install GNU tar or Free paxutils, or check the 33750806d53Smrg command line arguments." 33850806d53Smrg exit 1 33950806d53Smrg ;; 34050806d53Smrg 34150806d53Smrg *) 34250806d53Smrg echo 1>&2 "\ 34350806d53SmrgWARNING: \`$1' is needed, and is $msg. 34450806d53Smrg You might have modified some files without having the 34550806d53Smrg proper tools for further handling them. Check the \`README' file, 34650806d53Smrg it often tells you about the needed prerequisites for installing 34750806d53Smrg this package. You may also peek at any GNU archive site, in case 34850806d53Smrg some other package would contain this missing \`$1' program." 34950806d53Smrg exit 1 35050806d53Smrg ;; 35150806d53Smrgesac 35250806d53Smrg 35350806d53Smrgexit 0 35450806d53Smrg 35550806d53Smrg# Local variables: 35650806d53Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 35750806d53Smrg# time-stamp-start: "scriptversion=" 35850806d53Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 35950806d53Smrg# time-stamp-end: "$" 36050806d53Smrg# End: 361