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