missing revision 444c061a
1444c061aSmrg#! /bin/sh 2444c061aSmrg# Common stub for a few missing GNU programs while installing. 3444c061aSmrg 4444c061aSmrgscriptversion=2005-06-08.21 5444c061aSmrg 6444c061aSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 7444c061aSmrg# Free Software Foundation, Inc. 8444c061aSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9444c061aSmrg 10444c061aSmrg# This program is free software; you can redistribute it and/or modify 11444c061aSmrg# it under the terms of the GNU General Public License as published by 12444c061aSmrg# the Free Software Foundation; either version 2, or (at your option) 13444c061aSmrg# any later version. 14444c061aSmrg 15444c061aSmrg# This program is distributed in the hope that it will be useful, 16444c061aSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17444c061aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18444c061aSmrg# GNU General Public License for more details. 19444c061aSmrg 20444c061aSmrg# You should have received a copy of the GNU General Public License 21444c061aSmrg# along with this program; if not, write to the Free Software 22444c061aSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23444c061aSmrg# 02110-1301, USA. 24444c061aSmrg 25444c061aSmrg# As a special exception to the GNU General Public License, if you 26444c061aSmrg# distribute this file as part of a program that contains a 27444c061aSmrg# configuration script generated by Autoconf, you may include it under 28444c061aSmrg# the same distribution terms that you use for the rest of that program. 29444c061aSmrg 30444c061aSmrgif test $# -eq 0; then 31444c061aSmrg echo 1>&2 "Try \`$0 --help' for more information" 32444c061aSmrg exit 1 33444c061aSmrgfi 34444c061aSmrg 35444c061aSmrgrun=: 36444c061aSmrg 37444c061aSmrg# In the cases where this matters, `missing' is being run in the 38444c061aSmrg# srcdir already. 39444c061aSmrgif test -f configure.ac; then 40444c061aSmrg configure_ac=configure.ac 41444c061aSmrgelse 42444c061aSmrg configure_ac=configure.in 43444c061aSmrgfi 44444c061aSmrg 45444c061aSmrgmsg="missing on your system" 46444c061aSmrg 47444c061aSmrgcase "$1" in 48444c061aSmrg--run) 49444c061aSmrg # Try to run requested program, and just exit if it succeeds. 50444c061aSmrg run= 51444c061aSmrg shift 52444c061aSmrg "$@" && exit 0 53444c061aSmrg # Exit code 63 means version mismatch. This often happens 54444c061aSmrg # when the user try to use an ancient version of a tool on 55444c061aSmrg # a file that requires a minimum version. In this case we 56444c061aSmrg # we should proceed has if the program had been absent, or 57444c061aSmrg # if --run hadn't been passed. 58444c061aSmrg if test $? = 63; then 59444c061aSmrg run=: 60444c061aSmrg msg="probably too old" 61444c061aSmrg fi 62444c061aSmrg ;; 63444c061aSmrg 64444c061aSmrg -h|--h|--he|--hel|--help) 65444c061aSmrg echo "\ 66444c061aSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67444c061aSmrg 68444c061aSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69444c061aSmrgerror status if there is no known handling for PROGRAM. 70444c061aSmrg 71444c061aSmrgOptions: 72444c061aSmrg -h, --help display this help and exit 73444c061aSmrg -v, --version output version information and exit 74444c061aSmrg --run try to run the given command, and emulate it if it fails 75444c061aSmrg 76444c061aSmrgSupported PROGRAM values: 77444c061aSmrg aclocal touch file \`aclocal.m4' 78444c061aSmrg autoconf touch file \`configure' 79444c061aSmrg autoheader touch file \`config.h.in' 80444c061aSmrg automake touch all \`Makefile.in' files 81444c061aSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 82444c061aSmrg flex create \`lex.yy.c', if possible, from existing .c 83444c061aSmrg help2man touch the output file 84444c061aSmrg lex create \`lex.yy.c', if possible, from existing .c 85444c061aSmrg makeinfo touch the output file 86444c061aSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 87444c061aSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 88444c061aSmrg 89444c061aSmrgSend bug reports to <bug-automake@gnu.org>." 90444c061aSmrg exit $? 91444c061aSmrg ;; 92444c061aSmrg 93444c061aSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 94444c061aSmrg echo "missing $scriptversion (GNU Automake)" 95444c061aSmrg exit $? 96444c061aSmrg ;; 97444c061aSmrg 98444c061aSmrg -*) 99444c061aSmrg echo 1>&2 "$0: Unknown \`$1' option" 100444c061aSmrg echo 1>&2 "Try \`$0 --help' for more information" 101444c061aSmrg exit 1 102444c061aSmrg ;; 103444c061aSmrg 104444c061aSmrgesac 105444c061aSmrg 106444c061aSmrg# Now exit if we have it, but it failed. Also exit now if we 107444c061aSmrg# don't have it and --version was passed (most likely to detect 108444c061aSmrg# the program). 109444c061aSmrgcase "$1" in 110444c061aSmrg lex|yacc) 111444c061aSmrg # Not GNU programs, they don't have --version. 112444c061aSmrg ;; 113444c061aSmrg 114444c061aSmrg tar) 115444c061aSmrg if test -n "$run"; then 116444c061aSmrg echo 1>&2 "ERROR: \`tar' requires --run" 117444c061aSmrg exit 1 118444c061aSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 119444c061aSmrg exit 1 120444c061aSmrg fi 121444c061aSmrg ;; 122444c061aSmrg 123444c061aSmrg *) 124444c061aSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 125444c061aSmrg # We have it, but it failed. 126444c061aSmrg exit 1 127444c061aSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 128444c061aSmrg # Could not run --version or --help. This is probably someone 129444c061aSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 130444c061aSmrg # $TOOL exists and not knowing $TOOL uses missing. 131444c061aSmrg exit 1 132444c061aSmrg fi 133444c061aSmrg ;; 134444c061aSmrgesac 135444c061aSmrg 136444c061aSmrg# If it does not exist, or fails to run (possibly an outdated version), 137444c061aSmrg# try to emulate it. 138444c061aSmrgcase "$1" in 139444c061aSmrg aclocal*) 140444c061aSmrg echo 1>&2 "\ 141444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 142444c061aSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 143444c061aSmrg to install the \`Automake' and \`Perl' packages. Grab them from 144444c061aSmrg any GNU archive site." 145444c061aSmrg touch aclocal.m4 146444c061aSmrg ;; 147444c061aSmrg 148444c061aSmrg autoconf) 149444c061aSmrg echo 1>&2 "\ 150444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 151444c061aSmrg you modified \`${configure_ac}'. You might want to install the 152444c061aSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 153444c061aSmrg archive site." 154444c061aSmrg touch configure 155444c061aSmrg ;; 156444c061aSmrg 157444c061aSmrg autoheader) 158444c061aSmrg echo 1>&2 "\ 159444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 160444c061aSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 161444c061aSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 162444c061aSmrg from any GNU archive site." 163444c061aSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 164444c061aSmrg test -z "$files" && files="config.h" 165444c061aSmrg touch_files= 166444c061aSmrg for f in $files; do 167444c061aSmrg case "$f" in 168444c061aSmrg *:*) touch_files="$touch_files "`echo "$f" | 169444c061aSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 170444c061aSmrg *) touch_files="$touch_files $f.in";; 171444c061aSmrg esac 172444c061aSmrg done 173444c061aSmrg touch $touch_files 174444c061aSmrg ;; 175444c061aSmrg 176444c061aSmrg automake*) 177444c061aSmrg echo 1>&2 "\ 178444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 179444c061aSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 180444c061aSmrg You might want to install the \`Automake' and \`Perl' packages. 181444c061aSmrg Grab them from any GNU archive site." 182444c061aSmrg find . -type f -name Makefile.am -print | 183444c061aSmrg sed 's/\.am$/.in/' | 184444c061aSmrg while read f; do touch "$f"; done 185444c061aSmrg ;; 186444c061aSmrg 187444c061aSmrg autom4te) 188444c061aSmrg echo 1>&2 "\ 189444c061aSmrgWARNING: \`$1' is needed, but is $msg. 190444c061aSmrg You might have modified some files without having the 191444c061aSmrg proper tools for further handling them. 192444c061aSmrg You can get \`$1' as part of \`Autoconf' from any GNU 193444c061aSmrg archive site." 194444c061aSmrg 195444c061aSmrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 196444c061aSmrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 197444c061aSmrg if test -f "$file"; then 198444c061aSmrg touch $file 199444c061aSmrg else 200444c061aSmrg test -z "$file" || exec >$file 201444c061aSmrg echo "#! /bin/sh" 202444c061aSmrg echo "# Created by GNU Automake missing as a replacement of" 203444c061aSmrg echo "# $ $@" 204444c061aSmrg echo "exit 0" 205444c061aSmrg chmod +x $file 206444c061aSmrg exit 1 207444c061aSmrg fi 208444c061aSmrg ;; 209444c061aSmrg 210444c061aSmrg bison|yacc) 211444c061aSmrg echo 1>&2 "\ 212444c061aSmrgWARNING: \`$1' $msg. You should only need it if 213444c061aSmrg you modified a \`.y' file. You may need the \`Bison' package 214444c061aSmrg in order for those modifications to take effect. You can get 215444c061aSmrg \`Bison' from any GNU archive site." 216444c061aSmrg rm -f y.tab.c y.tab.h 217444c061aSmrg if [ $# -ne 1 ]; then 218444c061aSmrg eval LASTARG="\${$#}" 219444c061aSmrg case "$LASTARG" in 220444c061aSmrg *.y) 221444c061aSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 222444c061aSmrg if [ -f "$SRCFILE" ]; then 223444c061aSmrg cp "$SRCFILE" y.tab.c 224444c061aSmrg fi 225444c061aSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 226444c061aSmrg if [ -f "$SRCFILE" ]; then 227444c061aSmrg cp "$SRCFILE" y.tab.h 228444c061aSmrg fi 229444c061aSmrg ;; 230444c061aSmrg esac 231444c061aSmrg fi 232444c061aSmrg if [ ! -f y.tab.h ]; then 233444c061aSmrg echo >y.tab.h 234444c061aSmrg fi 235444c061aSmrg if [ ! -f y.tab.c ]; then 236444c061aSmrg echo 'main() { return 0; }' >y.tab.c 237444c061aSmrg fi 238444c061aSmrg ;; 239444c061aSmrg 240444c061aSmrg lex|flex) 241444c061aSmrg echo 1>&2 "\ 242444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 243444c061aSmrg you modified a \`.l' file. You may need the \`Flex' package 244444c061aSmrg in order for those modifications to take effect. You can get 245444c061aSmrg \`Flex' from any GNU archive site." 246444c061aSmrg rm -f lex.yy.c 247444c061aSmrg if [ $# -ne 1 ]; then 248444c061aSmrg eval LASTARG="\${$#}" 249444c061aSmrg case "$LASTARG" in 250444c061aSmrg *.l) 251444c061aSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 252444c061aSmrg if [ -f "$SRCFILE" ]; then 253444c061aSmrg cp "$SRCFILE" lex.yy.c 254444c061aSmrg fi 255444c061aSmrg ;; 256444c061aSmrg esac 257444c061aSmrg fi 258444c061aSmrg if [ ! -f lex.yy.c ]; then 259444c061aSmrg echo 'main() { return 0; }' >lex.yy.c 260444c061aSmrg fi 261444c061aSmrg ;; 262444c061aSmrg 263444c061aSmrg help2man) 264444c061aSmrg echo 1>&2 "\ 265444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 266444c061aSmrg you modified a dependency of a manual page. You may need the 267444c061aSmrg \`Help2man' package in order for those modifications to take 268444c061aSmrg effect. You can get \`Help2man' from any GNU archive site." 269444c061aSmrg 270444c061aSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 271444c061aSmrg if test -z "$file"; then 272444c061aSmrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 273444c061aSmrg fi 274444c061aSmrg if [ -f "$file" ]; then 275444c061aSmrg touch $file 276444c061aSmrg else 277444c061aSmrg test -z "$file" || exec >$file 278444c061aSmrg echo ".ab help2man is required to generate this page" 279444c061aSmrg exit 1 280444c061aSmrg fi 281444c061aSmrg ;; 282444c061aSmrg 283444c061aSmrg makeinfo) 284444c061aSmrg echo 1>&2 "\ 285444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 286444c061aSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 287444c061aSmrg indirectly affecting the aspect of the manual. The spurious 288444c061aSmrg call might also be the consequence of using a buggy \`make' (AIX, 289444c061aSmrg DU, IRIX). You might want to install the \`Texinfo' package or 290444c061aSmrg the \`GNU make' package. Grab either from any GNU archive site." 291444c061aSmrg # The file to touch is that specified with -o ... 292444c061aSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 293444c061aSmrg if test -z "$file"; then 294444c061aSmrg # ... or it is the one specified with @setfilename ... 295444c061aSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 296444c061aSmrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 297444c061aSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 298444c061aSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 299444c061aSmrg fi 300444c061aSmrg # If the file does not exist, the user really needs makeinfo; 301444c061aSmrg # let's fail without touching anything. 302444c061aSmrg test -f $file || exit 1 303444c061aSmrg touch $file 304444c061aSmrg ;; 305444c061aSmrg 306444c061aSmrg tar) 307444c061aSmrg shift 308444c061aSmrg 309444c061aSmrg # We have already tried tar in the generic part. 310444c061aSmrg # Look for gnutar/gtar before invocation to avoid ugly error 311444c061aSmrg # messages. 312444c061aSmrg if (gnutar --version > /dev/null 2>&1); then 313444c061aSmrg gnutar "$@" && exit 0 314444c061aSmrg fi 315444c061aSmrg if (gtar --version > /dev/null 2>&1); then 316444c061aSmrg gtar "$@" && exit 0 317444c061aSmrg fi 318444c061aSmrg firstarg="$1" 319444c061aSmrg if shift; then 320444c061aSmrg case "$firstarg" in 321444c061aSmrg *o*) 322444c061aSmrg firstarg=`echo "$firstarg" | sed s/o//` 323444c061aSmrg tar "$firstarg" "$@" && exit 0 324444c061aSmrg ;; 325444c061aSmrg esac 326444c061aSmrg case "$firstarg" in 327444c061aSmrg *h*) 328444c061aSmrg firstarg=`echo "$firstarg" | sed s/h//` 329444c061aSmrg tar "$firstarg" "$@" && exit 0 330444c061aSmrg ;; 331444c061aSmrg esac 332444c061aSmrg fi 333444c061aSmrg 334444c061aSmrg echo 1>&2 "\ 335444c061aSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 336444c061aSmrg You may want to install GNU tar or Free paxutils, or check the 337444c061aSmrg command line arguments." 338444c061aSmrg exit 1 339444c061aSmrg ;; 340444c061aSmrg 341444c061aSmrg *) 342444c061aSmrg echo 1>&2 "\ 343444c061aSmrgWARNING: \`$1' is needed, and is $msg. 344444c061aSmrg You might have modified some files without having the 345444c061aSmrg proper tools for further handling them. Check the \`README' file, 346444c061aSmrg it often tells you about the needed prerequisites for installing 347444c061aSmrg this package. You may also peek at any GNU archive site, in case 348444c061aSmrg some other package would contain this missing \`$1' program." 349444c061aSmrg exit 1 350444c061aSmrg ;; 351444c061aSmrgesac 352444c061aSmrg 353444c061aSmrgexit 0 354444c061aSmrg 355444c061aSmrg# Local variables: 356444c061aSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 357444c061aSmrg# time-stamp-start: "scriptversion=" 358444c061aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 359444c061aSmrg# time-stamp-end: "$" 360444c061aSmrg# End: 361