missing revision 2ae83157
1444c061aSmrg#! /bin/sh 2444c061aSmrg# Common stub for a few missing GNU programs while installing. 3444c061aSmrg 42ae83157Smrgscriptversion=2009-04-28.21; # UTC 5444c061aSmrg 62ae83157Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 72ae83157Smrg# 2008, 2009 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 212ae83157Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22444c061aSmrg 23444c061aSmrg# As a special exception to the GNU General Public License, if you 24444c061aSmrg# distribute this file as part of a program that contains a 25444c061aSmrg# configuration script generated by Autoconf, you may include it under 26444c061aSmrg# the same distribution terms that you use for the rest of that program. 27444c061aSmrg 28444c061aSmrgif test $# -eq 0; then 29444c061aSmrg echo 1>&2 "Try \`$0 --help' for more information" 30444c061aSmrg exit 1 31444c061aSmrgfi 32444c061aSmrg 33444c061aSmrgrun=: 342265a131Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 352265a131Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36444c061aSmrg 37444c061aSmrg# In the cases where this matters, `missing' is being run in the 38444c061aSmrg# srcdir already. 39444c061aSmrgif test -f configure.ac; then 40444c061aSmrg configure_ac=configure.ac 41444c061aSmrgelse 42444c061aSmrg configure_ac=configure.in 43444c061aSmrgfi 44444c061aSmrg 45444c061aSmrgmsg="missing on your system" 46444c061aSmrg 472265a131Smrgcase $1 in 48444c061aSmrg--run) 49444c061aSmrg # Try to run requested program, and just exit if it succeeds. 50444c061aSmrg run= 51444c061aSmrg shift 52444c061aSmrg "$@" && exit 0 53444c061aSmrg # Exit code 63 means version mismatch. This often happens 54444c061aSmrg # when the user try to use an ancient version of a tool on 55444c061aSmrg # a file that requires a minimum version. In this case we 56444c061aSmrg # we should proceed has if the program had been absent, or 57444c061aSmrg # if --run hadn't been passed. 58444c061aSmrg if test $? = 63; then 59444c061aSmrg run=: 60444c061aSmrg msg="probably too old" 61444c061aSmrg fi 62444c061aSmrg ;; 63444c061aSmrg 64444c061aSmrg -h|--h|--he|--hel|--help) 65444c061aSmrg echo "\ 66444c061aSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67444c061aSmrg 68444c061aSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69444c061aSmrgerror status if there is no known handling for PROGRAM. 70444c061aSmrg 71444c061aSmrgOptions: 72444c061aSmrg -h, --help display this help and exit 73444c061aSmrg -v, --version output version information and exit 74444c061aSmrg --run try to run the given command, and emulate it if it fails 75444c061aSmrg 76444c061aSmrgSupported PROGRAM values: 77444c061aSmrg aclocal touch file \`aclocal.m4' 78444c061aSmrg autoconf touch file \`configure' 79444c061aSmrg autoheader touch file \`config.h.in' 802265a131Smrg autom4te touch the output file, or create a stub one 81444c061aSmrg automake touch all \`Makefile.in' files 82444c061aSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83444c061aSmrg flex create \`lex.yy.c', if possible, from existing .c 84444c061aSmrg help2man touch the output file 85444c061aSmrg lex create \`lex.yy.c', if possible, from existing .c 86444c061aSmrg makeinfo touch the output file 87444c061aSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 88444c061aSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89444c061aSmrg 902ae83157SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 912ae83157Smrg\`g' are ignored when checking the name. 922ae83157Smrg 93444c061aSmrgSend bug reports to <bug-automake@gnu.org>." 94444c061aSmrg exit $? 95444c061aSmrg ;; 96444c061aSmrg 97444c061aSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98444c061aSmrg echo "missing $scriptversion (GNU Automake)" 99444c061aSmrg exit $? 100444c061aSmrg ;; 101444c061aSmrg 102444c061aSmrg -*) 103444c061aSmrg echo 1>&2 "$0: Unknown \`$1' option" 104444c061aSmrg echo 1>&2 "Try \`$0 --help' for more information" 105444c061aSmrg exit 1 106444c061aSmrg ;; 107444c061aSmrg 108444c061aSmrgesac 109444c061aSmrg 1102ae83157Smrg# normalize program name to check for. 1112ae83157Smrgprogram=`echo "$1" | sed ' 1122ae83157Smrg s/^gnu-//; t 1132ae83157Smrg s/^gnu//; t 1142ae83157Smrg s/^g//; t'` 1152ae83157Smrg 116444c061aSmrg# Now exit if we have it, but it failed. Also exit now if we 117444c061aSmrg# don't have it and --version was passed (most likely to detect 1182ae83157Smrg# the program). This is about non-GNU programs, so use $1 not 1192ae83157Smrg# $program. 1202265a131Smrgcase $1 in 1212ae83157Smrg lex*|yacc*) 122444c061aSmrg # Not GNU programs, they don't have --version. 123444c061aSmrg ;; 124444c061aSmrg 1252ae83157Smrg tar*) 126444c061aSmrg if test -n "$run"; then 127444c061aSmrg echo 1>&2 "ERROR: \`tar' requires --run" 128444c061aSmrg exit 1 129444c061aSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130444c061aSmrg exit 1 131444c061aSmrg fi 132444c061aSmrg ;; 133444c061aSmrg 134444c061aSmrg *) 135444c061aSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136444c061aSmrg # We have it, but it failed. 137444c061aSmrg exit 1 138444c061aSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139444c061aSmrg # Could not run --version or --help. This is probably someone 140444c061aSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 141444c061aSmrg # $TOOL exists and not knowing $TOOL uses missing. 142444c061aSmrg exit 1 143444c061aSmrg fi 144444c061aSmrg ;; 145444c061aSmrgesac 146444c061aSmrg 147444c061aSmrg# If it does not exist, or fails to run (possibly an outdated version), 148444c061aSmrg# try to emulate it. 1492ae83157Smrgcase $program in 150444c061aSmrg aclocal*) 151444c061aSmrg echo 1>&2 "\ 152444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 153444c061aSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154444c061aSmrg to install the \`Automake' and \`Perl' packages. Grab them from 155444c061aSmrg any GNU archive site." 156444c061aSmrg touch aclocal.m4 157444c061aSmrg ;; 158444c061aSmrg 1592ae83157Smrg autoconf*) 160444c061aSmrg echo 1>&2 "\ 161444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 162444c061aSmrg you modified \`${configure_ac}'. You might want to install the 163444c061aSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164444c061aSmrg archive site." 165444c061aSmrg touch configure 166444c061aSmrg ;; 167444c061aSmrg 1682ae83157Smrg autoheader*) 169444c061aSmrg echo 1>&2 "\ 170444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 171444c061aSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172444c061aSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173444c061aSmrg from any GNU archive site." 174444c061aSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175444c061aSmrg test -z "$files" && files="config.h" 176444c061aSmrg touch_files= 177444c061aSmrg for f in $files; do 1782265a131Smrg case $f in 179444c061aSmrg *:*) touch_files="$touch_files "`echo "$f" | 180444c061aSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181444c061aSmrg *) touch_files="$touch_files $f.in";; 182444c061aSmrg esac 183444c061aSmrg done 184444c061aSmrg touch $touch_files 185444c061aSmrg ;; 186444c061aSmrg 187444c061aSmrg automake*) 188444c061aSmrg echo 1>&2 "\ 189444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 190444c061aSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191444c061aSmrg You might want to install the \`Automake' and \`Perl' packages. 192444c061aSmrg Grab them from any GNU archive site." 193444c061aSmrg find . -type f -name Makefile.am -print | 194444c061aSmrg sed 's/\.am$/.in/' | 195444c061aSmrg while read f; do touch "$f"; done 196444c061aSmrg ;; 197444c061aSmrg 1982ae83157Smrg autom4te*) 199444c061aSmrg echo 1>&2 "\ 200444c061aSmrgWARNING: \`$1' is needed, but is $msg. 201444c061aSmrg You might have modified some files without having the 202444c061aSmrg proper tools for further handling them. 203444c061aSmrg You can get \`$1' as part of \`Autoconf' from any GNU 204444c061aSmrg archive site." 205444c061aSmrg 2062265a131Smrg file=`echo "$*" | sed -n "$sed_output"` 2072265a131Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208444c061aSmrg if test -f "$file"; then 209444c061aSmrg touch $file 210444c061aSmrg else 211444c061aSmrg test -z "$file" || exec >$file 212444c061aSmrg echo "#! /bin/sh" 213444c061aSmrg echo "# Created by GNU Automake missing as a replacement of" 214444c061aSmrg echo "# $ $@" 215444c061aSmrg echo "exit 0" 216444c061aSmrg chmod +x $file 217444c061aSmrg exit 1 218444c061aSmrg fi 219444c061aSmrg ;; 220444c061aSmrg 2212ae83157Smrg bison*|yacc*) 222444c061aSmrg echo 1>&2 "\ 223444c061aSmrgWARNING: \`$1' $msg. You should only need it if 224444c061aSmrg you modified a \`.y' file. You may need the \`Bison' package 225444c061aSmrg in order for those modifications to take effect. You can get 226444c061aSmrg \`Bison' from any GNU archive site." 227444c061aSmrg rm -f y.tab.c y.tab.h 2282265a131Smrg if test $# -ne 1; then 229444c061aSmrg eval LASTARG="\${$#}" 2302265a131Smrg case $LASTARG in 231444c061aSmrg *.y) 232444c061aSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2332265a131Smrg if test -f "$SRCFILE"; then 234444c061aSmrg cp "$SRCFILE" y.tab.c 235444c061aSmrg fi 236444c061aSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2372265a131Smrg if test -f "$SRCFILE"; then 238444c061aSmrg cp "$SRCFILE" y.tab.h 239444c061aSmrg fi 240444c061aSmrg ;; 241444c061aSmrg esac 242444c061aSmrg fi 2432265a131Smrg if test ! -f y.tab.h; then 244444c061aSmrg echo >y.tab.h 245444c061aSmrg fi 2462265a131Smrg if test ! -f y.tab.c; then 247444c061aSmrg echo 'main() { return 0; }' >y.tab.c 248444c061aSmrg fi 249444c061aSmrg ;; 250444c061aSmrg 2512ae83157Smrg lex*|flex*) 252444c061aSmrg echo 1>&2 "\ 253444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 254444c061aSmrg you modified a \`.l' file. You may need the \`Flex' package 255444c061aSmrg in order for those modifications to take effect. You can get 256444c061aSmrg \`Flex' from any GNU archive site." 257444c061aSmrg rm -f lex.yy.c 2582265a131Smrg if test $# -ne 1; then 259444c061aSmrg eval LASTARG="\${$#}" 2602265a131Smrg case $LASTARG in 261444c061aSmrg *.l) 262444c061aSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2632265a131Smrg if test -f "$SRCFILE"; then 264444c061aSmrg cp "$SRCFILE" lex.yy.c 265444c061aSmrg fi 266444c061aSmrg ;; 267444c061aSmrg esac 268444c061aSmrg fi 2692265a131Smrg if test ! -f lex.yy.c; then 270444c061aSmrg echo 'main() { return 0; }' >lex.yy.c 271444c061aSmrg fi 272444c061aSmrg ;; 273444c061aSmrg 2742ae83157Smrg help2man*) 275444c061aSmrg echo 1>&2 "\ 276444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 277444c061aSmrg you modified a dependency of a manual page. You may need the 278444c061aSmrg \`Help2man' package in order for those modifications to take 279444c061aSmrg effect. You can get \`Help2man' from any GNU archive site." 280444c061aSmrg 2812265a131Smrg file=`echo "$*" | sed -n "$sed_output"` 2822265a131Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2832265a131Smrg if test -f "$file"; then 284444c061aSmrg touch $file 285444c061aSmrg else 286444c061aSmrg test -z "$file" || exec >$file 287444c061aSmrg echo ".ab help2man is required to generate this page" 2882ae83157Smrg exit $? 289444c061aSmrg fi 290444c061aSmrg ;; 291444c061aSmrg 2922ae83157Smrg makeinfo*) 293444c061aSmrg echo 1>&2 "\ 294444c061aSmrgWARNING: \`$1' is $msg. You should only need it if 295444c061aSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 296444c061aSmrg indirectly affecting the aspect of the manual. The spurious 297444c061aSmrg call might also be the consequence of using a buggy \`make' (AIX, 298444c061aSmrg DU, IRIX). You might want to install the \`Texinfo' package or 299444c061aSmrg the \`GNU make' package. Grab either from any GNU archive site." 300444c061aSmrg # The file to touch is that specified with -o ... 3012265a131Smrg file=`echo "$*" | sed -n "$sed_output"` 3022265a131Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303444c061aSmrg if test -z "$file"; then 304444c061aSmrg # ... or it is the one specified with @setfilename ... 305444c061aSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 3062265a131Smrg file=`sed -n ' 3072265a131Smrg /^@setfilename/{ 3082265a131Smrg s/.* \([^ ]*\) *$/\1/ 3092265a131Smrg p 3102265a131Smrg q 3112265a131Smrg }' $infile` 312444c061aSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313444c061aSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314444c061aSmrg fi 315444c061aSmrg # If the file does not exist, the user really needs makeinfo; 316444c061aSmrg # let's fail without touching anything. 317444c061aSmrg test -f $file || exit 1 318444c061aSmrg touch $file 319444c061aSmrg ;; 320444c061aSmrg 3212ae83157Smrg tar*) 322444c061aSmrg shift 323444c061aSmrg 324444c061aSmrg # We have already tried tar in the generic part. 325444c061aSmrg # Look for gnutar/gtar before invocation to avoid ugly error 326444c061aSmrg # messages. 327444c061aSmrg if (gnutar --version > /dev/null 2>&1); then 328444c061aSmrg gnutar "$@" && exit 0 329444c061aSmrg fi 330444c061aSmrg if (gtar --version > /dev/null 2>&1); then 331444c061aSmrg gtar "$@" && exit 0 332444c061aSmrg fi 333444c061aSmrg firstarg="$1" 334444c061aSmrg if shift; then 3352265a131Smrg case $firstarg in 336444c061aSmrg *o*) 337444c061aSmrg firstarg=`echo "$firstarg" | sed s/o//` 338444c061aSmrg tar "$firstarg" "$@" && exit 0 339444c061aSmrg ;; 340444c061aSmrg esac 3412265a131Smrg case $firstarg in 342444c061aSmrg *h*) 343444c061aSmrg firstarg=`echo "$firstarg" | sed s/h//` 344444c061aSmrg tar "$firstarg" "$@" && exit 0 345444c061aSmrg ;; 346444c061aSmrg esac 347444c061aSmrg fi 348444c061aSmrg 349444c061aSmrg echo 1>&2 "\ 350444c061aSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351444c061aSmrg You may want to install GNU tar or Free paxutils, or check the 352444c061aSmrg command line arguments." 353444c061aSmrg exit 1 354444c061aSmrg ;; 355444c061aSmrg 356444c061aSmrg *) 357444c061aSmrg echo 1>&2 "\ 358444c061aSmrgWARNING: \`$1' is needed, and is $msg. 359444c061aSmrg You might have modified some files without having the 360444c061aSmrg proper tools for further handling them. Check the \`README' file, 361444c061aSmrg it often tells you about the needed prerequisites for installing 362444c061aSmrg this package. You may also peek at any GNU archive site, in case 363444c061aSmrg some other package would contain this missing \`$1' program." 364444c061aSmrg exit 1 365444c061aSmrg ;; 366444c061aSmrgesac 367444c061aSmrg 368444c061aSmrgexit 0 369444c061aSmrg 370444c061aSmrg# Local variables: 371444c061aSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372444c061aSmrg# time-stamp-start: "scriptversion=" 373444c061aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3742ae83157Smrg# time-stamp-time-zone: "UTC" 3752ae83157Smrg# time-stamp-end: "; # UTC" 376444c061aSmrg# End: 377