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