missing revision 302408
1198090Srdivacky#! /bin/sh 2198090Srdivacky# Common stub for a few missing GNU programs while installing. 3198090Srdivacky 4198090Srdivackyscriptversion=2005-06-08.21 5198090Srdivacky 6198090Srdivacky# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 7198090Srdivacky# Free Software Foundation, Inc. 8198090Srdivacky# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9198090Srdivacky 10198090Srdivacky# This program is free software; you can redistribute it and/or modify 11198090Srdivacky# it under the terms of the GNU General Public License as published by 12198090Srdivacky# the Free Software Foundation; either version 2, or (at your option) 13198090Srdivacky# any later version. 14198090Srdivacky 15198090Srdivacky# This program is distributed in the hope that it will be useful, 16198090Srdivacky# but WITHOUT ANY WARRANTY; without even the implied warranty of 17198090Srdivacky# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18198090Srdivacky# GNU General Public License for more details. 19198090Srdivacky 20198090Srdivacky# You should have received a copy of the GNU General Public License 21198090Srdivacky# along with this program; if not, write to the Free Software 22198090Srdivacky# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23198090Srdivacky# 02110-1301, USA. 24198090Srdivacky 25198090Srdivacky# As a special exception to the GNU General Public License, if you 26198090Srdivacky# distribute this file as part of a program that contains a 27198090Srdivacky# configuration script generated by Autoconf, you may include it under 28198090Srdivacky# the same distribution terms that you use for the rest of that program. 29198090Srdivacky 30198090Srdivackyif test $# -eq 0; then 31198090Srdivacky echo 1>&2 "Try \`$0 --help' for more information" 32198090Srdivacky exit 1 33198090Srdivackyfi 34198090Srdivacky 35198090Srdivackyrun=: 36198090Srdivacky 37198090Srdivacky# In the cases where this matters, `missing' is being run in the 38198090Srdivacky# srcdir already. 39198090Srdivackyif test -f configure.ac; then 40198090Srdivacky configure_ac=configure.ac 41198090Srdivackyelse 42198090Srdivacky configure_ac=configure.in 43198090Srdivackyfi 44198090Srdivacky 45198090Srdivackymsg="missing on your system" 46198090Srdivacky 47198090Srdivackycase "$1" in 48198090Srdivacky--run) 49198090Srdivacky # Try to run requested program, and just exit if it succeeds. 50198090Srdivacky run= 51198090Srdivacky shift 52198090Srdivacky "$@" && exit 0 53198090Srdivacky # Exit code 63 means version mismatch. This often happens 54198090Srdivacky # when the user try to use an ancient version of a tool on 55198090Srdivacky # a file that requires a minimum version. In this case we 56198090Srdivacky # we should proceed has if the program had been absent, or 57198090Srdivacky # if --run hadn't been passed. 58198090Srdivacky if test $? = 63; then 59198090Srdivacky run=: 60198090Srdivacky msg="probably too old" 61198090Srdivacky fi 62198090Srdivacky ;; 63198090Srdivacky 64198090Srdivacky -h|--h|--he|--hel|--help) 65198090Srdivacky echo "\ 66198090Srdivacky$0 [OPTION]... PROGRAM [ARGUMENT]... 67198090Srdivacky 68198090SrdivackyHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69198090Srdivackyerror status if there is no known handling for PROGRAM. 70198090Srdivacky 71198090SrdivackyOptions: 72198090Srdivacky -h, --help display this help and exit 73198090Srdivacky -v, --version output version information and exit 74198090Srdivacky --run try to run the given command, and emulate it if it fails 75198090Srdivacky 76198090SrdivackySupported PROGRAM values: 77198090Srdivacky aclocal touch file \`aclocal.m4' 78198090Srdivacky autoconf touch file \`configure' 79198090Srdivacky autoheader touch file \`config.h.in' 80198090Srdivacky automake touch all \`Makefile.in' files 81198090Srdivacky bison create \`y.tab.[ch]', if possible, from existing .[ch] 82198090Srdivacky flex create \`lex.yy.c', if possible, from existing .c 83198090Srdivacky help2man touch the output file 84198090Srdivacky lex create \`lex.yy.c', if possible, from existing .c 85198090Srdivacky makeinfo touch the output file 86198090Srdivacky tar try tar, gnutar, gtar, then tar without non-portable flags 87198090Srdivacky yacc create \`y.tab.[ch]', if possible, from existing .[ch] 88198090Srdivacky 89198090SrdivackySend bug reports to <bug-automake@gnu.org>." 90198090Srdivacky exit $? 91198090Srdivacky ;; 92198090Srdivacky 93198090Srdivacky -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 94198090Srdivacky echo "missing $scriptversion (GNU Automake)" 95198090Srdivacky exit $? 96198090Srdivacky ;; 97198090Srdivacky 98198090Srdivacky -*) 99198090Srdivacky echo 1>&2 "$0: Unknown \`$1' option" 100198090Srdivacky echo 1>&2 "Try \`$0 --help' for more information" 101198090Srdivacky exit 1 102198090Srdivacky ;; 103198090Srdivacky 104198090Srdivackyesac 105198090Srdivacky 106198090Srdivacky# Now exit if we have it, but it failed. Also exit now if we 107198090Srdivacky# don't have it and --version was passed (most likely to detect 108198090Srdivacky# the program). 109198090Srdivackycase "$1" in 110198090Srdivacky lex|yacc) 111198090Srdivacky # Not GNU programs, they don't have --version. 112198090Srdivacky ;; 113198090Srdivacky 114198090Srdivacky tar) 115198090Srdivacky if test -n "$run"; then 116198090Srdivacky echo 1>&2 "ERROR: \`tar' requires --run" 117198090Srdivacky exit 1 118198090Srdivacky elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 119198090Srdivacky exit 1 120198090Srdivacky fi 121198090Srdivacky ;; 122198090Srdivacky 123198090Srdivacky *) 124198090Srdivacky if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 125198090Srdivacky # We have it, but it failed. 126198090Srdivacky exit 1 127198090Srdivacky elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 128198090Srdivacky # Could not run --version or --help. This is probably someone 129198090Srdivacky # running `$TOOL --version' or `$TOOL --help' to check whether 130198090Srdivacky # $TOOL exists and not knowing $TOOL uses missing. 131198090Srdivacky exit 1 132198090Srdivacky fi 133198090Srdivacky ;; 134198090Srdivackyesac 135198090Srdivacky 136198090Srdivacky# If it does not exist, or fails to run (possibly an outdated version), 137198090Srdivacky# try to emulate it. 138198090Srdivackycase "$1" in 139198090Srdivacky aclocal*) 140198090Srdivacky echo 1>&2 "\ 141198090SrdivackyWARNING: \`$1' is $msg. You should only need it if 142198090Srdivacky you modified \`acinclude.m4' or \`${configure_ac}'. You might want 143198090Srdivacky to install the \`Automake' and \`Perl' packages. Grab them from 144198090Srdivacky any GNU archive site." 145198090Srdivacky touch aclocal.m4 146198090Srdivacky ;; 147198090Srdivacky 148198090Srdivacky autoconf) 149198090Srdivacky echo 1>&2 "\ 150198090SrdivackyWARNING: \`$1' is $msg. You should only need it if 151198090Srdivacky you modified \`${configure_ac}'. You might want to install the 152198090Srdivacky \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 153198090Srdivacky archive site." 154198090Srdivacky touch configure 155198090Srdivacky ;; 156198090Srdivacky 157198090Srdivacky autoheader) 158198090Srdivacky echo 1>&2 "\ 159198090SrdivackyWARNING: \`$1' is $msg. You should only need it if 160198090Srdivacky you modified \`acconfig.h' or \`${configure_ac}'. You might want 161198090Srdivacky to install the \`Autoconf' and \`GNU m4' packages. Grab them 162198090Srdivacky from any GNU archive site." 163198090Srdivacky files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 164198090Srdivacky test -z "$files" && files="config.h" 165198090Srdivacky touch_files= 166198090Srdivacky for f in $files; do 167198090Srdivacky case "$f" in 168198090Srdivacky *:*) touch_files="$touch_files "`echo "$f" | 169198090Srdivacky sed -e 's/^[^:]*://' -e 's/:.*//'`;; 170198090Srdivacky *) touch_files="$touch_files $f.in";; 171198090Srdivacky esac 172198090Srdivacky done 173198090Srdivacky touch $touch_files 174198090Srdivacky ;; 175198090Srdivacky 176198090Srdivacky automake*) 177198090Srdivacky echo 1>&2 "\ 178198090SrdivackyWARNING: \`$1' is $msg. You should only need it if 179198090Srdivacky you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 180198090Srdivacky You might want to install the \`Automake' and \`Perl' packages. 181198090Srdivacky Grab them from any GNU archive site." 182198090Srdivacky find . -type f -name Makefile.am -print | 183198090Srdivacky sed 's/\.am$/.in/' | 184198090Srdivacky while read f; do touch "$f"; done 185198090Srdivacky ;; 186198090Srdivacky 187198090Srdivacky autom4te) 188198090Srdivacky echo 1>&2 "\ 189198090SrdivackyWARNING: \`$1' is needed, but is $msg. 190198090Srdivacky You might have modified some files without having the 191198090Srdivacky proper tools for further handling them. 192198090Srdivacky You can get \`$1' as part of \`Autoconf' from any GNU 193198090Srdivacky archive site." 194198090Srdivacky 195198090Srdivacky file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 196198090Srdivacky test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 197198090Srdivacky if test -f "$file"; then 198198090Srdivacky touch $file 199198090Srdivacky else 200198090Srdivacky test -z "$file" || exec >$file 201198090Srdivacky echo "#! /bin/sh" 202198090Srdivacky echo "# Created by GNU Automake missing as a replacement of" 203198090Srdivacky echo "# $ $@" 204198090Srdivacky echo "exit 0" 205198090Srdivacky chmod +x $file 206198090Srdivacky exit 1 207198090Srdivacky fi 208198090Srdivacky ;; 209198090Srdivacky 210198090Srdivacky bison|yacc) 211198090Srdivacky echo 1>&2 "\ 212198090SrdivackyWARNING: \`$1' $msg. You should only need it if 213198090Srdivacky you modified a \`.y' file. You may need the \`Bison' package 214198090Srdivacky in order for those modifications to take effect. You can get 215198090Srdivacky \`Bison' from any GNU archive site." 216198090Srdivacky rm -f y.tab.c y.tab.h 217198090Srdivacky if [ $# -ne 1 ]; then 218198090Srdivacky eval LASTARG="\${$#}" 219198090Srdivacky case "$LASTARG" in 220198090Srdivacky *.y) 221198090Srdivacky SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 222198090Srdivacky if [ -f "$SRCFILE" ]; then 223198090Srdivacky cp "$SRCFILE" y.tab.c 224198090Srdivacky fi 225198090Srdivacky SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 226198090Srdivacky if [ -f "$SRCFILE" ]; then 227198090Srdivacky cp "$SRCFILE" y.tab.h 228198090Srdivacky fi 229198090Srdivacky ;; 230198090Srdivacky esac 231198090Srdivacky fi 232198090Srdivacky if [ ! -f y.tab.h ]; then 233198090Srdivacky echo >y.tab.h 234198090Srdivacky fi 235198090Srdivacky if [ ! -f y.tab.c ]; then 236198090Srdivacky echo 'main() { return 0; }' >y.tab.c 237198090Srdivacky fi 238198090Srdivacky ;; 239198090Srdivacky 240198090Srdivacky lex|flex) 241198090Srdivacky echo 1>&2 "\ 242198090SrdivackyWARNING: \`$1' is $msg. You should only need it if 243198090Srdivacky you modified a \`.l' file. You may need the \`Flex' package 244198090Srdivacky in order for those modifications to take effect. You can get 245198090Srdivacky \`Flex' from any GNU archive site." 246198090Srdivacky rm -f lex.yy.c 247198090Srdivacky if [ $# -ne 1 ]; then 248198090Srdivacky eval LASTARG="\${$#}" 249198090Srdivacky case "$LASTARG" in 250198090Srdivacky *.l) 251198090Srdivacky SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 252198090Srdivacky if [ -f "$SRCFILE" ]; then 253198090Srdivacky cp "$SRCFILE" lex.yy.c 254198090Srdivacky fi 255198090Srdivacky ;; 256198090Srdivacky esac 257198090Srdivacky fi 258198090Srdivacky if [ ! -f lex.yy.c ]; then 259198090Srdivacky echo 'main() { return 0; }' >lex.yy.c 260198090Srdivacky fi 261198090Srdivacky ;; 262198090Srdivacky 263198090Srdivacky help2man) 264198090Srdivacky echo 1>&2 "\ 265198090SrdivackyWARNING: \`$1' is $msg. You should only need it if 266198090Srdivacky you modified a dependency of a manual page. You may need the 267198090Srdivacky \`Help2man' package in order for those modifications to take 268198090Srdivacky effect. You can get \`Help2man' from any GNU archive site." 269198090Srdivacky 270198090Srdivacky file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 271198090Srdivacky if test -z "$file"; then 272198090Srdivacky file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 273198090Srdivacky fi 274198090Srdivacky if [ -f "$file" ]; then 275198090Srdivacky touch $file 276198090Srdivacky else 277198090Srdivacky test -z "$file" || exec >$file 278198090Srdivacky echo ".ab help2man is required to generate this page" 279198090Srdivacky exit 1 280198090Srdivacky fi 281198090Srdivacky ;; 282198090Srdivacky 283198090Srdivacky makeinfo) 284198090Srdivacky echo 1>&2 "\ 285198090SrdivackyWARNING: \`$1' is $msg. You should only need it if 286198090Srdivacky you modified a \`.texi' or \`.texinfo' file, or any other file 287 indirectly affecting the aspect of the manual. The spurious 288 call might also be the consequence of using a buggy \`make' (AIX, 289 DU, IRIX). You might want to install the \`Texinfo' package or 290 the \`GNU make' package. Grab either from any GNU archive site." 291 # The file to touch is that specified with -o ... 292 file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 293 if test -z "$file"; then 294 # ... or it is the one specified with @setfilename ... 295 infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 296 file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 297 # ... or it is derived from the source name (dir/f.texi becomes f.info) 298 test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 299 fi 300 # If the file does not exist, the user really needs makeinfo; 301 # let's fail without touching anything. 302 test -f $file || exit 1 303 touch $file 304 ;; 305 306 tar) 307 shift 308 309 # We have already tried tar in the generic part. 310 # Look for gnutar/gtar before invocation to avoid ugly error 311 # messages. 312 if (gnutar --version > /dev/null 2>&1); then 313 gnutar "$@" && exit 0 314 fi 315 if (gtar --version > /dev/null 2>&1); then 316 gtar "$@" && exit 0 317 fi 318 firstarg="$1" 319 if shift; then 320 case "$firstarg" in 321 *o*) 322 firstarg=`echo "$firstarg" | sed s/o//` 323 tar "$firstarg" "$@" && exit 0 324 ;; 325 esac 326 case "$firstarg" in 327 *h*) 328 firstarg=`echo "$firstarg" | sed s/h//` 329 tar "$firstarg" "$@" && exit 0 330 ;; 331 esac 332 fi 333 334 echo 1>&2 "\ 335WARNING: I can't seem to be able to run \`tar' with the given arguments. 336 You may want to install GNU tar or Free paxutils, or check the 337 command line arguments." 338 exit 1 339 ;; 340 341 *) 342 echo 1>&2 "\ 343WARNING: \`$1' is needed, and is $msg. 344 You might have modified some files without having the 345 proper tools for further handling them. Check the \`README' file, 346 it often tells you about the needed prerequisites for installing 347 this package. You may also peek at any GNU archive site, in case 348 some other package would contain this missing \`$1' program." 349 exit 1 350 ;; 351esac 352 353exit 0 354 355# Local variables: 356# eval: (add-hook 'write-file-hooks 'time-stamp) 357# time-stamp-start: "scriptversion=" 358# time-stamp-format: "%:y-%02m-%02d.%02H" 359# time-stamp-end: "$" 360# End: 361