missing revision 96ce994a
1bdcaa8d0Smrg#! /bin/sh 2bdcaa8d0Smrg# Common stub for a few missing GNU programs while installing. 3bdcaa8d0Smrg 496ce994aSmrgscriptversion=2009-04-28.21; # UTC 5bdcaa8d0Smrg 696ce994aSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 796ce994aSmrg# 2008, 2009 Free Software Foundation, Inc. 8bdcaa8d0Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9bdcaa8d0Smrg 10bdcaa8d0Smrg# This program is free software; you can redistribute it and/or modify 11bdcaa8d0Smrg# it under the terms of the GNU General Public License as published by 12bdcaa8d0Smrg# the Free Software Foundation; either version 2, or (at your option) 13bdcaa8d0Smrg# any later version. 14bdcaa8d0Smrg 15bdcaa8d0Smrg# This program is distributed in the hope that it will be useful, 16bdcaa8d0Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17bdcaa8d0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18bdcaa8d0Smrg# GNU General Public License for more details. 19bdcaa8d0Smrg 20bdcaa8d0Smrg# You should have received a copy of the GNU General Public License 2196ce994aSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22bdcaa8d0Smrg 23bdcaa8d0Smrg# As a special exception to the GNU General Public License, if you 24bdcaa8d0Smrg# distribute this file as part of a program that contains a 25bdcaa8d0Smrg# configuration script generated by Autoconf, you may include it under 26bdcaa8d0Smrg# the same distribution terms that you use for the rest of that program. 27bdcaa8d0Smrg 28bdcaa8d0Smrgif test $# -eq 0; then 29bdcaa8d0Smrg echo 1>&2 "Try \`$0 --help' for more information" 30bdcaa8d0Smrg exit 1 31bdcaa8d0Smrgfi 32bdcaa8d0Smrg 33bdcaa8d0Smrgrun=: 3472313efbSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 3572313efbSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36bdcaa8d0Smrg 37bdcaa8d0Smrg# In the cases where this matters, `missing' is being run in the 38bdcaa8d0Smrg# srcdir already. 39bdcaa8d0Smrgif test -f configure.ac; then 40bdcaa8d0Smrg configure_ac=configure.ac 41bdcaa8d0Smrgelse 42bdcaa8d0Smrg configure_ac=configure.in 43bdcaa8d0Smrgfi 44bdcaa8d0Smrg 45bdcaa8d0Smrgmsg="missing on your system" 46bdcaa8d0Smrg 4772313efbSmrgcase $1 in 48bdcaa8d0Smrg--run) 49bdcaa8d0Smrg # Try to run requested program, and just exit if it succeeds. 50bdcaa8d0Smrg run= 51bdcaa8d0Smrg shift 52bdcaa8d0Smrg "$@" && exit 0 53bdcaa8d0Smrg # Exit code 63 means version mismatch. This often happens 54bdcaa8d0Smrg # when the user try to use an ancient version of a tool on 55bdcaa8d0Smrg # a file that requires a minimum version. In this case we 56bdcaa8d0Smrg # we should proceed has if the program had been absent, or 57bdcaa8d0Smrg # if --run hadn't been passed. 58bdcaa8d0Smrg if test $? = 63; then 59bdcaa8d0Smrg run=: 60bdcaa8d0Smrg msg="probably too old" 61bdcaa8d0Smrg fi 62bdcaa8d0Smrg ;; 63bdcaa8d0Smrg 64bdcaa8d0Smrg -h|--h|--he|--hel|--help) 65bdcaa8d0Smrg echo "\ 66bdcaa8d0Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67bdcaa8d0Smrg 68bdcaa8d0SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69bdcaa8d0Smrgerror status if there is no known handling for PROGRAM. 70bdcaa8d0Smrg 71bdcaa8d0SmrgOptions: 72bdcaa8d0Smrg -h, --help display this help and exit 73bdcaa8d0Smrg -v, --version output version information and exit 74bdcaa8d0Smrg --run try to run the given command, and emulate it if it fails 75bdcaa8d0Smrg 76bdcaa8d0SmrgSupported PROGRAM values: 77bdcaa8d0Smrg aclocal touch file \`aclocal.m4' 78bdcaa8d0Smrg autoconf touch file \`configure' 79bdcaa8d0Smrg autoheader touch file \`config.h.in' 8072313efbSmrg autom4te touch the output file, or create a stub one 81bdcaa8d0Smrg automake touch all \`Makefile.in' files 82bdcaa8d0Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83bdcaa8d0Smrg flex create \`lex.yy.c', if possible, from existing .c 84bdcaa8d0Smrg help2man touch the output file 85bdcaa8d0Smrg lex create \`lex.yy.c', if possible, from existing .c 86bdcaa8d0Smrg makeinfo touch the output file 87bdcaa8d0Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 88bdcaa8d0Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89bdcaa8d0Smrg 9096ce994aSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 9196ce994aSmrg\`g' are ignored when checking the name. 9296ce994aSmrg 93bdcaa8d0SmrgSend bug reports to <bug-automake@gnu.org>." 94bdcaa8d0Smrg exit $? 95bdcaa8d0Smrg ;; 96bdcaa8d0Smrg 97bdcaa8d0Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98bdcaa8d0Smrg echo "missing $scriptversion (GNU Automake)" 99bdcaa8d0Smrg exit $? 100bdcaa8d0Smrg ;; 101bdcaa8d0Smrg 102bdcaa8d0Smrg -*) 103bdcaa8d0Smrg echo 1>&2 "$0: Unknown \`$1' option" 104bdcaa8d0Smrg echo 1>&2 "Try \`$0 --help' for more information" 105bdcaa8d0Smrg exit 1 106bdcaa8d0Smrg ;; 107bdcaa8d0Smrg 108bdcaa8d0Smrgesac 109bdcaa8d0Smrg 11096ce994aSmrg# normalize program name to check for. 11196ce994aSmrgprogram=`echo "$1" | sed ' 11296ce994aSmrg s/^gnu-//; t 11396ce994aSmrg s/^gnu//; t 11496ce994aSmrg s/^g//; t'` 11596ce994aSmrg 116bdcaa8d0Smrg# Now exit if we have it, but it failed. Also exit now if we 117bdcaa8d0Smrg# don't have it and --version was passed (most likely to detect 11896ce994aSmrg# the program). This is about non-GNU programs, so use $1 not 11996ce994aSmrg# $program. 12072313efbSmrgcase $1 in 12196ce994aSmrg lex*|yacc*) 122bdcaa8d0Smrg # Not GNU programs, they don't have --version. 123bdcaa8d0Smrg ;; 124bdcaa8d0Smrg 12596ce994aSmrg tar*) 126bdcaa8d0Smrg if test -n "$run"; then 127bdcaa8d0Smrg echo 1>&2 "ERROR: \`tar' requires --run" 128bdcaa8d0Smrg exit 1 129bdcaa8d0Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130bdcaa8d0Smrg exit 1 131bdcaa8d0Smrg fi 132bdcaa8d0Smrg ;; 133bdcaa8d0Smrg 134bdcaa8d0Smrg *) 135bdcaa8d0Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136bdcaa8d0Smrg # We have it, but it failed. 137bdcaa8d0Smrg exit 1 138bdcaa8d0Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139bdcaa8d0Smrg # Could not run --version or --help. This is probably someone 140bdcaa8d0Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 141bdcaa8d0Smrg # $TOOL exists and not knowing $TOOL uses missing. 142bdcaa8d0Smrg exit 1 143bdcaa8d0Smrg fi 144bdcaa8d0Smrg ;; 145bdcaa8d0Smrgesac 146bdcaa8d0Smrg 147bdcaa8d0Smrg# If it does not exist, or fails to run (possibly an outdated version), 148bdcaa8d0Smrg# try to emulate it. 14996ce994aSmrgcase $program in 150bdcaa8d0Smrg aclocal*) 151bdcaa8d0Smrg echo 1>&2 "\ 152bdcaa8d0SmrgWARNING: \`$1' is $msg. You should only need it if 153bdcaa8d0Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154bdcaa8d0Smrg to install the \`Automake' and \`Perl' packages. Grab them from 155bdcaa8d0Smrg any GNU archive site." 156bdcaa8d0Smrg touch aclocal.m4 157bdcaa8d0Smrg ;; 158bdcaa8d0Smrg 15996ce994aSmrg autoconf*) 160bdcaa8d0Smrg echo 1>&2 "\ 161bdcaa8d0SmrgWARNING: \`$1' is $msg. You should only need it if 162bdcaa8d0Smrg you modified \`${configure_ac}'. You might want to install the 163bdcaa8d0Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164bdcaa8d0Smrg archive site." 165bdcaa8d0Smrg touch configure 166bdcaa8d0Smrg ;; 167bdcaa8d0Smrg 16896ce994aSmrg autoheader*) 169bdcaa8d0Smrg echo 1>&2 "\ 170bdcaa8d0SmrgWARNING: \`$1' is $msg. You should only need it if 171bdcaa8d0Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172bdcaa8d0Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173bdcaa8d0Smrg from any GNU archive site." 174bdcaa8d0Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175bdcaa8d0Smrg test -z "$files" && files="config.h" 176bdcaa8d0Smrg touch_files= 177bdcaa8d0Smrg for f in $files; do 17872313efbSmrg case $f in 179bdcaa8d0Smrg *:*) touch_files="$touch_files "`echo "$f" | 180bdcaa8d0Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181bdcaa8d0Smrg *) touch_files="$touch_files $f.in";; 182bdcaa8d0Smrg esac 183bdcaa8d0Smrg done 184bdcaa8d0Smrg touch $touch_files 185bdcaa8d0Smrg ;; 186bdcaa8d0Smrg 187bdcaa8d0Smrg automake*) 188bdcaa8d0Smrg echo 1>&2 "\ 189bdcaa8d0SmrgWARNING: \`$1' is $msg. You should only need it if 190bdcaa8d0Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191bdcaa8d0Smrg You might want to install the \`Automake' and \`Perl' packages. 192bdcaa8d0Smrg Grab them from any GNU archive site." 193bdcaa8d0Smrg find . -type f -name Makefile.am -print | 194bdcaa8d0Smrg sed 's/\.am$/.in/' | 195bdcaa8d0Smrg while read f; do touch "$f"; done 196bdcaa8d0Smrg ;; 197bdcaa8d0Smrg 19896ce994aSmrg autom4te*) 199bdcaa8d0Smrg echo 1>&2 "\ 200bdcaa8d0SmrgWARNING: \`$1' is needed, but is $msg. 201bdcaa8d0Smrg You might have modified some files without having the 202bdcaa8d0Smrg proper tools for further handling them. 203bdcaa8d0Smrg You can get \`$1' as part of \`Autoconf' from any GNU 204bdcaa8d0Smrg archive site." 205bdcaa8d0Smrg 20672313efbSmrg file=`echo "$*" | sed -n "$sed_output"` 20772313efbSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208bdcaa8d0Smrg if test -f "$file"; then 209bdcaa8d0Smrg touch $file 210bdcaa8d0Smrg else 211bdcaa8d0Smrg test -z "$file" || exec >$file 212bdcaa8d0Smrg echo "#! /bin/sh" 213bdcaa8d0Smrg echo "# Created by GNU Automake missing as a replacement of" 214bdcaa8d0Smrg echo "# $ $@" 215bdcaa8d0Smrg echo "exit 0" 216bdcaa8d0Smrg chmod +x $file 217bdcaa8d0Smrg exit 1 218bdcaa8d0Smrg fi 219bdcaa8d0Smrg ;; 220bdcaa8d0Smrg 22196ce994aSmrg bison*|yacc*) 222bdcaa8d0Smrg echo 1>&2 "\ 223bdcaa8d0SmrgWARNING: \`$1' $msg. You should only need it if 224bdcaa8d0Smrg you modified a \`.y' file. You may need the \`Bison' package 225bdcaa8d0Smrg in order for those modifications to take effect. You can get 226bdcaa8d0Smrg \`Bison' from any GNU archive site." 227bdcaa8d0Smrg rm -f y.tab.c y.tab.h 22872313efbSmrg if test $# -ne 1; then 229bdcaa8d0Smrg eval LASTARG="\${$#}" 23072313efbSmrg case $LASTARG in 231bdcaa8d0Smrg *.y) 232bdcaa8d0Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 23372313efbSmrg if test -f "$SRCFILE"; then 234bdcaa8d0Smrg cp "$SRCFILE" y.tab.c 235bdcaa8d0Smrg fi 236bdcaa8d0Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 23772313efbSmrg if test -f "$SRCFILE"; then 238bdcaa8d0Smrg cp "$SRCFILE" y.tab.h 239bdcaa8d0Smrg fi 240bdcaa8d0Smrg ;; 241bdcaa8d0Smrg esac 242bdcaa8d0Smrg fi 24372313efbSmrg if test ! -f y.tab.h; then 244bdcaa8d0Smrg echo >y.tab.h 245bdcaa8d0Smrg fi 24672313efbSmrg if test ! -f y.tab.c; then 247bdcaa8d0Smrg echo 'main() { return 0; }' >y.tab.c 248bdcaa8d0Smrg fi 249bdcaa8d0Smrg ;; 250bdcaa8d0Smrg 25196ce994aSmrg lex*|flex*) 252bdcaa8d0Smrg echo 1>&2 "\ 253bdcaa8d0SmrgWARNING: \`$1' is $msg. You should only need it if 254bdcaa8d0Smrg you modified a \`.l' file. You may need the \`Flex' package 255bdcaa8d0Smrg in order for those modifications to take effect. You can get 256bdcaa8d0Smrg \`Flex' from any GNU archive site." 257bdcaa8d0Smrg rm -f lex.yy.c 25872313efbSmrg if test $# -ne 1; then 259bdcaa8d0Smrg eval LASTARG="\${$#}" 26072313efbSmrg case $LASTARG in 261bdcaa8d0Smrg *.l) 262bdcaa8d0Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 26372313efbSmrg if test -f "$SRCFILE"; then 264bdcaa8d0Smrg cp "$SRCFILE" lex.yy.c 265bdcaa8d0Smrg fi 266bdcaa8d0Smrg ;; 267bdcaa8d0Smrg esac 268bdcaa8d0Smrg fi 26972313efbSmrg if test ! -f lex.yy.c; then 270bdcaa8d0Smrg echo 'main() { return 0; }' >lex.yy.c 271bdcaa8d0Smrg fi 272bdcaa8d0Smrg ;; 273bdcaa8d0Smrg 27496ce994aSmrg help2man*) 275bdcaa8d0Smrg echo 1>&2 "\ 276bdcaa8d0SmrgWARNING: \`$1' is $msg. You should only need it if 277bdcaa8d0Smrg you modified a dependency of a manual page. You may need the 278bdcaa8d0Smrg \`Help2man' package in order for those modifications to take 279bdcaa8d0Smrg effect. You can get \`Help2man' from any GNU archive site." 280bdcaa8d0Smrg 28172313efbSmrg file=`echo "$*" | sed -n "$sed_output"` 28272313efbSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 28372313efbSmrg if test -f "$file"; then 284bdcaa8d0Smrg touch $file 285bdcaa8d0Smrg else 286bdcaa8d0Smrg test -z "$file" || exec >$file 287bdcaa8d0Smrg echo ".ab help2man is required to generate this page" 28896ce994aSmrg exit $? 289bdcaa8d0Smrg fi 290bdcaa8d0Smrg ;; 291bdcaa8d0Smrg 29296ce994aSmrg makeinfo*) 293bdcaa8d0Smrg echo 1>&2 "\ 294bdcaa8d0SmrgWARNING: \`$1' is $msg. You should only need it if 295bdcaa8d0Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 296bdcaa8d0Smrg indirectly affecting the aspect of the manual. The spurious 297bdcaa8d0Smrg call might also be the consequence of using a buggy \`make' (AIX, 298bdcaa8d0Smrg DU, IRIX). You might want to install the \`Texinfo' package or 299bdcaa8d0Smrg the \`GNU make' package. Grab either from any GNU archive site." 300bdcaa8d0Smrg # The file to touch is that specified with -o ... 30172313efbSmrg file=`echo "$*" | sed -n "$sed_output"` 30272313efbSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303bdcaa8d0Smrg if test -z "$file"; then 304bdcaa8d0Smrg # ... or it is the one specified with @setfilename ... 305bdcaa8d0Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 30672313efbSmrg file=`sed -n ' 30772313efbSmrg /^@setfilename/{ 30872313efbSmrg s/.* \([^ ]*\) *$/\1/ 30972313efbSmrg p 31072313efbSmrg q 31172313efbSmrg }' $infile` 312bdcaa8d0Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313bdcaa8d0Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314bdcaa8d0Smrg fi 315bdcaa8d0Smrg # If the file does not exist, the user really needs makeinfo; 316bdcaa8d0Smrg # let's fail without touching anything. 317bdcaa8d0Smrg test -f $file || exit 1 318bdcaa8d0Smrg touch $file 319bdcaa8d0Smrg ;; 320bdcaa8d0Smrg 32196ce994aSmrg tar*) 322bdcaa8d0Smrg shift 323bdcaa8d0Smrg 324bdcaa8d0Smrg # We have already tried tar in the generic part. 325bdcaa8d0Smrg # Look for gnutar/gtar before invocation to avoid ugly error 326bdcaa8d0Smrg # messages. 327bdcaa8d0Smrg if (gnutar --version > /dev/null 2>&1); then 328bdcaa8d0Smrg gnutar "$@" && exit 0 329bdcaa8d0Smrg fi 330bdcaa8d0Smrg if (gtar --version > /dev/null 2>&1); then 331bdcaa8d0Smrg gtar "$@" && exit 0 332bdcaa8d0Smrg fi 333bdcaa8d0Smrg firstarg="$1" 334bdcaa8d0Smrg if shift; then 33572313efbSmrg case $firstarg in 336bdcaa8d0Smrg *o*) 337bdcaa8d0Smrg firstarg=`echo "$firstarg" | sed s/o//` 338bdcaa8d0Smrg tar "$firstarg" "$@" && exit 0 339bdcaa8d0Smrg ;; 340bdcaa8d0Smrg esac 34172313efbSmrg case $firstarg in 342bdcaa8d0Smrg *h*) 343bdcaa8d0Smrg firstarg=`echo "$firstarg" | sed s/h//` 344bdcaa8d0Smrg tar "$firstarg" "$@" && exit 0 345bdcaa8d0Smrg ;; 346bdcaa8d0Smrg esac 347bdcaa8d0Smrg fi 348bdcaa8d0Smrg 349bdcaa8d0Smrg echo 1>&2 "\ 350bdcaa8d0SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351bdcaa8d0Smrg You may want to install GNU tar or Free paxutils, or check the 352bdcaa8d0Smrg command line arguments." 353bdcaa8d0Smrg exit 1 354bdcaa8d0Smrg ;; 355bdcaa8d0Smrg 356bdcaa8d0Smrg *) 357bdcaa8d0Smrg echo 1>&2 "\ 358bdcaa8d0SmrgWARNING: \`$1' is needed, and is $msg. 359bdcaa8d0Smrg You might have modified some files without having the 360bdcaa8d0Smrg proper tools for further handling them. Check the \`README' file, 361bdcaa8d0Smrg it often tells you about the needed prerequisites for installing 362bdcaa8d0Smrg this package. You may also peek at any GNU archive site, in case 363bdcaa8d0Smrg some other package would contain this missing \`$1' program." 364bdcaa8d0Smrg exit 1 365bdcaa8d0Smrg ;; 366bdcaa8d0Smrgesac 367bdcaa8d0Smrg 368bdcaa8d0Smrgexit 0 369bdcaa8d0Smrg 370bdcaa8d0Smrg# Local variables: 371bdcaa8d0Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372bdcaa8d0Smrg# time-stamp-start: "scriptversion=" 373bdcaa8d0Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 37496ce994aSmrg# time-stamp-time-zone: "UTC" 37596ce994aSmrg# time-stamp-end: "; # UTC" 376bdcaa8d0Smrg# End: 377