missing revision 357bfbb2
1357bfbb2Smrg#! /bin/sh 2357bfbb2Smrg# Common stub for a few missing GNU programs while installing. 3357bfbb2Smrg 4357bfbb2Smrgscriptversion=2005-06-08.21 5357bfbb2Smrg 6357bfbb2Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 7357bfbb2Smrg# Free Software Foundation, Inc. 8357bfbb2Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9357bfbb2Smrg 10357bfbb2Smrg# This program is free software; you can redistribute it and/or modify 11357bfbb2Smrg# it under the terms of the GNU General Public License as published by 12357bfbb2Smrg# the Free Software Foundation; either version 2, or (at your option) 13357bfbb2Smrg# any later version. 14357bfbb2Smrg 15357bfbb2Smrg# This program is distributed in the hope that it will be useful, 16357bfbb2Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17357bfbb2Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18357bfbb2Smrg# GNU General Public License for more details. 19357bfbb2Smrg 20357bfbb2Smrg# You should have received a copy of the GNU General Public License 21357bfbb2Smrg# along with this program; if not, write to the Free Software 22357bfbb2Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23357bfbb2Smrg# 02110-1301, USA. 24357bfbb2Smrg 25357bfbb2Smrg# As a special exception to the GNU General Public License, if you 26357bfbb2Smrg# distribute this file as part of a program that contains a 27357bfbb2Smrg# configuration script generated by Autoconf, you may include it under 28357bfbb2Smrg# the same distribution terms that you use for the rest of that program. 29357bfbb2Smrg 30357bfbb2Smrgif test $# -eq 0; then 31357bfbb2Smrg echo 1>&2 "Try \`$0 --help' for more information" 32357bfbb2Smrg exit 1 33357bfbb2Smrgfi 34357bfbb2Smrg 35357bfbb2Smrgrun=: 36357bfbb2Smrg 37357bfbb2Smrg# In the cases where this matters, `missing' is being run in the 38357bfbb2Smrg# srcdir already. 39357bfbb2Smrgif test -f configure.ac; then 40357bfbb2Smrg configure_ac=configure.ac 41357bfbb2Smrgelse 42357bfbb2Smrg configure_ac=configure.in 43357bfbb2Smrgfi 44357bfbb2Smrg 45357bfbb2Smrgmsg="missing on your system" 46357bfbb2Smrg 47357bfbb2Smrgcase "$1" in 48357bfbb2Smrg--run) 49357bfbb2Smrg # Try to run requested program, and just exit if it succeeds. 50357bfbb2Smrg run= 51357bfbb2Smrg shift 52357bfbb2Smrg "$@" && exit 0 53357bfbb2Smrg # Exit code 63 means version mismatch. This often happens 54357bfbb2Smrg # when the user try to use an ancient version of a tool on 55357bfbb2Smrg # a file that requires a minimum version. In this case we 56357bfbb2Smrg # we should proceed has if the program had been absent, or 57357bfbb2Smrg # if --run hadn't been passed. 58357bfbb2Smrg if test $? = 63; then 59357bfbb2Smrg run=: 60357bfbb2Smrg msg="probably too old" 61357bfbb2Smrg fi 62357bfbb2Smrg ;; 63357bfbb2Smrg 64357bfbb2Smrg -h|--h|--he|--hel|--help) 65357bfbb2Smrg echo "\ 66357bfbb2Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67357bfbb2Smrg 68357bfbb2SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69357bfbb2Smrgerror status if there is no known handling for PROGRAM. 70357bfbb2Smrg 71357bfbb2SmrgOptions: 72357bfbb2Smrg -h, --help display this help and exit 73357bfbb2Smrg -v, --version output version information and exit 74357bfbb2Smrg --run try to run the given command, and emulate it if it fails 75357bfbb2Smrg 76357bfbb2SmrgSupported PROGRAM values: 77357bfbb2Smrg aclocal touch file \`aclocal.m4' 78357bfbb2Smrg autoconf touch file \`configure' 79357bfbb2Smrg autoheader touch file \`config.h.in' 80357bfbb2Smrg automake touch all \`Makefile.in' files 81357bfbb2Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 82357bfbb2Smrg flex create \`lex.yy.c', if possible, from existing .c 83357bfbb2Smrg help2man touch the output file 84357bfbb2Smrg lex create \`lex.yy.c', if possible, from existing .c 85357bfbb2Smrg makeinfo touch the output file 86357bfbb2Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 87357bfbb2Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 88357bfbb2Smrg 89357bfbb2SmrgSend bug reports to <bug-automake@gnu.org>." 90357bfbb2Smrg exit $? 91357bfbb2Smrg ;; 92357bfbb2Smrg 93357bfbb2Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 94357bfbb2Smrg echo "missing $scriptversion (GNU Automake)" 95357bfbb2Smrg exit $? 96357bfbb2Smrg ;; 97357bfbb2Smrg 98357bfbb2Smrg -*) 99357bfbb2Smrg echo 1>&2 "$0: Unknown \`$1' option" 100357bfbb2Smrg echo 1>&2 "Try \`$0 --help' for more information" 101357bfbb2Smrg exit 1 102357bfbb2Smrg ;; 103357bfbb2Smrg 104357bfbb2Smrgesac 105357bfbb2Smrg 106357bfbb2Smrg# Now exit if we have it, but it failed. Also exit now if we 107357bfbb2Smrg# don't have it and --version was passed (most likely to detect 108357bfbb2Smrg# the program). 109357bfbb2Smrgcase "$1" in 110357bfbb2Smrg lex|yacc) 111357bfbb2Smrg # Not GNU programs, they don't have --version. 112357bfbb2Smrg ;; 113357bfbb2Smrg 114357bfbb2Smrg tar) 115357bfbb2Smrg if test -n "$run"; then 116357bfbb2Smrg echo 1>&2 "ERROR: \`tar' requires --run" 117357bfbb2Smrg exit 1 118357bfbb2Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 119357bfbb2Smrg exit 1 120357bfbb2Smrg fi 121357bfbb2Smrg ;; 122357bfbb2Smrg 123357bfbb2Smrg *) 124357bfbb2Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 125357bfbb2Smrg # We have it, but it failed. 126357bfbb2Smrg exit 1 127357bfbb2Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 128357bfbb2Smrg # Could not run --version or --help. This is probably someone 129357bfbb2Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 130357bfbb2Smrg # $TOOL exists and not knowing $TOOL uses missing. 131357bfbb2Smrg exit 1 132357bfbb2Smrg fi 133357bfbb2Smrg ;; 134357bfbb2Smrgesac 135357bfbb2Smrg 136357bfbb2Smrg# If it does not exist, or fails to run (possibly an outdated version), 137357bfbb2Smrg# try to emulate it. 138357bfbb2Smrgcase "$1" in 139357bfbb2Smrg aclocal*) 140357bfbb2Smrg echo 1>&2 "\ 141357bfbb2SmrgWARNING: \`$1' is $msg. You should only need it if 142357bfbb2Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 143357bfbb2Smrg to install the \`Automake' and \`Perl' packages. Grab them from 144357bfbb2Smrg any GNU archive site." 145357bfbb2Smrg touch aclocal.m4 146357bfbb2Smrg ;; 147357bfbb2Smrg 148357bfbb2Smrg autoconf) 149357bfbb2Smrg echo 1>&2 "\ 150357bfbb2SmrgWARNING: \`$1' is $msg. You should only need it if 151357bfbb2Smrg you modified \`${configure_ac}'. You might want to install the 152357bfbb2Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 153357bfbb2Smrg archive site." 154357bfbb2Smrg touch configure 155357bfbb2Smrg ;; 156357bfbb2Smrg 157357bfbb2Smrg autoheader) 158357bfbb2Smrg echo 1>&2 "\ 159357bfbb2SmrgWARNING: \`$1' is $msg. You should only need it if 160357bfbb2Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 161357bfbb2Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 162357bfbb2Smrg from any GNU archive site." 163357bfbb2Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 164357bfbb2Smrg test -z "$files" && files="config.h" 165357bfbb2Smrg touch_files= 166357bfbb2Smrg for f in $files; do 167357bfbb2Smrg case "$f" in 168357bfbb2Smrg *:*) touch_files="$touch_files "`echo "$f" | 169357bfbb2Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 170357bfbb2Smrg *) touch_files="$touch_files $f.in";; 171357bfbb2Smrg esac 172357bfbb2Smrg done 173357bfbb2Smrg touch $touch_files 174357bfbb2Smrg ;; 175357bfbb2Smrg 176357bfbb2Smrg automake*) 177357bfbb2Smrg echo 1>&2 "\ 178357bfbb2SmrgWARNING: \`$1' is $msg. You should only need it if 179357bfbb2Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 180357bfbb2Smrg You might want to install the \`Automake' and \`Perl' packages. 181357bfbb2Smrg Grab them from any GNU archive site." 182357bfbb2Smrg find . -type f -name Makefile.am -print | 183357bfbb2Smrg sed 's/\.am$/.in/' | 184357bfbb2Smrg while read f; do touch "$f"; done 185357bfbb2Smrg ;; 186357bfbb2Smrg 187357bfbb2Smrg autom4te) 188357bfbb2Smrg echo 1>&2 "\ 189357bfbb2SmrgWARNING: \`$1' is needed, but is $msg. 190357bfbb2Smrg You might have modified some files without having the 191357bfbb2Smrg proper tools for further handling them. 192357bfbb2Smrg You can get \`$1' as part of \`Autoconf' from any GNU 193357bfbb2Smrg archive site." 194357bfbb2Smrg 195357bfbb2Smrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 196357bfbb2Smrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 197357bfbb2Smrg if test -f "$file"; then 198357bfbb2Smrg touch $file 199357bfbb2Smrg else 200357bfbb2Smrg test -z "$file" || exec >$file 201357bfbb2Smrg echo "#! /bin/sh" 202357bfbb2Smrg echo "# Created by GNU Automake missing as a replacement of" 203357bfbb2Smrg echo "# $ $@" 204357bfbb2Smrg echo "exit 0" 205357bfbb2Smrg chmod +x $file 206357bfbb2Smrg exit 1 207357bfbb2Smrg fi 208357bfbb2Smrg ;; 209357bfbb2Smrg 210357bfbb2Smrg bison|yacc) 211357bfbb2Smrg echo 1>&2 "\ 212357bfbb2SmrgWARNING: \`$1' $msg. You should only need it if 213357bfbb2Smrg you modified a \`.y' file. You may need the \`Bison' package 214357bfbb2Smrg in order for those modifications to take effect. You can get 215357bfbb2Smrg \`Bison' from any GNU archive site." 216357bfbb2Smrg rm -f y.tab.c y.tab.h 217357bfbb2Smrg if [ $# -ne 1 ]; then 218357bfbb2Smrg eval LASTARG="\${$#}" 219357bfbb2Smrg case "$LASTARG" in 220357bfbb2Smrg *.y) 221357bfbb2Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 222357bfbb2Smrg if [ -f "$SRCFILE" ]; then 223357bfbb2Smrg cp "$SRCFILE" y.tab.c 224357bfbb2Smrg fi 225357bfbb2Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 226357bfbb2Smrg if [ -f "$SRCFILE" ]; then 227357bfbb2Smrg cp "$SRCFILE" y.tab.h 228357bfbb2Smrg fi 229357bfbb2Smrg ;; 230357bfbb2Smrg esac 231357bfbb2Smrg fi 232357bfbb2Smrg if [ ! -f y.tab.h ]; then 233357bfbb2Smrg echo >y.tab.h 234357bfbb2Smrg fi 235357bfbb2Smrg if [ ! -f y.tab.c ]; then 236357bfbb2Smrg echo 'main() { return 0; }' >y.tab.c 237357bfbb2Smrg fi 238357bfbb2Smrg ;; 239357bfbb2Smrg 240357bfbb2Smrg lex|flex) 241357bfbb2Smrg echo 1>&2 "\ 242357bfbb2SmrgWARNING: \`$1' is $msg. You should only need it if 243357bfbb2Smrg you modified a \`.l' file. You may need the \`Flex' package 244357bfbb2Smrg in order for those modifications to take effect. You can get 245357bfbb2Smrg \`Flex' from any GNU archive site." 246357bfbb2Smrg rm -f lex.yy.c 247357bfbb2Smrg if [ $# -ne 1 ]; then 248357bfbb2Smrg eval LASTARG="\${$#}" 249357bfbb2Smrg case "$LASTARG" in 250357bfbb2Smrg *.l) 251357bfbb2Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 252357bfbb2Smrg if [ -f "$SRCFILE" ]; then 253357bfbb2Smrg cp "$SRCFILE" lex.yy.c 254357bfbb2Smrg fi 255357bfbb2Smrg ;; 256357bfbb2Smrg esac 257357bfbb2Smrg fi 258357bfbb2Smrg if [ ! -f lex.yy.c ]; then 259357bfbb2Smrg echo 'main() { return 0; }' >lex.yy.c 260357bfbb2Smrg fi 261357bfbb2Smrg ;; 262357bfbb2Smrg 263357bfbb2Smrg help2man) 264357bfbb2Smrg echo 1>&2 "\ 265357bfbb2SmrgWARNING: \`$1' is $msg. You should only need it if 266357bfbb2Smrg you modified a dependency of a manual page. You may need the 267357bfbb2Smrg \`Help2man' package in order for those modifications to take 268357bfbb2Smrg effect. You can get \`Help2man' from any GNU archive site." 269357bfbb2Smrg 270357bfbb2Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 271357bfbb2Smrg if test -z "$file"; then 272357bfbb2Smrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 273357bfbb2Smrg fi 274357bfbb2Smrg if [ -f "$file" ]; then 275357bfbb2Smrg touch $file 276357bfbb2Smrg else 277357bfbb2Smrg test -z "$file" || exec >$file 278357bfbb2Smrg echo ".ab help2man is required to generate this page" 279357bfbb2Smrg exit 1 280357bfbb2Smrg fi 281357bfbb2Smrg ;; 282357bfbb2Smrg 283357bfbb2Smrg makeinfo) 284357bfbb2Smrg echo 1>&2 "\ 285357bfbb2SmrgWARNING: \`$1' is $msg. You should only need it if 286357bfbb2Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 287357bfbb2Smrg indirectly affecting the aspect of the manual. The spurious 288357bfbb2Smrg call might also be the consequence of using a buggy \`make' (AIX, 289357bfbb2Smrg DU, IRIX). You might want to install the \`Texinfo' package or 290357bfbb2Smrg the \`GNU make' package. Grab either from any GNU archive site." 291357bfbb2Smrg # The file to touch is that specified with -o ... 292357bfbb2Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 293357bfbb2Smrg if test -z "$file"; then 294357bfbb2Smrg # ... or it is the one specified with @setfilename ... 295357bfbb2Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 296357bfbb2Smrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 297357bfbb2Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 298357bfbb2Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 299357bfbb2Smrg fi 300357bfbb2Smrg # If the file does not exist, the user really needs makeinfo; 301357bfbb2Smrg # let's fail without touching anything. 302357bfbb2Smrg test -f $file || exit 1 303357bfbb2Smrg touch $file 304357bfbb2Smrg ;; 305357bfbb2Smrg 306357bfbb2Smrg tar) 307357bfbb2Smrg shift 308357bfbb2Smrg 309357bfbb2Smrg # We have already tried tar in the generic part. 310357bfbb2Smrg # Look for gnutar/gtar before invocation to avoid ugly error 311357bfbb2Smrg # messages. 312357bfbb2Smrg if (gnutar --version > /dev/null 2>&1); then 313357bfbb2Smrg gnutar "$@" && exit 0 314357bfbb2Smrg fi 315357bfbb2Smrg if (gtar --version > /dev/null 2>&1); then 316357bfbb2Smrg gtar "$@" && exit 0 317357bfbb2Smrg fi 318357bfbb2Smrg firstarg="$1" 319357bfbb2Smrg if shift; then 320357bfbb2Smrg case "$firstarg" in 321357bfbb2Smrg *o*) 322357bfbb2Smrg firstarg=`echo "$firstarg" | sed s/o//` 323357bfbb2Smrg tar "$firstarg" "$@" && exit 0 324357bfbb2Smrg ;; 325357bfbb2Smrg esac 326357bfbb2Smrg case "$firstarg" in 327357bfbb2Smrg *h*) 328357bfbb2Smrg firstarg=`echo "$firstarg" | sed s/h//` 329357bfbb2Smrg tar "$firstarg" "$@" && exit 0 330357bfbb2Smrg ;; 331357bfbb2Smrg esac 332357bfbb2Smrg fi 333357bfbb2Smrg 334357bfbb2Smrg echo 1>&2 "\ 335357bfbb2SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 336357bfbb2Smrg You may want to install GNU tar or Free paxutils, or check the 337357bfbb2Smrg command line arguments." 338357bfbb2Smrg exit 1 339357bfbb2Smrg ;; 340357bfbb2Smrg 341357bfbb2Smrg *) 342357bfbb2Smrg echo 1>&2 "\ 343357bfbb2SmrgWARNING: \`$1' is needed, and is $msg. 344357bfbb2Smrg You might have modified some files without having the 345357bfbb2Smrg proper tools for further handling them. Check the \`README' file, 346357bfbb2Smrg it often tells you about the needed prerequisites for installing 347357bfbb2Smrg this package. You may also peek at any GNU archive site, in case 348357bfbb2Smrg some other package would contain this missing \`$1' program." 349357bfbb2Smrg exit 1 350357bfbb2Smrg ;; 351357bfbb2Smrgesac 352357bfbb2Smrg 353357bfbb2Smrgexit 0 354357bfbb2Smrg 355357bfbb2Smrg# Local variables: 356357bfbb2Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 357357bfbb2Smrg# time-stamp-start: "scriptversion=" 358357bfbb2Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 359357bfbb2Smrg# time-stamp-end: "$" 360357bfbb2Smrg# End: 361