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