missing revision d656433a
1126a8a12Smrg#! /bin/sh 2126a8a12Smrg# Common stub for a few missing GNU programs while installing. 3126a8a12Smrg 4d656433aSmrgscriptversion=2009-04-28.21; # UTC 5126a8a12Smrg 6d656433aSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7d656433aSmrg# 2008, 2009 Free Software Foundation, Inc. 8126a8a12Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9126a8a12Smrg 10126a8a12Smrg# This program is free software; you can redistribute it and/or modify 11126a8a12Smrg# it under the terms of the GNU General Public License as published by 12126a8a12Smrg# the Free Software Foundation; either version 2, or (at your option) 13126a8a12Smrg# any later version. 14126a8a12Smrg 15126a8a12Smrg# This program is distributed in the hope that it will be useful, 16126a8a12Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17126a8a12Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18126a8a12Smrg# GNU General Public License for more details. 19126a8a12Smrg 20126a8a12Smrg# You should have received a copy of the GNU General Public License 21d656433aSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22126a8a12Smrg 23126a8a12Smrg# As a special exception to the GNU General Public License, if you 24126a8a12Smrg# distribute this file as part of a program that contains a 25126a8a12Smrg# configuration script generated by Autoconf, you may include it under 26126a8a12Smrg# the same distribution terms that you use for the rest of that program. 27126a8a12Smrg 28126a8a12Smrgif test $# -eq 0; then 29126a8a12Smrg echo 1>&2 "Try \`$0 --help' for more information" 30126a8a12Smrg exit 1 31126a8a12Smrgfi 32126a8a12Smrg 33126a8a12Smrgrun=: 34126a8a12Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35126a8a12Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36126a8a12Smrg 37126a8a12Smrg# In the cases where this matters, `missing' is being run in the 38126a8a12Smrg# srcdir already. 39126a8a12Smrgif test -f configure.ac; then 40126a8a12Smrg configure_ac=configure.ac 41126a8a12Smrgelse 42126a8a12Smrg configure_ac=configure.in 43126a8a12Smrgfi 44126a8a12Smrg 45126a8a12Smrgmsg="missing on your system" 46126a8a12Smrg 47126a8a12Smrgcase $1 in 48126a8a12Smrg--run) 49126a8a12Smrg # Try to run requested program, and just exit if it succeeds. 50126a8a12Smrg run= 51126a8a12Smrg shift 52126a8a12Smrg "$@" && exit 0 53126a8a12Smrg # Exit code 63 means version mismatch. This often happens 54126a8a12Smrg # when the user try to use an ancient version of a tool on 55126a8a12Smrg # a file that requires a minimum version. In this case we 56126a8a12Smrg # we should proceed has if the program had been absent, or 57126a8a12Smrg # if --run hadn't been passed. 58126a8a12Smrg if test $? = 63; then 59126a8a12Smrg run=: 60126a8a12Smrg msg="probably too old" 61126a8a12Smrg fi 62126a8a12Smrg ;; 63126a8a12Smrg 64126a8a12Smrg -h|--h|--he|--hel|--help) 65126a8a12Smrg echo "\ 66126a8a12Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67126a8a12Smrg 68126a8a12SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69126a8a12Smrgerror status if there is no known handling for PROGRAM. 70126a8a12Smrg 71126a8a12SmrgOptions: 72126a8a12Smrg -h, --help display this help and exit 73126a8a12Smrg -v, --version output version information and exit 74126a8a12Smrg --run try to run the given command, and emulate it if it fails 75126a8a12Smrg 76126a8a12SmrgSupported PROGRAM values: 77126a8a12Smrg aclocal touch file \`aclocal.m4' 78126a8a12Smrg autoconf touch file \`configure' 79126a8a12Smrg autoheader touch file \`config.h.in' 80126a8a12Smrg autom4te touch the output file, or create a stub one 81126a8a12Smrg automake touch all \`Makefile.in' files 82126a8a12Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83126a8a12Smrg flex create \`lex.yy.c', if possible, from existing .c 84126a8a12Smrg help2man touch the output file 85126a8a12Smrg lex create \`lex.yy.c', if possible, from existing .c 86126a8a12Smrg makeinfo touch the output file 87126a8a12Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 88126a8a12Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89126a8a12Smrg 90d656433aSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91d656433aSmrg\`g' are ignored when checking the name. 92d656433aSmrg 93126a8a12SmrgSend bug reports to <bug-automake@gnu.org>." 94126a8a12Smrg exit $? 95126a8a12Smrg ;; 96126a8a12Smrg 97126a8a12Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98126a8a12Smrg echo "missing $scriptversion (GNU Automake)" 99126a8a12Smrg exit $? 100126a8a12Smrg ;; 101126a8a12Smrg 102126a8a12Smrg -*) 103126a8a12Smrg echo 1>&2 "$0: Unknown \`$1' option" 104126a8a12Smrg echo 1>&2 "Try \`$0 --help' for more information" 105126a8a12Smrg exit 1 106126a8a12Smrg ;; 107126a8a12Smrg 108126a8a12Smrgesac 109126a8a12Smrg 110d656433aSmrg# normalize program name to check for. 111d656433aSmrgprogram=`echo "$1" | sed ' 112d656433aSmrg s/^gnu-//; t 113d656433aSmrg s/^gnu//; t 114d656433aSmrg s/^g//; t'` 115d656433aSmrg 116126a8a12Smrg# Now exit if we have it, but it failed. Also exit now if we 117126a8a12Smrg# don't have it and --version was passed (most likely to detect 118d656433aSmrg# the program). This is about non-GNU programs, so use $1 not 119d656433aSmrg# $program. 120126a8a12Smrgcase $1 in 121d656433aSmrg lex*|yacc*) 122126a8a12Smrg # Not GNU programs, they don't have --version. 123126a8a12Smrg ;; 124126a8a12Smrg 125d656433aSmrg tar*) 126126a8a12Smrg if test -n "$run"; then 127126a8a12Smrg echo 1>&2 "ERROR: \`tar' requires --run" 128126a8a12Smrg exit 1 129126a8a12Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130126a8a12Smrg exit 1 131126a8a12Smrg fi 132126a8a12Smrg ;; 133126a8a12Smrg 134126a8a12Smrg *) 135126a8a12Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136126a8a12Smrg # We have it, but it failed. 137126a8a12Smrg exit 1 138126a8a12Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139126a8a12Smrg # Could not run --version or --help. This is probably someone 140126a8a12Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 141126a8a12Smrg # $TOOL exists and not knowing $TOOL uses missing. 142126a8a12Smrg exit 1 143126a8a12Smrg fi 144126a8a12Smrg ;; 145126a8a12Smrgesac 146126a8a12Smrg 147126a8a12Smrg# If it does not exist, or fails to run (possibly an outdated version), 148126a8a12Smrg# try to emulate it. 149d656433aSmrgcase $program in 150126a8a12Smrg aclocal*) 151126a8a12Smrg echo 1>&2 "\ 152126a8a12SmrgWARNING: \`$1' is $msg. You should only need it if 153126a8a12Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154126a8a12Smrg to install the \`Automake' and \`Perl' packages. Grab them from 155126a8a12Smrg any GNU archive site." 156126a8a12Smrg touch aclocal.m4 157126a8a12Smrg ;; 158126a8a12Smrg 159d656433aSmrg autoconf*) 160126a8a12Smrg echo 1>&2 "\ 161126a8a12SmrgWARNING: \`$1' is $msg. You should only need it if 162126a8a12Smrg you modified \`${configure_ac}'. You might want to install the 163126a8a12Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164126a8a12Smrg archive site." 165126a8a12Smrg touch configure 166126a8a12Smrg ;; 167126a8a12Smrg 168d656433aSmrg autoheader*) 169126a8a12Smrg echo 1>&2 "\ 170126a8a12SmrgWARNING: \`$1' is $msg. You should only need it if 171126a8a12Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172126a8a12Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173126a8a12Smrg from any GNU archive site." 174126a8a12Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175126a8a12Smrg test -z "$files" && files="config.h" 176126a8a12Smrg touch_files= 177126a8a12Smrg for f in $files; do 178126a8a12Smrg case $f in 179126a8a12Smrg *:*) touch_files="$touch_files "`echo "$f" | 180126a8a12Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181126a8a12Smrg *) touch_files="$touch_files $f.in";; 182126a8a12Smrg esac 183126a8a12Smrg done 184126a8a12Smrg touch $touch_files 185126a8a12Smrg ;; 186126a8a12Smrg 187126a8a12Smrg automake*) 188126a8a12Smrg echo 1>&2 "\ 189126a8a12SmrgWARNING: \`$1' is $msg. You should only need it if 190126a8a12Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191126a8a12Smrg You might want to install the \`Automake' and \`Perl' packages. 192126a8a12Smrg Grab them from any GNU archive site." 193126a8a12Smrg find . -type f -name Makefile.am -print | 194126a8a12Smrg sed 's/\.am$/.in/' | 195126a8a12Smrg while read f; do touch "$f"; done 196126a8a12Smrg ;; 197126a8a12Smrg 198d656433aSmrg autom4te*) 199126a8a12Smrg echo 1>&2 "\ 200126a8a12SmrgWARNING: \`$1' is needed, but is $msg. 201126a8a12Smrg You might have modified some files without having the 202126a8a12Smrg proper tools for further handling them. 203126a8a12Smrg You can get \`$1' as part of \`Autoconf' from any GNU 204126a8a12Smrg archive site." 205126a8a12Smrg 206126a8a12Smrg file=`echo "$*" | sed -n "$sed_output"` 207126a8a12Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208126a8a12Smrg if test -f "$file"; then 209126a8a12Smrg touch $file 210126a8a12Smrg else 211126a8a12Smrg test -z "$file" || exec >$file 212126a8a12Smrg echo "#! /bin/sh" 213126a8a12Smrg echo "# Created by GNU Automake missing as a replacement of" 214126a8a12Smrg echo "# $ $@" 215126a8a12Smrg echo "exit 0" 216126a8a12Smrg chmod +x $file 217126a8a12Smrg exit 1 218126a8a12Smrg fi 219126a8a12Smrg ;; 220126a8a12Smrg 221d656433aSmrg bison*|yacc*) 222126a8a12Smrg echo 1>&2 "\ 223126a8a12SmrgWARNING: \`$1' $msg. You should only need it if 224126a8a12Smrg you modified a \`.y' file. You may need the \`Bison' package 225126a8a12Smrg in order for those modifications to take effect. You can get 226126a8a12Smrg \`Bison' from any GNU archive site." 227126a8a12Smrg rm -f y.tab.c y.tab.h 228126a8a12Smrg if test $# -ne 1; then 229126a8a12Smrg eval LASTARG="\${$#}" 230126a8a12Smrg case $LASTARG in 231126a8a12Smrg *.y) 232126a8a12Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233126a8a12Smrg if test -f "$SRCFILE"; then 234126a8a12Smrg cp "$SRCFILE" y.tab.c 235126a8a12Smrg fi 236126a8a12Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237126a8a12Smrg if test -f "$SRCFILE"; then 238126a8a12Smrg cp "$SRCFILE" y.tab.h 239126a8a12Smrg fi 240126a8a12Smrg ;; 241126a8a12Smrg esac 242126a8a12Smrg fi 243126a8a12Smrg if test ! -f y.tab.h; then 244126a8a12Smrg echo >y.tab.h 245126a8a12Smrg fi 246126a8a12Smrg if test ! -f y.tab.c; then 247126a8a12Smrg echo 'main() { return 0; }' >y.tab.c 248126a8a12Smrg fi 249126a8a12Smrg ;; 250126a8a12Smrg 251d656433aSmrg lex*|flex*) 252126a8a12Smrg echo 1>&2 "\ 253126a8a12SmrgWARNING: \`$1' is $msg. You should only need it if 254126a8a12Smrg you modified a \`.l' file. You may need the \`Flex' package 255126a8a12Smrg in order for those modifications to take effect. You can get 256126a8a12Smrg \`Flex' from any GNU archive site." 257126a8a12Smrg rm -f lex.yy.c 258126a8a12Smrg if test $# -ne 1; then 259126a8a12Smrg eval LASTARG="\${$#}" 260126a8a12Smrg case $LASTARG in 261126a8a12Smrg *.l) 262126a8a12Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263126a8a12Smrg if test -f "$SRCFILE"; then 264126a8a12Smrg cp "$SRCFILE" lex.yy.c 265126a8a12Smrg fi 266126a8a12Smrg ;; 267126a8a12Smrg esac 268126a8a12Smrg fi 269126a8a12Smrg if test ! -f lex.yy.c; then 270126a8a12Smrg echo 'main() { return 0; }' >lex.yy.c 271126a8a12Smrg fi 272126a8a12Smrg ;; 273126a8a12Smrg 274d656433aSmrg help2man*) 275126a8a12Smrg echo 1>&2 "\ 276126a8a12SmrgWARNING: \`$1' is $msg. You should only need it if 277126a8a12Smrg you modified a dependency of a manual page. You may need the 278126a8a12Smrg \`Help2man' package in order for those modifications to take 279126a8a12Smrg effect. You can get \`Help2man' from any GNU archive site." 280126a8a12Smrg 281126a8a12Smrg file=`echo "$*" | sed -n "$sed_output"` 282126a8a12Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283126a8a12Smrg if test -f "$file"; then 284126a8a12Smrg touch $file 285126a8a12Smrg else 286126a8a12Smrg test -z "$file" || exec >$file 287126a8a12Smrg echo ".ab help2man is required to generate this page" 288d656433aSmrg exit $? 289126a8a12Smrg fi 290126a8a12Smrg ;; 291126a8a12Smrg 292d656433aSmrg makeinfo*) 293126a8a12Smrg echo 1>&2 "\ 294126a8a12SmrgWARNING: \`$1' is $msg. You should only need it if 295126a8a12Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 296126a8a12Smrg indirectly affecting the aspect of the manual. The spurious 297126a8a12Smrg call might also be the consequence of using a buggy \`make' (AIX, 298126a8a12Smrg DU, IRIX). You might want to install the \`Texinfo' package or 299126a8a12Smrg the \`GNU make' package. Grab either from any GNU archive site." 300126a8a12Smrg # The file to touch is that specified with -o ... 301126a8a12Smrg file=`echo "$*" | sed -n "$sed_output"` 302126a8a12Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303126a8a12Smrg if test -z "$file"; then 304126a8a12Smrg # ... or it is the one specified with @setfilename ... 305126a8a12Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306126a8a12Smrg file=`sed -n ' 307126a8a12Smrg /^@setfilename/{ 308126a8a12Smrg s/.* \([^ ]*\) *$/\1/ 309126a8a12Smrg p 310126a8a12Smrg q 311126a8a12Smrg }' $infile` 312126a8a12Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313126a8a12Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314126a8a12Smrg fi 315126a8a12Smrg # If the file does not exist, the user really needs makeinfo; 316126a8a12Smrg # let's fail without touching anything. 317126a8a12Smrg test -f $file || exit 1 318126a8a12Smrg touch $file 319126a8a12Smrg ;; 320126a8a12Smrg 321d656433aSmrg tar*) 322126a8a12Smrg shift 323126a8a12Smrg 324126a8a12Smrg # We have already tried tar in the generic part. 325126a8a12Smrg # Look for gnutar/gtar before invocation to avoid ugly error 326126a8a12Smrg # messages. 327126a8a12Smrg if (gnutar --version > /dev/null 2>&1); then 328126a8a12Smrg gnutar "$@" && exit 0 329126a8a12Smrg fi 330126a8a12Smrg if (gtar --version > /dev/null 2>&1); then 331126a8a12Smrg gtar "$@" && exit 0 332126a8a12Smrg fi 333126a8a12Smrg firstarg="$1" 334126a8a12Smrg if shift; then 335126a8a12Smrg case $firstarg in 336126a8a12Smrg *o*) 337126a8a12Smrg firstarg=`echo "$firstarg" | sed s/o//` 338126a8a12Smrg tar "$firstarg" "$@" && exit 0 339126a8a12Smrg ;; 340126a8a12Smrg esac 341126a8a12Smrg case $firstarg in 342126a8a12Smrg *h*) 343126a8a12Smrg firstarg=`echo "$firstarg" | sed s/h//` 344126a8a12Smrg tar "$firstarg" "$@" && exit 0 345126a8a12Smrg ;; 346126a8a12Smrg esac 347126a8a12Smrg fi 348126a8a12Smrg 349126a8a12Smrg echo 1>&2 "\ 350126a8a12SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351126a8a12Smrg You may want to install GNU tar or Free paxutils, or check the 352126a8a12Smrg command line arguments." 353126a8a12Smrg exit 1 354126a8a12Smrg ;; 355126a8a12Smrg 356126a8a12Smrg *) 357126a8a12Smrg echo 1>&2 "\ 358126a8a12SmrgWARNING: \`$1' is needed, and is $msg. 359126a8a12Smrg You might have modified some files without having the 360126a8a12Smrg proper tools for further handling them. Check the \`README' file, 361126a8a12Smrg it often tells you about the needed prerequisites for installing 362126a8a12Smrg this package. You may also peek at any GNU archive site, in case 363126a8a12Smrg some other package would contain this missing \`$1' program." 364126a8a12Smrg exit 1 365126a8a12Smrg ;; 366126a8a12Smrgesac 367126a8a12Smrg 368126a8a12Smrgexit 0 369126a8a12Smrg 370126a8a12Smrg# Local variables: 371126a8a12Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372126a8a12Smrg# time-stamp-start: "scriptversion=" 373126a8a12Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374d656433aSmrg# time-stamp-time-zone: "UTC" 375d656433aSmrg# time-stamp-end: "; # UTC" 376126a8a12Smrg# End: 377