missing revision cbeba4ae
1cbeba4aeSmrg#! /bin/sh 2cbeba4aeSmrg# Common stub for a few missing GNU programs while installing. 3cbeba4aeSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. 4cbeba4aeSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 5cbeba4aeSmrg 6cbeba4aeSmrg# This program is free software; you can redistribute it and/or modify 7cbeba4aeSmrg# it under the terms of the GNU General Public License as published by 8cbeba4aeSmrg# the Free Software Foundation; either version 2, or (at your option) 9cbeba4aeSmrg# any later version. 10cbeba4aeSmrg 11cbeba4aeSmrg# This program is distributed in the hope that it will be useful, 12cbeba4aeSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 13cbeba4aeSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14cbeba4aeSmrg# GNU General Public License for more details. 15cbeba4aeSmrg 16cbeba4aeSmrg# You should have received a copy of the GNU General Public License 17cbeba4aeSmrg# along with this program; if not, write to the Free Software 18cbeba4aeSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19cbeba4aeSmrg# 02111-1307, USA. 20cbeba4aeSmrg 21cbeba4aeSmrg# As a special exception to the GNU General Public License, if you 22cbeba4aeSmrg# distribute this file as part of a program that contains a 23cbeba4aeSmrg# configuration script generated by Autoconf, you may include it under 24cbeba4aeSmrg# the same distribution terms that you use for the rest of that program. 25cbeba4aeSmrg 26cbeba4aeSmrgif test $# -eq 0; then 27cbeba4aeSmrg echo 1>&2 "Try \`$0 --help' for more information" 28cbeba4aeSmrg exit 1 29cbeba4aeSmrgfi 30cbeba4aeSmrg 31cbeba4aeSmrgrun=: 32cbeba4aeSmrg 33cbeba4aeSmrg# In the cases where this matters, `missing' is being run in the 34cbeba4aeSmrg# srcdir already. 35cbeba4aeSmrgif test -f configure.ac; then 36cbeba4aeSmrg configure_ac=configure.ac 37cbeba4aeSmrgelse 38cbeba4aeSmrg configure_ac=configure.in 39cbeba4aeSmrgfi 40cbeba4aeSmrg 41cbeba4aeSmrgcase "$1" in 42cbeba4aeSmrg--run) 43cbeba4aeSmrg # Try to run requested program, and just exit if it succeeds. 44cbeba4aeSmrg run= 45cbeba4aeSmrg shift 46cbeba4aeSmrg "$@" && exit 0 47cbeba4aeSmrg ;; 48cbeba4aeSmrgesac 49cbeba4aeSmrg 50cbeba4aeSmrg# If it does not exist, or fails to run (possibly an outdated version), 51cbeba4aeSmrg# try to emulate it. 52cbeba4aeSmrgcase "$1" in 53cbeba4aeSmrg 54cbeba4aeSmrg -h|--h|--he|--hel|--help) 55cbeba4aeSmrg echo "\ 56cbeba4aeSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 57cbeba4aeSmrg 58cbeba4aeSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 59cbeba4aeSmrgerror status if there is no known handling for PROGRAM. 60cbeba4aeSmrg 61cbeba4aeSmrgOptions: 62cbeba4aeSmrg -h, --help display this help and exit 63cbeba4aeSmrg -v, --version output version information and exit 64cbeba4aeSmrg --run try to run the given command, and emulate it if it fails 65cbeba4aeSmrg 66cbeba4aeSmrgSupported PROGRAM values: 67cbeba4aeSmrg aclocal touch file \`aclocal.m4' 68cbeba4aeSmrg autoconf touch file \`configure' 69cbeba4aeSmrg autoheader touch file \`config.h.in' 70cbeba4aeSmrg automake touch all \`Makefile.in' files 71cbeba4aeSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 72cbeba4aeSmrg flex create \`lex.yy.c', if possible, from existing .c 73cbeba4aeSmrg help2man touch the output file 74cbeba4aeSmrg lex create \`lex.yy.c', if possible, from existing .c 75cbeba4aeSmrg makeinfo touch the output file 76cbeba4aeSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 77cbeba4aeSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch]" 78cbeba4aeSmrg ;; 79cbeba4aeSmrg 80cbeba4aeSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 81cbeba4aeSmrg echo "missing 0.4 - GNU automake" 82cbeba4aeSmrg ;; 83cbeba4aeSmrg 84cbeba4aeSmrg -*) 85cbeba4aeSmrg echo 1>&2 "$0: Unknown \`$1' option" 86cbeba4aeSmrg echo 1>&2 "Try \`$0 --help' for more information" 87cbeba4aeSmrg exit 1 88cbeba4aeSmrg ;; 89cbeba4aeSmrg 90cbeba4aeSmrg aclocal*) 91cbeba4aeSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 92cbeba4aeSmrg # We have it, but it failed. 93cbeba4aeSmrg exit 1 94cbeba4aeSmrg fi 95cbeba4aeSmrg 96cbeba4aeSmrg echo 1>&2 "\ 97cbeba4aeSmrgWARNING: \`$1' is missing on your system. You should only need it if 98cbeba4aeSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 99cbeba4aeSmrg to install the \`Automake' and \`Perl' packages. Grab them from 100cbeba4aeSmrg any GNU archive site." 101cbeba4aeSmrg touch aclocal.m4 102cbeba4aeSmrg ;; 103cbeba4aeSmrg 104cbeba4aeSmrg autoconf) 105cbeba4aeSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 106cbeba4aeSmrg # We have it, but it failed. 107cbeba4aeSmrg exit 1 108cbeba4aeSmrg fi 109cbeba4aeSmrg 110cbeba4aeSmrg echo 1>&2 "\ 111cbeba4aeSmrgWARNING: \`$1' is missing on your system. You should only need it if 112cbeba4aeSmrg you modified \`${configure_ac}'. You might want to install the 113cbeba4aeSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 114cbeba4aeSmrg archive site." 115cbeba4aeSmrg touch configure 116cbeba4aeSmrg ;; 117cbeba4aeSmrg 118cbeba4aeSmrg autoheader) 119cbeba4aeSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 120cbeba4aeSmrg # We have it, but it failed. 121cbeba4aeSmrg exit 1 122cbeba4aeSmrg fi 123cbeba4aeSmrg 124cbeba4aeSmrg echo 1>&2 "\ 125cbeba4aeSmrgWARNING: \`$1' is missing on your system. You should only need it if 126cbeba4aeSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 127cbeba4aeSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 128cbeba4aeSmrg from any GNU archive site." 129cbeba4aeSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 130cbeba4aeSmrg test -z "$files" && files="config.h" 131cbeba4aeSmrg touch_files= 132cbeba4aeSmrg for f in $files; do 133cbeba4aeSmrg case "$f" in 134cbeba4aeSmrg *:*) touch_files="$touch_files "`echo "$f" | 135cbeba4aeSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 136cbeba4aeSmrg *) touch_files="$touch_files $f.in";; 137cbeba4aeSmrg esac 138cbeba4aeSmrg done 139cbeba4aeSmrg touch $touch_files 140cbeba4aeSmrg ;; 141cbeba4aeSmrg 142cbeba4aeSmrg automake*) 143cbeba4aeSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 144cbeba4aeSmrg # We have it, but it failed. 145cbeba4aeSmrg exit 1 146cbeba4aeSmrg fi 147cbeba4aeSmrg 148cbeba4aeSmrg echo 1>&2 "\ 149cbeba4aeSmrgWARNING: \`$1' is missing on your system. You should only need it if 150cbeba4aeSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 151cbeba4aeSmrg You might want to install the \`Automake' and \`Perl' packages. 152cbeba4aeSmrg Grab them from any GNU archive site." 153cbeba4aeSmrg find . -type f -name Makefile.am -print | 154cbeba4aeSmrg sed 's/\.am$/.in/' | 155cbeba4aeSmrg while read f; do touch "$f"; done 156cbeba4aeSmrg ;; 157cbeba4aeSmrg 158cbeba4aeSmrg autom4te) 159cbeba4aeSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 160cbeba4aeSmrg # We have it, but it failed. 161cbeba4aeSmrg exit 1 162cbeba4aeSmrg fi 163cbeba4aeSmrg 164cbeba4aeSmrg echo 1>&2 "\ 165cbeba4aeSmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your 166cbeba4aeSmrg system. You might have modified some files without having the 167cbeba4aeSmrg proper tools for further handling them. 168cbeba4aeSmrg You can get \`$1' as part of \`Autoconf' from any GNU 169cbeba4aeSmrg archive site." 170cbeba4aeSmrg 171cbeba4aeSmrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 172cbeba4aeSmrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 173cbeba4aeSmrg if test -f "$file"; then 174cbeba4aeSmrg touch $file 175cbeba4aeSmrg else 176cbeba4aeSmrg test -z "$file" || exec >$file 177cbeba4aeSmrg echo "#! /bin/sh" 178cbeba4aeSmrg echo "# Created by GNU Automake missing as a replacement of" 179cbeba4aeSmrg echo "# $ $@" 180cbeba4aeSmrg echo "exit 0" 181cbeba4aeSmrg chmod +x $file 182cbeba4aeSmrg exit 1 183cbeba4aeSmrg fi 184cbeba4aeSmrg ;; 185cbeba4aeSmrg 186cbeba4aeSmrg bison|yacc) 187cbeba4aeSmrg echo 1>&2 "\ 188cbeba4aeSmrgWARNING: \`$1' is missing on your system. You should only need it if 189cbeba4aeSmrg you modified a \`.y' file. You may need the \`Bison' package 190cbeba4aeSmrg in order for those modifications to take effect. You can get 191cbeba4aeSmrg \`Bison' from any GNU archive site." 192cbeba4aeSmrg rm -f y.tab.c y.tab.h 193cbeba4aeSmrg if [ $# -ne 1 ]; then 194cbeba4aeSmrg eval LASTARG="\${$#}" 195cbeba4aeSmrg case "$LASTARG" in 196cbeba4aeSmrg *.y) 197cbeba4aeSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 198cbeba4aeSmrg if [ -f "$SRCFILE" ]; then 199cbeba4aeSmrg cp "$SRCFILE" y.tab.c 200cbeba4aeSmrg fi 201cbeba4aeSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 202cbeba4aeSmrg if [ -f "$SRCFILE" ]; then 203cbeba4aeSmrg cp "$SRCFILE" y.tab.h 204cbeba4aeSmrg fi 205cbeba4aeSmrg ;; 206cbeba4aeSmrg esac 207cbeba4aeSmrg fi 208cbeba4aeSmrg if [ ! -f y.tab.h ]; then 209cbeba4aeSmrg echo >y.tab.h 210cbeba4aeSmrg fi 211cbeba4aeSmrg if [ ! -f y.tab.c ]; then 212cbeba4aeSmrg echo 'main() { return 0; }' >y.tab.c 213cbeba4aeSmrg fi 214cbeba4aeSmrg ;; 215cbeba4aeSmrg 216cbeba4aeSmrg lex|flex) 217cbeba4aeSmrg echo 1>&2 "\ 218cbeba4aeSmrgWARNING: \`$1' is missing on your system. You should only need it if 219cbeba4aeSmrg you modified a \`.l' file. You may need the \`Flex' package 220cbeba4aeSmrg in order for those modifications to take effect. You can get 221cbeba4aeSmrg \`Flex' from any GNU archive site." 222cbeba4aeSmrg rm -f lex.yy.c 223cbeba4aeSmrg if [ $# -ne 1 ]; then 224cbeba4aeSmrg eval LASTARG="\${$#}" 225cbeba4aeSmrg case "$LASTARG" in 226cbeba4aeSmrg *.l) 227cbeba4aeSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 228cbeba4aeSmrg if [ -f "$SRCFILE" ]; then 229cbeba4aeSmrg cp "$SRCFILE" lex.yy.c 230cbeba4aeSmrg fi 231cbeba4aeSmrg ;; 232cbeba4aeSmrg esac 233cbeba4aeSmrg fi 234cbeba4aeSmrg if [ ! -f lex.yy.c ]; then 235cbeba4aeSmrg echo 'main() { return 0; }' >lex.yy.c 236cbeba4aeSmrg fi 237cbeba4aeSmrg ;; 238cbeba4aeSmrg 239cbeba4aeSmrg help2man) 240cbeba4aeSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 241cbeba4aeSmrg # We have it, but it failed. 242cbeba4aeSmrg exit 1 243cbeba4aeSmrg fi 244cbeba4aeSmrg 245cbeba4aeSmrg echo 1>&2 "\ 246cbeba4aeSmrgWARNING: \`$1' is missing on your system. You should only need it if 247cbeba4aeSmrg you modified a dependency of a manual page. You may need the 248cbeba4aeSmrg \`Help2man' package in order for those modifications to take 249cbeba4aeSmrg effect. You can get \`Help2man' from any GNU archive site." 250cbeba4aeSmrg 251cbeba4aeSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 252cbeba4aeSmrg if test -z "$file"; then 253cbeba4aeSmrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 254cbeba4aeSmrg fi 255cbeba4aeSmrg if [ -f "$file" ]; then 256cbeba4aeSmrg touch $file 257cbeba4aeSmrg else 258cbeba4aeSmrg test -z "$file" || exec >$file 259cbeba4aeSmrg echo ".ab help2man is required to generate this page" 260cbeba4aeSmrg exit 1 261cbeba4aeSmrg fi 262cbeba4aeSmrg ;; 263cbeba4aeSmrg 264cbeba4aeSmrg makeinfo) 265cbeba4aeSmrg if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then 266cbeba4aeSmrg # We have makeinfo, but it failed. 267cbeba4aeSmrg exit 1 268cbeba4aeSmrg fi 269cbeba4aeSmrg 270cbeba4aeSmrg echo 1>&2 "\ 271cbeba4aeSmrgWARNING: \`$1' is missing on your system. You should only need it if 272cbeba4aeSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 273cbeba4aeSmrg indirectly affecting the aspect of the manual. The spurious 274cbeba4aeSmrg call might also be the consequence of using a buggy \`make' (AIX, 275cbeba4aeSmrg DU, IRIX). You might want to install the \`Texinfo' package or 276cbeba4aeSmrg the \`GNU make' package. Grab either from any GNU archive site." 277cbeba4aeSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 278cbeba4aeSmrg if test -z "$file"; then 279cbeba4aeSmrg file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 280cbeba4aeSmrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` 281cbeba4aeSmrg fi 282cbeba4aeSmrg touch $file 283cbeba4aeSmrg ;; 284cbeba4aeSmrg 285cbeba4aeSmrg tar) 286cbeba4aeSmrg shift 287cbeba4aeSmrg if test -n "$run"; then 288cbeba4aeSmrg echo 1>&2 "ERROR: \`tar' requires --run" 289cbeba4aeSmrg exit 1 290cbeba4aeSmrg fi 291cbeba4aeSmrg 292cbeba4aeSmrg # We have already tried tar in the generic part. 293cbeba4aeSmrg # Look for gnutar/gtar before invocation to avoid ugly error 294cbeba4aeSmrg # messages. 295cbeba4aeSmrg if (gnutar --version > /dev/null 2>&1); then 296cbeba4aeSmrg gnutar "$@" && exit 0 297cbeba4aeSmrg fi 298cbeba4aeSmrg if (gtar --version > /dev/null 2>&1); then 299cbeba4aeSmrg gtar "$@" && exit 0 300cbeba4aeSmrg fi 301cbeba4aeSmrg firstarg="$1" 302cbeba4aeSmrg if shift; then 303cbeba4aeSmrg case "$firstarg" in 304cbeba4aeSmrg *o*) 305cbeba4aeSmrg firstarg=`echo "$firstarg" | sed s/o//` 306cbeba4aeSmrg tar "$firstarg" "$@" && exit 0 307cbeba4aeSmrg ;; 308cbeba4aeSmrg esac 309cbeba4aeSmrg case "$firstarg" in 310cbeba4aeSmrg *h*) 311cbeba4aeSmrg firstarg=`echo "$firstarg" | sed s/h//` 312cbeba4aeSmrg tar "$firstarg" "$@" && exit 0 313cbeba4aeSmrg ;; 314cbeba4aeSmrg esac 315cbeba4aeSmrg fi 316cbeba4aeSmrg 317cbeba4aeSmrg echo 1>&2 "\ 318cbeba4aeSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 319cbeba4aeSmrg You may want to install GNU tar or Free paxutils, or check the 320cbeba4aeSmrg command line arguments." 321cbeba4aeSmrg exit 1 322cbeba4aeSmrg ;; 323cbeba4aeSmrg 324cbeba4aeSmrg *) 325cbeba4aeSmrg echo 1>&2 "\ 326cbeba4aeSmrgWARNING: \`$1' is needed, and you do not seem to have it handy on your 327cbeba4aeSmrg system. You might have modified some files without having the 328cbeba4aeSmrg proper tools for further handling them. Check the \`README' file, 329cbeba4aeSmrg it often tells you about the needed prerequisites for installing 330cbeba4aeSmrg this package. You may also peek at any GNU archive site, in case 331cbeba4aeSmrg some other package would contain this missing \`$1' program." 332cbeba4aeSmrg exit 1 333cbeba4aeSmrg ;; 334cbeba4aeSmrgesac 335cbeba4aeSmrg 336cbeba4aeSmrgexit 0 337