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