171d7fec4Smrg#! /bin/sh 271d7fec4Smrg# Common stub for a few missing GNU programs while installing. 371d7fec4Smrg 471d7fec4Smrgscriptversion=2005-06-08.21 571d7fec4Smrg 671d7fec4Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 771d7fec4Smrg# Free Software Foundation, Inc. 871d7fec4Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 971d7fec4Smrg 1071d7fec4Smrg# This program is free software; you can redistribute it and/or modify 1171d7fec4Smrg# it under the terms of the GNU General Public License as published by 1271d7fec4Smrg# the Free Software Foundation; either version 2, or (at your option) 1371d7fec4Smrg# any later version. 1471d7fec4Smrg 1571d7fec4Smrg# This program is distributed in the hope that it will be useful, 1671d7fec4Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1771d7fec4Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1871d7fec4Smrg# GNU General Public License for more details. 1971d7fec4Smrg 2071d7fec4Smrg# You should have received a copy of the GNU General Public License 2171d7fec4Smrg# along with this program; if not, write to the Free Software 2271d7fec4Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2371d7fec4Smrg# 02110-1301, USA. 2471d7fec4Smrg 2571d7fec4Smrg# As a special exception to the GNU General Public License, if you 2671d7fec4Smrg# distribute this file as part of a program that contains a 2771d7fec4Smrg# configuration script generated by Autoconf, you may include it under 2871d7fec4Smrg# the same distribution terms that you use for the rest of that program. 2971d7fec4Smrg 3071d7fec4Smrgif test $# -eq 0; then 3171d7fec4Smrg echo 1>&2 "Try \`$0 --help' for more information" 3271d7fec4Smrg exit 1 3371d7fec4Smrgfi 3471d7fec4Smrg 3571d7fec4Smrgrun=: 3671d7fec4Smrg 3771d7fec4Smrg# In the cases where this matters, `missing' is being run in the 3871d7fec4Smrg# srcdir already. 3971d7fec4Smrgif test -f configure.ac; then 4071d7fec4Smrg configure_ac=configure.ac 4171d7fec4Smrgelse 4271d7fec4Smrg configure_ac=configure.in 4371d7fec4Smrgfi 4471d7fec4Smrg 4571d7fec4Smrgmsg="missing on your system" 4671d7fec4Smrg 4771d7fec4Smrgcase "$1" in 4871d7fec4Smrg--run) 4971d7fec4Smrg # Try to run requested program, and just exit if it succeeds. 5071d7fec4Smrg run= 5171d7fec4Smrg shift 5271d7fec4Smrg "$@" && exit 0 5371d7fec4Smrg # Exit code 63 means version mismatch. This often happens 5471d7fec4Smrg # when the user try to use an ancient version of a tool on 5571d7fec4Smrg # a file that requires a minimum version. In this case we 5671d7fec4Smrg # we should proceed has if the program had been absent, or 5771d7fec4Smrg # if --run hadn't been passed. 5871d7fec4Smrg if test $? = 63; then 5971d7fec4Smrg run=: 6071d7fec4Smrg msg="probably too old" 6171d7fec4Smrg fi 6271d7fec4Smrg ;; 6371d7fec4Smrg 6471d7fec4Smrg -h|--h|--he|--hel|--help) 6571d7fec4Smrg echo "\ 6671d7fec4Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6771d7fec4Smrg 6871d7fec4SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6971d7fec4Smrgerror status if there is no known handling for PROGRAM. 7071d7fec4Smrg 7171d7fec4SmrgOptions: 7271d7fec4Smrg -h, --help display this help and exit 7371d7fec4Smrg -v, --version output version information and exit 7471d7fec4Smrg --run try to run the given command, and emulate it if it fails 7571d7fec4Smrg 7671d7fec4SmrgSupported PROGRAM values: 7771d7fec4Smrg aclocal touch file \`aclocal.m4' 7871d7fec4Smrg autoconf touch file \`configure' 7971d7fec4Smrg autoheader touch file \`config.h.in' 8071d7fec4Smrg automake touch all \`Makefile.in' files 8171d7fec4Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8271d7fec4Smrg flex create \`lex.yy.c', if possible, from existing .c 8371d7fec4Smrg help2man touch the output file 8471d7fec4Smrg lex create \`lex.yy.c', if possible, from existing .c 8571d7fec4Smrg makeinfo touch the output file 8671d7fec4Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 8771d7fec4Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8871d7fec4Smrg 8971d7fec4SmrgSend bug reports to <bug-automake@gnu.org>." 9071d7fec4Smrg exit $? 9171d7fec4Smrg ;; 9271d7fec4Smrg 9371d7fec4Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9471d7fec4Smrg echo "missing $scriptversion (GNU Automake)" 9571d7fec4Smrg exit $? 9671d7fec4Smrg ;; 9771d7fec4Smrg 9871d7fec4Smrg -*) 9971d7fec4Smrg echo 1>&2 "$0: Unknown \`$1' option" 10071d7fec4Smrg echo 1>&2 "Try \`$0 --help' for more information" 10171d7fec4Smrg exit 1 10271d7fec4Smrg ;; 10371d7fec4Smrg 10471d7fec4Smrgesac 10571d7fec4Smrg 10671d7fec4Smrg# Now exit if we have it, but it failed. Also exit now if we 10771d7fec4Smrg# don't have it and --version was passed (most likely to detect 10871d7fec4Smrg# the program). 10971d7fec4Smrgcase "$1" in 11071d7fec4Smrg lex|yacc) 11171d7fec4Smrg # Not GNU programs, they don't have --version. 11271d7fec4Smrg ;; 11371d7fec4Smrg 11471d7fec4Smrg tar) 11571d7fec4Smrg if test -n "$run"; then 11671d7fec4Smrg echo 1>&2 "ERROR: \`tar' requires --run" 11771d7fec4Smrg exit 1 11871d7fec4Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 11971d7fec4Smrg exit 1 12071d7fec4Smrg fi 12171d7fec4Smrg ;; 12271d7fec4Smrg 12371d7fec4Smrg *) 12471d7fec4Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 12571d7fec4Smrg # We have it, but it failed. 12671d7fec4Smrg exit 1 12771d7fec4Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 12871d7fec4Smrg # Could not run --version or --help. This is probably someone 12971d7fec4Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 13071d7fec4Smrg # $TOOL exists and not knowing $TOOL uses missing. 13171d7fec4Smrg exit 1 13271d7fec4Smrg fi 13371d7fec4Smrg ;; 13471d7fec4Smrgesac 13571d7fec4Smrg 13671d7fec4Smrg# If it does not exist, or fails to run (possibly an outdated version), 13771d7fec4Smrg# try to emulate it. 13871d7fec4Smrgcase "$1" in 13971d7fec4Smrg aclocal*) 14071d7fec4Smrg echo 1>&2 "\ 14171d7fec4SmrgWARNING: \`$1' is $msg. You should only need it if 14271d7fec4Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 14371d7fec4Smrg to install the \`Automake' and \`Perl' packages. Grab them from 14471d7fec4Smrg any GNU archive site." 14571d7fec4Smrg touch aclocal.m4 14671d7fec4Smrg ;; 14771d7fec4Smrg 14871d7fec4Smrg autoconf) 14971d7fec4Smrg echo 1>&2 "\ 15071d7fec4SmrgWARNING: \`$1' is $msg. You should only need it if 15171d7fec4Smrg you modified \`${configure_ac}'. You might want to install the 15271d7fec4Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 15371d7fec4Smrg archive site." 15471d7fec4Smrg touch configure 15571d7fec4Smrg ;; 15671d7fec4Smrg 15771d7fec4Smrg autoheader) 15871d7fec4Smrg echo 1>&2 "\ 15971d7fec4SmrgWARNING: \`$1' is $msg. You should only need it if 16071d7fec4Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 16171d7fec4Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 16271d7fec4Smrg from any GNU archive site." 16371d7fec4Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 16471d7fec4Smrg test -z "$files" && files="config.h" 16571d7fec4Smrg touch_files= 16671d7fec4Smrg for f in $files; do 16771d7fec4Smrg case "$f" in 16871d7fec4Smrg *:*) touch_files="$touch_files "`echo "$f" | 16971d7fec4Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 17071d7fec4Smrg *) touch_files="$touch_files $f.in";; 17171d7fec4Smrg esac 17271d7fec4Smrg done 17371d7fec4Smrg touch $touch_files 17471d7fec4Smrg ;; 17571d7fec4Smrg 17671d7fec4Smrg automake*) 17771d7fec4Smrg echo 1>&2 "\ 17871d7fec4SmrgWARNING: \`$1' is $msg. You should only need it if 17971d7fec4Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 18071d7fec4Smrg You might want to install the \`Automake' and \`Perl' packages. 18171d7fec4Smrg Grab them from any GNU archive site." 18271d7fec4Smrg find . -type f -name Makefile.am -print | 18371d7fec4Smrg sed 's/\.am$/.in/' | 18471d7fec4Smrg while read f; do touch "$f"; done 18571d7fec4Smrg ;; 18671d7fec4Smrg 18771d7fec4Smrg autom4te) 18871d7fec4Smrg echo 1>&2 "\ 18971d7fec4SmrgWARNING: \`$1' is needed, but is $msg. 19071d7fec4Smrg You might have modified some files without having the 19171d7fec4Smrg proper tools for further handling them. 19271d7fec4Smrg You can get \`$1' as part of \`Autoconf' from any GNU 19371d7fec4Smrg archive site." 19471d7fec4Smrg 19571d7fec4Smrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 19671d7fec4Smrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 19771d7fec4Smrg if test -f "$file"; then 19871d7fec4Smrg touch $file 19971d7fec4Smrg else 20071d7fec4Smrg test -z "$file" || exec >$file 20171d7fec4Smrg echo "#! /bin/sh" 20271d7fec4Smrg echo "# Created by GNU Automake missing as a replacement of" 20371d7fec4Smrg echo "# $ $@" 20471d7fec4Smrg echo "exit 0" 20571d7fec4Smrg chmod +x $file 20671d7fec4Smrg exit 1 20771d7fec4Smrg fi 20871d7fec4Smrg ;; 20971d7fec4Smrg 21071d7fec4Smrg bison|yacc) 21171d7fec4Smrg echo 1>&2 "\ 21271d7fec4SmrgWARNING: \`$1' $msg. You should only need it if 21371d7fec4Smrg you modified a \`.y' file. You may need the \`Bison' package 21471d7fec4Smrg in order for those modifications to take effect. You can get 21571d7fec4Smrg \`Bison' from any GNU archive site." 21671d7fec4Smrg rm -f y.tab.c y.tab.h 21771d7fec4Smrg if [ $# -ne 1 ]; then 21871d7fec4Smrg eval LASTARG="\${$#}" 21971d7fec4Smrg case "$LASTARG" in 22071d7fec4Smrg *.y) 22171d7fec4Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 22271d7fec4Smrg if [ -f "$SRCFILE" ]; then 22371d7fec4Smrg cp "$SRCFILE" y.tab.c 22471d7fec4Smrg fi 22571d7fec4Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 22671d7fec4Smrg if [ -f "$SRCFILE" ]; then 22771d7fec4Smrg cp "$SRCFILE" y.tab.h 22871d7fec4Smrg fi 22971d7fec4Smrg ;; 23071d7fec4Smrg esac 23171d7fec4Smrg fi 23271d7fec4Smrg if [ ! -f y.tab.h ]; then 23371d7fec4Smrg echo >y.tab.h 23471d7fec4Smrg fi 23571d7fec4Smrg if [ ! -f y.tab.c ]; then 23671d7fec4Smrg echo 'main() { return 0; }' >y.tab.c 23771d7fec4Smrg fi 23871d7fec4Smrg ;; 23971d7fec4Smrg 24071d7fec4Smrg lex|flex) 24171d7fec4Smrg echo 1>&2 "\ 24271d7fec4SmrgWARNING: \`$1' is $msg. You should only need it if 24371d7fec4Smrg you modified a \`.l' file. You may need the \`Flex' package 24471d7fec4Smrg in order for those modifications to take effect. You can get 24571d7fec4Smrg \`Flex' from any GNU archive site." 24671d7fec4Smrg rm -f lex.yy.c 24771d7fec4Smrg if [ $# -ne 1 ]; then 24871d7fec4Smrg eval LASTARG="\${$#}" 24971d7fec4Smrg case "$LASTARG" in 25071d7fec4Smrg *.l) 25171d7fec4Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 25271d7fec4Smrg if [ -f "$SRCFILE" ]; then 25371d7fec4Smrg cp "$SRCFILE" lex.yy.c 25471d7fec4Smrg fi 25571d7fec4Smrg ;; 25671d7fec4Smrg esac 25771d7fec4Smrg fi 25871d7fec4Smrg if [ ! -f lex.yy.c ]; then 25971d7fec4Smrg echo 'main() { return 0; }' >lex.yy.c 26071d7fec4Smrg fi 26171d7fec4Smrg ;; 26271d7fec4Smrg 26371d7fec4Smrg help2man) 26471d7fec4Smrg echo 1>&2 "\ 26571d7fec4SmrgWARNING: \`$1' is $msg. You should only need it if 26671d7fec4Smrg you modified a dependency of a manual page. You may need the 26771d7fec4Smrg \`Help2man' package in order for those modifications to take 26871d7fec4Smrg effect. You can get \`Help2man' from any GNU archive site." 26971d7fec4Smrg 27071d7fec4Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 27171d7fec4Smrg if test -z "$file"; then 27271d7fec4Smrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 27371d7fec4Smrg fi 27471d7fec4Smrg if [ -f "$file" ]; then 27571d7fec4Smrg touch $file 27671d7fec4Smrg else 27771d7fec4Smrg test -z "$file" || exec >$file 27871d7fec4Smrg echo ".ab help2man is required to generate this page" 27971d7fec4Smrg exit 1 28071d7fec4Smrg fi 28171d7fec4Smrg ;; 28271d7fec4Smrg 28371d7fec4Smrg makeinfo) 28471d7fec4Smrg echo 1>&2 "\ 28571d7fec4SmrgWARNING: \`$1' is $msg. You should only need it if 28671d7fec4Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 28771d7fec4Smrg indirectly affecting the aspect of the manual. The spurious 28871d7fec4Smrg call might also be the consequence of using a buggy \`make' (AIX, 28971d7fec4Smrg DU, IRIX). You might want to install the \`Texinfo' package or 29071d7fec4Smrg the \`GNU make' package. Grab either from any GNU archive site." 29171d7fec4Smrg # The file to touch is that specified with -o ... 29271d7fec4Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 29371d7fec4Smrg if test -z "$file"; then 29471d7fec4Smrg # ... or it is the one specified with @setfilename ... 29571d7fec4Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 29671d7fec4Smrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 29771d7fec4Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 29871d7fec4Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 29971d7fec4Smrg fi 30071d7fec4Smrg # If the file does not exist, the user really needs makeinfo; 30171d7fec4Smrg # let's fail without touching anything. 30271d7fec4Smrg test -f $file || exit 1 30371d7fec4Smrg touch $file 30471d7fec4Smrg ;; 30571d7fec4Smrg 30671d7fec4Smrg tar) 30771d7fec4Smrg shift 30871d7fec4Smrg 30971d7fec4Smrg # We have already tried tar in the generic part. 31071d7fec4Smrg # Look for gnutar/gtar before invocation to avoid ugly error 31171d7fec4Smrg # messages. 31271d7fec4Smrg if (gnutar --version > /dev/null 2>&1); then 31371d7fec4Smrg gnutar "$@" && exit 0 31471d7fec4Smrg fi 31571d7fec4Smrg if (gtar --version > /dev/null 2>&1); then 31671d7fec4Smrg gtar "$@" && exit 0 31771d7fec4Smrg fi 31871d7fec4Smrg firstarg="$1" 31971d7fec4Smrg if shift; then 32071d7fec4Smrg case "$firstarg" in 32171d7fec4Smrg *o*) 32271d7fec4Smrg firstarg=`echo "$firstarg" | sed s/o//` 32371d7fec4Smrg tar "$firstarg" "$@" && exit 0 32471d7fec4Smrg ;; 32571d7fec4Smrg esac 32671d7fec4Smrg case "$firstarg" in 32771d7fec4Smrg *h*) 32871d7fec4Smrg firstarg=`echo "$firstarg" | sed s/h//` 32971d7fec4Smrg tar "$firstarg" "$@" && exit 0 33071d7fec4Smrg ;; 33171d7fec4Smrg esac 33271d7fec4Smrg fi 33371d7fec4Smrg 33471d7fec4Smrg echo 1>&2 "\ 33571d7fec4SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 33671d7fec4Smrg You may want to install GNU tar or Free paxutils, or check the 33771d7fec4Smrg command line arguments." 33871d7fec4Smrg exit 1 33971d7fec4Smrg ;; 34071d7fec4Smrg 34171d7fec4Smrg *) 34271d7fec4Smrg echo 1>&2 "\ 34371d7fec4SmrgWARNING: \`$1' is needed, and is $msg. 34471d7fec4Smrg You might have modified some files without having the 34571d7fec4Smrg proper tools for further handling them. Check the \`README' file, 34671d7fec4Smrg it often tells you about the needed prerequisites for installing 34771d7fec4Smrg this package. You may also peek at any GNU archive site, in case 34871d7fec4Smrg some other package would contain this missing \`$1' program." 34971d7fec4Smrg exit 1 35071d7fec4Smrg ;; 35171d7fec4Smrgesac 35271d7fec4Smrg 35371d7fec4Smrgexit 0 35471d7fec4Smrg 35571d7fec4Smrg# Local variables: 35671d7fec4Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 35771d7fec4Smrg# time-stamp-start: "scriptversion=" 35871d7fec4Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 35971d7fec4Smrg# time-stamp-end: "$" 36071d7fec4Smrg# End: 361