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