missing revision b73be646
1659607e0Smrg#! /bin/sh 2659607e0Smrg# Common stub for a few missing GNU programs while installing. 3659607e0Smrg 4b73be646Smrgscriptversion=2009-04-28.21; # UTC 5659607e0Smrg 6b73be646Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7b73be646Smrg# 2008, 2009 Free Software Foundation, Inc. 8659607e0Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9659607e0Smrg 10659607e0Smrg# This program is free software; you can redistribute it and/or modify 11659607e0Smrg# it under the terms of the GNU General Public License as published by 12659607e0Smrg# the Free Software Foundation; either version 2, or (at your option) 13659607e0Smrg# any later version. 14659607e0Smrg 15659607e0Smrg# This program is distributed in the hope that it will be useful, 16659607e0Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17659607e0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18659607e0Smrg# GNU General Public License for more details. 19659607e0Smrg 20659607e0Smrg# You should have received a copy of the GNU General Public License 21b73be646Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22659607e0Smrg 23659607e0Smrg# As a special exception to the GNU General Public License, if you 24659607e0Smrg# distribute this file as part of a program that contains a 25659607e0Smrg# configuration script generated by Autoconf, you may include it under 26659607e0Smrg# the same distribution terms that you use for the rest of that program. 27659607e0Smrg 28659607e0Smrgif test $# -eq 0; then 29659607e0Smrg echo 1>&2 "Try \`$0 --help' for more information" 30659607e0Smrg exit 1 31659607e0Smrgfi 32659607e0Smrg 33659607e0Smrgrun=: 34659607e0Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35659607e0Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36659607e0Smrg 37659607e0Smrg# In the cases where this matters, `missing' is being run in the 38659607e0Smrg# srcdir already. 39659607e0Smrgif test -f configure.ac; then 40659607e0Smrg configure_ac=configure.ac 41659607e0Smrgelse 42659607e0Smrg configure_ac=configure.in 43659607e0Smrgfi 44659607e0Smrg 45659607e0Smrgmsg="missing on your system" 46659607e0Smrg 47659607e0Smrgcase $1 in 48659607e0Smrg--run) 49659607e0Smrg # Try to run requested program, and just exit if it succeeds. 50659607e0Smrg run= 51659607e0Smrg shift 52659607e0Smrg "$@" && exit 0 53659607e0Smrg # Exit code 63 means version mismatch. This often happens 54659607e0Smrg # when the user try to use an ancient version of a tool on 55659607e0Smrg # a file that requires a minimum version. In this case we 56659607e0Smrg # we should proceed has if the program had been absent, or 57659607e0Smrg # if --run hadn't been passed. 58659607e0Smrg if test $? = 63; then 59659607e0Smrg run=: 60659607e0Smrg msg="probably too old" 61659607e0Smrg fi 62659607e0Smrg ;; 63659607e0Smrg 64659607e0Smrg -h|--h|--he|--hel|--help) 65659607e0Smrg echo "\ 66659607e0Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67659607e0Smrg 68659607e0SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69659607e0Smrgerror status if there is no known handling for PROGRAM. 70659607e0Smrg 71659607e0SmrgOptions: 72659607e0Smrg -h, --help display this help and exit 73659607e0Smrg -v, --version output version information and exit 74659607e0Smrg --run try to run the given command, and emulate it if it fails 75659607e0Smrg 76659607e0SmrgSupported PROGRAM values: 77659607e0Smrg aclocal touch file \`aclocal.m4' 78659607e0Smrg autoconf touch file \`configure' 79659607e0Smrg autoheader touch file \`config.h.in' 80659607e0Smrg autom4te touch the output file, or create a stub one 81659607e0Smrg automake touch all \`Makefile.in' files 82659607e0Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83659607e0Smrg flex create \`lex.yy.c', if possible, from existing .c 84659607e0Smrg help2man touch the output file 85659607e0Smrg lex create \`lex.yy.c', if possible, from existing .c 86659607e0Smrg makeinfo touch the output file 87659607e0Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 88659607e0Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89659607e0Smrg 90b73be646SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91b73be646Smrg\`g' are ignored when checking the name. 92b73be646Smrg 93659607e0SmrgSend bug reports to <bug-automake@gnu.org>." 94659607e0Smrg exit $? 95659607e0Smrg ;; 96659607e0Smrg 97659607e0Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98659607e0Smrg echo "missing $scriptversion (GNU Automake)" 99659607e0Smrg exit $? 100659607e0Smrg ;; 101659607e0Smrg 102659607e0Smrg -*) 103659607e0Smrg echo 1>&2 "$0: Unknown \`$1' option" 104659607e0Smrg echo 1>&2 "Try \`$0 --help' for more information" 105659607e0Smrg exit 1 106659607e0Smrg ;; 107659607e0Smrg 108659607e0Smrgesac 109659607e0Smrg 110b73be646Smrg# normalize program name to check for. 111b73be646Smrgprogram=`echo "$1" | sed ' 112b73be646Smrg s/^gnu-//; t 113b73be646Smrg s/^gnu//; t 114b73be646Smrg s/^g//; t'` 115b73be646Smrg 116659607e0Smrg# Now exit if we have it, but it failed. Also exit now if we 117659607e0Smrg# don't have it and --version was passed (most likely to detect 118b73be646Smrg# the program). This is about non-GNU programs, so use $1 not 119b73be646Smrg# $program. 120659607e0Smrgcase $1 in 121b73be646Smrg lex*|yacc*) 122659607e0Smrg # Not GNU programs, they don't have --version. 123659607e0Smrg ;; 124659607e0Smrg 125b73be646Smrg tar*) 126659607e0Smrg if test -n "$run"; then 127659607e0Smrg echo 1>&2 "ERROR: \`tar' requires --run" 128659607e0Smrg exit 1 129659607e0Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130659607e0Smrg exit 1 131659607e0Smrg fi 132659607e0Smrg ;; 133659607e0Smrg 134659607e0Smrg *) 135659607e0Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136659607e0Smrg # We have it, but it failed. 137659607e0Smrg exit 1 138659607e0Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139659607e0Smrg # Could not run --version or --help. This is probably someone 140659607e0Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 141659607e0Smrg # $TOOL exists and not knowing $TOOL uses missing. 142659607e0Smrg exit 1 143659607e0Smrg fi 144659607e0Smrg ;; 145659607e0Smrgesac 146659607e0Smrg 147659607e0Smrg# If it does not exist, or fails to run (possibly an outdated version), 148659607e0Smrg# try to emulate it. 149b73be646Smrgcase $program in 150659607e0Smrg aclocal*) 151659607e0Smrg echo 1>&2 "\ 152659607e0SmrgWARNING: \`$1' is $msg. You should only need it if 153659607e0Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154659607e0Smrg to install the \`Automake' and \`Perl' packages. Grab them from 155659607e0Smrg any GNU archive site." 156659607e0Smrg touch aclocal.m4 157659607e0Smrg ;; 158659607e0Smrg 159b73be646Smrg autoconf*) 160659607e0Smrg echo 1>&2 "\ 161659607e0SmrgWARNING: \`$1' is $msg. You should only need it if 162659607e0Smrg you modified \`${configure_ac}'. You might want to install the 163659607e0Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164659607e0Smrg archive site." 165659607e0Smrg touch configure 166659607e0Smrg ;; 167659607e0Smrg 168b73be646Smrg autoheader*) 169659607e0Smrg echo 1>&2 "\ 170659607e0SmrgWARNING: \`$1' is $msg. You should only need it if 171659607e0Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172659607e0Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173659607e0Smrg from any GNU archive site." 174659607e0Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175659607e0Smrg test -z "$files" && files="config.h" 176659607e0Smrg touch_files= 177659607e0Smrg for f in $files; do 178659607e0Smrg case $f in 179659607e0Smrg *:*) touch_files="$touch_files "`echo "$f" | 180659607e0Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181659607e0Smrg *) touch_files="$touch_files $f.in";; 182659607e0Smrg esac 183659607e0Smrg done 184659607e0Smrg touch $touch_files 185659607e0Smrg ;; 186659607e0Smrg 187659607e0Smrg automake*) 188659607e0Smrg echo 1>&2 "\ 189659607e0SmrgWARNING: \`$1' is $msg. You should only need it if 190659607e0Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191659607e0Smrg You might want to install the \`Automake' and \`Perl' packages. 192659607e0Smrg Grab them from any GNU archive site." 193659607e0Smrg find . -type f -name Makefile.am -print | 194659607e0Smrg sed 's/\.am$/.in/' | 195659607e0Smrg while read f; do touch "$f"; done 196659607e0Smrg ;; 197659607e0Smrg 198b73be646Smrg autom4te*) 199659607e0Smrg echo 1>&2 "\ 200659607e0SmrgWARNING: \`$1' is needed, but is $msg. 201659607e0Smrg You might have modified some files without having the 202659607e0Smrg proper tools for further handling them. 203659607e0Smrg You can get \`$1' as part of \`Autoconf' from any GNU 204659607e0Smrg archive site." 205659607e0Smrg 206659607e0Smrg file=`echo "$*" | sed -n "$sed_output"` 207659607e0Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208659607e0Smrg if test -f "$file"; then 209659607e0Smrg touch $file 210659607e0Smrg else 211659607e0Smrg test -z "$file" || exec >$file 212659607e0Smrg echo "#! /bin/sh" 213659607e0Smrg echo "# Created by GNU Automake missing as a replacement of" 214659607e0Smrg echo "# $ $@" 215659607e0Smrg echo "exit 0" 216659607e0Smrg chmod +x $file 217659607e0Smrg exit 1 218659607e0Smrg fi 219659607e0Smrg ;; 220659607e0Smrg 221b73be646Smrg bison*|yacc*) 222659607e0Smrg echo 1>&2 "\ 223659607e0SmrgWARNING: \`$1' $msg. You should only need it if 224659607e0Smrg you modified a \`.y' file. You may need the \`Bison' package 225659607e0Smrg in order for those modifications to take effect. You can get 226659607e0Smrg \`Bison' from any GNU archive site." 227659607e0Smrg rm -f y.tab.c y.tab.h 228659607e0Smrg if test $# -ne 1; then 229659607e0Smrg eval LASTARG="\${$#}" 230659607e0Smrg case $LASTARG in 231659607e0Smrg *.y) 232659607e0Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233659607e0Smrg if test -f "$SRCFILE"; then 234659607e0Smrg cp "$SRCFILE" y.tab.c 235659607e0Smrg fi 236659607e0Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237659607e0Smrg if test -f "$SRCFILE"; then 238659607e0Smrg cp "$SRCFILE" y.tab.h 239659607e0Smrg fi 240659607e0Smrg ;; 241659607e0Smrg esac 242659607e0Smrg fi 243659607e0Smrg if test ! -f y.tab.h; then 244659607e0Smrg echo >y.tab.h 245659607e0Smrg fi 246659607e0Smrg if test ! -f y.tab.c; then 247659607e0Smrg echo 'main() { return 0; }' >y.tab.c 248659607e0Smrg fi 249659607e0Smrg ;; 250659607e0Smrg 251b73be646Smrg lex*|flex*) 252659607e0Smrg echo 1>&2 "\ 253659607e0SmrgWARNING: \`$1' is $msg. You should only need it if 254659607e0Smrg you modified a \`.l' file. You may need the \`Flex' package 255659607e0Smrg in order for those modifications to take effect. You can get 256659607e0Smrg \`Flex' from any GNU archive site." 257659607e0Smrg rm -f lex.yy.c 258659607e0Smrg if test $# -ne 1; then 259659607e0Smrg eval LASTARG="\${$#}" 260659607e0Smrg case $LASTARG in 261659607e0Smrg *.l) 262659607e0Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263659607e0Smrg if test -f "$SRCFILE"; then 264659607e0Smrg cp "$SRCFILE" lex.yy.c 265659607e0Smrg fi 266659607e0Smrg ;; 267659607e0Smrg esac 268659607e0Smrg fi 269659607e0Smrg if test ! -f lex.yy.c; then 270659607e0Smrg echo 'main() { return 0; }' >lex.yy.c 271659607e0Smrg fi 272659607e0Smrg ;; 273659607e0Smrg 274b73be646Smrg help2man*) 275659607e0Smrg echo 1>&2 "\ 276659607e0SmrgWARNING: \`$1' is $msg. You should only need it if 277659607e0Smrg you modified a dependency of a manual page. You may need the 278659607e0Smrg \`Help2man' package in order for those modifications to take 279659607e0Smrg effect. You can get \`Help2man' from any GNU archive site." 280659607e0Smrg 281659607e0Smrg file=`echo "$*" | sed -n "$sed_output"` 282659607e0Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283659607e0Smrg if test -f "$file"; then 284659607e0Smrg touch $file 285659607e0Smrg else 286659607e0Smrg test -z "$file" || exec >$file 287659607e0Smrg echo ".ab help2man is required to generate this page" 288b73be646Smrg exit $? 289659607e0Smrg fi 290659607e0Smrg ;; 291659607e0Smrg 292b73be646Smrg makeinfo*) 293659607e0Smrg echo 1>&2 "\ 294659607e0SmrgWARNING: \`$1' is $msg. You should only need it if 295659607e0Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 296659607e0Smrg indirectly affecting the aspect of the manual. The spurious 297659607e0Smrg call might also be the consequence of using a buggy \`make' (AIX, 298659607e0Smrg DU, IRIX). You might want to install the \`Texinfo' package or 299659607e0Smrg the \`GNU make' package. Grab either from any GNU archive site." 300659607e0Smrg # The file to touch is that specified with -o ... 301659607e0Smrg file=`echo "$*" | sed -n "$sed_output"` 302659607e0Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303659607e0Smrg if test -z "$file"; then 304659607e0Smrg # ... or it is the one specified with @setfilename ... 305659607e0Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306659607e0Smrg file=`sed -n ' 307659607e0Smrg /^@setfilename/{ 308659607e0Smrg s/.* \([^ ]*\) *$/\1/ 309659607e0Smrg p 310659607e0Smrg q 311659607e0Smrg }' $infile` 312659607e0Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313659607e0Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314659607e0Smrg fi 315659607e0Smrg # If the file does not exist, the user really needs makeinfo; 316659607e0Smrg # let's fail without touching anything. 317659607e0Smrg test -f $file || exit 1 318659607e0Smrg touch $file 319659607e0Smrg ;; 320659607e0Smrg 321b73be646Smrg tar*) 322659607e0Smrg shift 323659607e0Smrg 324659607e0Smrg # We have already tried tar in the generic part. 325659607e0Smrg # Look for gnutar/gtar before invocation to avoid ugly error 326659607e0Smrg # messages. 327659607e0Smrg if (gnutar --version > /dev/null 2>&1); then 328659607e0Smrg gnutar "$@" && exit 0 329659607e0Smrg fi 330659607e0Smrg if (gtar --version > /dev/null 2>&1); then 331659607e0Smrg gtar "$@" && exit 0 332659607e0Smrg fi 333659607e0Smrg firstarg="$1" 334659607e0Smrg if shift; then 335659607e0Smrg case $firstarg in 336659607e0Smrg *o*) 337659607e0Smrg firstarg=`echo "$firstarg" | sed s/o//` 338659607e0Smrg tar "$firstarg" "$@" && exit 0 339659607e0Smrg ;; 340659607e0Smrg esac 341659607e0Smrg case $firstarg in 342659607e0Smrg *h*) 343659607e0Smrg firstarg=`echo "$firstarg" | sed s/h//` 344659607e0Smrg tar "$firstarg" "$@" && exit 0 345659607e0Smrg ;; 346659607e0Smrg esac 347659607e0Smrg fi 348659607e0Smrg 349659607e0Smrg echo 1>&2 "\ 350659607e0SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351659607e0Smrg You may want to install GNU tar or Free paxutils, or check the 352659607e0Smrg command line arguments." 353659607e0Smrg exit 1 354659607e0Smrg ;; 355659607e0Smrg 356659607e0Smrg *) 357659607e0Smrg echo 1>&2 "\ 358659607e0SmrgWARNING: \`$1' is needed, and is $msg. 359659607e0Smrg You might have modified some files without having the 360659607e0Smrg proper tools for further handling them. Check the \`README' file, 361659607e0Smrg it often tells you about the needed prerequisites for installing 362659607e0Smrg this package. You may also peek at any GNU archive site, in case 363659607e0Smrg some other package would contain this missing \`$1' program." 364659607e0Smrg exit 1 365659607e0Smrg ;; 366659607e0Smrgesac 367659607e0Smrg 368659607e0Smrgexit 0 369659607e0Smrg 370659607e0Smrg# Local variables: 371659607e0Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372659607e0Smrg# time-stamp-start: "scriptversion=" 373659607e0Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374b73be646Smrg# time-stamp-time-zone: "UTC" 375b73be646Smrg# time-stamp-end: "; # UTC" 376659607e0Smrg# End: 377