missing revision 7bd0f98d
1cbeba4aeSmrg#! /bin/sh 2cbeba4aeSmrg# Common stub for a few missing GNU programs while installing. 37bd0f98dSmrg 47bd0f98dSmrgscriptversion=2009-04-28.21; # UTC 57bd0f98dSmrg 67bd0f98dSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 77bd0f98dSmrg# 2008, 2009 Free Software Foundation, Inc. 8cbeba4aeSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9cbeba4aeSmrg 10cbeba4aeSmrg# This program is free software; you can redistribute it and/or modify 11cbeba4aeSmrg# it under the terms of the GNU General Public License as published by 12cbeba4aeSmrg# the Free Software Foundation; either version 2, or (at your option) 13cbeba4aeSmrg# any later version. 14cbeba4aeSmrg 15cbeba4aeSmrg# This program is distributed in the hope that it will be useful, 16cbeba4aeSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17cbeba4aeSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18cbeba4aeSmrg# GNU General Public License for more details. 19cbeba4aeSmrg 20cbeba4aeSmrg# You should have received a copy of the GNU General Public License 217bd0f98dSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22cbeba4aeSmrg 23cbeba4aeSmrg# As a special exception to the GNU General Public License, if you 24cbeba4aeSmrg# distribute this file as part of a program that contains a 25cbeba4aeSmrg# configuration script generated by Autoconf, you may include it under 26cbeba4aeSmrg# the same distribution terms that you use for the rest of that program. 27cbeba4aeSmrg 28cbeba4aeSmrgif test $# -eq 0; then 29cbeba4aeSmrg echo 1>&2 "Try \`$0 --help' for more information" 30cbeba4aeSmrg exit 1 31cbeba4aeSmrgfi 32cbeba4aeSmrg 33cbeba4aeSmrgrun=: 347bd0f98dSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 357bd0f98dSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36cbeba4aeSmrg 37cbeba4aeSmrg# In the cases where this matters, `missing' is being run in the 38cbeba4aeSmrg# srcdir already. 39cbeba4aeSmrgif test -f configure.ac; then 40cbeba4aeSmrg configure_ac=configure.ac 41cbeba4aeSmrgelse 42cbeba4aeSmrg configure_ac=configure.in 43cbeba4aeSmrgfi 44cbeba4aeSmrg 457bd0f98dSmrgmsg="missing on your system" 467bd0f98dSmrg 477bd0f98dSmrgcase $1 in 48cbeba4aeSmrg--run) 49cbeba4aeSmrg # Try to run requested program, and just exit if it succeeds. 50cbeba4aeSmrg run= 51cbeba4aeSmrg shift 52cbeba4aeSmrg "$@" && exit 0 537bd0f98dSmrg # Exit code 63 means version mismatch. This often happens 547bd0f98dSmrg # when the user try to use an ancient version of a tool on 557bd0f98dSmrg # a file that requires a minimum version. In this case we 567bd0f98dSmrg # we should proceed has if the program had been absent, or 577bd0f98dSmrg # if --run hadn't been passed. 587bd0f98dSmrg if test $? = 63; then 597bd0f98dSmrg run=: 607bd0f98dSmrg msg="probably too old" 617bd0f98dSmrg fi 62cbeba4aeSmrg ;; 63cbeba4aeSmrg 64cbeba4aeSmrg -h|--h|--he|--hel|--help) 65cbeba4aeSmrg echo "\ 66cbeba4aeSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67cbeba4aeSmrg 68cbeba4aeSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69cbeba4aeSmrgerror status if there is no known handling for PROGRAM. 70cbeba4aeSmrg 71cbeba4aeSmrgOptions: 72cbeba4aeSmrg -h, --help display this help and exit 73cbeba4aeSmrg -v, --version output version information and exit 74cbeba4aeSmrg --run try to run the given command, and emulate it if it fails 75cbeba4aeSmrg 76cbeba4aeSmrgSupported PROGRAM values: 77cbeba4aeSmrg aclocal touch file \`aclocal.m4' 78cbeba4aeSmrg autoconf touch file \`configure' 79cbeba4aeSmrg autoheader touch file \`config.h.in' 807bd0f98dSmrg autom4te touch the output file, or create a stub one 81cbeba4aeSmrg automake touch all \`Makefile.in' files 82cbeba4aeSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83cbeba4aeSmrg flex create \`lex.yy.c', if possible, from existing .c 84cbeba4aeSmrg help2man touch the output file 85cbeba4aeSmrg lex create \`lex.yy.c', if possible, from existing .c 86cbeba4aeSmrg makeinfo touch the output file 87cbeba4aeSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 887bd0f98dSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 897bd0f98dSmrg 907bd0f98dSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 917bd0f98dSmrg\`g' are ignored when checking the name. 927bd0f98dSmrg 937bd0f98dSmrgSend bug reports to <bug-automake@gnu.org>." 947bd0f98dSmrg exit $? 95cbeba4aeSmrg ;; 96cbeba4aeSmrg 97cbeba4aeSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 987bd0f98dSmrg echo "missing $scriptversion (GNU Automake)" 997bd0f98dSmrg exit $? 100cbeba4aeSmrg ;; 101cbeba4aeSmrg 102cbeba4aeSmrg -*) 103cbeba4aeSmrg echo 1>&2 "$0: Unknown \`$1' option" 104cbeba4aeSmrg echo 1>&2 "Try \`$0 --help' for more information" 105cbeba4aeSmrg exit 1 106cbeba4aeSmrg ;; 107cbeba4aeSmrg 1087bd0f98dSmrgesac 1097bd0f98dSmrg 1107bd0f98dSmrg# normalize program name to check for. 1117bd0f98dSmrgprogram=`echo "$1" | sed ' 1127bd0f98dSmrg s/^gnu-//; t 1137bd0f98dSmrg s/^gnu//; t 1147bd0f98dSmrg s/^g//; t'` 1157bd0f98dSmrg 1167bd0f98dSmrg# Now exit if we have it, but it failed. Also exit now if we 1177bd0f98dSmrg# don't have it and --version was passed (most likely to detect 1187bd0f98dSmrg# the program). This is about non-GNU programs, so use $1 not 1197bd0f98dSmrg# $program. 1207bd0f98dSmrgcase $1 in 1217bd0f98dSmrg lex*|yacc*) 1227bd0f98dSmrg # Not GNU programs, they don't have --version. 1237bd0f98dSmrg ;; 1247bd0f98dSmrg 1257bd0f98dSmrg tar*) 1267bd0f98dSmrg if test -n "$run"; then 1277bd0f98dSmrg echo 1>&2 "ERROR: \`tar' requires --run" 1287bd0f98dSmrg exit 1 1297bd0f98dSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1307bd0f98dSmrg exit 1 1317bd0f98dSmrg fi 1327bd0f98dSmrg ;; 1337bd0f98dSmrg 1347bd0f98dSmrg *) 135cbeba4aeSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136cbeba4aeSmrg # We have it, but it failed. 137cbeba4aeSmrg exit 1 1387bd0f98dSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1397bd0f98dSmrg # Could not run --version or --help. This is probably someone 1407bd0f98dSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 1417bd0f98dSmrg # $TOOL exists and not knowing $TOOL uses missing. 1427bd0f98dSmrg exit 1 143cbeba4aeSmrg fi 1447bd0f98dSmrg ;; 1457bd0f98dSmrgesac 146cbeba4aeSmrg 1477bd0f98dSmrg# If it does not exist, or fails to run (possibly an outdated version), 1487bd0f98dSmrg# try to emulate it. 1497bd0f98dSmrgcase $program in 1507bd0f98dSmrg aclocal*) 151cbeba4aeSmrg echo 1>&2 "\ 1527bd0f98dSmrgWARNING: \`$1' is $msg. You should only need it if 153cbeba4aeSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154cbeba4aeSmrg to install the \`Automake' and \`Perl' packages. Grab them from 155cbeba4aeSmrg any GNU archive site." 156cbeba4aeSmrg touch aclocal.m4 157cbeba4aeSmrg ;; 158cbeba4aeSmrg 1597bd0f98dSmrg autoconf*) 160cbeba4aeSmrg echo 1>&2 "\ 1617bd0f98dSmrgWARNING: \`$1' is $msg. You should only need it if 162cbeba4aeSmrg you modified \`${configure_ac}'. You might want to install the 163cbeba4aeSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164cbeba4aeSmrg archive site." 165cbeba4aeSmrg touch configure 166cbeba4aeSmrg ;; 167cbeba4aeSmrg 1687bd0f98dSmrg autoheader*) 169cbeba4aeSmrg echo 1>&2 "\ 1707bd0f98dSmrgWARNING: \`$1' is $msg. You should only need it if 171cbeba4aeSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172cbeba4aeSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173cbeba4aeSmrg from any GNU archive site." 174cbeba4aeSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175cbeba4aeSmrg test -z "$files" && files="config.h" 176cbeba4aeSmrg touch_files= 177cbeba4aeSmrg for f in $files; do 1787bd0f98dSmrg case $f in 179cbeba4aeSmrg *:*) touch_files="$touch_files "`echo "$f" | 180cbeba4aeSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181cbeba4aeSmrg *) touch_files="$touch_files $f.in";; 182cbeba4aeSmrg esac 183cbeba4aeSmrg done 184cbeba4aeSmrg touch $touch_files 185cbeba4aeSmrg ;; 186cbeba4aeSmrg 187cbeba4aeSmrg automake*) 188cbeba4aeSmrg echo 1>&2 "\ 1897bd0f98dSmrgWARNING: \`$1' is $msg. You should only need it if 190cbeba4aeSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191cbeba4aeSmrg You might want to install the \`Automake' and \`Perl' packages. 192cbeba4aeSmrg Grab them from any GNU archive site." 193cbeba4aeSmrg find . -type f -name Makefile.am -print | 194cbeba4aeSmrg sed 's/\.am$/.in/' | 195cbeba4aeSmrg while read f; do touch "$f"; done 196cbeba4aeSmrg ;; 197cbeba4aeSmrg 1987bd0f98dSmrg autom4te*) 199cbeba4aeSmrg echo 1>&2 "\ 2007bd0f98dSmrgWARNING: \`$1' is needed, but is $msg. 2017bd0f98dSmrg You might have modified some files without having the 202cbeba4aeSmrg proper tools for further handling them. 203cbeba4aeSmrg You can get \`$1' as part of \`Autoconf' from any GNU 204cbeba4aeSmrg archive site." 205cbeba4aeSmrg 2067bd0f98dSmrg file=`echo "$*" | sed -n "$sed_output"` 2077bd0f98dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208cbeba4aeSmrg if test -f "$file"; then 209cbeba4aeSmrg touch $file 210cbeba4aeSmrg else 211cbeba4aeSmrg test -z "$file" || exec >$file 212cbeba4aeSmrg echo "#! /bin/sh" 213cbeba4aeSmrg echo "# Created by GNU Automake missing as a replacement of" 214cbeba4aeSmrg echo "# $ $@" 215cbeba4aeSmrg echo "exit 0" 216cbeba4aeSmrg chmod +x $file 217cbeba4aeSmrg exit 1 218cbeba4aeSmrg fi 219cbeba4aeSmrg ;; 220cbeba4aeSmrg 2217bd0f98dSmrg bison*|yacc*) 222cbeba4aeSmrg echo 1>&2 "\ 2237bd0f98dSmrgWARNING: \`$1' $msg. You should only need it if 224cbeba4aeSmrg you modified a \`.y' file. You may need the \`Bison' package 225cbeba4aeSmrg in order for those modifications to take effect. You can get 226cbeba4aeSmrg \`Bison' from any GNU archive site." 227cbeba4aeSmrg rm -f y.tab.c y.tab.h 2287bd0f98dSmrg if test $# -ne 1; then 229cbeba4aeSmrg eval LASTARG="\${$#}" 2307bd0f98dSmrg case $LASTARG in 231cbeba4aeSmrg *.y) 232cbeba4aeSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2337bd0f98dSmrg if test -f "$SRCFILE"; then 234cbeba4aeSmrg cp "$SRCFILE" y.tab.c 235cbeba4aeSmrg fi 236cbeba4aeSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2377bd0f98dSmrg if test -f "$SRCFILE"; then 238cbeba4aeSmrg cp "$SRCFILE" y.tab.h 239cbeba4aeSmrg fi 240cbeba4aeSmrg ;; 241cbeba4aeSmrg esac 242cbeba4aeSmrg fi 2437bd0f98dSmrg if test ! -f y.tab.h; then 244cbeba4aeSmrg echo >y.tab.h 245cbeba4aeSmrg fi 2467bd0f98dSmrg if test ! -f y.tab.c; then 247cbeba4aeSmrg echo 'main() { return 0; }' >y.tab.c 248cbeba4aeSmrg fi 249cbeba4aeSmrg ;; 250cbeba4aeSmrg 2517bd0f98dSmrg lex*|flex*) 252cbeba4aeSmrg echo 1>&2 "\ 2537bd0f98dSmrgWARNING: \`$1' is $msg. You should only need it if 254cbeba4aeSmrg you modified a \`.l' file. You may need the \`Flex' package 255cbeba4aeSmrg in order for those modifications to take effect. You can get 256cbeba4aeSmrg \`Flex' from any GNU archive site." 257cbeba4aeSmrg rm -f lex.yy.c 2587bd0f98dSmrg if test $# -ne 1; then 259cbeba4aeSmrg eval LASTARG="\${$#}" 2607bd0f98dSmrg case $LASTARG in 261cbeba4aeSmrg *.l) 262cbeba4aeSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2637bd0f98dSmrg if test -f "$SRCFILE"; then 264cbeba4aeSmrg cp "$SRCFILE" lex.yy.c 265cbeba4aeSmrg fi 266cbeba4aeSmrg ;; 267cbeba4aeSmrg esac 268cbeba4aeSmrg fi 2697bd0f98dSmrg if test ! -f lex.yy.c; then 270cbeba4aeSmrg echo 'main() { return 0; }' >lex.yy.c 271cbeba4aeSmrg fi 272cbeba4aeSmrg ;; 273cbeba4aeSmrg 2747bd0f98dSmrg help2man*) 275cbeba4aeSmrg echo 1>&2 "\ 2767bd0f98dSmrgWARNING: \`$1' is $msg. You should only need it if 277cbeba4aeSmrg you modified a dependency of a manual page. You may need the 278cbeba4aeSmrg \`Help2man' package in order for those modifications to take 279cbeba4aeSmrg effect. You can get \`Help2man' from any GNU archive site." 280cbeba4aeSmrg 2817bd0f98dSmrg file=`echo "$*" | sed -n "$sed_output"` 2827bd0f98dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2837bd0f98dSmrg if test -f "$file"; then 284cbeba4aeSmrg touch $file 285cbeba4aeSmrg else 286cbeba4aeSmrg test -z "$file" || exec >$file 287cbeba4aeSmrg echo ".ab help2man is required to generate this page" 2887bd0f98dSmrg exit $? 289cbeba4aeSmrg fi 290cbeba4aeSmrg ;; 291cbeba4aeSmrg 2927bd0f98dSmrg makeinfo*) 293cbeba4aeSmrg echo 1>&2 "\ 2947bd0f98dSmrgWARNING: \`$1' is $msg. You should only need it if 295cbeba4aeSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 296cbeba4aeSmrg indirectly affecting the aspect of the manual. The spurious 297cbeba4aeSmrg call might also be the consequence of using a buggy \`make' (AIX, 298cbeba4aeSmrg DU, IRIX). You might want to install the \`Texinfo' package or 299cbeba4aeSmrg the \`GNU make' package. Grab either from any GNU archive site." 3007bd0f98dSmrg # The file to touch is that specified with -o ... 3017bd0f98dSmrg file=`echo "$*" | sed -n "$sed_output"` 3027bd0f98dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303cbeba4aeSmrg if test -z "$file"; then 3047bd0f98dSmrg # ... or it is the one specified with @setfilename ... 3057bd0f98dSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 3067bd0f98dSmrg file=`sed -n ' 3077bd0f98dSmrg /^@setfilename/{ 3087bd0f98dSmrg s/.* \([^ ]*\) *$/\1/ 3097bd0f98dSmrg p 3107bd0f98dSmrg q 3117bd0f98dSmrg }' $infile` 3127bd0f98dSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3137bd0f98dSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314cbeba4aeSmrg fi 3157bd0f98dSmrg # If the file does not exist, the user really needs makeinfo; 3167bd0f98dSmrg # let's fail without touching anything. 3177bd0f98dSmrg test -f $file || exit 1 318cbeba4aeSmrg touch $file 319cbeba4aeSmrg ;; 320cbeba4aeSmrg 3217bd0f98dSmrg tar*) 322cbeba4aeSmrg shift 323cbeba4aeSmrg 324cbeba4aeSmrg # We have already tried tar in the generic part. 325cbeba4aeSmrg # Look for gnutar/gtar before invocation to avoid ugly error 326cbeba4aeSmrg # messages. 327cbeba4aeSmrg if (gnutar --version > /dev/null 2>&1); then 328cbeba4aeSmrg gnutar "$@" && exit 0 329cbeba4aeSmrg fi 330cbeba4aeSmrg if (gtar --version > /dev/null 2>&1); then 331cbeba4aeSmrg gtar "$@" && exit 0 332cbeba4aeSmrg fi 333cbeba4aeSmrg firstarg="$1" 334cbeba4aeSmrg if shift; then 3357bd0f98dSmrg case $firstarg in 336cbeba4aeSmrg *o*) 337cbeba4aeSmrg firstarg=`echo "$firstarg" | sed s/o//` 338cbeba4aeSmrg tar "$firstarg" "$@" && exit 0 339cbeba4aeSmrg ;; 340cbeba4aeSmrg esac 3417bd0f98dSmrg case $firstarg in 342cbeba4aeSmrg *h*) 343cbeba4aeSmrg firstarg=`echo "$firstarg" | sed s/h//` 344cbeba4aeSmrg tar "$firstarg" "$@" && exit 0 345cbeba4aeSmrg ;; 346cbeba4aeSmrg esac 347cbeba4aeSmrg fi 348cbeba4aeSmrg 349cbeba4aeSmrg echo 1>&2 "\ 350cbeba4aeSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351cbeba4aeSmrg You may want to install GNU tar or Free paxutils, or check the 352cbeba4aeSmrg command line arguments." 353cbeba4aeSmrg exit 1 354cbeba4aeSmrg ;; 355cbeba4aeSmrg 356cbeba4aeSmrg *) 357cbeba4aeSmrg echo 1>&2 "\ 3587bd0f98dSmrgWARNING: \`$1' is needed, and is $msg. 3597bd0f98dSmrg You might have modified some files without having the 360cbeba4aeSmrg proper tools for further handling them. Check the \`README' file, 361cbeba4aeSmrg it often tells you about the needed prerequisites for installing 362cbeba4aeSmrg this package. You may also peek at any GNU archive site, in case 363cbeba4aeSmrg some other package would contain this missing \`$1' program." 364cbeba4aeSmrg exit 1 365cbeba4aeSmrg ;; 366cbeba4aeSmrgesac 367cbeba4aeSmrg 368cbeba4aeSmrgexit 0 3697bd0f98dSmrg 3707bd0f98dSmrg# Local variables: 3717bd0f98dSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3727bd0f98dSmrg# time-stamp-start: "scriptversion=" 3737bd0f98dSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3747bd0f98dSmrg# time-stamp-time-zone: "UTC" 3757bd0f98dSmrg# time-stamp-end: "; # UTC" 3767bd0f98dSmrg# End: 377