missing revision 191cded7
1191cded7Smrg#! /bin/sh 2191cded7Smrg# Common stub for a few missing GNU programs while installing. 3191cded7Smrg 4191cded7Smrgscriptversion=2005-06-08.21 5191cded7Smrg 6191cded7Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 7191cded7Smrg# Free Software Foundation, Inc. 8191cded7Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9191cded7Smrg 10191cded7Smrg# This program is free software; you can redistribute it and/or modify 11191cded7Smrg# it under the terms of the GNU General Public License as published by 12191cded7Smrg# the Free Software Foundation; either version 2, or (at your option) 13191cded7Smrg# any later version. 14191cded7Smrg 15191cded7Smrg# This program is distributed in the hope that it will be useful, 16191cded7Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17191cded7Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18191cded7Smrg# GNU General Public License for more details. 19191cded7Smrg 20191cded7Smrg# You should have received a copy of the GNU General Public License 21191cded7Smrg# along with this program; if not, write to the Free Software 22191cded7Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23191cded7Smrg# 02110-1301, USA. 24191cded7Smrg 25191cded7Smrg# As a special exception to the GNU General Public License, if you 26191cded7Smrg# distribute this file as part of a program that contains a 27191cded7Smrg# configuration script generated by Autoconf, you may include it under 28191cded7Smrg# the same distribution terms that you use for the rest of that program. 29191cded7Smrg 30191cded7Smrgif test $# -eq 0; then 31191cded7Smrg echo 1>&2 "Try \`$0 --help' for more information" 32191cded7Smrg exit 1 33191cded7Smrgfi 34191cded7Smrg 35191cded7Smrgrun=: 36191cded7Smrg 37191cded7Smrg# In the cases where this matters, `missing' is being run in the 38191cded7Smrg# srcdir already. 39191cded7Smrgif test -f configure.ac; then 40191cded7Smrg configure_ac=configure.ac 41191cded7Smrgelse 42191cded7Smrg configure_ac=configure.in 43191cded7Smrgfi 44191cded7Smrg 45191cded7Smrgmsg="missing on your system" 46191cded7Smrg 47191cded7Smrgcase "$1" in 48191cded7Smrg--run) 49191cded7Smrg # Try to run requested program, and just exit if it succeeds. 50191cded7Smrg run= 51191cded7Smrg shift 52191cded7Smrg "$@" && exit 0 53191cded7Smrg # Exit code 63 means version mismatch. This often happens 54191cded7Smrg # when the user try to use an ancient version of a tool on 55191cded7Smrg # a file that requires a minimum version. In this case we 56191cded7Smrg # we should proceed has if the program had been absent, or 57191cded7Smrg # if --run hadn't been passed. 58191cded7Smrg if test $? = 63; then 59191cded7Smrg run=: 60191cded7Smrg msg="probably too old" 61191cded7Smrg fi 62191cded7Smrg ;; 63191cded7Smrg 64191cded7Smrg -h|--h|--he|--hel|--help) 65191cded7Smrg echo "\ 66191cded7Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67191cded7Smrg 68191cded7SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69191cded7Smrgerror status if there is no known handling for PROGRAM. 70191cded7Smrg 71191cded7SmrgOptions: 72191cded7Smrg -h, --help display this help and exit 73191cded7Smrg -v, --version output version information and exit 74191cded7Smrg --run try to run the given command, and emulate it if it fails 75191cded7Smrg 76191cded7SmrgSupported PROGRAM values: 77191cded7Smrg aclocal touch file \`aclocal.m4' 78191cded7Smrg autoconf touch file \`configure' 79191cded7Smrg autoheader touch file \`config.h.in' 80191cded7Smrg automake touch all \`Makefile.in' files 81191cded7Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 82191cded7Smrg flex create \`lex.yy.c', if possible, from existing .c 83191cded7Smrg help2man touch the output file 84191cded7Smrg lex create \`lex.yy.c', if possible, from existing .c 85191cded7Smrg makeinfo touch the output file 86191cded7Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 87191cded7Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 88191cded7Smrg 89191cded7SmrgSend bug reports to <bug-automake@gnu.org>." 90191cded7Smrg exit $? 91191cded7Smrg ;; 92191cded7Smrg 93191cded7Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 94191cded7Smrg echo "missing $scriptversion (GNU Automake)" 95191cded7Smrg exit $? 96191cded7Smrg ;; 97191cded7Smrg 98191cded7Smrg -*) 99191cded7Smrg echo 1>&2 "$0: Unknown \`$1' option" 100191cded7Smrg echo 1>&2 "Try \`$0 --help' for more information" 101191cded7Smrg exit 1 102191cded7Smrg ;; 103191cded7Smrg 104191cded7Smrgesac 105191cded7Smrg 106191cded7Smrg# Now exit if we have it, but it failed. Also exit now if we 107191cded7Smrg# don't have it and --version was passed (most likely to detect 108191cded7Smrg# the program). 109191cded7Smrgcase "$1" in 110191cded7Smrg lex|yacc) 111191cded7Smrg # Not GNU programs, they don't have --version. 112191cded7Smrg ;; 113191cded7Smrg 114191cded7Smrg tar) 115191cded7Smrg if test -n "$run"; then 116191cded7Smrg echo 1>&2 "ERROR: \`tar' requires --run" 117191cded7Smrg exit 1 118191cded7Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 119191cded7Smrg exit 1 120191cded7Smrg fi 121191cded7Smrg ;; 122191cded7Smrg 123191cded7Smrg *) 124191cded7Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 125191cded7Smrg # We have it, but it failed. 126191cded7Smrg exit 1 127191cded7Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 128191cded7Smrg # Could not run --version or --help. This is probably someone 129191cded7Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 130191cded7Smrg # $TOOL exists and not knowing $TOOL uses missing. 131191cded7Smrg exit 1 132191cded7Smrg fi 133191cded7Smrg ;; 134191cded7Smrgesac 135191cded7Smrg 136191cded7Smrg# If it does not exist, or fails to run (possibly an outdated version), 137191cded7Smrg# try to emulate it. 138191cded7Smrgcase "$1" in 139191cded7Smrg aclocal*) 140191cded7Smrg echo 1>&2 "\ 141191cded7SmrgWARNING: \`$1' is $msg. You should only need it if 142191cded7Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 143191cded7Smrg to install the \`Automake' and \`Perl' packages. Grab them from 144191cded7Smrg any GNU archive site." 145191cded7Smrg touch aclocal.m4 146191cded7Smrg ;; 147191cded7Smrg 148191cded7Smrg autoconf) 149191cded7Smrg echo 1>&2 "\ 150191cded7SmrgWARNING: \`$1' is $msg. You should only need it if 151191cded7Smrg you modified \`${configure_ac}'. You might want to install the 152191cded7Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 153191cded7Smrg archive site." 154191cded7Smrg touch configure 155191cded7Smrg ;; 156191cded7Smrg 157191cded7Smrg autoheader) 158191cded7Smrg echo 1>&2 "\ 159191cded7SmrgWARNING: \`$1' is $msg. You should only need it if 160191cded7Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 161191cded7Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 162191cded7Smrg from any GNU archive site." 163191cded7Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 164191cded7Smrg test -z "$files" && files="config.h" 165191cded7Smrg touch_files= 166191cded7Smrg for f in $files; do 167191cded7Smrg case "$f" in 168191cded7Smrg *:*) touch_files="$touch_files "`echo "$f" | 169191cded7Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 170191cded7Smrg *) touch_files="$touch_files $f.in";; 171191cded7Smrg esac 172191cded7Smrg done 173191cded7Smrg touch $touch_files 174191cded7Smrg ;; 175191cded7Smrg 176191cded7Smrg automake*) 177191cded7Smrg echo 1>&2 "\ 178191cded7SmrgWARNING: \`$1' is $msg. You should only need it if 179191cded7Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 180191cded7Smrg You might want to install the \`Automake' and \`Perl' packages. 181191cded7Smrg Grab them from any GNU archive site." 182191cded7Smrg find . -type f -name Makefile.am -print | 183191cded7Smrg sed 's/\.am$/.in/' | 184191cded7Smrg while read f; do touch "$f"; done 185191cded7Smrg ;; 186191cded7Smrg 187191cded7Smrg autom4te) 188191cded7Smrg echo 1>&2 "\ 189191cded7SmrgWARNING: \`$1' is needed, but is $msg. 190191cded7Smrg You might have modified some files without having the 191191cded7Smrg proper tools for further handling them. 192191cded7Smrg You can get \`$1' as part of \`Autoconf' from any GNU 193191cded7Smrg archive site." 194191cded7Smrg 195191cded7Smrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 196191cded7Smrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 197191cded7Smrg if test -f "$file"; then 198191cded7Smrg touch $file 199191cded7Smrg else 200191cded7Smrg test -z "$file" || exec >$file 201191cded7Smrg echo "#! /bin/sh" 202191cded7Smrg echo "# Created by GNU Automake missing as a replacement of" 203191cded7Smrg echo "# $ $@" 204191cded7Smrg echo "exit 0" 205191cded7Smrg chmod +x $file 206191cded7Smrg exit 1 207191cded7Smrg fi 208191cded7Smrg ;; 209191cded7Smrg 210191cded7Smrg bison|yacc) 211191cded7Smrg echo 1>&2 "\ 212191cded7SmrgWARNING: \`$1' $msg. You should only need it if 213191cded7Smrg you modified a \`.y' file. You may need the \`Bison' package 214191cded7Smrg in order for those modifications to take effect. You can get 215191cded7Smrg \`Bison' from any GNU archive site." 216191cded7Smrg rm -f y.tab.c y.tab.h 217191cded7Smrg if [ $# -ne 1 ]; then 218191cded7Smrg eval LASTARG="\${$#}" 219191cded7Smrg case "$LASTARG" in 220191cded7Smrg *.y) 221191cded7Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 222191cded7Smrg if [ -f "$SRCFILE" ]; then 223191cded7Smrg cp "$SRCFILE" y.tab.c 224191cded7Smrg fi 225191cded7Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 226191cded7Smrg if [ -f "$SRCFILE" ]; then 227191cded7Smrg cp "$SRCFILE" y.tab.h 228191cded7Smrg fi 229191cded7Smrg ;; 230191cded7Smrg esac 231191cded7Smrg fi 232191cded7Smrg if [ ! -f y.tab.h ]; then 233191cded7Smrg echo >y.tab.h 234191cded7Smrg fi 235191cded7Smrg if [ ! -f y.tab.c ]; then 236191cded7Smrg echo 'main() { return 0; }' >y.tab.c 237191cded7Smrg fi 238191cded7Smrg ;; 239191cded7Smrg 240191cded7Smrg lex|flex) 241191cded7Smrg echo 1>&2 "\ 242191cded7SmrgWARNING: \`$1' is $msg. You should only need it if 243191cded7Smrg you modified a \`.l' file. You may need the \`Flex' package 244191cded7Smrg in order for those modifications to take effect. You can get 245191cded7Smrg \`Flex' from any GNU archive site." 246191cded7Smrg rm -f lex.yy.c 247191cded7Smrg if [ $# -ne 1 ]; then 248191cded7Smrg eval LASTARG="\${$#}" 249191cded7Smrg case "$LASTARG" in 250191cded7Smrg *.l) 251191cded7Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 252191cded7Smrg if [ -f "$SRCFILE" ]; then 253191cded7Smrg cp "$SRCFILE" lex.yy.c 254191cded7Smrg fi 255191cded7Smrg ;; 256191cded7Smrg esac 257191cded7Smrg fi 258191cded7Smrg if [ ! -f lex.yy.c ]; then 259191cded7Smrg echo 'main() { return 0; }' >lex.yy.c 260191cded7Smrg fi 261191cded7Smrg ;; 262191cded7Smrg 263191cded7Smrg help2man) 264191cded7Smrg echo 1>&2 "\ 265191cded7SmrgWARNING: \`$1' is $msg. You should only need it if 266191cded7Smrg you modified a dependency of a manual page. You may need the 267191cded7Smrg \`Help2man' package in order for those modifications to take 268191cded7Smrg effect. You can get \`Help2man' from any GNU archive site." 269191cded7Smrg 270191cded7Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 271191cded7Smrg if test -z "$file"; then 272191cded7Smrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 273191cded7Smrg fi 274191cded7Smrg if [ -f "$file" ]; then 275191cded7Smrg touch $file 276191cded7Smrg else 277191cded7Smrg test -z "$file" || exec >$file 278191cded7Smrg echo ".ab help2man is required to generate this page" 279191cded7Smrg exit 1 280191cded7Smrg fi 281191cded7Smrg ;; 282191cded7Smrg 283191cded7Smrg makeinfo) 284191cded7Smrg echo 1>&2 "\ 285191cded7SmrgWARNING: \`$1' is $msg. You should only need it if 286191cded7Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 287191cded7Smrg indirectly affecting the aspect of the manual. The spurious 288191cded7Smrg call might also be the consequence of using a buggy \`make' (AIX, 289191cded7Smrg DU, IRIX). You might want to install the \`Texinfo' package or 290191cded7Smrg the \`GNU make' package. Grab either from any GNU archive site." 291191cded7Smrg # The file to touch is that specified with -o ... 292191cded7Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 293191cded7Smrg if test -z "$file"; then 294191cded7Smrg # ... or it is the one specified with @setfilename ... 295191cded7Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 296191cded7Smrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 297191cded7Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 298191cded7Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 299191cded7Smrg fi 300191cded7Smrg # If the file does not exist, the user really needs makeinfo; 301191cded7Smrg # let's fail without touching anything. 302191cded7Smrg test -f $file || exit 1 303191cded7Smrg touch $file 304191cded7Smrg ;; 305191cded7Smrg 306191cded7Smrg tar) 307191cded7Smrg shift 308191cded7Smrg 309191cded7Smrg # We have already tried tar in the generic part. 310191cded7Smrg # Look for gnutar/gtar before invocation to avoid ugly error 311191cded7Smrg # messages. 312191cded7Smrg if (gnutar --version > /dev/null 2>&1); then 313191cded7Smrg gnutar "$@" && exit 0 314191cded7Smrg fi 315191cded7Smrg if (gtar --version > /dev/null 2>&1); then 316191cded7Smrg gtar "$@" && exit 0 317191cded7Smrg fi 318191cded7Smrg firstarg="$1" 319191cded7Smrg if shift; then 320191cded7Smrg case "$firstarg" in 321191cded7Smrg *o*) 322191cded7Smrg firstarg=`echo "$firstarg" | sed s/o//` 323191cded7Smrg tar "$firstarg" "$@" && exit 0 324191cded7Smrg ;; 325191cded7Smrg esac 326191cded7Smrg case "$firstarg" in 327191cded7Smrg *h*) 328191cded7Smrg firstarg=`echo "$firstarg" | sed s/h//` 329191cded7Smrg tar "$firstarg" "$@" && exit 0 330191cded7Smrg ;; 331191cded7Smrg esac 332191cded7Smrg fi 333191cded7Smrg 334191cded7Smrg echo 1>&2 "\ 335191cded7SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 336191cded7Smrg You may want to install GNU tar or Free paxutils, or check the 337191cded7Smrg command line arguments." 338191cded7Smrg exit 1 339191cded7Smrg ;; 340191cded7Smrg 341191cded7Smrg *) 342191cded7Smrg echo 1>&2 "\ 343191cded7SmrgWARNING: \`$1' is needed, and is $msg. 344191cded7Smrg You might have modified some files without having the 345191cded7Smrg proper tools for further handling them. Check the \`README' file, 346191cded7Smrg it often tells you about the needed prerequisites for installing 347191cded7Smrg this package. You may also peek at any GNU archive site, in case 348191cded7Smrg some other package would contain this missing \`$1' program." 349191cded7Smrg exit 1 350191cded7Smrg ;; 351191cded7Smrgesac 352191cded7Smrg 353191cded7Smrgexit 0 354191cded7Smrg 355191cded7Smrg# Local variables: 356191cded7Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 357191cded7Smrg# time-stamp-start: "scriptversion=" 358191cded7Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 359191cded7Smrg# time-stamp-end: "$" 360191cded7Smrg# End: 361