missing revision 61dc2d86
102be438aSmrg#! /bin/sh 202be438aSmrg# Common stub for a few missing GNU programs while installing. 302be438aSmrg 461dc2d86Smrgscriptversion=2009-04-28.21; # UTC 502be438aSmrg 661dc2d86Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 761dc2d86Smrg# 2008, 2009 Free Software Foundation, Inc. 802be438aSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 902be438aSmrg 1002be438aSmrg# This program is free software; you can redistribute it and/or modify 1102be438aSmrg# it under the terms of the GNU General Public License as published by 1202be438aSmrg# the Free Software Foundation; either version 2, or (at your option) 1302be438aSmrg# any later version. 1402be438aSmrg 1502be438aSmrg# This program is distributed in the hope that it will be useful, 1602be438aSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1702be438aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1802be438aSmrg# GNU General Public License for more details. 1902be438aSmrg 2002be438aSmrg# You should have received a copy of the GNU General Public License 2161dc2d86Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2202be438aSmrg 2302be438aSmrg# As a special exception to the GNU General Public License, if you 2402be438aSmrg# distribute this file as part of a program that contains a 2502be438aSmrg# configuration script generated by Autoconf, you may include it under 2602be438aSmrg# the same distribution terms that you use for the rest of that program. 2702be438aSmrg 2802be438aSmrgif test $# -eq 0; then 2902be438aSmrg echo 1>&2 "Try \`$0 --help' for more information" 3002be438aSmrg exit 1 3102be438aSmrgfi 3202be438aSmrg 3302be438aSmrgrun=: 34880ed95aSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35880ed95aSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 3602be438aSmrg 3702be438aSmrg# In the cases where this matters, `missing' is being run in the 3802be438aSmrg# srcdir already. 3902be438aSmrgif test -f configure.ac; then 4002be438aSmrg configure_ac=configure.ac 4102be438aSmrgelse 4202be438aSmrg configure_ac=configure.in 4302be438aSmrgfi 4402be438aSmrg 4502be438aSmrgmsg="missing on your system" 4602be438aSmrg 47880ed95aSmrgcase $1 in 4802be438aSmrg--run) 4902be438aSmrg # Try to run requested program, and just exit if it succeeds. 5002be438aSmrg run= 5102be438aSmrg shift 5202be438aSmrg "$@" && exit 0 5302be438aSmrg # Exit code 63 means version mismatch. This often happens 5402be438aSmrg # when the user try to use an ancient version of a tool on 5502be438aSmrg # a file that requires a minimum version. In this case we 5602be438aSmrg # we should proceed has if the program had been absent, or 5702be438aSmrg # if --run hadn't been passed. 5802be438aSmrg if test $? = 63; then 5902be438aSmrg run=: 6002be438aSmrg msg="probably too old" 6102be438aSmrg fi 6202be438aSmrg ;; 6302be438aSmrg 6402be438aSmrg -h|--h|--he|--hel|--help) 6502be438aSmrg echo "\ 6602be438aSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6702be438aSmrg 6802be438aSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6902be438aSmrgerror status if there is no known handling for PROGRAM. 7002be438aSmrg 7102be438aSmrgOptions: 7202be438aSmrg -h, --help display this help and exit 7302be438aSmrg -v, --version output version information and exit 7402be438aSmrg --run try to run the given command, and emulate it if it fails 7502be438aSmrg 7602be438aSmrgSupported PROGRAM values: 7702be438aSmrg aclocal touch file \`aclocal.m4' 7802be438aSmrg autoconf touch file \`configure' 7902be438aSmrg autoheader touch file \`config.h.in' 80880ed95aSmrg autom4te touch the output file, or create a stub one 8102be438aSmrg automake touch all \`Makefile.in' files 8202be438aSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8302be438aSmrg flex create \`lex.yy.c', if possible, from existing .c 8402be438aSmrg help2man touch the output file 8502be438aSmrg lex create \`lex.yy.c', if possible, from existing .c 8602be438aSmrg makeinfo touch the output file 8702be438aSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 8802be438aSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8902be438aSmrg 9061dc2d86SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 9161dc2d86Smrg\`g' are ignored when checking the name. 9261dc2d86Smrg 9302be438aSmrgSend bug reports to <bug-automake@gnu.org>." 9402be438aSmrg exit $? 9502be438aSmrg ;; 9602be438aSmrg 9702be438aSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9802be438aSmrg echo "missing $scriptversion (GNU Automake)" 9902be438aSmrg exit $? 10002be438aSmrg ;; 10102be438aSmrg 10202be438aSmrg -*) 10302be438aSmrg echo 1>&2 "$0: Unknown \`$1' option" 10402be438aSmrg echo 1>&2 "Try \`$0 --help' for more information" 10502be438aSmrg exit 1 10602be438aSmrg ;; 10702be438aSmrg 10802be438aSmrgesac 10902be438aSmrg 11061dc2d86Smrg# normalize program name to check for. 11161dc2d86Smrgprogram=`echo "$1" | sed ' 11261dc2d86Smrg s/^gnu-//; t 11361dc2d86Smrg s/^gnu//; t 11461dc2d86Smrg s/^g//; t'` 11561dc2d86Smrg 11602be438aSmrg# Now exit if we have it, but it failed. Also exit now if we 11702be438aSmrg# don't have it and --version was passed (most likely to detect 11861dc2d86Smrg# the program). This is about non-GNU programs, so use $1 not 11961dc2d86Smrg# $program. 120880ed95aSmrgcase $1 in 12161dc2d86Smrg lex*|yacc*) 12202be438aSmrg # Not GNU programs, they don't have --version. 12302be438aSmrg ;; 12402be438aSmrg 12561dc2d86Smrg tar*) 12602be438aSmrg if test -n "$run"; then 12702be438aSmrg echo 1>&2 "ERROR: \`tar' requires --run" 12802be438aSmrg exit 1 12902be438aSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13002be438aSmrg exit 1 13102be438aSmrg fi 13202be438aSmrg ;; 13302be438aSmrg 13402be438aSmrg *) 13502be438aSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 13602be438aSmrg # We have it, but it failed. 13702be438aSmrg exit 1 13802be438aSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13902be438aSmrg # Could not run --version or --help. This is probably someone 14002be438aSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 14102be438aSmrg # $TOOL exists and not knowing $TOOL uses missing. 14202be438aSmrg exit 1 14302be438aSmrg fi 14402be438aSmrg ;; 14502be438aSmrgesac 14602be438aSmrg 14702be438aSmrg# If it does not exist, or fails to run (possibly an outdated version), 14802be438aSmrg# try to emulate it. 14961dc2d86Smrgcase $program in 15002be438aSmrg aclocal*) 15102be438aSmrg echo 1>&2 "\ 15202be438aSmrgWARNING: \`$1' is $msg. You should only need it if 15302be438aSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 15402be438aSmrg to install the \`Automake' and \`Perl' packages. Grab them from 15502be438aSmrg any GNU archive site." 15602be438aSmrg touch aclocal.m4 15702be438aSmrg ;; 15802be438aSmrg 15961dc2d86Smrg autoconf*) 16002be438aSmrg echo 1>&2 "\ 16102be438aSmrgWARNING: \`$1' is $msg. You should only need it if 16202be438aSmrg you modified \`${configure_ac}'. You might want to install the 16302be438aSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 16402be438aSmrg archive site." 16502be438aSmrg touch configure 16602be438aSmrg ;; 16702be438aSmrg 16861dc2d86Smrg autoheader*) 16902be438aSmrg echo 1>&2 "\ 17002be438aSmrgWARNING: \`$1' is $msg. You should only need it if 17102be438aSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 17202be438aSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 17302be438aSmrg from any GNU archive site." 17402be438aSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 17502be438aSmrg test -z "$files" && files="config.h" 17602be438aSmrg touch_files= 17702be438aSmrg for f in $files; do 178880ed95aSmrg case $f in 17902be438aSmrg *:*) touch_files="$touch_files "`echo "$f" | 18002be438aSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 18102be438aSmrg *) touch_files="$touch_files $f.in";; 18202be438aSmrg esac 18302be438aSmrg done 18402be438aSmrg touch $touch_files 18502be438aSmrg ;; 18602be438aSmrg 18702be438aSmrg automake*) 18802be438aSmrg echo 1>&2 "\ 18902be438aSmrgWARNING: \`$1' is $msg. You should only need it if 19002be438aSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 19102be438aSmrg You might want to install the \`Automake' and \`Perl' packages. 19202be438aSmrg Grab them from any GNU archive site." 19302be438aSmrg find . -type f -name Makefile.am -print | 19402be438aSmrg sed 's/\.am$/.in/' | 19502be438aSmrg while read f; do touch "$f"; done 19602be438aSmrg ;; 19702be438aSmrg 19861dc2d86Smrg autom4te*) 19902be438aSmrg echo 1>&2 "\ 20002be438aSmrgWARNING: \`$1' is needed, but is $msg. 20102be438aSmrg You might have modified some files without having the 20202be438aSmrg proper tools for further handling them. 20302be438aSmrg You can get \`$1' as part of \`Autoconf' from any GNU 20402be438aSmrg archive site." 20502be438aSmrg 206880ed95aSmrg file=`echo "$*" | sed -n "$sed_output"` 207880ed95aSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 20802be438aSmrg if test -f "$file"; then 20902be438aSmrg touch $file 21002be438aSmrg else 21102be438aSmrg test -z "$file" || exec >$file 21202be438aSmrg echo "#! /bin/sh" 21302be438aSmrg echo "# Created by GNU Automake missing as a replacement of" 21402be438aSmrg echo "# $ $@" 21502be438aSmrg echo "exit 0" 21602be438aSmrg chmod +x $file 21702be438aSmrg exit 1 21802be438aSmrg fi 21902be438aSmrg ;; 22002be438aSmrg 22161dc2d86Smrg bison*|yacc*) 22202be438aSmrg echo 1>&2 "\ 22302be438aSmrgWARNING: \`$1' $msg. You should only need it if 22402be438aSmrg you modified a \`.y' file. You may need the \`Bison' package 22502be438aSmrg in order for those modifications to take effect. You can get 22602be438aSmrg \`Bison' from any GNU archive site." 22702be438aSmrg rm -f y.tab.c y.tab.h 228880ed95aSmrg if test $# -ne 1; then 22902be438aSmrg eval LASTARG="\${$#}" 230880ed95aSmrg case $LASTARG in 23102be438aSmrg *.y) 23202be438aSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233880ed95aSmrg if test -f "$SRCFILE"; then 23402be438aSmrg cp "$SRCFILE" y.tab.c 23502be438aSmrg fi 23602be438aSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237880ed95aSmrg if test -f "$SRCFILE"; then 23802be438aSmrg cp "$SRCFILE" y.tab.h 23902be438aSmrg fi 24002be438aSmrg ;; 24102be438aSmrg esac 24202be438aSmrg fi 243880ed95aSmrg if test ! -f y.tab.h; then 24402be438aSmrg echo >y.tab.h 24502be438aSmrg fi 246880ed95aSmrg if test ! -f y.tab.c; then 24702be438aSmrg echo 'main() { return 0; }' >y.tab.c 24802be438aSmrg fi 24902be438aSmrg ;; 25002be438aSmrg 25161dc2d86Smrg lex*|flex*) 25202be438aSmrg echo 1>&2 "\ 25302be438aSmrgWARNING: \`$1' is $msg. You should only need it if 25402be438aSmrg you modified a \`.l' file. You may need the \`Flex' package 25502be438aSmrg in order for those modifications to take effect. You can get 25602be438aSmrg \`Flex' from any GNU archive site." 25702be438aSmrg rm -f lex.yy.c 258880ed95aSmrg if test $# -ne 1; then 25902be438aSmrg eval LASTARG="\${$#}" 260880ed95aSmrg case $LASTARG in 26102be438aSmrg *.l) 26202be438aSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263880ed95aSmrg if test -f "$SRCFILE"; then 26402be438aSmrg cp "$SRCFILE" lex.yy.c 26502be438aSmrg fi 26602be438aSmrg ;; 26702be438aSmrg esac 26802be438aSmrg fi 269880ed95aSmrg if test ! -f lex.yy.c; then 27002be438aSmrg echo 'main() { return 0; }' >lex.yy.c 27102be438aSmrg fi 27202be438aSmrg ;; 27302be438aSmrg 27461dc2d86Smrg help2man*) 27502be438aSmrg echo 1>&2 "\ 27602be438aSmrgWARNING: \`$1' is $msg. You should only need it if 27702be438aSmrg you modified a dependency of a manual page. You may need the 27802be438aSmrg \`Help2man' package in order for those modifications to take 27902be438aSmrg effect. You can get \`Help2man' from any GNU archive site." 28002be438aSmrg 281880ed95aSmrg file=`echo "$*" | sed -n "$sed_output"` 282880ed95aSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283880ed95aSmrg if test -f "$file"; then 28402be438aSmrg touch $file 28502be438aSmrg else 28602be438aSmrg test -z "$file" || exec >$file 28702be438aSmrg echo ".ab help2man is required to generate this page" 28861dc2d86Smrg exit $? 28902be438aSmrg fi 29002be438aSmrg ;; 29102be438aSmrg 29261dc2d86Smrg makeinfo*) 29302be438aSmrg echo 1>&2 "\ 29402be438aSmrgWARNING: \`$1' is $msg. You should only need it if 29502be438aSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 29602be438aSmrg indirectly affecting the aspect of the manual. The spurious 29702be438aSmrg call might also be the consequence of using a buggy \`make' (AIX, 29802be438aSmrg DU, IRIX). You might want to install the \`Texinfo' package or 29902be438aSmrg the \`GNU make' package. Grab either from any GNU archive site." 30002be438aSmrg # The file to touch is that specified with -o ... 301880ed95aSmrg file=`echo "$*" | sed -n "$sed_output"` 302880ed95aSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 30302be438aSmrg if test -z "$file"; then 30402be438aSmrg # ... or it is the one specified with @setfilename ... 30502be438aSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306880ed95aSmrg file=`sed -n ' 307880ed95aSmrg /^@setfilename/{ 308880ed95aSmrg s/.* \([^ ]*\) *$/\1/ 309880ed95aSmrg p 310880ed95aSmrg q 311880ed95aSmrg }' $infile` 31202be438aSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 31302be438aSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 31402be438aSmrg fi 31502be438aSmrg # If the file does not exist, the user really needs makeinfo; 31602be438aSmrg # let's fail without touching anything. 31702be438aSmrg test -f $file || exit 1 31802be438aSmrg touch $file 31902be438aSmrg ;; 32002be438aSmrg 32161dc2d86Smrg tar*) 32202be438aSmrg shift 32302be438aSmrg 32402be438aSmrg # We have already tried tar in the generic part. 32502be438aSmrg # Look for gnutar/gtar before invocation to avoid ugly error 32602be438aSmrg # messages. 32702be438aSmrg if (gnutar --version > /dev/null 2>&1); then 32802be438aSmrg gnutar "$@" && exit 0 32902be438aSmrg fi 33002be438aSmrg if (gtar --version > /dev/null 2>&1); then 33102be438aSmrg gtar "$@" && exit 0 33202be438aSmrg fi 33302be438aSmrg firstarg="$1" 33402be438aSmrg if shift; then 335880ed95aSmrg case $firstarg in 33602be438aSmrg *o*) 33702be438aSmrg firstarg=`echo "$firstarg" | sed s/o//` 33802be438aSmrg tar "$firstarg" "$@" && exit 0 33902be438aSmrg ;; 34002be438aSmrg esac 341880ed95aSmrg case $firstarg in 34202be438aSmrg *h*) 34302be438aSmrg firstarg=`echo "$firstarg" | sed s/h//` 34402be438aSmrg tar "$firstarg" "$@" && exit 0 34502be438aSmrg ;; 34602be438aSmrg esac 34702be438aSmrg fi 34802be438aSmrg 34902be438aSmrg echo 1>&2 "\ 35002be438aSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 35102be438aSmrg You may want to install GNU tar or Free paxutils, or check the 35202be438aSmrg command line arguments." 35302be438aSmrg exit 1 35402be438aSmrg ;; 35502be438aSmrg 35602be438aSmrg *) 35702be438aSmrg echo 1>&2 "\ 35802be438aSmrgWARNING: \`$1' is needed, and is $msg. 35902be438aSmrg You might have modified some files without having the 36002be438aSmrg proper tools for further handling them. Check the \`README' file, 36102be438aSmrg it often tells you about the needed prerequisites for installing 36202be438aSmrg this package. You may also peek at any GNU archive site, in case 36302be438aSmrg some other package would contain this missing \`$1' program." 36402be438aSmrg exit 1 36502be438aSmrg ;; 36602be438aSmrgesac 36702be438aSmrg 36802be438aSmrgexit 0 36902be438aSmrg 37002be438aSmrg# Local variables: 37102be438aSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 37202be438aSmrg# time-stamp-start: "scriptversion=" 37302be438aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 37461dc2d86Smrg# time-stamp-time-zone: "UTC" 37561dc2d86Smrg# time-stamp-end: "; # UTC" 37602be438aSmrg# End: 377