missing revision ef6fb4a5
1301ea0f4Smrg#! /bin/sh 2301ea0f4Smrg# Common stub for a few missing GNU programs while installing. 3301ea0f4Smrg 4ef6fb4a5Smrgscriptversion=2009-04-28.21; # UTC 5301ea0f4Smrg 6ef6fb4a5Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7ef6fb4a5Smrg# 2008, 2009 Free Software Foundation, Inc. 8301ea0f4Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9301ea0f4Smrg 10301ea0f4Smrg# This program is free software; you can redistribute it and/or modify 11301ea0f4Smrg# it under the terms of the GNU General Public License as published by 12301ea0f4Smrg# the Free Software Foundation; either version 2, or (at your option) 13301ea0f4Smrg# any later version. 14301ea0f4Smrg 15301ea0f4Smrg# This program is distributed in the hope that it will be useful, 16301ea0f4Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17301ea0f4Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18301ea0f4Smrg# GNU General Public License for more details. 19301ea0f4Smrg 20301ea0f4Smrg# You should have received a copy of the GNU General Public License 21ef6fb4a5Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22301ea0f4Smrg 23301ea0f4Smrg# As a special exception to the GNU General Public License, if you 24301ea0f4Smrg# distribute this file as part of a program that contains a 25301ea0f4Smrg# configuration script generated by Autoconf, you may include it under 26301ea0f4Smrg# the same distribution terms that you use for the rest of that program. 27301ea0f4Smrg 28301ea0f4Smrgif test $# -eq 0; then 29301ea0f4Smrg echo 1>&2 "Try \`$0 --help' for more information" 30301ea0f4Smrg exit 1 31301ea0f4Smrgfi 32301ea0f4Smrg 33301ea0f4Smrgrun=: 340cc67336Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 350cc67336Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36301ea0f4Smrg 37301ea0f4Smrg# In the cases where this matters, `missing' is being run in the 38301ea0f4Smrg# srcdir already. 39301ea0f4Smrgif test -f configure.ac; then 40301ea0f4Smrg configure_ac=configure.ac 41301ea0f4Smrgelse 42301ea0f4Smrg configure_ac=configure.in 43301ea0f4Smrgfi 44301ea0f4Smrg 45301ea0f4Smrgmsg="missing on your system" 46301ea0f4Smrg 470cc67336Smrgcase $1 in 48301ea0f4Smrg--run) 49301ea0f4Smrg # Try to run requested program, and just exit if it succeeds. 50301ea0f4Smrg run= 51301ea0f4Smrg shift 52301ea0f4Smrg "$@" && exit 0 53301ea0f4Smrg # Exit code 63 means version mismatch. This often happens 54301ea0f4Smrg # when the user try to use an ancient version of a tool on 55301ea0f4Smrg # a file that requires a minimum version. In this case we 56301ea0f4Smrg # we should proceed has if the program had been absent, or 57301ea0f4Smrg # if --run hadn't been passed. 58301ea0f4Smrg if test $? = 63; then 59301ea0f4Smrg run=: 60301ea0f4Smrg msg="probably too old" 61301ea0f4Smrg fi 62301ea0f4Smrg ;; 63301ea0f4Smrg 64301ea0f4Smrg -h|--h|--he|--hel|--help) 65301ea0f4Smrg echo "\ 66301ea0f4Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67301ea0f4Smrg 68301ea0f4SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69301ea0f4Smrgerror status if there is no known handling for PROGRAM. 70301ea0f4Smrg 71301ea0f4SmrgOptions: 72301ea0f4Smrg -h, --help display this help and exit 73301ea0f4Smrg -v, --version output version information and exit 74301ea0f4Smrg --run try to run the given command, and emulate it if it fails 75301ea0f4Smrg 76301ea0f4SmrgSupported PROGRAM values: 77301ea0f4Smrg aclocal touch file \`aclocal.m4' 78301ea0f4Smrg autoconf touch file \`configure' 79301ea0f4Smrg autoheader touch file \`config.h.in' 800cc67336Smrg autom4te touch the output file, or create a stub one 81301ea0f4Smrg automake touch all \`Makefile.in' files 82301ea0f4Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83301ea0f4Smrg flex create \`lex.yy.c', if possible, from existing .c 84301ea0f4Smrg help2man touch the output file 85301ea0f4Smrg lex create \`lex.yy.c', if possible, from existing .c 86301ea0f4Smrg makeinfo touch the output file 87301ea0f4Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 88301ea0f4Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89301ea0f4Smrg 90ef6fb4a5SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91ef6fb4a5Smrg\`g' are ignored when checking the name. 92ef6fb4a5Smrg 93301ea0f4SmrgSend bug reports to <bug-automake@gnu.org>." 94301ea0f4Smrg exit $? 95301ea0f4Smrg ;; 96301ea0f4Smrg 97301ea0f4Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98301ea0f4Smrg echo "missing $scriptversion (GNU Automake)" 99301ea0f4Smrg exit $? 100301ea0f4Smrg ;; 101301ea0f4Smrg 102301ea0f4Smrg -*) 103301ea0f4Smrg echo 1>&2 "$0: Unknown \`$1' option" 104301ea0f4Smrg echo 1>&2 "Try \`$0 --help' for more information" 105301ea0f4Smrg exit 1 106301ea0f4Smrg ;; 107301ea0f4Smrg 108301ea0f4Smrgesac 109301ea0f4Smrg 110ef6fb4a5Smrg# normalize program name to check for. 111ef6fb4a5Smrgprogram=`echo "$1" | sed ' 112ef6fb4a5Smrg s/^gnu-//; t 113ef6fb4a5Smrg s/^gnu//; t 114ef6fb4a5Smrg s/^g//; t'` 115ef6fb4a5Smrg 116301ea0f4Smrg# Now exit if we have it, but it failed. Also exit now if we 117301ea0f4Smrg# don't have it and --version was passed (most likely to detect 118ef6fb4a5Smrg# the program). This is about non-GNU programs, so use $1 not 119ef6fb4a5Smrg# $program. 1200cc67336Smrgcase $1 in 121ef6fb4a5Smrg lex*|yacc*) 122301ea0f4Smrg # Not GNU programs, they don't have --version. 123301ea0f4Smrg ;; 124301ea0f4Smrg 125ef6fb4a5Smrg tar*) 126301ea0f4Smrg if test -n "$run"; then 127301ea0f4Smrg echo 1>&2 "ERROR: \`tar' requires --run" 128301ea0f4Smrg exit 1 129301ea0f4Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130301ea0f4Smrg exit 1 131301ea0f4Smrg fi 132301ea0f4Smrg ;; 133301ea0f4Smrg 134301ea0f4Smrg *) 135301ea0f4Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136301ea0f4Smrg # We have it, but it failed. 137301ea0f4Smrg exit 1 138301ea0f4Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139301ea0f4Smrg # Could not run --version or --help. This is probably someone 140301ea0f4Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 141301ea0f4Smrg # $TOOL exists and not knowing $TOOL uses missing. 142301ea0f4Smrg exit 1 143301ea0f4Smrg fi 144301ea0f4Smrg ;; 145301ea0f4Smrgesac 146301ea0f4Smrg 147301ea0f4Smrg# If it does not exist, or fails to run (possibly an outdated version), 148301ea0f4Smrg# try to emulate it. 149ef6fb4a5Smrgcase $program in 150301ea0f4Smrg aclocal*) 151301ea0f4Smrg echo 1>&2 "\ 152301ea0f4SmrgWARNING: \`$1' is $msg. You should only need it if 153301ea0f4Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154301ea0f4Smrg to install the \`Automake' and \`Perl' packages. Grab them from 155301ea0f4Smrg any GNU archive site." 156301ea0f4Smrg touch aclocal.m4 157301ea0f4Smrg ;; 158301ea0f4Smrg 159ef6fb4a5Smrg autoconf*) 160301ea0f4Smrg echo 1>&2 "\ 161301ea0f4SmrgWARNING: \`$1' is $msg. You should only need it if 162301ea0f4Smrg you modified \`${configure_ac}'. You might want to install the 163301ea0f4Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164301ea0f4Smrg archive site." 165301ea0f4Smrg touch configure 166301ea0f4Smrg ;; 167301ea0f4Smrg 168ef6fb4a5Smrg autoheader*) 169301ea0f4Smrg echo 1>&2 "\ 170301ea0f4SmrgWARNING: \`$1' is $msg. You should only need it if 171301ea0f4Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172301ea0f4Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173301ea0f4Smrg from any GNU archive site." 174301ea0f4Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175301ea0f4Smrg test -z "$files" && files="config.h" 176301ea0f4Smrg touch_files= 177301ea0f4Smrg for f in $files; do 1780cc67336Smrg case $f in 179301ea0f4Smrg *:*) touch_files="$touch_files "`echo "$f" | 180301ea0f4Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181301ea0f4Smrg *) touch_files="$touch_files $f.in";; 182301ea0f4Smrg esac 183301ea0f4Smrg done 184301ea0f4Smrg touch $touch_files 185301ea0f4Smrg ;; 186301ea0f4Smrg 187301ea0f4Smrg automake*) 188301ea0f4Smrg echo 1>&2 "\ 189301ea0f4SmrgWARNING: \`$1' is $msg. You should only need it if 190301ea0f4Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191301ea0f4Smrg You might want to install the \`Automake' and \`Perl' packages. 192301ea0f4Smrg Grab them from any GNU archive site." 193301ea0f4Smrg find . -type f -name Makefile.am -print | 194301ea0f4Smrg sed 's/\.am$/.in/' | 195301ea0f4Smrg while read f; do touch "$f"; done 196301ea0f4Smrg ;; 197301ea0f4Smrg 198ef6fb4a5Smrg autom4te*) 199301ea0f4Smrg echo 1>&2 "\ 200301ea0f4SmrgWARNING: \`$1' is needed, but is $msg. 201301ea0f4Smrg You might have modified some files without having the 202301ea0f4Smrg proper tools for further handling them. 203301ea0f4Smrg You can get \`$1' as part of \`Autoconf' from any GNU 204301ea0f4Smrg archive site." 205301ea0f4Smrg 2060cc67336Smrg file=`echo "$*" | sed -n "$sed_output"` 2070cc67336Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208301ea0f4Smrg if test -f "$file"; then 209301ea0f4Smrg touch $file 210301ea0f4Smrg else 211301ea0f4Smrg test -z "$file" || exec >$file 212301ea0f4Smrg echo "#! /bin/sh" 213301ea0f4Smrg echo "# Created by GNU Automake missing as a replacement of" 214301ea0f4Smrg echo "# $ $@" 215301ea0f4Smrg echo "exit 0" 216301ea0f4Smrg chmod +x $file 217301ea0f4Smrg exit 1 218301ea0f4Smrg fi 219301ea0f4Smrg ;; 220301ea0f4Smrg 221ef6fb4a5Smrg bison*|yacc*) 222301ea0f4Smrg echo 1>&2 "\ 223301ea0f4SmrgWARNING: \`$1' $msg. You should only need it if 224301ea0f4Smrg you modified a \`.y' file. You may need the \`Bison' package 225301ea0f4Smrg in order for those modifications to take effect. You can get 226301ea0f4Smrg \`Bison' from any GNU archive site." 227301ea0f4Smrg rm -f y.tab.c y.tab.h 2280cc67336Smrg if test $# -ne 1; then 229301ea0f4Smrg eval LASTARG="\${$#}" 2300cc67336Smrg case $LASTARG in 231301ea0f4Smrg *.y) 232301ea0f4Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2330cc67336Smrg if test -f "$SRCFILE"; then 234301ea0f4Smrg cp "$SRCFILE" y.tab.c 235301ea0f4Smrg fi 236301ea0f4Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2370cc67336Smrg if test -f "$SRCFILE"; then 238301ea0f4Smrg cp "$SRCFILE" y.tab.h 239301ea0f4Smrg fi 240301ea0f4Smrg ;; 241301ea0f4Smrg esac 242301ea0f4Smrg fi 2430cc67336Smrg if test ! -f y.tab.h; then 244301ea0f4Smrg echo >y.tab.h 245301ea0f4Smrg fi 2460cc67336Smrg if test ! -f y.tab.c; then 247301ea0f4Smrg echo 'main() { return 0; }' >y.tab.c 248301ea0f4Smrg fi 249301ea0f4Smrg ;; 250301ea0f4Smrg 251ef6fb4a5Smrg lex*|flex*) 252301ea0f4Smrg echo 1>&2 "\ 253301ea0f4SmrgWARNING: \`$1' is $msg. You should only need it if 254301ea0f4Smrg you modified a \`.l' file. You may need the \`Flex' package 255301ea0f4Smrg in order for those modifications to take effect. You can get 256301ea0f4Smrg \`Flex' from any GNU archive site." 257301ea0f4Smrg rm -f lex.yy.c 2580cc67336Smrg if test $# -ne 1; then 259301ea0f4Smrg eval LASTARG="\${$#}" 2600cc67336Smrg case $LASTARG in 261301ea0f4Smrg *.l) 262301ea0f4Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2630cc67336Smrg if test -f "$SRCFILE"; then 264301ea0f4Smrg cp "$SRCFILE" lex.yy.c 265301ea0f4Smrg fi 266301ea0f4Smrg ;; 267301ea0f4Smrg esac 268301ea0f4Smrg fi 2690cc67336Smrg if test ! -f lex.yy.c; then 270301ea0f4Smrg echo 'main() { return 0; }' >lex.yy.c 271301ea0f4Smrg fi 272301ea0f4Smrg ;; 273301ea0f4Smrg 274ef6fb4a5Smrg help2man*) 275301ea0f4Smrg echo 1>&2 "\ 276301ea0f4SmrgWARNING: \`$1' is $msg. You should only need it if 277301ea0f4Smrg you modified a dependency of a manual page. You may need the 278301ea0f4Smrg \`Help2man' package in order for those modifications to take 279301ea0f4Smrg effect. You can get \`Help2man' from any GNU archive site." 280301ea0f4Smrg 2810cc67336Smrg file=`echo "$*" | sed -n "$sed_output"` 2820cc67336Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2830cc67336Smrg if test -f "$file"; then 284301ea0f4Smrg touch $file 285301ea0f4Smrg else 286301ea0f4Smrg test -z "$file" || exec >$file 287301ea0f4Smrg echo ".ab help2man is required to generate this page" 288ef6fb4a5Smrg exit $? 289301ea0f4Smrg fi 290301ea0f4Smrg ;; 291301ea0f4Smrg 292ef6fb4a5Smrg makeinfo*) 293301ea0f4Smrg echo 1>&2 "\ 294301ea0f4SmrgWARNING: \`$1' is $msg. You should only need it if 295301ea0f4Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 296301ea0f4Smrg indirectly affecting the aspect of the manual. The spurious 297301ea0f4Smrg call might also be the consequence of using a buggy \`make' (AIX, 298301ea0f4Smrg DU, IRIX). You might want to install the \`Texinfo' package or 299301ea0f4Smrg the \`GNU make' package. Grab either from any GNU archive site." 300301ea0f4Smrg # The file to touch is that specified with -o ... 3010cc67336Smrg file=`echo "$*" | sed -n "$sed_output"` 3020cc67336Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303301ea0f4Smrg if test -z "$file"; then 304301ea0f4Smrg # ... or it is the one specified with @setfilename ... 305301ea0f4Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 3060cc67336Smrg file=`sed -n ' 3070cc67336Smrg /^@setfilename/{ 3080cc67336Smrg s/.* \([^ ]*\) *$/\1/ 3090cc67336Smrg p 3100cc67336Smrg q 3110cc67336Smrg }' $infile` 312301ea0f4Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313301ea0f4Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314301ea0f4Smrg fi 315301ea0f4Smrg # If the file does not exist, the user really needs makeinfo; 316301ea0f4Smrg # let's fail without touching anything. 317301ea0f4Smrg test -f $file || exit 1 318301ea0f4Smrg touch $file 319301ea0f4Smrg ;; 320301ea0f4Smrg 321ef6fb4a5Smrg tar*) 322301ea0f4Smrg shift 323301ea0f4Smrg 324301ea0f4Smrg # We have already tried tar in the generic part. 325301ea0f4Smrg # Look for gnutar/gtar before invocation to avoid ugly error 326301ea0f4Smrg # messages. 327301ea0f4Smrg if (gnutar --version > /dev/null 2>&1); then 328301ea0f4Smrg gnutar "$@" && exit 0 329301ea0f4Smrg fi 330301ea0f4Smrg if (gtar --version > /dev/null 2>&1); then 331301ea0f4Smrg gtar "$@" && exit 0 332301ea0f4Smrg fi 333301ea0f4Smrg firstarg="$1" 334301ea0f4Smrg if shift; then 3350cc67336Smrg case $firstarg in 336301ea0f4Smrg *o*) 337301ea0f4Smrg firstarg=`echo "$firstarg" | sed s/o//` 338301ea0f4Smrg tar "$firstarg" "$@" && exit 0 339301ea0f4Smrg ;; 340301ea0f4Smrg esac 3410cc67336Smrg case $firstarg in 342301ea0f4Smrg *h*) 343301ea0f4Smrg firstarg=`echo "$firstarg" | sed s/h//` 344301ea0f4Smrg tar "$firstarg" "$@" && exit 0 345301ea0f4Smrg ;; 346301ea0f4Smrg esac 347301ea0f4Smrg fi 348301ea0f4Smrg 349301ea0f4Smrg echo 1>&2 "\ 350301ea0f4SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351301ea0f4Smrg You may want to install GNU tar or Free paxutils, or check the 352301ea0f4Smrg command line arguments." 353301ea0f4Smrg exit 1 354301ea0f4Smrg ;; 355301ea0f4Smrg 356301ea0f4Smrg *) 357301ea0f4Smrg echo 1>&2 "\ 358301ea0f4SmrgWARNING: \`$1' is needed, and is $msg. 359301ea0f4Smrg You might have modified some files without having the 360301ea0f4Smrg proper tools for further handling them. Check the \`README' file, 361301ea0f4Smrg it often tells you about the needed prerequisites for installing 362301ea0f4Smrg this package. You may also peek at any GNU archive site, in case 363301ea0f4Smrg some other package would contain this missing \`$1' program." 364301ea0f4Smrg exit 1 365301ea0f4Smrg ;; 366301ea0f4Smrgesac 367301ea0f4Smrg 368301ea0f4Smrgexit 0 369301ea0f4Smrg 370301ea0f4Smrg# Local variables: 371301ea0f4Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372301ea0f4Smrg# time-stamp-start: "scriptversion=" 373301ea0f4Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374ef6fb4a5Smrg# time-stamp-time-zone: "UTC" 375ef6fb4a5Smrg# time-stamp-end: "; # UTC" 376301ea0f4Smrg# End: 377