191a17321Smrg#! /bin/sh 291a17321Smrg# Common stub for a few missing GNU programs while installing. 391a17321Smrg 491a17321Smrgscriptversion=2005-06-08.21 591a17321Smrg 691a17321Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 791a17321Smrg# Free Software Foundation, Inc. 891a17321Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 991a17321Smrg 1091a17321Smrg# This program is free software; you can redistribute it and/or modify 1191a17321Smrg# it under the terms of the GNU General Public License as published by 1291a17321Smrg# the Free Software Foundation; either version 2, or (at your option) 1391a17321Smrg# any later version. 1491a17321Smrg 1591a17321Smrg# This program is distributed in the hope that it will be useful, 1691a17321Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1791a17321Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1891a17321Smrg# GNU General Public License for more details. 1991a17321Smrg 2091a17321Smrg# You should have received a copy of the GNU General Public License 2191a17321Smrg# along with this program; if not, write to the Free Software 2291a17321Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2391a17321Smrg# 02110-1301, USA. 2491a17321Smrg 2591a17321Smrg# As a special exception to the GNU General Public License, if you 2691a17321Smrg# distribute this file as part of a program that contains a 2791a17321Smrg# configuration script generated by Autoconf, you may include it under 2891a17321Smrg# the same distribution terms that you use for the rest of that program. 2991a17321Smrg 3091a17321Smrgif test $# -eq 0; then 3191a17321Smrg echo 1>&2 "Try \`$0 --help' for more information" 3291a17321Smrg exit 1 3391a17321Smrgfi 3491a17321Smrg 3591a17321Smrgrun=: 3691a17321Smrg 3791a17321Smrg# In the cases where this matters, `missing' is being run in the 3891a17321Smrg# srcdir already. 3991a17321Smrgif test -f configure.ac; then 4091a17321Smrg configure_ac=configure.ac 4191a17321Smrgelse 4291a17321Smrg configure_ac=configure.in 4391a17321Smrgfi 4491a17321Smrg 4591a17321Smrgmsg="missing on your system" 4691a17321Smrg 4791a17321Smrgcase "$1" in 4891a17321Smrg--run) 4991a17321Smrg # Try to run requested program, and just exit if it succeeds. 5091a17321Smrg run= 5191a17321Smrg shift 5291a17321Smrg "$@" && exit 0 5391a17321Smrg # Exit code 63 means version mismatch. This often happens 5491a17321Smrg # when the user try to use an ancient version of a tool on 5591a17321Smrg # a file that requires a minimum version. In this case we 5691a17321Smrg # we should proceed has if the program had been absent, or 5791a17321Smrg # if --run hadn't been passed. 5891a17321Smrg if test $? = 63; then 5991a17321Smrg run=: 6091a17321Smrg msg="probably too old" 6191a17321Smrg fi 6291a17321Smrg ;; 6391a17321Smrg 6491a17321Smrg -h|--h|--he|--hel|--help) 6591a17321Smrg echo "\ 6691a17321Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6791a17321Smrg 6891a17321SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6991a17321Smrgerror status if there is no known handling for PROGRAM. 7091a17321Smrg 7191a17321SmrgOptions: 7291a17321Smrg -h, --help display this help and exit 7391a17321Smrg -v, --version output version information and exit 7491a17321Smrg --run try to run the given command, and emulate it if it fails 7591a17321Smrg 7691a17321SmrgSupported PROGRAM values: 7791a17321Smrg aclocal touch file \`aclocal.m4' 7891a17321Smrg autoconf touch file \`configure' 7991a17321Smrg autoheader touch file \`config.h.in' 8091a17321Smrg automake touch all \`Makefile.in' files 8191a17321Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8291a17321Smrg flex create \`lex.yy.c', if possible, from existing .c 8391a17321Smrg help2man touch the output file 8491a17321Smrg lex create \`lex.yy.c', if possible, from existing .c 8591a17321Smrg makeinfo touch the output file 8691a17321Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 8791a17321Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8891a17321Smrg 8991a17321SmrgSend bug reports to <bug-automake@gnu.org>." 9091a17321Smrg exit $? 9191a17321Smrg ;; 9291a17321Smrg 9391a17321Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9491a17321Smrg echo "missing $scriptversion (GNU Automake)" 9591a17321Smrg exit $? 9691a17321Smrg ;; 9791a17321Smrg 9891a17321Smrg -*) 9991a17321Smrg echo 1>&2 "$0: Unknown \`$1' option" 10091a17321Smrg echo 1>&2 "Try \`$0 --help' for more information" 10191a17321Smrg exit 1 10291a17321Smrg ;; 10391a17321Smrg 10491a17321Smrgesac 10591a17321Smrg 10691a17321Smrg# Now exit if we have it, but it failed. Also exit now if we 10791a17321Smrg# don't have it and --version was passed (most likely to detect 10891a17321Smrg# the program). 10991a17321Smrgcase "$1" in 11091a17321Smrg lex|yacc) 11191a17321Smrg # Not GNU programs, they don't have --version. 11291a17321Smrg ;; 11391a17321Smrg 11491a17321Smrg tar) 11591a17321Smrg if test -n "$run"; then 11691a17321Smrg echo 1>&2 "ERROR: \`tar' requires --run" 11791a17321Smrg exit 1 11891a17321Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 11991a17321Smrg exit 1 12091a17321Smrg fi 12191a17321Smrg ;; 12291a17321Smrg 12391a17321Smrg *) 12491a17321Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 12591a17321Smrg # We have it, but it failed. 12691a17321Smrg exit 1 12791a17321Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 12891a17321Smrg # Could not run --version or --help. This is probably someone 12991a17321Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 13091a17321Smrg # $TOOL exists and not knowing $TOOL uses missing. 13191a17321Smrg exit 1 13291a17321Smrg fi 13391a17321Smrg ;; 13491a17321Smrgesac 13591a17321Smrg 13691a17321Smrg# If it does not exist, or fails to run (possibly an outdated version), 13791a17321Smrg# try to emulate it. 13891a17321Smrgcase "$1" in 13991a17321Smrg aclocal*) 14091a17321Smrg echo 1>&2 "\ 14191a17321SmrgWARNING: \`$1' is $msg. You should only need it if 14291a17321Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 14391a17321Smrg to install the \`Automake' and \`Perl' packages. Grab them from 14491a17321Smrg any GNU archive site." 14591a17321Smrg touch aclocal.m4 14691a17321Smrg ;; 14791a17321Smrg 14891a17321Smrg autoconf) 14991a17321Smrg echo 1>&2 "\ 15091a17321SmrgWARNING: \`$1' is $msg. You should only need it if 15191a17321Smrg you modified \`${configure_ac}'. You might want to install the 15291a17321Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 15391a17321Smrg archive site." 15491a17321Smrg touch configure 15591a17321Smrg ;; 15691a17321Smrg 15791a17321Smrg autoheader) 15891a17321Smrg echo 1>&2 "\ 15991a17321SmrgWARNING: \`$1' is $msg. You should only need it if 16091a17321Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 16191a17321Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 16291a17321Smrg from any GNU archive site." 16391a17321Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 16491a17321Smrg test -z "$files" && files="config.h" 16591a17321Smrg touch_files= 16691a17321Smrg for f in $files; do 16791a17321Smrg case "$f" in 16891a17321Smrg *:*) touch_files="$touch_files "`echo "$f" | 16991a17321Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 17091a17321Smrg *) touch_files="$touch_files $f.in";; 17191a17321Smrg esac 17291a17321Smrg done 17391a17321Smrg touch $touch_files 17491a17321Smrg ;; 17591a17321Smrg 17691a17321Smrg automake*) 17791a17321Smrg echo 1>&2 "\ 17891a17321SmrgWARNING: \`$1' is $msg. You should only need it if 17991a17321Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 18091a17321Smrg You might want to install the \`Automake' and \`Perl' packages. 18191a17321Smrg Grab them from any GNU archive site." 18291a17321Smrg find . -type f -name Makefile.am -print | 18391a17321Smrg sed 's/\.am$/.in/' | 18491a17321Smrg while read f; do touch "$f"; done 18591a17321Smrg ;; 18691a17321Smrg 18791a17321Smrg autom4te) 18891a17321Smrg echo 1>&2 "\ 18991a17321SmrgWARNING: \`$1' is needed, but is $msg. 19091a17321Smrg You might have modified some files without having the 19191a17321Smrg proper tools for further handling them. 19291a17321Smrg You can get \`$1' as part of \`Autoconf' from any GNU 19391a17321Smrg archive site." 19491a17321Smrg 19591a17321Smrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 19691a17321Smrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 19791a17321Smrg if test -f "$file"; then 19891a17321Smrg touch $file 19991a17321Smrg else 20091a17321Smrg test -z "$file" || exec >$file 20191a17321Smrg echo "#! /bin/sh" 20291a17321Smrg echo "# Created by GNU Automake missing as a replacement of" 20391a17321Smrg echo "# $ $@" 20491a17321Smrg echo "exit 0" 20591a17321Smrg chmod +x $file 20691a17321Smrg exit 1 20791a17321Smrg fi 20891a17321Smrg ;; 20991a17321Smrg 21091a17321Smrg bison|yacc) 21191a17321Smrg echo 1>&2 "\ 21291a17321SmrgWARNING: \`$1' $msg. You should only need it if 21391a17321Smrg you modified a \`.y' file. You may need the \`Bison' package 21491a17321Smrg in order for those modifications to take effect. You can get 21591a17321Smrg \`Bison' from any GNU archive site." 21691a17321Smrg rm -f y.tab.c y.tab.h 21791a17321Smrg if [ $# -ne 1 ]; then 21891a17321Smrg eval LASTARG="\${$#}" 21991a17321Smrg case "$LASTARG" in 22091a17321Smrg *.y) 22191a17321Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 22291a17321Smrg if [ -f "$SRCFILE" ]; then 22391a17321Smrg cp "$SRCFILE" y.tab.c 22491a17321Smrg fi 22591a17321Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 22691a17321Smrg if [ -f "$SRCFILE" ]; then 22791a17321Smrg cp "$SRCFILE" y.tab.h 22891a17321Smrg fi 22991a17321Smrg ;; 23091a17321Smrg esac 23191a17321Smrg fi 23291a17321Smrg if [ ! -f y.tab.h ]; then 23391a17321Smrg echo >y.tab.h 23491a17321Smrg fi 23591a17321Smrg if [ ! -f y.tab.c ]; then 23691a17321Smrg echo 'main() { return 0; }' >y.tab.c 23791a17321Smrg fi 23891a17321Smrg ;; 23991a17321Smrg 24091a17321Smrg lex|flex) 24191a17321Smrg echo 1>&2 "\ 24291a17321SmrgWARNING: \`$1' is $msg. You should only need it if 24391a17321Smrg you modified a \`.l' file. You may need the \`Flex' package 24491a17321Smrg in order for those modifications to take effect. You can get 24591a17321Smrg \`Flex' from any GNU archive site." 24691a17321Smrg rm -f lex.yy.c 24791a17321Smrg if [ $# -ne 1 ]; then 24891a17321Smrg eval LASTARG="\${$#}" 24991a17321Smrg case "$LASTARG" in 25091a17321Smrg *.l) 25191a17321Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 25291a17321Smrg if [ -f "$SRCFILE" ]; then 25391a17321Smrg cp "$SRCFILE" lex.yy.c 25491a17321Smrg fi 25591a17321Smrg ;; 25691a17321Smrg esac 25791a17321Smrg fi 25891a17321Smrg if [ ! -f lex.yy.c ]; then 25991a17321Smrg echo 'main() { return 0; }' >lex.yy.c 26091a17321Smrg fi 26191a17321Smrg ;; 26291a17321Smrg 26391a17321Smrg help2man) 26491a17321Smrg echo 1>&2 "\ 26591a17321SmrgWARNING: \`$1' is $msg. You should only need it if 26691a17321Smrg you modified a dependency of a manual page. You may need the 26791a17321Smrg \`Help2man' package in order for those modifications to take 26891a17321Smrg effect. You can get \`Help2man' from any GNU archive site." 26991a17321Smrg 27091a17321Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 27191a17321Smrg if test -z "$file"; then 27291a17321Smrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 27391a17321Smrg fi 27491a17321Smrg if [ -f "$file" ]; then 27591a17321Smrg touch $file 27691a17321Smrg else 27791a17321Smrg test -z "$file" || exec >$file 27891a17321Smrg echo ".ab help2man is required to generate this page" 27991a17321Smrg exit 1 28091a17321Smrg fi 28191a17321Smrg ;; 28291a17321Smrg 28391a17321Smrg makeinfo) 28491a17321Smrg echo 1>&2 "\ 28591a17321SmrgWARNING: \`$1' is $msg. You should only need it if 28691a17321Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 28791a17321Smrg indirectly affecting the aspect of the manual. The spurious 28891a17321Smrg call might also be the consequence of using a buggy \`make' (AIX, 28991a17321Smrg DU, IRIX). You might want to install the \`Texinfo' package or 29091a17321Smrg the \`GNU make' package. Grab either from any GNU archive site." 29191a17321Smrg # The file to touch is that specified with -o ... 29291a17321Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 29391a17321Smrg if test -z "$file"; then 29491a17321Smrg # ... or it is the one specified with @setfilename ... 29591a17321Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 29691a17321Smrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 29791a17321Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 29891a17321Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 29991a17321Smrg fi 30091a17321Smrg # If the file does not exist, the user really needs makeinfo; 30191a17321Smrg # let's fail without touching anything. 30291a17321Smrg test -f $file || exit 1 30391a17321Smrg touch $file 30491a17321Smrg ;; 30591a17321Smrg 30691a17321Smrg tar) 30791a17321Smrg shift 30891a17321Smrg 30991a17321Smrg # We have already tried tar in the generic part. 31091a17321Smrg # Look for gnutar/gtar before invocation to avoid ugly error 31191a17321Smrg # messages. 31291a17321Smrg if (gnutar --version > /dev/null 2>&1); then 31391a17321Smrg gnutar "$@" && exit 0 31491a17321Smrg fi 31591a17321Smrg if (gtar --version > /dev/null 2>&1); then 31691a17321Smrg gtar "$@" && exit 0 31791a17321Smrg fi 31891a17321Smrg firstarg="$1" 31991a17321Smrg if shift; then 32091a17321Smrg case "$firstarg" in 32191a17321Smrg *o*) 32291a17321Smrg firstarg=`echo "$firstarg" | sed s/o//` 32391a17321Smrg tar "$firstarg" "$@" && exit 0 32491a17321Smrg ;; 32591a17321Smrg esac 32691a17321Smrg case "$firstarg" in 32791a17321Smrg *h*) 32891a17321Smrg firstarg=`echo "$firstarg" | sed s/h//` 32991a17321Smrg tar "$firstarg" "$@" && exit 0 33091a17321Smrg ;; 33191a17321Smrg esac 33291a17321Smrg fi 33391a17321Smrg 33491a17321Smrg echo 1>&2 "\ 33591a17321SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 33691a17321Smrg You may want to install GNU tar or Free paxutils, or check the 33791a17321Smrg command line arguments." 33891a17321Smrg exit 1 33991a17321Smrg ;; 34091a17321Smrg 34191a17321Smrg *) 34291a17321Smrg echo 1>&2 "\ 34391a17321SmrgWARNING: \`$1' is needed, and is $msg. 34491a17321Smrg You might have modified some files without having the 34591a17321Smrg proper tools for further handling them. Check the \`README' file, 34691a17321Smrg it often tells you about the needed prerequisites for installing 34791a17321Smrg this package. You may also peek at any GNU archive site, in case 34891a17321Smrg some other package would contain this missing \`$1' program." 34991a17321Smrg exit 1 35091a17321Smrg ;; 35191a17321Smrgesac 35291a17321Smrg 35391a17321Smrgexit 0 35491a17321Smrg 35591a17321Smrg# Local variables: 35691a17321Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 35791a17321Smrg# time-stamp-start: "scriptversion=" 35891a17321Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 35991a17321Smrg# time-stamp-end: "$" 36091a17321Smrg# End: 361