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