missing revision 86bbecbe
153354cdbSmrg#! /bin/sh 253354cdbSmrg# Common stub for a few missing GNU programs while installing. 353354cdbSmrg 486bbecbeSmrgscriptversion=2009-04-28.21; # UTC 553354cdbSmrg 686bbecbeSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 786bbecbeSmrg# 2008, 2009 Free Software Foundation, Inc. 853354cdbSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 953354cdbSmrg 1053354cdbSmrg# This program is free software; you can redistribute it and/or modify 1153354cdbSmrg# it under the terms of the GNU General Public License as published by 1253354cdbSmrg# the Free Software Foundation; either version 2, or (at your option) 1353354cdbSmrg# any later version. 1453354cdbSmrg 1553354cdbSmrg# This program is distributed in the hope that it will be useful, 1653354cdbSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1753354cdbSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1853354cdbSmrg# GNU General Public License for more details. 1953354cdbSmrg 2053354cdbSmrg# You should have received a copy of the GNU General Public License 2186bbecbeSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2253354cdbSmrg 2353354cdbSmrg# As a special exception to the GNU General Public License, if you 2453354cdbSmrg# distribute this file as part of a program that contains a 2553354cdbSmrg# configuration script generated by Autoconf, you may include it under 2653354cdbSmrg# the same distribution terms that you use for the rest of that program. 2753354cdbSmrg 2853354cdbSmrgif test $# -eq 0; then 2953354cdbSmrg echo 1>&2 "Try \`$0 --help' for more information" 3053354cdbSmrg exit 1 3153354cdbSmrgfi 3253354cdbSmrg 3353354cdbSmrgrun=: 3453354cdbSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 3553354cdbSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 3653354cdbSmrg 3753354cdbSmrg# In the cases where this matters, `missing' is being run in the 3853354cdbSmrg# srcdir already. 3953354cdbSmrgif test -f configure.ac; then 4053354cdbSmrg configure_ac=configure.ac 4153354cdbSmrgelse 4253354cdbSmrg configure_ac=configure.in 4353354cdbSmrgfi 4453354cdbSmrg 4553354cdbSmrgmsg="missing on your system" 4653354cdbSmrg 4753354cdbSmrgcase $1 in 4853354cdbSmrg--run) 4953354cdbSmrg # Try to run requested program, and just exit if it succeeds. 5053354cdbSmrg run= 5153354cdbSmrg shift 5253354cdbSmrg "$@" && exit 0 5353354cdbSmrg # Exit code 63 means version mismatch. This often happens 5453354cdbSmrg # when the user try to use an ancient version of a tool on 5553354cdbSmrg # a file that requires a minimum version. In this case we 5653354cdbSmrg # we should proceed has if the program had been absent, or 5753354cdbSmrg # if --run hadn't been passed. 5853354cdbSmrg if test $? = 63; then 5953354cdbSmrg run=: 6053354cdbSmrg msg="probably too old" 6153354cdbSmrg fi 6253354cdbSmrg ;; 6353354cdbSmrg 6453354cdbSmrg -h|--h|--he|--hel|--help) 6553354cdbSmrg echo "\ 6653354cdbSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6753354cdbSmrg 6853354cdbSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6953354cdbSmrgerror status if there is no known handling for PROGRAM. 7053354cdbSmrg 7153354cdbSmrgOptions: 7253354cdbSmrg -h, --help display this help and exit 7353354cdbSmrg -v, --version output version information and exit 7453354cdbSmrg --run try to run the given command, and emulate it if it fails 7553354cdbSmrg 7653354cdbSmrgSupported PROGRAM values: 7753354cdbSmrg aclocal touch file \`aclocal.m4' 7853354cdbSmrg autoconf touch file \`configure' 7953354cdbSmrg autoheader touch file \`config.h.in' 8053354cdbSmrg autom4te touch the output file, or create a stub one 8153354cdbSmrg automake touch all \`Makefile.in' files 8253354cdbSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8353354cdbSmrg flex create \`lex.yy.c', if possible, from existing .c 8453354cdbSmrg help2man touch the output file 8553354cdbSmrg lex create \`lex.yy.c', if possible, from existing .c 8653354cdbSmrg makeinfo touch the output file 8753354cdbSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 8853354cdbSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8953354cdbSmrg 9086bbecbeSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 9186bbecbeSmrg\`g' are ignored when checking the name. 9286bbecbeSmrg 9353354cdbSmrgSend bug reports to <bug-automake@gnu.org>." 9453354cdbSmrg exit $? 9553354cdbSmrg ;; 9653354cdbSmrg 9753354cdbSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9853354cdbSmrg echo "missing $scriptversion (GNU Automake)" 9953354cdbSmrg exit $? 10053354cdbSmrg ;; 10153354cdbSmrg 10253354cdbSmrg -*) 10353354cdbSmrg echo 1>&2 "$0: Unknown \`$1' option" 10453354cdbSmrg echo 1>&2 "Try \`$0 --help' for more information" 10553354cdbSmrg exit 1 10653354cdbSmrg ;; 10753354cdbSmrg 10853354cdbSmrgesac 10953354cdbSmrg 11086bbecbeSmrg# normalize program name to check for. 11186bbecbeSmrgprogram=`echo "$1" | sed ' 11286bbecbeSmrg s/^gnu-//; t 11386bbecbeSmrg s/^gnu//; t 11486bbecbeSmrg s/^g//; t'` 11586bbecbeSmrg 11653354cdbSmrg# Now exit if we have it, but it failed. Also exit now if we 11753354cdbSmrg# don't have it and --version was passed (most likely to detect 11886bbecbeSmrg# the program). This is about non-GNU programs, so use $1 not 11986bbecbeSmrg# $program. 12053354cdbSmrgcase $1 in 12186bbecbeSmrg lex*|yacc*) 12253354cdbSmrg # Not GNU programs, they don't have --version. 12353354cdbSmrg ;; 12453354cdbSmrg 12586bbecbeSmrg tar*) 12653354cdbSmrg if test -n "$run"; then 12753354cdbSmrg echo 1>&2 "ERROR: \`tar' requires --run" 12853354cdbSmrg exit 1 12953354cdbSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13053354cdbSmrg exit 1 13153354cdbSmrg fi 13253354cdbSmrg ;; 13353354cdbSmrg 13453354cdbSmrg *) 13553354cdbSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 13653354cdbSmrg # We have it, but it failed. 13753354cdbSmrg exit 1 13853354cdbSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13953354cdbSmrg # Could not run --version or --help. This is probably someone 14053354cdbSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 14153354cdbSmrg # $TOOL exists and not knowing $TOOL uses missing. 14253354cdbSmrg exit 1 14353354cdbSmrg fi 14453354cdbSmrg ;; 14553354cdbSmrgesac 14653354cdbSmrg 14753354cdbSmrg# If it does not exist, or fails to run (possibly an outdated version), 14853354cdbSmrg# try to emulate it. 14986bbecbeSmrgcase $program in 15053354cdbSmrg aclocal*) 15153354cdbSmrg echo 1>&2 "\ 15253354cdbSmrgWARNING: \`$1' is $msg. You should only need it if 15353354cdbSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 15453354cdbSmrg to install the \`Automake' and \`Perl' packages. Grab them from 15553354cdbSmrg any GNU archive site." 15653354cdbSmrg touch aclocal.m4 15753354cdbSmrg ;; 15853354cdbSmrg 15986bbecbeSmrg autoconf*) 16053354cdbSmrg echo 1>&2 "\ 16153354cdbSmrgWARNING: \`$1' is $msg. You should only need it if 16253354cdbSmrg you modified \`${configure_ac}'. You might want to install the 16353354cdbSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 16453354cdbSmrg archive site." 16553354cdbSmrg touch configure 16653354cdbSmrg ;; 16753354cdbSmrg 16886bbecbeSmrg autoheader*) 16953354cdbSmrg echo 1>&2 "\ 17053354cdbSmrgWARNING: \`$1' is $msg. You should only need it if 17153354cdbSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 17253354cdbSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 17353354cdbSmrg from any GNU archive site." 17453354cdbSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 17553354cdbSmrg test -z "$files" && files="config.h" 17653354cdbSmrg touch_files= 17753354cdbSmrg for f in $files; do 17853354cdbSmrg case $f in 17953354cdbSmrg *:*) touch_files="$touch_files "`echo "$f" | 18053354cdbSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 18153354cdbSmrg *) touch_files="$touch_files $f.in";; 18253354cdbSmrg esac 18353354cdbSmrg done 18453354cdbSmrg touch $touch_files 18553354cdbSmrg ;; 18653354cdbSmrg 18753354cdbSmrg automake*) 18853354cdbSmrg echo 1>&2 "\ 18953354cdbSmrgWARNING: \`$1' is $msg. You should only need it if 19053354cdbSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 19153354cdbSmrg You might want to install the \`Automake' and \`Perl' packages. 19253354cdbSmrg Grab them from any GNU archive site." 19353354cdbSmrg find . -type f -name Makefile.am -print | 19453354cdbSmrg sed 's/\.am$/.in/' | 19553354cdbSmrg while read f; do touch "$f"; done 19653354cdbSmrg ;; 19753354cdbSmrg 19886bbecbeSmrg autom4te*) 19953354cdbSmrg echo 1>&2 "\ 20053354cdbSmrgWARNING: \`$1' is needed, but is $msg. 20153354cdbSmrg You might have modified some files without having the 20253354cdbSmrg proper tools for further handling them. 20353354cdbSmrg You can get \`$1' as part of \`Autoconf' from any GNU 20453354cdbSmrg archive site." 20553354cdbSmrg 20653354cdbSmrg file=`echo "$*" | sed -n "$sed_output"` 20753354cdbSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 20853354cdbSmrg if test -f "$file"; then 20953354cdbSmrg touch $file 21053354cdbSmrg else 21153354cdbSmrg test -z "$file" || exec >$file 21253354cdbSmrg echo "#! /bin/sh" 21353354cdbSmrg echo "# Created by GNU Automake missing as a replacement of" 21453354cdbSmrg echo "# $ $@" 21553354cdbSmrg echo "exit 0" 21653354cdbSmrg chmod +x $file 21753354cdbSmrg exit 1 21853354cdbSmrg fi 21953354cdbSmrg ;; 22053354cdbSmrg 22186bbecbeSmrg bison*|yacc*) 22253354cdbSmrg echo 1>&2 "\ 22353354cdbSmrgWARNING: \`$1' $msg. You should only need it if 22453354cdbSmrg you modified a \`.y' file. You may need the \`Bison' package 22553354cdbSmrg in order for those modifications to take effect. You can get 22653354cdbSmrg \`Bison' from any GNU archive site." 22753354cdbSmrg rm -f y.tab.c y.tab.h 22853354cdbSmrg if test $# -ne 1; then 22953354cdbSmrg eval LASTARG="\${$#}" 23053354cdbSmrg case $LASTARG in 23153354cdbSmrg *.y) 23253354cdbSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 23353354cdbSmrg if test -f "$SRCFILE"; then 23453354cdbSmrg cp "$SRCFILE" y.tab.c 23553354cdbSmrg fi 23653354cdbSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 23753354cdbSmrg if test -f "$SRCFILE"; then 23853354cdbSmrg cp "$SRCFILE" y.tab.h 23953354cdbSmrg fi 24053354cdbSmrg ;; 24153354cdbSmrg esac 24253354cdbSmrg fi 24353354cdbSmrg if test ! -f y.tab.h; then 24453354cdbSmrg echo >y.tab.h 24553354cdbSmrg fi 24653354cdbSmrg if test ! -f y.tab.c; then 24753354cdbSmrg echo 'main() { return 0; }' >y.tab.c 24853354cdbSmrg fi 24953354cdbSmrg ;; 25053354cdbSmrg 25186bbecbeSmrg lex*|flex*) 25253354cdbSmrg echo 1>&2 "\ 25353354cdbSmrgWARNING: \`$1' is $msg. You should only need it if 25453354cdbSmrg you modified a \`.l' file. You may need the \`Flex' package 25553354cdbSmrg in order for those modifications to take effect. You can get 25653354cdbSmrg \`Flex' from any GNU archive site." 25753354cdbSmrg rm -f lex.yy.c 25853354cdbSmrg if test $# -ne 1; then 25953354cdbSmrg eval LASTARG="\${$#}" 26053354cdbSmrg case $LASTARG in 26153354cdbSmrg *.l) 26253354cdbSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 26353354cdbSmrg if test -f "$SRCFILE"; then 26453354cdbSmrg cp "$SRCFILE" lex.yy.c 26553354cdbSmrg fi 26653354cdbSmrg ;; 26753354cdbSmrg esac 26853354cdbSmrg fi 26953354cdbSmrg if test ! -f lex.yy.c; then 27053354cdbSmrg echo 'main() { return 0; }' >lex.yy.c 27153354cdbSmrg fi 27253354cdbSmrg ;; 27353354cdbSmrg 27486bbecbeSmrg help2man*) 27553354cdbSmrg echo 1>&2 "\ 27653354cdbSmrgWARNING: \`$1' is $msg. You should only need it if 27753354cdbSmrg you modified a dependency of a manual page. You may need the 27853354cdbSmrg \`Help2man' package in order for those modifications to take 27953354cdbSmrg effect. You can get \`Help2man' from any GNU archive site." 28053354cdbSmrg 28153354cdbSmrg file=`echo "$*" | sed -n "$sed_output"` 28253354cdbSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 28353354cdbSmrg if test -f "$file"; then 28453354cdbSmrg touch $file 28553354cdbSmrg else 28653354cdbSmrg test -z "$file" || exec >$file 28753354cdbSmrg echo ".ab help2man is required to generate this page" 28886bbecbeSmrg exit $? 28953354cdbSmrg fi 29053354cdbSmrg ;; 29153354cdbSmrg 29286bbecbeSmrg makeinfo*) 29353354cdbSmrg echo 1>&2 "\ 29453354cdbSmrgWARNING: \`$1' is $msg. You should only need it if 29553354cdbSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 29653354cdbSmrg indirectly affecting the aspect of the manual. The spurious 29753354cdbSmrg call might also be the consequence of using a buggy \`make' (AIX, 29853354cdbSmrg DU, IRIX). You might want to install the \`Texinfo' package or 29953354cdbSmrg the \`GNU make' package. Grab either from any GNU archive site." 30053354cdbSmrg # The file to touch is that specified with -o ... 30153354cdbSmrg file=`echo "$*" | sed -n "$sed_output"` 30253354cdbSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 30353354cdbSmrg if test -z "$file"; then 30453354cdbSmrg # ... or it is the one specified with @setfilename ... 30553354cdbSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 30653354cdbSmrg file=`sed -n ' 30753354cdbSmrg /^@setfilename/{ 30853354cdbSmrg s/.* \([^ ]*\) *$/\1/ 30953354cdbSmrg p 31053354cdbSmrg q 31153354cdbSmrg }' $infile` 31253354cdbSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 31353354cdbSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 31453354cdbSmrg fi 31553354cdbSmrg # If the file does not exist, the user really needs makeinfo; 31653354cdbSmrg # let's fail without touching anything. 31753354cdbSmrg test -f $file || exit 1 31853354cdbSmrg touch $file 31953354cdbSmrg ;; 32053354cdbSmrg 32186bbecbeSmrg tar*) 32253354cdbSmrg shift 32353354cdbSmrg 32453354cdbSmrg # We have already tried tar in the generic part. 32553354cdbSmrg # Look for gnutar/gtar before invocation to avoid ugly error 32653354cdbSmrg # messages. 32753354cdbSmrg if (gnutar --version > /dev/null 2>&1); then 32853354cdbSmrg gnutar "$@" && exit 0 32953354cdbSmrg fi 33053354cdbSmrg if (gtar --version > /dev/null 2>&1); then 33153354cdbSmrg gtar "$@" && exit 0 33253354cdbSmrg fi 33353354cdbSmrg firstarg="$1" 33453354cdbSmrg if shift; then 33553354cdbSmrg case $firstarg in 33653354cdbSmrg *o*) 33753354cdbSmrg firstarg=`echo "$firstarg" | sed s/o//` 33853354cdbSmrg tar "$firstarg" "$@" && exit 0 33953354cdbSmrg ;; 34053354cdbSmrg esac 34153354cdbSmrg case $firstarg in 34253354cdbSmrg *h*) 34353354cdbSmrg firstarg=`echo "$firstarg" | sed s/h//` 34453354cdbSmrg tar "$firstarg" "$@" && exit 0 34553354cdbSmrg ;; 34653354cdbSmrg esac 34753354cdbSmrg fi 34853354cdbSmrg 34953354cdbSmrg echo 1>&2 "\ 35053354cdbSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 35153354cdbSmrg You may want to install GNU tar or Free paxutils, or check the 35253354cdbSmrg command line arguments." 35353354cdbSmrg exit 1 35453354cdbSmrg ;; 35553354cdbSmrg 35653354cdbSmrg *) 35753354cdbSmrg echo 1>&2 "\ 35853354cdbSmrgWARNING: \`$1' is needed, and is $msg. 35953354cdbSmrg You might have modified some files without having the 36053354cdbSmrg proper tools for further handling them. Check the \`README' file, 36153354cdbSmrg it often tells you about the needed prerequisites for installing 36253354cdbSmrg this package. You may also peek at any GNU archive site, in case 36353354cdbSmrg some other package would contain this missing \`$1' program." 36453354cdbSmrg exit 1 36553354cdbSmrg ;; 36653354cdbSmrgesac 36753354cdbSmrg 36853354cdbSmrgexit 0 36953354cdbSmrg 37053354cdbSmrg# Local variables: 37153354cdbSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 37253354cdbSmrg# time-stamp-start: "scriptversion=" 37353354cdbSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 37486bbecbeSmrg# time-stamp-time-zone: "UTC" 37586bbecbeSmrg# time-stamp-end: "; # UTC" 37653354cdbSmrg# End: 377