missing revision 11d341ca
111d341caSmrg#! /bin/sh 211d341caSmrg# Common stub for a few missing GNU programs while installing. 311d341caSmrg 411d341caSmrgscriptversion=2005-06-08.21 511d341caSmrg 611d341caSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 711d341caSmrg# Free Software Foundation, Inc. 811d341caSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 911d341caSmrg 1011d341caSmrg# This program is free software; you can redistribute it and/or modify 1111d341caSmrg# it under the terms of the GNU General Public License as published by 1211d341caSmrg# the Free Software Foundation; either version 2, or (at your option) 1311d341caSmrg# any later version. 1411d341caSmrg 1511d341caSmrg# This program is distributed in the hope that it will be useful, 1611d341caSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1711d341caSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1811d341caSmrg# GNU General Public License for more details. 1911d341caSmrg 2011d341caSmrg# You should have received a copy of the GNU General Public License 2111d341caSmrg# along with this program; if not, write to the Free Software 2211d341caSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2311d341caSmrg# 02110-1301, USA. 2411d341caSmrg 2511d341caSmrg# As a special exception to the GNU General Public License, if you 2611d341caSmrg# distribute this file as part of a program that contains a 2711d341caSmrg# configuration script generated by Autoconf, you may include it under 2811d341caSmrg# the same distribution terms that you use for the rest of that program. 2911d341caSmrg 3011d341caSmrgif test $# -eq 0; then 3111d341caSmrg echo 1>&2 "Try \`$0 --help' for more information" 3211d341caSmrg exit 1 3311d341caSmrgfi 3411d341caSmrg 3511d341caSmrgrun=: 3611d341caSmrg 3711d341caSmrg# In the cases where this matters, `missing' is being run in the 3811d341caSmrg# srcdir already. 3911d341caSmrgif test -f configure.ac; then 4011d341caSmrg configure_ac=configure.ac 4111d341caSmrgelse 4211d341caSmrg configure_ac=configure.in 4311d341caSmrgfi 4411d341caSmrg 4511d341caSmrgmsg="missing on your system" 4611d341caSmrg 4711d341caSmrgcase "$1" in 4811d341caSmrg--run) 4911d341caSmrg # Try to run requested program, and just exit if it succeeds. 5011d341caSmrg run= 5111d341caSmrg shift 5211d341caSmrg "$@" && exit 0 5311d341caSmrg # Exit code 63 means version mismatch. This often happens 5411d341caSmrg # when the user try to use an ancient version of a tool on 5511d341caSmrg # a file that requires a minimum version. In this case we 5611d341caSmrg # we should proceed has if the program had been absent, or 5711d341caSmrg # if --run hadn't been passed. 5811d341caSmrg if test $? = 63; then 5911d341caSmrg run=: 6011d341caSmrg msg="probably too old" 6111d341caSmrg fi 6211d341caSmrg ;; 6311d341caSmrg 6411d341caSmrg -h|--h|--he|--hel|--help) 6511d341caSmrg echo "\ 6611d341caSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6711d341caSmrg 6811d341caSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6911d341caSmrgerror status if there is no known handling for PROGRAM. 7011d341caSmrg 7111d341caSmrgOptions: 7211d341caSmrg -h, --help display this help and exit 7311d341caSmrg -v, --version output version information and exit 7411d341caSmrg --run try to run the given command, and emulate it if it fails 7511d341caSmrg 7611d341caSmrgSupported PROGRAM values: 7711d341caSmrg aclocal touch file \`aclocal.m4' 7811d341caSmrg autoconf touch file \`configure' 7911d341caSmrg autoheader touch file \`config.h.in' 8011d341caSmrg automake touch all \`Makefile.in' files 8111d341caSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8211d341caSmrg flex create \`lex.yy.c', if possible, from existing .c 8311d341caSmrg help2man touch the output file 8411d341caSmrg lex create \`lex.yy.c', if possible, from existing .c 8511d341caSmrg makeinfo touch the output file 8611d341caSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 8711d341caSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8811d341caSmrg 8911d341caSmrgSend bug reports to <bug-automake@gnu.org>." 9011d341caSmrg exit $? 9111d341caSmrg ;; 9211d341caSmrg 9311d341caSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9411d341caSmrg echo "missing $scriptversion (GNU Automake)" 9511d341caSmrg exit $? 9611d341caSmrg ;; 9711d341caSmrg 9811d341caSmrg -*) 9911d341caSmrg echo 1>&2 "$0: Unknown \`$1' option" 10011d341caSmrg echo 1>&2 "Try \`$0 --help' for more information" 10111d341caSmrg exit 1 10211d341caSmrg ;; 10311d341caSmrg 10411d341caSmrgesac 10511d341caSmrg 10611d341caSmrg# Now exit if we have it, but it failed. Also exit now if we 10711d341caSmrg# don't have it and --version was passed (most likely to detect 10811d341caSmrg# the program). 10911d341caSmrgcase "$1" in 11011d341caSmrg lex|yacc) 11111d341caSmrg # Not GNU programs, they don't have --version. 11211d341caSmrg ;; 11311d341caSmrg 11411d341caSmrg tar) 11511d341caSmrg if test -n "$run"; then 11611d341caSmrg echo 1>&2 "ERROR: \`tar' requires --run" 11711d341caSmrg exit 1 11811d341caSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 11911d341caSmrg exit 1 12011d341caSmrg fi 12111d341caSmrg ;; 12211d341caSmrg 12311d341caSmrg *) 12411d341caSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 12511d341caSmrg # We have it, but it failed. 12611d341caSmrg exit 1 12711d341caSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 12811d341caSmrg # Could not run --version or --help. This is probably someone 12911d341caSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 13011d341caSmrg # $TOOL exists and not knowing $TOOL uses missing. 13111d341caSmrg exit 1 13211d341caSmrg fi 13311d341caSmrg ;; 13411d341caSmrgesac 13511d341caSmrg 13611d341caSmrg# If it does not exist, or fails to run (possibly an outdated version), 13711d341caSmrg# try to emulate it. 13811d341caSmrgcase "$1" in 13911d341caSmrg aclocal*) 14011d341caSmrg echo 1>&2 "\ 14111d341caSmrgWARNING: \`$1' is $msg. You should only need it if 14211d341caSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 14311d341caSmrg to install the \`Automake' and \`Perl' packages. Grab them from 14411d341caSmrg any GNU archive site." 14511d341caSmrg touch aclocal.m4 14611d341caSmrg ;; 14711d341caSmrg 14811d341caSmrg autoconf) 14911d341caSmrg echo 1>&2 "\ 15011d341caSmrgWARNING: \`$1' is $msg. You should only need it if 15111d341caSmrg you modified \`${configure_ac}'. You might want to install the 15211d341caSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 15311d341caSmrg archive site." 15411d341caSmrg touch configure 15511d341caSmrg ;; 15611d341caSmrg 15711d341caSmrg autoheader) 15811d341caSmrg echo 1>&2 "\ 15911d341caSmrgWARNING: \`$1' is $msg. You should only need it if 16011d341caSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 16111d341caSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 16211d341caSmrg from any GNU archive site." 16311d341caSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 16411d341caSmrg test -z "$files" && files="config.h" 16511d341caSmrg touch_files= 16611d341caSmrg for f in $files; do 16711d341caSmrg case "$f" in 16811d341caSmrg *:*) touch_files="$touch_files "`echo "$f" | 16911d341caSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 17011d341caSmrg *) touch_files="$touch_files $f.in";; 17111d341caSmrg esac 17211d341caSmrg done 17311d341caSmrg touch $touch_files 17411d341caSmrg ;; 17511d341caSmrg 17611d341caSmrg automake*) 17711d341caSmrg echo 1>&2 "\ 17811d341caSmrgWARNING: \`$1' is $msg. You should only need it if 17911d341caSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 18011d341caSmrg You might want to install the \`Automake' and \`Perl' packages. 18111d341caSmrg Grab them from any GNU archive site." 18211d341caSmrg find . -type f -name Makefile.am -print | 18311d341caSmrg sed 's/\.am$/.in/' | 18411d341caSmrg while read f; do touch "$f"; done 18511d341caSmrg ;; 18611d341caSmrg 18711d341caSmrg autom4te) 18811d341caSmrg echo 1>&2 "\ 18911d341caSmrgWARNING: \`$1' is needed, but is $msg. 19011d341caSmrg You might have modified some files without having the 19111d341caSmrg proper tools for further handling them. 19211d341caSmrg You can get \`$1' as part of \`Autoconf' from any GNU 19311d341caSmrg archive site." 19411d341caSmrg 19511d341caSmrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 19611d341caSmrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 19711d341caSmrg if test -f "$file"; then 19811d341caSmrg touch $file 19911d341caSmrg else 20011d341caSmrg test -z "$file" || exec >$file 20111d341caSmrg echo "#! /bin/sh" 20211d341caSmrg echo "# Created by GNU Automake missing as a replacement of" 20311d341caSmrg echo "# $ $@" 20411d341caSmrg echo "exit 0" 20511d341caSmrg chmod +x $file 20611d341caSmrg exit 1 20711d341caSmrg fi 20811d341caSmrg ;; 20911d341caSmrg 21011d341caSmrg bison|yacc) 21111d341caSmrg echo 1>&2 "\ 21211d341caSmrgWARNING: \`$1' $msg. You should only need it if 21311d341caSmrg you modified a \`.y' file. You may need the \`Bison' package 21411d341caSmrg in order for those modifications to take effect. You can get 21511d341caSmrg \`Bison' from any GNU archive site." 21611d341caSmrg rm -f y.tab.c y.tab.h 21711d341caSmrg if [ $# -ne 1 ]; then 21811d341caSmrg eval LASTARG="\${$#}" 21911d341caSmrg case "$LASTARG" in 22011d341caSmrg *.y) 22111d341caSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 22211d341caSmrg if [ -f "$SRCFILE" ]; then 22311d341caSmrg cp "$SRCFILE" y.tab.c 22411d341caSmrg fi 22511d341caSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 22611d341caSmrg if [ -f "$SRCFILE" ]; then 22711d341caSmrg cp "$SRCFILE" y.tab.h 22811d341caSmrg fi 22911d341caSmrg ;; 23011d341caSmrg esac 23111d341caSmrg fi 23211d341caSmrg if [ ! -f y.tab.h ]; then 23311d341caSmrg echo >y.tab.h 23411d341caSmrg fi 23511d341caSmrg if [ ! -f y.tab.c ]; then 23611d341caSmrg echo 'main() { return 0; }' >y.tab.c 23711d341caSmrg fi 23811d341caSmrg ;; 23911d341caSmrg 24011d341caSmrg lex|flex) 24111d341caSmrg echo 1>&2 "\ 24211d341caSmrgWARNING: \`$1' is $msg. You should only need it if 24311d341caSmrg you modified a \`.l' file. You may need the \`Flex' package 24411d341caSmrg in order for those modifications to take effect. You can get 24511d341caSmrg \`Flex' from any GNU archive site." 24611d341caSmrg rm -f lex.yy.c 24711d341caSmrg if [ $# -ne 1 ]; then 24811d341caSmrg eval LASTARG="\${$#}" 24911d341caSmrg case "$LASTARG" in 25011d341caSmrg *.l) 25111d341caSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 25211d341caSmrg if [ -f "$SRCFILE" ]; then 25311d341caSmrg cp "$SRCFILE" lex.yy.c 25411d341caSmrg fi 25511d341caSmrg ;; 25611d341caSmrg esac 25711d341caSmrg fi 25811d341caSmrg if [ ! -f lex.yy.c ]; then 25911d341caSmrg echo 'main() { return 0; }' >lex.yy.c 26011d341caSmrg fi 26111d341caSmrg ;; 26211d341caSmrg 26311d341caSmrg help2man) 26411d341caSmrg echo 1>&2 "\ 26511d341caSmrgWARNING: \`$1' is $msg. You should only need it if 26611d341caSmrg you modified a dependency of a manual page. You may need the 26711d341caSmrg \`Help2man' package in order for those modifications to take 26811d341caSmrg effect. You can get \`Help2man' from any GNU archive site." 26911d341caSmrg 27011d341caSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 27111d341caSmrg if test -z "$file"; then 27211d341caSmrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 27311d341caSmrg fi 27411d341caSmrg if [ -f "$file" ]; then 27511d341caSmrg touch $file 27611d341caSmrg else 27711d341caSmrg test -z "$file" || exec >$file 27811d341caSmrg echo ".ab help2man is required to generate this page" 27911d341caSmrg exit 1 28011d341caSmrg fi 28111d341caSmrg ;; 28211d341caSmrg 28311d341caSmrg makeinfo) 28411d341caSmrg echo 1>&2 "\ 28511d341caSmrgWARNING: \`$1' is $msg. You should only need it if 28611d341caSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 28711d341caSmrg indirectly affecting the aspect of the manual. The spurious 28811d341caSmrg call might also be the consequence of using a buggy \`make' (AIX, 28911d341caSmrg DU, IRIX). You might want to install the \`Texinfo' package or 29011d341caSmrg the \`GNU make' package. Grab either from any GNU archive site." 29111d341caSmrg # The file to touch is that specified with -o ... 29211d341caSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 29311d341caSmrg if test -z "$file"; then 29411d341caSmrg # ... or it is the one specified with @setfilename ... 29511d341caSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 29611d341caSmrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 29711d341caSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 29811d341caSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 29911d341caSmrg fi 30011d341caSmrg # If the file does not exist, the user really needs makeinfo; 30111d341caSmrg # let's fail without touching anything. 30211d341caSmrg test -f $file || exit 1 30311d341caSmrg touch $file 30411d341caSmrg ;; 30511d341caSmrg 30611d341caSmrg tar) 30711d341caSmrg shift 30811d341caSmrg 30911d341caSmrg # We have already tried tar in the generic part. 31011d341caSmrg # Look for gnutar/gtar before invocation to avoid ugly error 31111d341caSmrg # messages. 31211d341caSmrg if (gnutar --version > /dev/null 2>&1); then 31311d341caSmrg gnutar "$@" && exit 0 31411d341caSmrg fi 31511d341caSmrg if (gtar --version > /dev/null 2>&1); then 31611d341caSmrg gtar "$@" && exit 0 31711d341caSmrg fi 31811d341caSmrg firstarg="$1" 31911d341caSmrg if shift; then 32011d341caSmrg case "$firstarg" in 32111d341caSmrg *o*) 32211d341caSmrg firstarg=`echo "$firstarg" | sed s/o//` 32311d341caSmrg tar "$firstarg" "$@" && exit 0 32411d341caSmrg ;; 32511d341caSmrg esac 32611d341caSmrg case "$firstarg" in 32711d341caSmrg *h*) 32811d341caSmrg firstarg=`echo "$firstarg" | sed s/h//` 32911d341caSmrg tar "$firstarg" "$@" && exit 0 33011d341caSmrg ;; 33111d341caSmrg esac 33211d341caSmrg fi 33311d341caSmrg 33411d341caSmrg echo 1>&2 "\ 33511d341caSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 33611d341caSmrg You may want to install GNU tar or Free paxutils, or check the 33711d341caSmrg command line arguments." 33811d341caSmrg exit 1 33911d341caSmrg ;; 34011d341caSmrg 34111d341caSmrg *) 34211d341caSmrg echo 1>&2 "\ 34311d341caSmrgWARNING: \`$1' is needed, and is $msg. 34411d341caSmrg You might have modified some files without having the 34511d341caSmrg proper tools for further handling them. Check the \`README' file, 34611d341caSmrg it often tells you about the needed prerequisites for installing 34711d341caSmrg this package. You may also peek at any GNU archive site, in case 34811d341caSmrg some other package would contain this missing \`$1' program." 34911d341caSmrg exit 1 35011d341caSmrg ;; 35111d341caSmrgesac 35211d341caSmrg 35311d341caSmrgexit 0 35411d341caSmrg 35511d341caSmrg# Local variables: 35611d341caSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 35711d341caSmrg# time-stamp-start: "scriptversion=" 35811d341caSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 35911d341caSmrg# time-stamp-end: "$" 36011d341caSmrg# End: 361