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