missing revision 2265a131
1444c061aSmrg#! /bin/sh 2444c061aSmrg# Common stub for a few missing GNU programs while installing. 3444c061aSmrg 42265a131Smrgscriptversion=2006-05-10.23 5444c061aSmrg 62265a131Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 7444c061aSmrg# Free Software Foundation, Inc. 8444c061aSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9444c061aSmrg 10444c061aSmrg# This program is free software; you can redistribute it and/or modify 11444c061aSmrg# it under the terms of the GNU General Public License as published by 12444c061aSmrg# the Free Software Foundation; either version 2, or (at your option) 13444c061aSmrg# any later version. 14444c061aSmrg 15444c061aSmrg# This program is distributed in the hope that it will be useful, 16444c061aSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17444c061aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18444c061aSmrg# GNU General Public License for more details. 19444c061aSmrg 20444c061aSmrg# You should have received a copy of the GNU General Public License 21444c061aSmrg# along with this program; if not, write to the Free Software 22444c061aSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23444c061aSmrg# 02110-1301, USA. 24444c061aSmrg 25444c061aSmrg# As a special exception to the GNU General Public License, if you 26444c061aSmrg# distribute this file as part of a program that contains a 27444c061aSmrg# configuration script generated by Autoconf, you may include it under 28444c061aSmrg# the same distribution terms that you use for the rest of that program. 29444c061aSmrg 30444c061aSmrgif test $# -eq 0; then 31444c061aSmrg echo 1>&2 "Try \`$0 --help' for more information" 32444c061aSmrg exit 1 33444c061aSmrgfi 34444c061aSmrg 35444c061aSmrgrun=: 362265a131Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 372265a131Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 38444c061aSmrg 39444c061aSmrg# In the cases where this matters, `missing' is being run in the 40444c061aSmrg# srcdir already. 41444c061aSmrgif test -f configure.ac; then 42444c061aSmrg configure_ac=configure.ac 43444c061aSmrgelse 44444c061aSmrg configure_ac=configure.in 45444c061aSmrgfi 46444c061aSmrg 47444c061aSmrgmsg="missing on your system" 48444c061aSmrg 492265a131Smrgcase $1 in 50444c061aSmrg--run) 51444c061aSmrg # Try to run requested program, and just exit if it succeeds. 52444c061aSmrg run= 53444c061aSmrg shift 54444c061aSmrg "$@" && exit 0 55444c061aSmrg # Exit code 63 means version mismatch. This often happens 56444c061aSmrg # when the user try to use an ancient version of a tool on 57444c061aSmrg # a file that requires a minimum version. In this case we 58444c061aSmrg # we should proceed has if the program had been absent, or 59444c061aSmrg # if --run hadn't been passed. 60444c061aSmrg if test $? = 63; then 61444c061aSmrg run=: 62444c061aSmrg msg="probably too old" 63444c061aSmrg fi 64444c061aSmrg ;; 65444c061aSmrg 66444c061aSmrg -h|--h|--he|--hel|--help) 67444c061aSmrg echo "\ 68444c061aSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 69444c061aSmrg 70444c061aSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 71444c061aSmrgerror status if there is no known handling for PROGRAM. 72444c061aSmrg 73444c061aSmrgOptions: 74444c061aSmrg -h, --help display this help and exit 75444c061aSmrg -v, --version output version information and exit 76444c061aSmrg --run try to run the given command, and emulate it if it fails 77444c061aSmrg 78444c061aSmrgSupported PROGRAM values: 79444c061aSmrg aclocal touch file \`aclocal.m4' 80444c061aSmrg autoconf touch file \`configure' 81444c061aSmrg autoheader touch file \`config.h.in' 822265a131Smrg autom4te touch the output file, or create a stub one 83444c061aSmrg automake touch all \`Makefile.in' files 84444c061aSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 85444c061aSmrg flex create \`lex.yy.c', if possible, from existing .c 86444c061aSmrg help2man touch the output file 87444c061aSmrg lex create \`lex.yy.c', if possible, from existing .c 88444c061aSmrg makeinfo touch the output file 89444c061aSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 90444c061aSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 91444c061aSmrg 92444c061aSmrgSend bug reports to <bug-automake@gnu.org>." 93444c061aSmrg exit $? 94444c061aSmrg ;; 95444c061aSmrg 96444c061aSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 97444c061aSmrg echo "missing $scriptversion (GNU Automake)" 98444c061aSmrg exit $? 99444c061aSmrg ;; 100444c061aSmrg 101444c061aSmrg -*) 102444c061aSmrg echo 1>&2 "$0: Unknown \`$1' option" 103444c061aSmrg echo 1>&2 "Try \`$0 --help' for more information" 104444c061aSmrg exit 1 105444c061aSmrg ;; 106444c061aSmrg 107444c061aSmrgesac 108444c061aSmrg 109444c061aSmrg# Now exit if we have it, but it failed. Also exit now if we 110444c061aSmrg# don't have it and --version was passed (most likely to detect 111444c061aSmrg# the program). 1122265a131Smrgcase $1 in 113444c061aSmrg lex|yacc) 114444c061aSmrg # Not GNU programs, they don't have --version. 115444c061aSmrg ;; 116444c061aSmrg 117444c061aSmrg tar) 118444c061aSmrg if test -n "$run"; then 119444c061aSmrg echo 1>&2 "ERROR: \`tar' requires --run" 120444c061aSmrg exit 1 121444c061aSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 122444c061aSmrg exit 1 123444c061aSmrg fi 124444c061aSmrg ;; 125444c061aSmrg 126444c061aSmrg *) 127444c061aSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 128444c061aSmrg # We have it, but it failed. 129444c061aSmrg exit 1 130444c061aSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 131444c061aSmrg # Could not run --version or --help. This is probably someone 132444c061aSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 133444c061aSmrg # $TOOL exists and not knowing $TOOL uses missing. 134444c061aSmrg exit 1 135444c061aSmrg fi 136444c061aSmrg ;; 137444c061aSmrgesac 138444c061aSmrg 139444c061aSmrg# If it does not exist, or fails to run (possibly an outdated version), 140444c061aSmrg# try to emulate it. 1412265a131Smrgcase $1 in 142444c061aSmrg aclocal*) 143444c061aSmrg echo 1>&2 "\ 144444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 145444c061aSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 146444c061aSmrg to install the \`Automake' and \`Perl' packages. Grab them from 147444c061aSmrg any GNU archive site." 148444c061aSmrg touch aclocal.m4 149444c061aSmrg ;; 150444c061aSmrg 151444c061aSmrg autoconf) 152444c061aSmrg echo 1>&2 "\ 153444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 154444c061aSmrg you modified \`${configure_ac}'. You might want to install the 155444c061aSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 156444c061aSmrg archive site." 157444c061aSmrg touch configure 158444c061aSmrg ;; 159444c061aSmrg 160444c061aSmrg autoheader) 161444c061aSmrg echo 1>&2 "\ 162444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 163444c061aSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 164444c061aSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 165444c061aSmrg from any GNU archive site." 166444c061aSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 167444c061aSmrg test -z "$files" && files="config.h" 168444c061aSmrg touch_files= 169444c061aSmrg for f in $files; do 1702265a131Smrg case $f in 171444c061aSmrg *:*) touch_files="$touch_files "`echo "$f" | 172444c061aSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 173444c061aSmrg *) touch_files="$touch_files $f.in";; 174444c061aSmrg esac 175444c061aSmrg done 176444c061aSmrg touch $touch_files 177444c061aSmrg ;; 178444c061aSmrg 179444c061aSmrg automake*) 180444c061aSmrg echo 1>&2 "\ 181444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 182444c061aSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 183444c061aSmrg You might want to install the \`Automake' and \`Perl' packages. 184444c061aSmrg Grab them from any GNU archive site." 185444c061aSmrg find . -type f -name Makefile.am -print | 186444c061aSmrg sed 's/\.am$/.in/' | 187444c061aSmrg while read f; do touch "$f"; done 188444c061aSmrg ;; 189444c061aSmrg 190444c061aSmrg autom4te) 191444c061aSmrg echo 1>&2 "\ 192444c061aSmrgWARNING: \`$1' is needed, but is $msg. 193444c061aSmrg You might have modified some files without having the 194444c061aSmrg proper tools for further handling them. 195444c061aSmrg You can get \`$1' as part of \`Autoconf' from any GNU 196444c061aSmrg archive site." 197444c061aSmrg 1982265a131Smrg file=`echo "$*" | sed -n "$sed_output"` 1992265a131Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 200444c061aSmrg if test -f "$file"; then 201444c061aSmrg touch $file 202444c061aSmrg else 203444c061aSmrg test -z "$file" || exec >$file 204444c061aSmrg echo "#! /bin/sh" 205444c061aSmrg echo "# Created by GNU Automake missing as a replacement of" 206444c061aSmrg echo "# $ $@" 207444c061aSmrg echo "exit 0" 208444c061aSmrg chmod +x $file 209444c061aSmrg exit 1 210444c061aSmrg fi 211444c061aSmrg ;; 212444c061aSmrg 213444c061aSmrg bison|yacc) 214444c061aSmrg echo 1>&2 "\ 215444c061aSmrgWARNING: \`$1' $msg. You should only need it if 216444c061aSmrg you modified a \`.y' file. You may need the \`Bison' package 217444c061aSmrg in order for those modifications to take effect. You can get 218444c061aSmrg \`Bison' from any GNU archive site." 219444c061aSmrg rm -f y.tab.c y.tab.h 2202265a131Smrg if test $# -ne 1; then 221444c061aSmrg eval LASTARG="\${$#}" 2222265a131Smrg case $LASTARG in 223444c061aSmrg *.y) 224444c061aSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2252265a131Smrg if test -f "$SRCFILE"; then 226444c061aSmrg cp "$SRCFILE" y.tab.c 227444c061aSmrg fi 228444c061aSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2292265a131Smrg if test -f "$SRCFILE"; then 230444c061aSmrg cp "$SRCFILE" y.tab.h 231444c061aSmrg fi 232444c061aSmrg ;; 233444c061aSmrg esac 234444c061aSmrg fi 2352265a131Smrg if test ! -f y.tab.h; then 236444c061aSmrg echo >y.tab.h 237444c061aSmrg fi 2382265a131Smrg if test ! -f y.tab.c; then 239444c061aSmrg echo 'main() { return 0; }' >y.tab.c 240444c061aSmrg fi 241444c061aSmrg ;; 242444c061aSmrg 243444c061aSmrg lex|flex) 244444c061aSmrg echo 1>&2 "\ 245444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 246444c061aSmrg you modified a \`.l' file. You may need the \`Flex' package 247444c061aSmrg in order for those modifications to take effect. You can get 248444c061aSmrg \`Flex' from any GNU archive site." 249444c061aSmrg rm -f lex.yy.c 2502265a131Smrg if test $# -ne 1; then 251444c061aSmrg eval LASTARG="\${$#}" 2522265a131Smrg case $LASTARG in 253444c061aSmrg *.l) 254444c061aSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2552265a131Smrg if test -f "$SRCFILE"; then 256444c061aSmrg cp "$SRCFILE" lex.yy.c 257444c061aSmrg fi 258444c061aSmrg ;; 259444c061aSmrg esac 260444c061aSmrg fi 2612265a131Smrg if test ! -f lex.yy.c; then 262444c061aSmrg echo 'main() { return 0; }' >lex.yy.c 263444c061aSmrg fi 264444c061aSmrg ;; 265444c061aSmrg 266444c061aSmrg help2man) 267444c061aSmrg echo 1>&2 "\ 268444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 269444c061aSmrg you modified a dependency of a manual page. You may need the 270444c061aSmrg \`Help2man' package in order for those modifications to take 271444c061aSmrg effect. You can get \`Help2man' from any GNU archive site." 272444c061aSmrg 2732265a131Smrg file=`echo "$*" | sed -n "$sed_output"` 2742265a131Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2752265a131Smrg if test -f "$file"; then 276444c061aSmrg touch $file 277444c061aSmrg else 278444c061aSmrg test -z "$file" || exec >$file 279444c061aSmrg echo ".ab help2man is required to generate this page" 280444c061aSmrg exit 1 281444c061aSmrg fi 282444c061aSmrg ;; 283444c061aSmrg 284444c061aSmrg makeinfo) 285444c061aSmrg echo 1>&2 "\ 286444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 287444c061aSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 288444c061aSmrg indirectly affecting the aspect of the manual. The spurious 289444c061aSmrg call might also be the consequence of using a buggy \`make' (AIX, 290444c061aSmrg DU, IRIX). You might want to install the \`Texinfo' package or 291444c061aSmrg the \`GNU make' package. Grab either from any GNU archive site." 292444c061aSmrg # The file to touch is that specified with -o ... 2932265a131Smrg file=`echo "$*" | sed -n "$sed_output"` 2942265a131Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 295444c061aSmrg if test -z "$file"; then 296444c061aSmrg # ... or it is the one specified with @setfilename ... 297444c061aSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 2982265a131Smrg file=`sed -n ' 2992265a131Smrg /^@setfilename/{ 3002265a131Smrg s/.* \([^ ]*\) *$/\1/ 3012265a131Smrg p 3022265a131Smrg q 3032265a131Smrg }' $infile` 304444c061aSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 305444c061aSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 306444c061aSmrg fi 307444c061aSmrg # If the file does not exist, the user really needs makeinfo; 308444c061aSmrg # let's fail without touching anything. 309444c061aSmrg test -f $file || exit 1 310444c061aSmrg touch $file 311444c061aSmrg ;; 312444c061aSmrg 313444c061aSmrg tar) 314444c061aSmrg shift 315444c061aSmrg 316444c061aSmrg # We have already tried tar in the generic part. 317444c061aSmrg # Look for gnutar/gtar before invocation to avoid ugly error 318444c061aSmrg # messages. 319444c061aSmrg if (gnutar --version > /dev/null 2>&1); then 320444c061aSmrg gnutar "$@" && exit 0 321444c061aSmrg fi 322444c061aSmrg if (gtar --version > /dev/null 2>&1); then 323444c061aSmrg gtar "$@" && exit 0 324444c061aSmrg fi 325444c061aSmrg firstarg="$1" 326444c061aSmrg if shift; then 3272265a131Smrg case $firstarg in 328444c061aSmrg *o*) 329444c061aSmrg firstarg=`echo "$firstarg" | sed s/o//` 330444c061aSmrg tar "$firstarg" "$@" && exit 0 331444c061aSmrg ;; 332444c061aSmrg esac 3332265a131Smrg case $firstarg in 334444c061aSmrg *h*) 335444c061aSmrg firstarg=`echo "$firstarg" | sed s/h//` 336444c061aSmrg tar "$firstarg" "$@" && exit 0 337444c061aSmrg ;; 338444c061aSmrg esac 339444c061aSmrg fi 340444c061aSmrg 341444c061aSmrg echo 1>&2 "\ 342444c061aSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 343444c061aSmrg You may want to install GNU tar or Free paxutils, or check the 344444c061aSmrg command line arguments." 345444c061aSmrg exit 1 346444c061aSmrg ;; 347444c061aSmrg 348444c061aSmrg *) 349444c061aSmrg echo 1>&2 "\ 350444c061aSmrgWARNING: \`$1' is needed, and is $msg. 351444c061aSmrg You might have modified some files without having the 352444c061aSmrg proper tools for further handling them. Check the \`README' file, 353444c061aSmrg it often tells you about the needed prerequisites for installing 354444c061aSmrg this package. You may also peek at any GNU archive site, in case 355444c061aSmrg some other package would contain this missing \`$1' program." 356444c061aSmrg exit 1 357444c061aSmrg ;; 358444c061aSmrgesac 359444c061aSmrg 360444c061aSmrgexit 0 361444c061aSmrg 362444c061aSmrg# Local variables: 363444c061aSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 364444c061aSmrg# time-stamp-start: "scriptversion=" 365444c061aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 366444c061aSmrg# time-stamp-end: "$" 367444c061aSmrg# End: 368