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