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