missing revision 4c61c93d
111d341caSmrg#! /bin/sh 211d341caSmrg# Common stub for a few missing GNU programs while installing. 311d341caSmrg 44c61c93dSmrgscriptversion=2009-04-28.21; # UTC 511d341caSmrg 64c61c93dSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 74c61c93dSmrg# 2008, 2009 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 214c61c93dSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2211d341caSmrg 2311d341caSmrg# As a special exception to the GNU General Public License, if you 2411d341caSmrg# distribute this file as part of a program that contains a 2511d341caSmrg# configuration script generated by Autoconf, you may include it under 2611d341caSmrg# the same distribution terms that you use for the rest of that program. 2711d341caSmrg 2811d341caSmrgif test $# -eq 0; then 2911d341caSmrg echo 1>&2 "Try \`$0 --help' for more information" 3011d341caSmrg exit 1 3111d341caSmrgfi 3211d341caSmrg 3311d341caSmrgrun=: 344c61c93dSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 354c61c93dSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 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 474c61c93dSmrgcase $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' 804c61c93dSmrg autom4te touch the output file, or create a stub one 8111d341caSmrg automake touch all \`Makefile.in' files 8211d341caSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8311d341caSmrg flex create \`lex.yy.c', if possible, from existing .c 8411d341caSmrg help2man touch the output file 8511d341caSmrg lex create \`lex.yy.c', if possible, from existing .c 8611d341caSmrg makeinfo touch the output file 8711d341caSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 8811d341caSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8911d341caSmrg 904c61c93dSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 914c61c93dSmrg\`g' are ignored when checking the name. 924c61c93dSmrg 9311d341caSmrgSend bug reports to <bug-automake@gnu.org>." 9411d341caSmrg exit $? 9511d341caSmrg ;; 9611d341caSmrg 9711d341caSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9811d341caSmrg echo "missing $scriptversion (GNU Automake)" 9911d341caSmrg exit $? 10011d341caSmrg ;; 10111d341caSmrg 10211d341caSmrg -*) 10311d341caSmrg echo 1>&2 "$0: Unknown \`$1' option" 10411d341caSmrg echo 1>&2 "Try \`$0 --help' for more information" 10511d341caSmrg exit 1 10611d341caSmrg ;; 10711d341caSmrg 10811d341caSmrgesac 10911d341caSmrg 1104c61c93dSmrg# normalize program name to check for. 1114c61c93dSmrgprogram=`echo "$1" | sed ' 1124c61c93dSmrg s/^gnu-//; t 1134c61c93dSmrg s/^gnu//; t 1144c61c93dSmrg s/^g//; t'` 1154c61c93dSmrg 11611d341caSmrg# Now exit if we have it, but it failed. Also exit now if we 11711d341caSmrg# don't have it and --version was passed (most likely to detect 1184c61c93dSmrg# the program). This is about non-GNU programs, so use $1 not 1194c61c93dSmrg# $program. 1204c61c93dSmrgcase $1 in 1214c61c93dSmrg lex*|yacc*) 12211d341caSmrg # Not GNU programs, they don't have --version. 12311d341caSmrg ;; 12411d341caSmrg 1254c61c93dSmrg tar*) 12611d341caSmrg if test -n "$run"; then 12711d341caSmrg echo 1>&2 "ERROR: \`tar' requires --run" 12811d341caSmrg exit 1 12911d341caSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13011d341caSmrg exit 1 13111d341caSmrg fi 13211d341caSmrg ;; 13311d341caSmrg 13411d341caSmrg *) 13511d341caSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 13611d341caSmrg # We have it, but it failed. 13711d341caSmrg exit 1 13811d341caSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13911d341caSmrg # Could not run --version or --help. This is probably someone 14011d341caSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 14111d341caSmrg # $TOOL exists and not knowing $TOOL uses missing. 14211d341caSmrg exit 1 14311d341caSmrg fi 14411d341caSmrg ;; 14511d341caSmrgesac 14611d341caSmrg 14711d341caSmrg# If it does not exist, or fails to run (possibly an outdated version), 14811d341caSmrg# try to emulate it. 1494c61c93dSmrgcase $program in 15011d341caSmrg aclocal*) 15111d341caSmrg echo 1>&2 "\ 15211d341caSmrgWARNING: \`$1' is $msg. You should only need it if 15311d341caSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 15411d341caSmrg to install the \`Automake' and \`Perl' packages. Grab them from 15511d341caSmrg any GNU archive site." 15611d341caSmrg touch aclocal.m4 15711d341caSmrg ;; 15811d341caSmrg 1594c61c93dSmrg autoconf*) 16011d341caSmrg echo 1>&2 "\ 16111d341caSmrgWARNING: \`$1' is $msg. You should only need it if 16211d341caSmrg you modified \`${configure_ac}'. You might want to install the 16311d341caSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 16411d341caSmrg archive site." 16511d341caSmrg touch configure 16611d341caSmrg ;; 16711d341caSmrg 1684c61c93dSmrg autoheader*) 16911d341caSmrg echo 1>&2 "\ 17011d341caSmrgWARNING: \`$1' is $msg. You should only need it if 17111d341caSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 17211d341caSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 17311d341caSmrg from any GNU archive site." 17411d341caSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 17511d341caSmrg test -z "$files" && files="config.h" 17611d341caSmrg touch_files= 17711d341caSmrg for f in $files; do 1784c61c93dSmrg case $f in 17911d341caSmrg *:*) touch_files="$touch_files "`echo "$f" | 18011d341caSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 18111d341caSmrg *) touch_files="$touch_files $f.in";; 18211d341caSmrg esac 18311d341caSmrg done 18411d341caSmrg touch $touch_files 18511d341caSmrg ;; 18611d341caSmrg 18711d341caSmrg automake*) 18811d341caSmrg echo 1>&2 "\ 18911d341caSmrgWARNING: \`$1' is $msg. You should only need it if 19011d341caSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 19111d341caSmrg You might want to install the \`Automake' and \`Perl' packages. 19211d341caSmrg Grab them from any GNU archive site." 19311d341caSmrg find . -type f -name Makefile.am -print | 19411d341caSmrg sed 's/\.am$/.in/' | 19511d341caSmrg while read f; do touch "$f"; done 19611d341caSmrg ;; 19711d341caSmrg 1984c61c93dSmrg autom4te*) 19911d341caSmrg echo 1>&2 "\ 20011d341caSmrgWARNING: \`$1' is needed, but is $msg. 20111d341caSmrg You might have modified some files without having the 20211d341caSmrg proper tools for further handling them. 20311d341caSmrg You can get \`$1' as part of \`Autoconf' from any GNU 20411d341caSmrg archive site." 20511d341caSmrg 2064c61c93dSmrg file=`echo "$*" | sed -n "$sed_output"` 2074c61c93dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 20811d341caSmrg if test -f "$file"; then 20911d341caSmrg touch $file 21011d341caSmrg else 21111d341caSmrg test -z "$file" || exec >$file 21211d341caSmrg echo "#! /bin/sh" 21311d341caSmrg echo "# Created by GNU Automake missing as a replacement of" 21411d341caSmrg echo "# $ $@" 21511d341caSmrg echo "exit 0" 21611d341caSmrg chmod +x $file 21711d341caSmrg exit 1 21811d341caSmrg fi 21911d341caSmrg ;; 22011d341caSmrg 2214c61c93dSmrg bison*|yacc*) 22211d341caSmrg echo 1>&2 "\ 22311d341caSmrgWARNING: \`$1' $msg. You should only need it if 22411d341caSmrg you modified a \`.y' file. You may need the \`Bison' package 22511d341caSmrg in order for those modifications to take effect. You can get 22611d341caSmrg \`Bison' from any GNU archive site." 22711d341caSmrg rm -f y.tab.c y.tab.h 2284c61c93dSmrg if test $# -ne 1; then 22911d341caSmrg eval LASTARG="\${$#}" 2304c61c93dSmrg case $LASTARG in 23111d341caSmrg *.y) 23211d341caSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2334c61c93dSmrg if test -f "$SRCFILE"; then 23411d341caSmrg cp "$SRCFILE" y.tab.c 23511d341caSmrg fi 23611d341caSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2374c61c93dSmrg if test -f "$SRCFILE"; then 23811d341caSmrg cp "$SRCFILE" y.tab.h 23911d341caSmrg fi 24011d341caSmrg ;; 24111d341caSmrg esac 24211d341caSmrg fi 2434c61c93dSmrg if test ! -f y.tab.h; then 24411d341caSmrg echo >y.tab.h 24511d341caSmrg fi 2464c61c93dSmrg if test ! -f y.tab.c; then 24711d341caSmrg echo 'main() { return 0; }' >y.tab.c 24811d341caSmrg fi 24911d341caSmrg ;; 25011d341caSmrg 2514c61c93dSmrg lex*|flex*) 25211d341caSmrg echo 1>&2 "\ 25311d341caSmrgWARNING: \`$1' is $msg. You should only need it if 25411d341caSmrg you modified a \`.l' file. You may need the \`Flex' package 25511d341caSmrg in order for those modifications to take effect. You can get 25611d341caSmrg \`Flex' from any GNU archive site." 25711d341caSmrg rm -f lex.yy.c 2584c61c93dSmrg if test $# -ne 1; then 25911d341caSmrg eval LASTARG="\${$#}" 2604c61c93dSmrg case $LASTARG in 26111d341caSmrg *.l) 26211d341caSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2634c61c93dSmrg if test -f "$SRCFILE"; then 26411d341caSmrg cp "$SRCFILE" lex.yy.c 26511d341caSmrg fi 26611d341caSmrg ;; 26711d341caSmrg esac 26811d341caSmrg fi 2694c61c93dSmrg if test ! -f lex.yy.c; then 27011d341caSmrg echo 'main() { return 0; }' >lex.yy.c 27111d341caSmrg fi 27211d341caSmrg ;; 27311d341caSmrg 2744c61c93dSmrg help2man*) 27511d341caSmrg echo 1>&2 "\ 27611d341caSmrgWARNING: \`$1' is $msg. You should only need it if 27711d341caSmrg you modified a dependency of a manual page. You may need the 27811d341caSmrg \`Help2man' package in order for those modifications to take 27911d341caSmrg effect. You can get \`Help2man' from any GNU archive site." 28011d341caSmrg 2814c61c93dSmrg file=`echo "$*" | sed -n "$sed_output"` 2824c61c93dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2834c61c93dSmrg if test -f "$file"; then 28411d341caSmrg touch $file 28511d341caSmrg else 28611d341caSmrg test -z "$file" || exec >$file 28711d341caSmrg echo ".ab help2man is required to generate this page" 2884c61c93dSmrg exit $? 28911d341caSmrg fi 29011d341caSmrg ;; 29111d341caSmrg 2924c61c93dSmrg makeinfo*) 29311d341caSmrg echo 1>&2 "\ 29411d341caSmrgWARNING: \`$1' is $msg. You should only need it if 29511d341caSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 29611d341caSmrg indirectly affecting the aspect of the manual. The spurious 29711d341caSmrg call might also be the consequence of using a buggy \`make' (AIX, 29811d341caSmrg DU, IRIX). You might want to install the \`Texinfo' package or 29911d341caSmrg the \`GNU make' package. Grab either from any GNU archive site." 30011d341caSmrg # The file to touch is that specified with -o ... 3014c61c93dSmrg file=`echo "$*" | sed -n "$sed_output"` 3024c61c93dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 30311d341caSmrg if test -z "$file"; then 30411d341caSmrg # ... or it is the one specified with @setfilename ... 30511d341caSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 3064c61c93dSmrg file=`sed -n ' 3074c61c93dSmrg /^@setfilename/{ 3084c61c93dSmrg s/.* \([^ ]*\) *$/\1/ 3094c61c93dSmrg p 3104c61c93dSmrg q 3114c61c93dSmrg }' $infile` 31211d341caSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 31311d341caSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 31411d341caSmrg fi 31511d341caSmrg # If the file does not exist, the user really needs makeinfo; 31611d341caSmrg # let's fail without touching anything. 31711d341caSmrg test -f $file || exit 1 31811d341caSmrg touch $file 31911d341caSmrg ;; 32011d341caSmrg 3214c61c93dSmrg tar*) 32211d341caSmrg shift 32311d341caSmrg 32411d341caSmrg # We have already tried tar in the generic part. 32511d341caSmrg # Look for gnutar/gtar before invocation to avoid ugly error 32611d341caSmrg # messages. 32711d341caSmrg if (gnutar --version > /dev/null 2>&1); then 32811d341caSmrg gnutar "$@" && exit 0 32911d341caSmrg fi 33011d341caSmrg if (gtar --version > /dev/null 2>&1); then 33111d341caSmrg gtar "$@" && exit 0 33211d341caSmrg fi 33311d341caSmrg firstarg="$1" 33411d341caSmrg if shift; then 3354c61c93dSmrg case $firstarg in 33611d341caSmrg *o*) 33711d341caSmrg firstarg=`echo "$firstarg" | sed s/o//` 33811d341caSmrg tar "$firstarg" "$@" && exit 0 33911d341caSmrg ;; 34011d341caSmrg esac 3414c61c93dSmrg case $firstarg in 34211d341caSmrg *h*) 34311d341caSmrg firstarg=`echo "$firstarg" | sed s/h//` 34411d341caSmrg tar "$firstarg" "$@" && exit 0 34511d341caSmrg ;; 34611d341caSmrg esac 34711d341caSmrg fi 34811d341caSmrg 34911d341caSmrg echo 1>&2 "\ 35011d341caSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 35111d341caSmrg You may want to install GNU tar or Free paxutils, or check the 35211d341caSmrg command line arguments." 35311d341caSmrg exit 1 35411d341caSmrg ;; 35511d341caSmrg 35611d341caSmrg *) 35711d341caSmrg echo 1>&2 "\ 35811d341caSmrgWARNING: \`$1' is needed, and is $msg. 35911d341caSmrg You might have modified some files without having the 36011d341caSmrg proper tools for further handling them. Check the \`README' file, 36111d341caSmrg it often tells you about the needed prerequisites for installing 36211d341caSmrg this package. You may also peek at any GNU archive site, in case 36311d341caSmrg some other package would contain this missing \`$1' program." 36411d341caSmrg exit 1 36511d341caSmrg ;; 36611d341caSmrgesac 36711d341caSmrg 36811d341caSmrgexit 0 36911d341caSmrg 37011d341caSmrg# Local variables: 37111d341caSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 37211d341caSmrg# time-stamp-start: "scriptversion=" 37311d341caSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3744c61c93dSmrg# time-stamp-time-zone: "UTC" 3754c61c93dSmrg# time-stamp-end: "; # UTC" 37611d341caSmrg# End: 377