missing revision 50539131
1ded1caa4Smrg#! /bin/sh 2ded1caa4Smrg# Common stub for a few missing GNU programs while installing. 350539131Smrg 450539131Smrgscriptversion=2009-04-28.21; # UTC 550539131Smrg 650539131Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 750539131Smrg# 2008, 2009 Free Software Foundation, Inc. 8ded1caa4Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9ded1caa4Smrg 10ded1caa4Smrg# This program is free software; you can redistribute it and/or modify 11ded1caa4Smrg# it under the terms of the GNU General Public License as published by 12ded1caa4Smrg# the Free Software Foundation; either version 2, or (at your option) 13ded1caa4Smrg# any later version. 14ded1caa4Smrg 15ded1caa4Smrg# This program is distributed in the hope that it will be useful, 16ded1caa4Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17ded1caa4Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18ded1caa4Smrg# GNU General Public License for more details. 19ded1caa4Smrg 20ded1caa4Smrg# You should have received a copy of the GNU General Public License 2150539131Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22ded1caa4Smrg 23ded1caa4Smrg# As a special exception to the GNU General Public License, if you 24ded1caa4Smrg# distribute this file as part of a program that contains a 25ded1caa4Smrg# configuration script generated by Autoconf, you may include it under 26ded1caa4Smrg# the same distribution terms that you use for the rest of that program. 27ded1caa4Smrg 28ded1caa4Smrgif test $# -eq 0; then 29ded1caa4Smrg echo 1>&2 "Try \`$0 --help' for more information" 30ded1caa4Smrg exit 1 31ded1caa4Smrgfi 32ded1caa4Smrg 33ded1caa4Smrgrun=: 3450539131Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 3550539131Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36ded1caa4Smrg 37ded1caa4Smrg# In the cases where this matters, `missing' is being run in the 38ded1caa4Smrg# srcdir already. 39ded1caa4Smrgif test -f configure.ac; then 40ded1caa4Smrg configure_ac=configure.ac 41ded1caa4Smrgelse 42ded1caa4Smrg configure_ac=configure.in 43ded1caa4Smrgfi 44ded1caa4Smrg 4550539131Smrgmsg="missing on your system" 4650539131Smrg 4750539131Smrgcase $1 in 48ded1caa4Smrg--run) 49ded1caa4Smrg # Try to run requested program, and just exit if it succeeds. 50ded1caa4Smrg run= 51ded1caa4Smrg shift 52ded1caa4Smrg "$@" && exit 0 5350539131Smrg # Exit code 63 means version mismatch. This often happens 5450539131Smrg # when the user try to use an ancient version of a tool on 5550539131Smrg # a file that requires a minimum version. In this case we 5650539131Smrg # we should proceed has if the program had been absent, or 5750539131Smrg # if --run hadn't been passed. 5850539131Smrg if test $? = 63; then 5950539131Smrg run=: 6050539131Smrg msg="probably too old" 6150539131Smrg fi 62ded1caa4Smrg ;; 63ded1caa4Smrg 64ded1caa4Smrg -h|--h|--he|--hel|--help) 65ded1caa4Smrg echo "\ 66ded1caa4Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67ded1caa4Smrg 68ded1caa4SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69ded1caa4Smrgerror status if there is no known handling for PROGRAM. 70ded1caa4Smrg 71ded1caa4SmrgOptions: 72ded1caa4Smrg -h, --help display this help and exit 73ded1caa4Smrg -v, --version output version information and exit 74ded1caa4Smrg --run try to run the given command, and emulate it if it fails 75ded1caa4Smrg 76ded1caa4SmrgSupported PROGRAM values: 77ded1caa4Smrg aclocal touch file \`aclocal.m4' 78ded1caa4Smrg autoconf touch file \`configure' 79ded1caa4Smrg autoheader touch file \`config.h.in' 8050539131Smrg autom4te touch the output file, or create a stub one 81ded1caa4Smrg automake touch all \`Makefile.in' files 82ded1caa4Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83ded1caa4Smrg flex create \`lex.yy.c', if possible, from existing .c 84ded1caa4Smrg help2man touch the output file 85ded1caa4Smrg lex create \`lex.yy.c', if possible, from existing .c 86ded1caa4Smrg makeinfo touch the output file 87ded1caa4Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 8850539131Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8950539131Smrg 9050539131SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 9150539131Smrg\`g' are ignored when checking the name. 9250539131Smrg 9350539131SmrgSend bug reports to <bug-automake@gnu.org>." 9450539131Smrg exit $? 95ded1caa4Smrg ;; 96ded1caa4Smrg 97ded1caa4Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9850539131Smrg echo "missing $scriptversion (GNU Automake)" 9950539131Smrg exit $? 100ded1caa4Smrg ;; 101ded1caa4Smrg 102ded1caa4Smrg -*) 103ded1caa4Smrg echo 1>&2 "$0: Unknown \`$1' option" 104ded1caa4Smrg echo 1>&2 "Try \`$0 --help' for more information" 105ded1caa4Smrg exit 1 106ded1caa4Smrg ;; 107ded1caa4Smrg 10850539131Smrgesac 10950539131Smrg 11050539131Smrg# normalize program name to check for. 11150539131Smrgprogram=`echo "$1" | sed ' 11250539131Smrg s/^gnu-//; t 11350539131Smrg s/^gnu//; t 11450539131Smrg s/^g//; t'` 11550539131Smrg 11650539131Smrg# Now exit if we have it, but it failed. Also exit now if we 11750539131Smrg# don't have it and --version was passed (most likely to detect 11850539131Smrg# the program). This is about non-GNU programs, so use $1 not 11950539131Smrg# $program. 12050539131Smrgcase $1 in 12150539131Smrg lex*|yacc*) 12250539131Smrg # Not GNU programs, they don't have --version. 12350539131Smrg ;; 12450539131Smrg 12550539131Smrg tar*) 12650539131Smrg if test -n "$run"; then 12750539131Smrg echo 1>&2 "ERROR: \`tar' requires --run" 12850539131Smrg exit 1 12950539131Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13050539131Smrg exit 1 13150539131Smrg fi 13250539131Smrg ;; 13350539131Smrg 13450539131Smrg *) 135ded1caa4Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136ded1caa4Smrg # We have it, but it failed. 137ded1caa4Smrg exit 1 13850539131Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13950539131Smrg # Could not run --version or --help. This is probably someone 14050539131Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 14150539131Smrg # $TOOL exists and not knowing $TOOL uses missing. 14250539131Smrg exit 1 143ded1caa4Smrg fi 14450539131Smrg ;; 14550539131Smrgesac 146ded1caa4Smrg 14750539131Smrg# If it does not exist, or fails to run (possibly an outdated version), 14850539131Smrg# try to emulate it. 14950539131Smrgcase $program in 15050539131Smrg aclocal*) 151ded1caa4Smrg echo 1>&2 "\ 15250539131SmrgWARNING: \`$1' is $msg. You should only need it if 153ded1caa4Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154ded1caa4Smrg to install the \`Automake' and \`Perl' packages. Grab them from 155ded1caa4Smrg any GNU archive site." 156ded1caa4Smrg touch aclocal.m4 157ded1caa4Smrg ;; 158ded1caa4Smrg 15950539131Smrg autoconf*) 160ded1caa4Smrg echo 1>&2 "\ 16150539131SmrgWARNING: \`$1' is $msg. You should only need it if 162ded1caa4Smrg you modified \`${configure_ac}'. You might want to install the 163ded1caa4Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164ded1caa4Smrg archive site." 165ded1caa4Smrg touch configure 166ded1caa4Smrg ;; 167ded1caa4Smrg 16850539131Smrg autoheader*) 169ded1caa4Smrg echo 1>&2 "\ 17050539131SmrgWARNING: \`$1' is $msg. You should only need it if 171ded1caa4Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172ded1caa4Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173ded1caa4Smrg from any GNU archive site." 174ded1caa4Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175ded1caa4Smrg test -z "$files" && files="config.h" 176ded1caa4Smrg touch_files= 177ded1caa4Smrg for f in $files; do 17850539131Smrg case $f in 179ded1caa4Smrg *:*) touch_files="$touch_files "`echo "$f" | 180ded1caa4Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181ded1caa4Smrg *) touch_files="$touch_files $f.in";; 182ded1caa4Smrg esac 183ded1caa4Smrg done 184ded1caa4Smrg touch $touch_files 185ded1caa4Smrg ;; 186ded1caa4Smrg 187ded1caa4Smrg automake*) 188ded1caa4Smrg echo 1>&2 "\ 18950539131SmrgWARNING: \`$1' is $msg. You should only need it if 190ded1caa4Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191ded1caa4Smrg You might want to install the \`Automake' and \`Perl' packages. 192ded1caa4Smrg Grab them from any GNU archive site." 193ded1caa4Smrg find . -type f -name Makefile.am -print | 194ded1caa4Smrg sed 's/\.am$/.in/' | 195ded1caa4Smrg while read f; do touch "$f"; done 196ded1caa4Smrg ;; 197ded1caa4Smrg 19850539131Smrg autom4te*) 199ded1caa4Smrg echo 1>&2 "\ 20050539131SmrgWARNING: \`$1' is needed, but is $msg. 20150539131Smrg You might have modified some files without having the 202ded1caa4Smrg proper tools for further handling them. 203ded1caa4Smrg You can get \`$1' as part of \`Autoconf' from any GNU 204ded1caa4Smrg archive site." 205ded1caa4Smrg 20650539131Smrg file=`echo "$*" | sed -n "$sed_output"` 20750539131Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208ded1caa4Smrg if test -f "$file"; then 209ded1caa4Smrg touch $file 210ded1caa4Smrg else 211ded1caa4Smrg test -z "$file" || exec >$file 212ded1caa4Smrg echo "#! /bin/sh" 213ded1caa4Smrg echo "# Created by GNU Automake missing as a replacement of" 214ded1caa4Smrg echo "# $ $@" 215ded1caa4Smrg echo "exit 0" 216ded1caa4Smrg chmod +x $file 217ded1caa4Smrg exit 1 218ded1caa4Smrg fi 219ded1caa4Smrg ;; 220ded1caa4Smrg 22150539131Smrg bison*|yacc*) 222ded1caa4Smrg echo 1>&2 "\ 22350539131SmrgWARNING: \`$1' $msg. You should only need it if 224ded1caa4Smrg you modified a \`.y' file. You may need the \`Bison' package 225ded1caa4Smrg in order for those modifications to take effect. You can get 226ded1caa4Smrg \`Bison' from any GNU archive site." 227ded1caa4Smrg rm -f y.tab.c y.tab.h 22850539131Smrg if test $# -ne 1; then 229ded1caa4Smrg eval LASTARG="\${$#}" 23050539131Smrg case $LASTARG in 231ded1caa4Smrg *.y) 232ded1caa4Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 23350539131Smrg if test -f "$SRCFILE"; then 234ded1caa4Smrg cp "$SRCFILE" y.tab.c 235ded1caa4Smrg fi 236ded1caa4Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 23750539131Smrg if test -f "$SRCFILE"; then 238ded1caa4Smrg cp "$SRCFILE" y.tab.h 239ded1caa4Smrg fi 240ded1caa4Smrg ;; 241ded1caa4Smrg esac 242ded1caa4Smrg fi 24350539131Smrg if test ! -f y.tab.h; then 244ded1caa4Smrg echo >y.tab.h 245ded1caa4Smrg fi 24650539131Smrg if test ! -f y.tab.c; then 247ded1caa4Smrg echo 'main() { return 0; }' >y.tab.c 248ded1caa4Smrg fi 249ded1caa4Smrg ;; 250ded1caa4Smrg 25150539131Smrg lex*|flex*) 252ded1caa4Smrg echo 1>&2 "\ 25350539131SmrgWARNING: \`$1' is $msg. You should only need it if 254ded1caa4Smrg you modified a \`.l' file. You may need the \`Flex' package 255ded1caa4Smrg in order for those modifications to take effect. You can get 256ded1caa4Smrg \`Flex' from any GNU archive site." 257ded1caa4Smrg rm -f lex.yy.c 25850539131Smrg if test $# -ne 1; then 259ded1caa4Smrg eval LASTARG="\${$#}" 26050539131Smrg case $LASTARG in 261ded1caa4Smrg *.l) 262ded1caa4Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 26350539131Smrg if test -f "$SRCFILE"; then 264ded1caa4Smrg cp "$SRCFILE" lex.yy.c 265ded1caa4Smrg fi 266ded1caa4Smrg ;; 267ded1caa4Smrg esac 268ded1caa4Smrg fi 26950539131Smrg if test ! -f lex.yy.c; then 270ded1caa4Smrg echo 'main() { return 0; }' >lex.yy.c 271ded1caa4Smrg fi 272ded1caa4Smrg ;; 273ded1caa4Smrg 27450539131Smrg help2man*) 275ded1caa4Smrg echo 1>&2 "\ 27650539131SmrgWARNING: \`$1' is $msg. You should only need it if 277ded1caa4Smrg you modified a dependency of a manual page. You may need the 278ded1caa4Smrg \`Help2man' package in order for those modifications to take 279ded1caa4Smrg effect. You can get \`Help2man' from any GNU archive site." 280ded1caa4Smrg 28150539131Smrg file=`echo "$*" | sed -n "$sed_output"` 28250539131Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 28350539131Smrg if test -f "$file"; then 284ded1caa4Smrg touch $file 285ded1caa4Smrg else 286ded1caa4Smrg test -z "$file" || exec >$file 287ded1caa4Smrg echo ".ab help2man is required to generate this page" 28850539131Smrg exit $? 289ded1caa4Smrg fi 290ded1caa4Smrg ;; 291ded1caa4Smrg 29250539131Smrg makeinfo*) 293ded1caa4Smrg echo 1>&2 "\ 29450539131SmrgWARNING: \`$1' is $msg. You should only need it if 295ded1caa4Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 296ded1caa4Smrg indirectly affecting the aspect of the manual. The spurious 297ded1caa4Smrg call might also be the consequence of using a buggy \`make' (AIX, 298ded1caa4Smrg DU, IRIX). You might want to install the \`Texinfo' package or 299ded1caa4Smrg the \`GNU make' package. Grab either from any GNU archive site." 30050539131Smrg # The file to touch is that specified with -o ... 30150539131Smrg file=`echo "$*" | sed -n "$sed_output"` 30250539131Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303ded1caa4Smrg if test -z "$file"; then 30450539131Smrg # ... or it is the one specified with @setfilename ... 30550539131Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 30650539131Smrg file=`sed -n ' 30750539131Smrg /^@setfilename/{ 30850539131Smrg s/.* \([^ ]*\) *$/\1/ 30950539131Smrg p 31050539131Smrg q 31150539131Smrg }' $infile` 31250539131Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 31350539131Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314ded1caa4Smrg fi 31550539131Smrg # If the file does not exist, the user really needs makeinfo; 31650539131Smrg # let's fail without touching anything. 31750539131Smrg test -f $file || exit 1 318ded1caa4Smrg touch $file 319ded1caa4Smrg ;; 320ded1caa4Smrg 32150539131Smrg tar*) 322ded1caa4Smrg shift 323ded1caa4Smrg 324ded1caa4Smrg # We have already tried tar in the generic part. 325ded1caa4Smrg # Look for gnutar/gtar before invocation to avoid ugly error 326ded1caa4Smrg # messages. 327ded1caa4Smrg if (gnutar --version > /dev/null 2>&1); then 328ded1caa4Smrg gnutar "$@" && exit 0 329ded1caa4Smrg fi 330ded1caa4Smrg if (gtar --version > /dev/null 2>&1); then 331ded1caa4Smrg gtar "$@" && exit 0 332ded1caa4Smrg fi 333ded1caa4Smrg firstarg="$1" 334ded1caa4Smrg if shift; then 33550539131Smrg case $firstarg in 336ded1caa4Smrg *o*) 337ded1caa4Smrg firstarg=`echo "$firstarg" | sed s/o//` 338ded1caa4Smrg tar "$firstarg" "$@" && exit 0 339ded1caa4Smrg ;; 340ded1caa4Smrg esac 34150539131Smrg case $firstarg in 342ded1caa4Smrg *h*) 343ded1caa4Smrg firstarg=`echo "$firstarg" | sed s/h//` 344ded1caa4Smrg tar "$firstarg" "$@" && exit 0 345ded1caa4Smrg ;; 346ded1caa4Smrg esac 347ded1caa4Smrg fi 348ded1caa4Smrg 349ded1caa4Smrg echo 1>&2 "\ 350ded1caa4SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351ded1caa4Smrg You may want to install GNU tar or Free paxutils, or check the 352ded1caa4Smrg command line arguments." 353ded1caa4Smrg exit 1 354ded1caa4Smrg ;; 355ded1caa4Smrg 356ded1caa4Smrg *) 357ded1caa4Smrg echo 1>&2 "\ 35850539131SmrgWARNING: \`$1' is needed, and is $msg. 35950539131Smrg You might have modified some files without having the 360ded1caa4Smrg proper tools for further handling them. Check the \`README' file, 361ded1caa4Smrg it often tells you about the needed prerequisites for installing 362ded1caa4Smrg this package. You may also peek at any GNU archive site, in case 363ded1caa4Smrg some other package would contain this missing \`$1' program." 364ded1caa4Smrg exit 1 365ded1caa4Smrg ;; 366ded1caa4Smrgesac 367ded1caa4Smrg 368ded1caa4Smrgexit 0 36950539131Smrg 37050539131Smrg# Local variables: 37150539131Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 37250539131Smrg# time-stamp-start: "scriptversion=" 37350539131Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 37450539131Smrg# time-stamp-time-zone: "UTC" 37550539131Smrg# time-stamp-end: "; # UTC" 37650539131Smrg# End: 377