1156283Srwatson#! /bin/sh 2156283Srwatson# Common stub for a few missing GNU programs while installing. 3156283Srwatson 4156283Srwatsonscriptversion=2005-06-08.21 5156283Srwatson 6156283Srwatson# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 7156283Srwatson# Free Software Foundation, Inc. 8156283Srwatson# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9156283Srwatson 10156283Srwatson# This program is free software; you can redistribute it and/or modify 11156283Srwatson# it under the terms of the GNU General Public License as published by 12156283Srwatson# the Free Software Foundation; either version 2, or (at your option) 13156283Srwatson# any later version. 14156283Srwatson 15156283Srwatson# This program is distributed in the hope that it will be useful, 16156283Srwatson# but WITHOUT ANY WARRANTY; without even the implied warranty of 17156283Srwatson# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18156283Srwatson# GNU General Public License for more details. 19156283Srwatson 20156283Srwatson# You should have received a copy of the GNU General Public License 21156283Srwatson# along with this program; if not, write to the Free Software 22156283Srwatson# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23156283Srwatson# 02110-1301, USA. 24156283Srwatson 25156283Srwatson# As a special exception to the GNU General Public License, if you 26156283Srwatson# distribute this file as part of a program that contains a 27156283Srwatson# configuration script generated by Autoconf, you may include it under 28156283Srwatson# the same distribution terms that you use for the rest of that program. 29156283Srwatson 30156283Srwatsonif test $# -eq 0; then 31156283Srwatson echo 1>&2 "Try \`$0 --help' for more information" 32156283Srwatson exit 1 33156283Srwatsonfi 34156283Srwatson 35156283Srwatsonrun=: 36156283Srwatson 37156283Srwatson# In the cases where this matters, `missing' is being run in the 38156283Srwatson# srcdir already. 39156283Srwatsonif test -f configure.ac; then 40156283Srwatson configure_ac=configure.ac 41156283Srwatsonelse 42156283Srwatson configure_ac=configure.in 43156283Srwatsonfi 44156283Srwatson 45156283Srwatsonmsg="missing on your system" 46156283Srwatson 47156283Srwatsoncase "$1" in 48156283Srwatson--run) 49156283Srwatson # Try to run requested program, and just exit if it succeeds. 50156283Srwatson run= 51156283Srwatson shift 52156283Srwatson "$@" && exit 0 53156283Srwatson # Exit code 63 means version mismatch. This often happens 54156283Srwatson # when the user try to use an ancient version of a tool on 55156283Srwatson # a file that requires a minimum version. In this case we 56156283Srwatson # we should proceed has if the program had been absent, or 57156283Srwatson # if --run hadn't been passed. 58156283Srwatson if test $? = 63; then 59156283Srwatson run=: 60156283Srwatson msg="probably too old" 61156283Srwatson fi 62156283Srwatson ;; 63156283Srwatson 64156283Srwatson -h|--h|--he|--hel|--help) 65156283Srwatson echo "\ 66156283Srwatson$0 [OPTION]... PROGRAM [ARGUMENT]... 67156283Srwatson 68156283SrwatsonHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69156283Srwatsonerror status if there is no known handling for PROGRAM. 70156283Srwatson 71156283SrwatsonOptions: 72156283Srwatson -h, --help display this help and exit 73156283Srwatson -v, --version output version information and exit 74156283Srwatson --run try to run the given command, and emulate it if it fails 75156283Srwatson 76156283SrwatsonSupported PROGRAM values: 77156283Srwatson aclocal touch file \`aclocal.m4' 78156283Srwatson autoconf touch file \`configure' 79156283Srwatson autoheader touch file \`config.h.in' 80156283Srwatson automake touch all \`Makefile.in' files 81156283Srwatson bison create \`y.tab.[ch]', if possible, from existing .[ch] 82156283Srwatson flex create \`lex.yy.c', if possible, from existing .c 83156283Srwatson help2man touch the output file 84156283Srwatson lex create \`lex.yy.c', if possible, from existing .c 85156283Srwatson makeinfo touch the output file 86156283Srwatson tar try tar, gnutar, gtar, then tar without non-portable flags 87156283Srwatson yacc create \`y.tab.[ch]', if possible, from existing .[ch] 88156283Srwatson 89156283SrwatsonSend bug reports to <bug-automake@gnu.org>." 90156283Srwatson exit $? 91156283Srwatson ;; 92156283Srwatson 93156283Srwatson -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 94156283Srwatson echo "missing $scriptversion (GNU Automake)" 95156283Srwatson exit $? 96156283Srwatson ;; 97156283Srwatson 98156283Srwatson -*) 99156283Srwatson echo 1>&2 "$0: Unknown \`$1' option" 100156283Srwatson echo 1>&2 "Try \`$0 --help' for more information" 101156283Srwatson exit 1 102156283Srwatson ;; 103156283Srwatson 104156283Srwatsonesac 105156283Srwatson 106156283Srwatson# Now exit if we have it, but it failed. Also exit now if we 107156283Srwatson# don't have it and --version was passed (most likely to detect 108156283Srwatson# the program). 109156283Srwatsoncase "$1" in 110156283Srwatson lex|yacc) 111156283Srwatson # Not GNU programs, they don't have --version. 112156283Srwatson ;; 113156283Srwatson 114156283Srwatson tar) 115156283Srwatson if test -n "$run"; then 116156283Srwatson echo 1>&2 "ERROR: \`tar' requires --run" 117156283Srwatson exit 1 118156283Srwatson elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 119156283Srwatson exit 1 120156283Srwatson fi 121156283Srwatson ;; 122156283Srwatson 123156283Srwatson *) 124156283Srwatson if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 125156283Srwatson # We have it, but it failed. 126156283Srwatson exit 1 127156283Srwatson elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 128156283Srwatson # Could not run --version or --help. This is probably someone 129156283Srwatson # running `$TOOL --version' or `$TOOL --help' to check whether 130156283Srwatson # $TOOL exists and not knowing $TOOL uses missing. 131156283Srwatson exit 1 132156283Srwatson fi 133156283Srwatson ;; 134156283Srwatsonesac 135156283Srwatson 136156283Srwatson# If it does not exist, or fails to run (possibly an outdated version), 137156283Srwatson# try to emulate it. 138156283Srwatsoncase "$1" in 139156283Srwatson aclocal*) 140156283Srwatson echo 1>&2 "\ 141156283SrwatsonWARNING: \`$1' is $msg. You should only need it if 142156283Srwatson you modified \`acinclude.m4' or \`${configure_ac}'. You might want 143156283Srwatson to install the \`Automake' and \`Perl' packages. Grab them from 144156283Srwatson any GNU archive site." 145156283Srwatson touch aclocal.m4 146156283Srwatson ;; 147156283Srwatson 148156283Srwatson autoconf) 149156283Srwatson echo 1>&2 "\ 150156283SrwatsonWARNING: \`$1' is $msg. You should only need it if 151156283Srwatson you modified \`${configure_ac}'. You might want to install the 152156283Srwatson \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 153156283Srwatson archive site." 154156283Srwatson touch configure 155156283Srwatson ;; 156156283Srwatson 157156283Srwatson autoheader) 158156283Srwatson echo 1>&2 "\ 159156283SrwatsonWARNING: \`$1' is $msg. You should only need it if 160156283Srwatson you modified \`acconfig.h' or \`${configure_ac}'. You might want 161156283Srwatson to install the \`Autoconf' and \`GNU m4' packages. Grab them 162156283Srwatson from any GNU archive site." 163156283Srwatson files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 164156283Srwatson test -z "$files" && files="config.h" 165156283Srwatson touch_files= 166156283Srwatson for f in $files; do 167156283Srwatson case "$f" in 168156283Srwatson *:*) touch_files="$touch_files "`echo "$f" | 169156283Srwatson sed -e 's/^[^:]*://' -e 's/:.*//'`;; 170156283Srwatson *) touch_files="$touch_files $f.in";; 171156283Srwatson esac 172156283Srwatson done 173156283Srwatson touch $touch_files 174156283Srwatson ;; 175156283Srwatson 176156283Srwatson automake*) 177156283Srwatson echo 1>&2 "\ 178156283SrwatsonWARNING: \`$1' is $msg. You should only need it if 179156283Srwatson you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 180156283Srwatson You might want to install the \`Automake' and \`Perl' packages. 181156283Srwatson Grab them from any GNU archive site." 182156283Srwatson find . -type f -name Makefile.am -print | 183156283Srwatson sed 's/\.am$/.in/' | 184156283Srwatson while read f; do touch "$f"; done 185156283Srwatson ;; 186156283Srwatson 187156283Srwatson autom4te) 188156283Srwatson echo 1>&2 "\ 189156283SrwatsonWARNING: \`$1' is needed, but is $msg. 190156283Srwatson You might have modified some files without having the 191156283Srwatson proper tools for further handling them. 192156283Srwatson You can get \`$1' as part of \`Autoconf' from any GNU 193156283Srwatson archive site." 194156283Srwatson 195156283Srwatson file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 196156283Srwatson test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 197156283Srwatson if test -f "$file"; then 198156283Srwatson touch $file 199156283Srwatson else 200156283Srwatson test -z "$file" || exec >$file 201156283Srwatson echo "#! /bin/sh" 202156283Srwatson echo "# Created by GNU Automake missing as a replacement of" 203156283Srwatson echo "# $ $@" 204156283Srwatson echo "exit 0" 205156283Srwatson chmod +x $file 206156283Srwatson exit 1 207156283Srwatson fi 208156283Srwatson ;; 209156283Srwatson 210156283Srwatson bison|yacc) 211156283Srwatson echo 1>&2 "\ 212156283SrwatsonWARNING: \`$1' $msg. You should only need it if 213156283Srwatson you modified a \`.y' file. You may need the \`Bison' package 214156283Srwatson in order for those modifications to take effect. You can get 215156283Srwatson \`Bison' from any GNU archive site." 216156283Srwatson rm -f y.tab.c y.tab.h 217156283Srwatson if [ $# -ne 1 ]; then 218156283Srwatson eval LASTARG="\${$#}" 219156283Srwatson case "$LASTARG" in 220156283Srwatson *.y) 221156283Srwatson SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 222156283Srwatson if [ -f "$SRCFILE" ]; then 223156283Srwatson cp "$SRCFILE" y.tab.c 224156283Srwatson fi 225156283Srwatson SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 226156283Srwatson if [ -f "$SRCFILE" ]; then 227156283Srwatson cp "$SRCFILE" y.tab.h 228156283Srwatson fi 229156283Srwatson ;; 230156283Srwatson esac 231156283Srwatson fi 232156283Srwatson if [ ! -f y.tab.h ]; then 233156283Srwatson echo >y.tab.h 234156283Srwatson fi 235156283Srwatson if [ ! -f y.tab.c ]; then 236156283Srwatson echo 'main() { return 0; }' >y.tab.c 237156283Srwatson fi 238156283Srwatson ;; 239156283Srwatson 240156283Srwatson lex|flex) 241156283Srwatson echo 1>&2 "\ 242156283SrwatsonWARNING: \`$1' is $msg. You should only need it if 243156283Srwatson you modified a \`.l' file. You may need the \`Flex' package 244156283Srwatson in order for those modifications to take effect. You can get 245156283Srwatson \`Flex' from any GNU archive site." 246156283Srwatson rm -f lex.yy.c 247156283Srwatson if [ $# -ne 1 ]; then 248156283Srwatson eval LASTARG="\${$#}" 249156283Srwatson case "$LASTARG" in 250156283Srwatson *.l) 251156283Srwatson SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 252156283Srwatson if [ -f "$SRCFILE" ]; then 253156283Srwatson cp "$SRCFILE" lex.yy.c 254156283Srwatson fi 255156283Srwatson ;; 256156283Srwatson esac 257156283Srwatson fi 258156283Srwatson if [ ! -f lex.yy.c ]; then 259156283Srwatson echo 'main() { return 0; }' >lex.yy.c 260156283Srwatson fi 261156283Srwatson ;; 262156283Srwatson 263156283Srwatson help2man) 264156283Srwatson echo 1>&2 "\ 265156283SrwatsonWARNING: \`$1' is $msg. You should only need it if 266156283Srwatson you modified a dependency of a manual page. You may need the 267156283Srwatson \`Help2man' package in order for those modifications to take 268156283Srwatson effect. You can get \`Help2man' from any GNU archive site." 269156283Srwatson 270156283Srwatson file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 271156283Srwatson if test -z "$file"; then 272156283Srwatson file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 273156283Srwatson fi 274156283Srwatson if [ -f "$file" ]; then 275156283Srwatson touch $file 276156283Srwatson else 277156283Srwatson test -z "$file" || exec >$file 278156283Srwatson echo ".ab help2man is required to generate this page" 279156283Srwatson exit 1 280156283Srwatson fi 281156283Srwatson ;; 282156283Srwatson 283156283Srwatson makeinfo) 284156283Srwatson echo 1>&2 "\ 285156283SrwatsonWARNING: \`$1' is $msg. You should only need it if 286156283Srwatson you modified a \`.texi' or \`.texinfo' file, or any other file 287156283Srwatson indirectly affecting the aspect of the manual. The spurious 288156283Srwatson call might also be the consequence of using a buggy \`make' (AIX, 289156283Srwatson DU, IRIX). You might want to install the \`Texinfo' package or 290156283Srwatson the \`GNU make' package. Grab either from any GNU archive site." 291156283Srwatson # The file to touch is that specified with -o ... 292156283Srwatson file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 293156283Srwatson if test -z "$file"; then 294156283Srwatson # ... or it is the one specified with @setfilename ... 295156283Srwatson infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 296156283Srwatson file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 297156283Srwatson # ... or it is derived from the source name (dir/f.texi becomes f.info) 298156283Srwatson test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 299156283Srwatson fi 300156283Srwatson # If the file does not exist, the user really needs makeinfo; 301156283Srwatson # let's fail without touching anything. 302156283Srwatson test -f $file || exit 1 303156283Srwatson touch $file 304156283Srwatson ;; 305156283Srwatson 306156283Srwatson tar) 307156283Srwatson shift 308156283Srwatson 309156283Srwatson # We have already tried tar in the generic part. 310156283Srwatson # Look for gnutar/gtar before invocation to avoid ugly error 311156283Srwatson # messages. 312156283Srwatson if (gnutar --version > /dev/null 2>&1); then 313156283Srwatson gnutar "$@" && exit 0 314156283Srwatson fi 315156283Srwatson if (gtar --version > /dev/null 2>&1); then 316156283Srwatson gtar "$@" && exit 0 317156283Srwatson fi 318156283Srwatson firstarg="$1" 319156283Srwatson if shift; then 320156283Srwatson case "$firstarg" in 321156283Srwatson *o*) 322156283Srwatson firstarg=`echo "$firstarg" | sed s/o//` 323156283Srwatson tar "$firstarg" "$@" && exit 0 324156283Srwatson ;; 325156283Srwatson esac 326156283Srwatson case "$firstarg" in 327156283Srwatson *h*) 328156283Srwatson firstarg=`echo "$firstarg" | sed s/h//` 329156283Srwatson tar "$firstarg" "$@" && exit 0 330156283Srwatson ;; 331156283Srwatson esac 332156283Srwatson fi 333156283Srwatson 334156283Srwatson echo 1>&2 "\ 335156283SrwatsonWARNING: I can't seem to be able to run \`tar' with the given arguments. 336156283Srwatson You may want to install GNU tar or Free paxutils, or check the 337156283Srwatson command line arguments." 338156283Srwatson exit 1 339156283Srwatson ;; 340156283Srwatson 341156283Srwatson *) 342156283Srwatson echo 1>&2 "\ 343156283SrwatsonWARNING: \`$1' is needed, and is $msg. 344156283Srwatson You might have modified some files without having the 345156283Srwatson proper tools for further handling them. Check the \`README' file, 346156283Srwatson it often tells you about the needed prerequisites for installing 347156283Srwatson this package. You may also peek at any GNU archive site, in case 348156283Srwatson some other package would contain this missing \`$1' program." 349156283Srwatson exit 1 350156283Srwatson ;; 351156283Srwatsonesac 352156283Srwatson 353156283Srwatsonexit 0 354156283Srwatson 355156283Srwatson# Local variables: 356156283Srwatson# eval: (add-hook 'write-file-hooks 'time-stamp) 357156283Srwatson# time-stamp-start: "scriptversion=" 358156283Srwatson# time-stamp-format: "%:y-%02m-%02d.%02H" 359156283Srwatson# time-stamp-end: "$" 360156283Srwatson# End: 361