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