1566738d7Smrg#! /bin/sh 2566738d7Smrg# Common stub for a few missing GNU programs while installing. 350718ea6Smrg 450718ea6Smrgscriptversion=2009-04-28.21; # UTC 550718ea6Smrg 650718ea6Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 750718ea6Smrg# 2008, 2009 Free Software Foundation, Inc. 8566738d7Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9566738d7Smrg 10566738d7Smrg# This program is free software; you can redistribute it and/or modify 11566738d7Smrg# it under the terms of the GNU General Public License as published by 12566738d7Smrg# the Free Software Foundation; either version 2, or (at your option) 13566738d7Smrg# any later version. 14566738d7Smrg 15566738d7Smrg# This program is distributed in the hope that it will be useful, 16566738d7Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17566738d7Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18566738d7Smrg# GNU General Public License for more details. 19566738d7Smrg 20566738d7Smrg# You should have received a copy of the GNU General Public License 2150718ea6Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22566738d7Smrg 23566738d7Smrg# As a special exception to the GNU General Public License, if you 24566738d7Smrg# distribute this file as part of a program that contains a 25566738d7Smrg# configuration script generated by Autoconf, you may include it under 26566738d7Smrg# the same distribution terms that you use for the rest of that program. 27566738d7Smrg 28566738d7Smrgif test $# -eq 0; then 29566738d7Smrg echo 1>&2 "Try \`$0 --help' for more information" 30566738d7Smrg exit 1 31566738d7Smrgfi 32566738d7Smrg 33566738d7Smrgrun=: 3450718ea6Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 3550718ea6Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36566738d7Smrg 37566738d7Smrg# In the cases where this matters, `missing' is being run in the 38566738d7Smrg# srcdir already. 39566738d7Smrgif test -f configure.ac; then 40566738d7Smrg configure_ac=configure.ac 41566738d7Smrgelse 42566738d7Smrg configure_ac=configure.in 43566738d7Smrgfi 44566738d7Smrg 4550718ea6Smrgmsg="missing on your system" 4650718ea6Smrg 4750718ea6Smrgcase $1 in 48566738d7Smrg--run) 49566738d7Smrg # Try to run requested program, and just exit if it succeeds. 50566738d7Smrg run= 51566738d7Smrg shift 52566738d7Smrg "$@" && exit 0 5350718ea6Smrg # Exit code 63 means version mismatch. This often happens 5450718ea6Smrg # when the user try to use an ancient version of a tool on 5550718ea6Smrg # a file that requires a minimum version. In this case we 5650718ea6Smrg # we should proceed has if the program had been absent, or 5750718ea6Smrg # if --run hadn't been passed. 5850718ea6Smrg if test $? = 63; then 5950718ea6Smrg run=: 6050718ea6Smrg msg="probably too old" 6150718ea6Smrg fi 62566738d7Smrg ;; 63566738d7Smrg 64566738d7Smrg -h|--h|--he|--hel|--help) 65566738d7Smrg echo "\ 66566738d7Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67566738d7Smrg 68566738d7SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69566738d7Smrgerror status if there is no known handling for PROGRAM. 70566738d7Smrg 71566738d7SmrgOptions: 72566738d7Smrg -h, --help display this help and exit 73566738d7Smrg -v, --version output version information and exit 74566738d7Smrg --run try to run the given command, and emulate it if it fails 75566738d7Smrg 76566738d7SmrgSupported PROGRAM values: 77566738d7Smrg aclocal touch file \`aclocal.m4' 78566738d7Smrg autoconf touch file \`configure' 79566738d7Smrg autoheader touch file \`config.h.in' 8050718ea6Smrg autom4te touch the output file, or create a stub one 81566738d7Smrg automake touch all \`Makefile.in' files 82566738d7Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83566738d7Smrg flex create \`lex.yy.c', if possible, from existing .c 84566738d7Smrg help2man touch the output file 85566738d7Smrg lex create \`lex.yy.c', if possible, from existing .c 86566738d7Smrg makeinfo touch the output file 87566738d7Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 8850718ea6Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8950718ea6Smrg 9050718ea6SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 9150718ea6Smrg\`g' are ignored when checking the name. 9250718ea6Smrg 9350718ea6SmrgSend bug reports to <bug-automake@gnu.org>." 9450718ea6Smrg exit $? 95566738d7Smrg ;; 96566738d7Smrg 97566738d7Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9850718ea6Smrg echo "missing $scriptversion (GNU Automake)" 9950718ea6Smrg exit $? 100566738d7Smrg ;; 101566738d7Smrg 102566738d7Smrg -*) 103566738d7Smrg echo 1>&2 "$0: Unknown \`$1' option" 104566738d7Smrg echo 1>&2 "Try \`$0 --help' for more information" 105566738d7Smrg exit 1 106566738d7Smrg ;; 107566738d7Smrg 10850718ea6Smrgesac 10950718ea6Smrg 11050718ea6Smrg# normalize program name to check for. 11150718ea6Smrgprogram=`echo "$1" | sed ' 11250718ea6Smrg s/^gnu-//; t 11350718ea6Smrg s/^gnu//; t 11450718ea6Smrg s/^g//; t'` 11550718ea6Smrg 11650718ea6Smrg# Now exit if we have it, but it failed. Also exit now if we 11750718ea6Smrg# don't have it and --version was passed (most likely to detect 11850718ea6Smrg# the program). This is about non-GNU programs, so use $1 not 11950718ea6Smrg# $program. 12050718ea6Smrgcase $1 in 12150718ea6Smrg lex*|yacc*) 12250718ea6Smrg # Not GNU programs, they don't have --version. 12350718ea6Smrg ;; 12450718ea6Smrg 12550718ea6Smrg tar*) 12650718ea6Smrg if test -n "$run"; then 12750718ea6Smrg echo 1>&2 "ERROR: \`tar' requires --run" 12850718ea6Smrg exit 1 12950718ea6Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13050718ea6Smrg exit 1 13150718ea6Smrg fi 13250718ea6Smrg ;; 13350718ea6Smrg 13450718ea6Smrg *) 135566738d7Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136566738d7Smrg # We have it, but it failed. 137566738d7Smrg exit 1 13850718ea6Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13950718ea6Smrg # Could not run --version or --help. This is probably someone 14050718ea6Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 14150718ea6Smrg # $TOOL exists and not knowing $TOOL uses missing. 14250718ea6Smrg exit 1 143566738d7Smrg fi 14450718ea6Smrg ;; 14550718ea6Smrgesac 146566738d7Smrg 14750718ea6Smrg# If it does not exist, or fails to run (possibly an outdated version), 14850718ea6Smrg# try to emulate it. 14950718ea6Smrgcase $program in 15050718ea6Smrg aclocal*) 151566738d7Smrg echo 1>&2 "\ 15250718ea6SmrgWARNING: \`$1' is $msg. You should only need it if 153566738d7Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154566738d7Smrg to install the \`Automake' and \`Perl' packages. Grab them from 155566738d7Smrg any GNU archive site." 156566738d7Smrg touch aclocal.m4 157566738d7Smrg ;; 158566738d7Smrg 15950718ea6Smrg autoconf*) 160566738d7Smrg echo 1>&2 "\ 16150718ea6SmrgWARNING: \`$1' is $msg. You should only need it if 162566738d7Smrg you modified \`${configure_ac}'. You might want to install the 163566738d7Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164566738d7Smrg archive site." 165566738d7Smrg touch configure 166566738d7Smrg ;; 167566738d7Smrg 16850718ea6Smrg autoheader*) 169566738d7Smrg echo 1>&2 "\ 17050718ea6SmrgWARNING: \`$1' is $msg. You should only need it if 171566738d7Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172566738d7Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173566738d7Smrg from any GNU archive site." 174566738d7Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175566738d7Smrg test -z "$files" && files="config.h" 176566738d7Smrg touch_files= 177566738d7Smrg for f in $files; do 17850718ea6Smrg case $f in 179566738d7Smrg *:*) touch_files="$touch_files "`echo "$f" | 180566738d7Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181566738d7Smrg *) touch_files="$touch_files $f.in";; 182566738d7Smrg esac 183566738d7Smrg done 184566738d7Smrg touch $touch_files 185566738d7Smrg ;; 186566738d7Smrg 187566738d7Smrg automake*) 188566738d7Smrg echo 1>&2 "\ 18950718ea6SmrgWARNING: \`$1' is $msg. You should only need it if 190566738d7Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191566738d7Smrg You might want to install the \`Automake' and \`Perl' packages. 192566738d7Smrg Grab them from any GNU archive site." 193566738d7Smrg find . -type f -name Makefile.am -print | 194566738d7Smrg sed 's/\.am$/.in/' | 195566738d7Smrg while read f; do touch "$f"; done 196566738d7Smrg ;; 197566738d7Smrg 19850718ea6Smrg autom4te*) 199566738d7Smrg echo 1>&2 "\ 20050718ea6SmrgWARNING: \`$1' is needed, but is $msg. 20150718ea6Smrg You might have modified some files without having the 202566738d7Smrg proper tools for further handling them. 203566738d7Smrg You can get \`$1' as part of \`Autoconf' from any GNU 204566738d7Smrg archive site." 205566738d7Smrg 20650718ea6Smrg file=`echo "$*" | sed -n "$sed_output"` 20750718ea6Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208566738d7Smrg if test -f "$file"; then 209566738d7Smrg touch $file 210566738d7Smrg else 211566738d7Smrg test -z "$file" || exec >$file 212566738d7Smrg echo "#! /bin/sh" 213566738d7Smrg echo "# Created by GNU Automake missing as a replacement of" 214566738d7Smrg echo "# $ $@" 215566738d7Smrg echo "exit 0" 216566738d7Smrg chmod +x $file 217566738d7Smrg exit 1 218566738d7Smrg fi 219566738d7Smrg ;; 220566738d7Smrg 22150718ea6Smrg bison*|yacc*) 222566738d7Smrg echo 1>&2 "\ 22350718ea6SmrgWARNING: \`$1' $msg. You should only need it if 224566738d7Smrg you modified a \`.y' file. You may need the \`Bison' package 225566738d7Smrg in order for those modifications to take effect. You can get 226566738d7Smrg \`Bison' from any GNU archive site." 227566738d7Smrg rm -f y.tab.c y.tab.h 22850718ea6Smrg if test $# -ne 1; then 229566738d7Smrg eval LASTARG="\${$#}" 23050718ea6Smrg case $LASTARG in 231566738d7Smrg *.y) 232566738d7Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 23350718ea6Smrg if test -f "$SRCFILE"; then 234566738d7Smrg cp "$SRCFILE" y.tab.c 235566738d7Smrg fi 236566738d7Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 23750718ea6Smrg if test -f "$SRCFILE"; then 238566738d7Smrg cp "$SRCFILE" y.tab.h 239566738d7Smrg fi 240566738d7Smrg ;; 241566738d7Smrg esac 242566738d7Smrg fi 24350718ea6Smrg if test ! -f y.tab.h; then 244566738d7Smrg echo >y.tab.h 245566738d7Smrg fi 24650718ea6Smrg if test ! -f y.tab.c; then 247566738d7Smrg echo 'main() { return 0; }' >y.tab.c 248566738d7Smrg fi 249566738d7Smrg ;; 250566738d7Smrg 25150718ea6Smrg lex*|flex*) 252566738d7Smrg echo 1>&2 "\ 25350718ea6SmrgWARNING: \`$1' is $msg. You should only need it if 254566738d7Smrg you modified a \`.l' file. You may need the \`Flex' package 255566738d7Smrg in order for those modifications to take effect. You can get 256566738d7Smrg \`Flex' from any GNU archive site." 257566738d7Smrg rm -f lex.yy.c 25850718ea6Smrg if test $# -ne 1; then 259566738d7Smrg eval LASTARG="\${$#}" 26050718ea6Smrg case $LASTARG in 261566738d7Smrg *.l) 262566738d7Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 26350718ea6Smrg if test -f "$SRCFILE"; then 264566738d7Smrg cp "$SRCFILE" lex.yy.c 265566738d7Smrg fi 266566738d7Smrg ;; 267566738d7Smrg esac 268566738d7Smrg fi 26950718ea6Smrg if test ! -f lex.yy.c; then 270566738d7Smrg echo 'main() { return 0; }' >lex.yy.c 271566738d7Smrg fi 272566738d7Smrg ;; 273566738d7Smrg 27450718ea6Smrg help2man*) 275566738d7Smrg echo 1>&2 "\ 27650718ea6SmrgWARNING: \`$1' is $msg. You should only need it if 277566738d7Smrg you modified a dependency of a manual page. You may need the 278566738d7Smrg \`Help2man' package in order for those modifications to take 279566738d7Smrg effect. You can get \`Help2man' from any GNU archive site." 280566738d7Smrg 28150718ea6Smrg file=`echo "$*" | sed -n "$sed_output"` 28250718ea6Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 28350718ea6Smrg if test -f "$file"; then 284566738d7Smrg touch $file 285566738d7Smrg else 286566738d7Smrg test -z "$file" || exec >$file 287566738d7Smrg echo ".ab help2man is required to generate this page" 28850718ea6Smrg exit $? 289566738d7Smrg fi 290566738d7Smrg ;; 291566738d7Smrg 29250718ea6Smrg makeinfo*) 293566738d7Smrg echo 1>&2 "\ 29450718ea6SmrgWARNING: \`$1' is $msg. You should only need it if 295566738d7Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 296566738d7Smrg indirectly affecting the aspect of the manual. The spurious 297566738d7Smrg call might also be the consequence of using a buggy \`make' (AIX, 298566738d7Smrg DU, IRIX). You might want to install the \`Texinfo' package or 299566738d7Smrg the \`GNU make' package. Grab either from any GNU archive site." 30050718ea6Smrg # The file to touch is that specified with -o ... 30150718ea6Smrg file=`echo "$*" | sed -n "$sed_output"` 30250718ea6Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303566738d7Smrg if test -z "$file"; then 30450718ea6Smrg # ... or it is the one specified with @setfilename ... 30550718ea6Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 30650718ea6Smrg file=`sed -n ' 30750718ea6Smrg /^@setfilename/{ 30850718ea6Smrg s/.* \([^ ]*\) *$/\1/ 30950718ea6Smrg p 31050718ea6Smrg q 31150718ea6Smrg }' $infile` 31250718ea6Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 31350718ea6Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314566738d7Smrg fi 31550718ea6Smrg # If the file does not exist, the user really needs makeinfo; 31650718ea6Smrg # let's fail without touching anything. 31750718ea6Smrg test -f $file || exit 1 318566738d7Smrg touch $file 319566738d7Smrg ;; 320566738d7Smrg 32150718ea6Smrg tar*) 322566738d7Smrg shift 323566738d7Smrg 324566738d7Smrg # We have already tried tar in the generic part. 325566738d7Smrg # Look for gnutar/gtar before invocation to avoid ugly error 326566738d7Smrg # messages. 327566738d7Smrg if (gnutar --version > /dev/null 2>&1); then 328566738d7Smrg gnutar "$@" && exit 0 329566738d7Smrg fi 330566738d7Smrg if (gtar --version > /dev/null 2>&1); then 331566738d7Smrg gtar "$@" && exit 0 332566738d7Smrg fi 333566738d7Smrg firstarg="$1" 334566738d7Smrg if shift; then 33550718ea6Smrg case $firstarg in 336566738d7Smrg *o*) 337566738d7Smrg firstarg=`echo "$firstarg" | sed s/o//` 338566738d7Smrg tar "$firstarg" "$@" && exit 0 339566738d7Smrg ;; 340566738d7Smrg esac 34150718ea6Smrg case $firstarg in 342566738d7Smrg *h*) 343566738d7Smrg firstarg=`echo "$firstarg" | sed s/h//` 344566738d7Smrg tar "$firstarg" "$@" && exit 0 345566738d7Smrg ;; 346566738d7Smrg esac 347566738d7Smrg fi 348566738d7Smrg 349566738d7Smrg echo 1>&2 "\ 350566738d7SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351566738d7Smrg You may want to install GNU tar or Free paxutils, or check the 352566738d7Smrg command line arguments." 353566738d7Smrg exit 1 354566738d7Smrg ;; 355566738d7Smrg 356566738d7Smrg *) 357566738d7Smrg echo 1>&2 "\ 35850718ea6SmrgWARNING: \`$1' is needed, and is $msg. 35950718ea6Smrg You might have modified some files without having the 360566738d7Smrg proper tools for further handling them. Check the \`README' file, 361566738d7Smrg it often tells you about the needed prerequisites for installing 362566738d7Smrg this package. You may also peek at any GNU archive site, in case 363566738d7Smrg some other package would contain this missing \`$1' program." 364566738d7Smrg exit 1 365566738d7Smrg ;; 366566738d7Smrgesac 367566738d7Smrg 368566738d7Smrgexit 0 36950718ea6Smrg 37050718ea6Smrg# Local variables: 37150718ea6Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 37250718ea6Smrg# time-stamp-start: "scriptversion=" 37350718ea6Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 37450718ea6Smrg# time-stamp-time-zone: "UTC" 37550718ea6Smrg# time-stamp-end: "; # UTC" 37650718ea6Smrg# End: 377