missing revision a9a39c43
1129be1b7Smrg#! /bin/sh 2129be1b7Smrg# Common stub for a few missing GNU programs while installing. 3a9a39c43Smrg 4a9a39c43Smrgscriptversion=2009-04-28.21; # UTC 5a9a39c43Smrg 6a9a39c43Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7a9a39c43Smrg# 2008, 2009 Free Software Foundation, Inc. 8129be1b7Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9129be1b7Smrg 10129be1b7Smrg# This program is free software; you can redistribute it and/or modify 11129be1b7Smrg# it under the terms of the GNU General Public License as published by 12129be1b7Smrg# the Free Software Foundation; either version 2, or (at your option) 13129be1b7Smrg# any later version. 14129be1b7Smrg 15129be1b7Smrg# This program is distributed in the hope that it will be useful, 16129be1b7Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17129be1b7Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18129be1b7Smrg# GNU General Public License for more details. 19129be1b7Smrg 20129be1b7Smrg# You should have received a copy of the GNU General Public License 21a9a39c43Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22129be1b7Smrg 23129be1b7Smrg# As a special exception to the GNU General Public License, if you 24129be1b7Smrg# distribute this file as part of a program that contains a 25129be1b7Smrg# configuration script generated by Autoconf, you may include it under 26129be1b7Smrg# the same distribution terms that you use for the rest of that program. 27129be1b7Smrg 28129be1b7Smrgif test $# -eq 0; then 29129be1b7Smrg echo 1>&2 "Try \`$0 --help' for more information" 30129be1b7Smrg exit 1 31129be1b7Smrgfi 32129be1b7Smrg 33129be1b7Smrgrun=: 34a9a39c43Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35a9a39c43Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36129be1b7Smrg 37129be1b7Smrg# In the cases where this matters, `missing' is being run in the 38129be1b7Smrg# srcdir already. 39129be1b7Smrgif test -f configure.ac; then 40129be1b7Smrg configure_ac=configure.ac 41129be1b7Smrgelse 42129be1b7Smrg configure_ac=configure.in 43129be1b7Smrgfi 44129be1b7Smrg 45a9a39c43Smrgmsg="missing on your system" 46a9a39c43Smrg 47a9a39c43Smrgcase $1 in 48129be1b7Smrg--run) 49129be1b7Smrg # Try to run requested program, and just exit if it succeeds. 50129be1b7Smrg run= 51129be1b7Smrg shift 52129be1b7Smrg "$@" && exit 0 53a9a39c43Smrg # Exit code 63 means version mismatch. This often happens 54a9a39c43Smrg # when the user try to use an ancient version of a tool on 55a9a39c43Smrg # a file that requires a minimum version. In this case we 56a9a39c43Smrg # we should proceed has if the program had been absent, or 57a9a39c43Smrg # if --run hadn't been passed. 58a9a39c43Smrg if test $? = 63; then 59a9a39c43Smrg run=: 60a9a39c43Smrg msg="probably too old" 61a9a39c43Smrg fi 62129be1b7Smrg ;; 63129be1b7Smrg 64129be1b7Smrg -h|--h|--he|--hel|--help) 65129be1b7Smrg echo "\ 66129be1b7Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67129be1b7Smrg 68129be1b7SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69129be1b7Smrgerror status if there is no known handling for PROGRAM. 70129be1b7Smrg 71129be1b7SmrgOptions: 72129be1b7Smrg -h, --help display this help and exit 73129be1b7Smrg -v, --version output version information and exit 74129be1b7Smrg --run try to run the given command, and emulate it if it fails 75129be1b7Smrg 76129be1b7SmrgSupported PROGRAM values: 77129be1b7Smrg aclocal touch file \`aclocal.m4' 78129be1b7Smrg autoconf touch file \`configure' 79129be1b7Smrg autoheader touch file \`config.h.in' 80a9a39c43Smrg autom4te touch the output file, or create a stub one 81129be1b7Smrg automake touch all \`Makefile.in' files 82129be1b7Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83129be1b7Smrg flex create \`lex.yy.c', if possible, from existing .c 84129be1b7Smrg help2man touch the output file 85129be1b7Smrg lex create \`lex.yy.c', if possible, from existing .c 86129be1b7Smrg makeinfo touch the output file 87129be1b7Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 88a9a39c43Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89a9a39c43Smrg 90a9a39c43SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91a9a39c43Smrg\`g' are ignored when checking the name. 92a9a39c43Smrg 93a9a39c43SmrgSend bug reports to <bug-automake@gnu.org>." 94a9a39c43Smrg exit $? 95129be1b7Smrg ;; 96129be1b7Smrg 97129be1b7Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98a9a39c43Smrg echo "missing $scriptversion (GNU Automake)" 99a9a39c43Smrg exit $? 100129be1b7Smrg ;; 101129be1b7Smrg 102129be1b7Smrg -*) 103129be1b7Smrg echo 1>&2 "$0: Unknown \`$1' option" 104129be1b7Smrg echo 1>&2 "Try \`$0 --help' for more information" 105129be1b7Smrg exit 1 106129be1b7Smrg ;; 107129be1b7Smrg 108a9a39c43Smrgesac 109a9a39c43Smrg 110a9a39c43Smrg# normalize program name to check for. 111a9a39c43Smrgprogram=`echo "$1" | sed ' 112a9a39c43Smrg s/^gnu-//; t 113a9a39c43Smrg s/^gnu//; t 114a9a39c43Smrg s/^g//; t'` 115a9a39c43Smrg 116a9a39c43Smrg# Now exit if we have it, but it failed. Also exit now if we 117a9a39c43Smrg# don't have it and --version was passed (most likely to detect 118a9a39c43Smrg# the program). This is about non-GNU programs, so use $1 not 119a9a39c43Smrg# $program. 120a9a39c43Smrgcase $1 in 121a9a39c43Smrg lex*|yacc*) 122a9a39c43Smrg # Not GNU programs, they don't have --version. 123a9a39c43Smrg ;; 124a9a39c43Smrg 125a9a39c43Smrg tar*) 126a9a39c43Smrg if test -n "$run"; then 127a9a39c43Smrg echo 1>&2 "ERROR: \`tar' requires --run" 128a9a39c43Smrg exit 1 129a9a39c43Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130a9a39c43Smrg exit 1 131a9a39c43Smrg fi 132a9a39c43Smrg ;; 133a9a39c43Smrg 134a9a39c43Smrg *) 135129be1b7Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136129be1b7Smrg # We have it, but it failed. 137129be1b7Smrg exit 1 138a9a39c43Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139a9a39c43Smrg # Could not run --version or --help. This is probably someone 140a9a39c43Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 141a9a39c43Smrg # $TOOL exists and not knowing $TOOL uses missing. 142a9a39c43Smrg exit 1 143129be1b7Smrg fi 144a9a39c43Smrg ;; 145a9a39c43Smrgesac 146129be1b7Smrg 147a9a39c43Smrg# If it does not exist, or fails to run (possibly an outdated version), 148a9a39c43Smrg# try to emulate it. 149a9a39c43Smrgcase $program in 150a9a39c43Smrg aclocal*) 151129be1b7Smrg echo 1>&2 "\ 152a9a39c43SmrgWARNING: \`$1' is $msg. You should only need it if 153129be1b7Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154129be1b7Smrg to install the \`Automake' and \`Perl' packages. Grab them from 155129be1b7Smrg any GNU archive site." 156129be1b7Smrg touch aclocal.m4 157129be1b7Smrg ;; 158129be1b7Smrg 159a9a39c43Smrg autoconf*) 160129be1b7Smrg echo 1>&2 "\ 161a9a39c43SmrgWARNING: \`$1' is $msg. You should only need it if 162129be1b7Smrg you modified \`${configure_ac}'. You might want to install the 163129be1b7Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164129be1b7Smrg archive site." 165129be1b7Smrg touch configure 166129be1b7Smrg ;; 167129be1b7Smrg 168a9a39c43Smrg autoheader*) 169129be1b7Smrg echo 1>&2 "\ 170a9a39c43SmrgWARNING: \`$1' is $msg. You should only need it if 171129be1b7Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172129be1b7Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173129be1b7Smrg from any GNU archive site." 174129be1b7Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175129be1b7Smrg test -z "$files" && files="config.h" 176129be1b7Smrg touch_files= 177129be1b7Smrg for f in $files; do 178a9a39c43Smrg case $f in 179129be1b7Smrg *:*) touch_files="$touch_files "`echo "$f" | 180129be1b7Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181129be1b7Smrg *) touch_files="$touch_files $f.in";; 182129be1b7Smrg esac 183129be1b7Smrg done 184129be1b7Smrg touch $touch_files 185129be1b7Smrg ;; 186129be1b7Smrg 187129be1b7Smrg automake*) 188129be1b7Smrg echo 1>&2 "\ 189a9a39c43SmrgWARNING: \`$1' is $msg. You should only need it if 190129be1b7Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191129be1b7Smrg You might want to install the \`Automake' and \`Perl' packages. 192129be1b7Smrg Grab them from any GNU archive site." 193129be1b7Smrg find . -type f -name Makefile.am -print | 194129be1b7Smrg sed 's/\.am$/.in/' | 195129be1b7Smrg while read f; do touch "$f"; done 196129be1b7Smrg ;; 197129be1b7Smrg 198a9a39c43Smrg autom4te*) 199129be1b7Smrg echo 1>&2 "\ 200a9a39c43SmrgWARNING: \`$1' is needed, but is $msg. 201a9a39c43Smrg You might have modified some files without having the 202129be1b7Smrg proper tools for further handling them. 203129be1b7Smrg You can get \`$1' as part of \`Autoconf' from any GNU 204129be1b7Smrg archive site." 205129be1b7Smrg 206a9a39c43Smrg file=`echo "$*" | sed -n "$sed_output"` 207a9a39c43Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208129be1b7Smrg if test -f "$file"; then 209129be1b7Smrg touch $file 210129be1b7Smrg else 211129be1b7Smrg test -z "$file" || exec >$file 212129be1b7Smrg echo "#! /bin/sh" 213129be1b7Smrg echo "# Created by GNU Automake missing as a replacement of" 214129be1b7Smrg echo "# $ $@" 215129be1b7Smrg echo "exit 0" 216129be1b7Smrg chmod +x $file 217129be1b7Smrg exit 1 218129be1b7Smrg fi 219129be1b7Smrg ;; 220129be1b7Smrg 221a9a39c43Smrg bison*|yacc*) 222129be1b7Smrg echo 1>&2 "\ 223a9a39c43SmrgWARNING: \`$1' $msg. You should only need it if 224129be1b7Smrg you modified a \`.y' file. You may need the \`Bison' package 225129be1b7Smrg in order for those modifications to take effect. You can get 226129be1b7Smrg \`Bison' from any GNU archive site." 227129be1b7Smrg rm -f y.tab.c y.tab.h 228a9a39c43Smrg if test $# -ne 1; then 229129be1b7Smrg eval LASTARG="\${$#}" 230a9a39c43Smrg case $LASTARG in 231129be1b7Smrg *.y) 232129be1b7Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233a9a39c43Smrg if test -f "$SRCFILE"; then 234129be1b7Smrg cp "$SRCFILE" y.tab.c 235129be1b7Smrg fi 236129be1b7Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237a9a39c43Smrg if test -f "$SRCFILE"; then 238129be1b7Smrg cp "$SRCFILE" y.tab.h 239129be1b7Smrg fi 240129be1b7Smrg ;; 241129be1b7Smrg esac 242129be1b7Smrg fi 243a9a39c43Smrg if test ! -f y.tab.h; then 244129be1b7Smrg echo >y.tab.h 245129be1b7Smrg fi 246a9a39c43Smrg if test ! -f y.tab.c; then 247129be1b7Smrg echo 'main() { return 0; }' >y.tab.c 248129be1b7Smrg fi 249129be1b7Smrg ;; 250129be1b7Smrg 251a9a39c43Smrg lex*|flex*) 252129be1b7Smrg echo 1>&2 "\ 253a9a39c43SmrgWARNING: \`$1' is $msg. You should only need it if 254129be1b7Smrg you modified a \`.l' file. You may need the \`Flex' package 255129be1b7Smrg in order for those modifications to take effect. You can get 256129be1b7Smrg \`Flex' from any GNU archive site." 257129be1b7Smrg rm -f lex.yy.c 258a9a39c43Smrg if test $# -ne 1; then 259129be1b7Smrg eval LASTARG="\${$#}" 260a9a39c43Smrg case $LASTARG in 261129be1b7Smrg *.l) 262129be1b7Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263a9a39c43Smrg if test -f "$SRCFILE"; then 264129be1b7Smrg cp "$SRCFILE" lex.yy.c 265129be1b7Smrg fi 266129be1b7Smrg ;; 267129be1b7Smrg esac 268129be1b7Smrg fi 269a9a39c43Smrg if test ! -f lex.yy.c; then 270129be1b7Smrg echo 'main() { return 0; }' >lex.yy.c 271129be1b7Smrg fi 272129be1b7Smrg ;; 273129be1b7Smrg 274a9a39c43Smrg help2man*) 275129be1b7Smrg echo 1>&2 "\ 276a9a39c43SmrgWARNING: \`$1' is $msg. You should only need it if 277129be1b7Smrg you modified a dependency of a manual page. You may need the 278129be1b7Smrg \`Help2man' package in order for those modifications to take 279129be1b7Smrg effect. You can get \`Help2man' from any GNU archive site." 280129be1b7Smrg 281a9a39c43Smrg file=`echo "$*" | sed -n "$sed_output"` 282a9a39c43Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283a9a39c43Smrg if test -f "$file"; then 284129be1b7Smrg touch $file 285129be1b7Smrg else 286129be1b7Smrg test -z "$file" || exec >$file 287129be1b7Smrg echo ".ab help2man is required to generate this page" 288a9a39c43Smrg exit $? 289129be1b7Smrg fi 290129be1b7Smrg ;; 291129be1b7Smrg 292a9a39c43Smrg makeinfo*) 293129be1b7Smrg echo 1>&2 "\ 294a9a39c43SmrgWARNING: \`$1' is $msg. You should only need it if 295129be1b7Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 296129be1b7Smrg indirectly affecting the aspect of the manual. The spurious 297129be1b7Smrg call might also be the consequence of using a buggy \`make' (AIX, 298129be1b7Smrg DU, IRIX). You might want to install the \`Texinfo' package or 299129be1b7Smrg the \`GNU make' package. Grab either from any GNU archive site." 300a9a39c43Smrg # The file to touch is that specified with -o ... 301a9a39c43Smrg file=`echo "$*" | sed -n "$sed_output"` 302a9a39c43Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303129be1b7Smrg if test -z "$file"; then 304a9a39c43Smrg # ... or it is the one specified with @setfilename ... 305a9a39c43Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306a9a39c43Smrg file=`sed -n ' 307a9a39c43Smrg /^@setfilename/{ 308a9a39c43Smrg s/.* \([^ ]*\) *$/\1/ 309a9a39c43Smrg p 310a9a39c43Smrg q 311a9a39c43Smrg }' $infile` 312a9a39c43Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313a9a39c43Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314129be1b7Smrg fi 315a9a39c43Smrg # If the file does not exist, the user really needs makeinfo; 316a9a39c43Smrg # let's fail without touching anything. 317a9a39c43Smrg test -f $file || exit 1 318129be1b7Smrg touch $file 319129be1b7Smrg ;; 320129be1b7Smrg 321a9a39c43Smrg tar*) 322129be1b7Smrg shift 323129be1b7Smrg 324129be1b7Smrg # We have already tried tar in the generic part. 325129be1b7Smrg # Look for gnutar/gtar before invocation to avoid ugly error 326129be1b7Smrg # messages. 327129be1b7Smrg if (gnutar --version > /dev/null 2>&1); then 328129be1b7Smrg gnutar "$@" && exit 0 329129be1b7Smrg fi 330129be1b7Smrg if (gtar --version > /dev/null 2>&1); then 331129be1b7Smrg gtar "$@" && exit 0 332129be1b7Smrg fi 333129be1b7Smrg firstarg="$1" 334129be1b7Smrg if shift; then 335a9a39c43Smrg case $firstarg in 336129be1b7Smrg *o*) 337129be1b7Smrg firstarg=`echo "$firstarg" | sed s/o//` 338129be1b7Smrg tar "$firstarg" "$@" && exit 0 339129be1b7Smrg ;; 340129be1b7Smrg esac 341a9a39c43Smrg case $firstarg in 342129be1b7Smrg *h*) 343129be1b7Smrg firstarg=`echo "$firstarg" | sed s/h//` 344129be1b7Smrg tar "$firstarg" "$@" && exit 0 345129be1b7Smrg ;; 346129be1b7Smrg esac 347129be1b7Smrg fi 348129be1b7Smrg 349129be1b7Smrg echo 1>&2 "\ 350129be1b7SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351129be1b7Smrg You may want to install GNU tar or Free paxutils, or check the 352129be1b7Smrg command line arguments." 353129be1b7Smrg exit 1 354129be1b7Smrg ;; 355129be1b7Smrg 356129be1b7Smrg *) 357129be1b7Smrg echo 1>&2 "\ 358a9a39c43SmrgWARNING: \`$1' is needed, and is $msg. 359a9a39c43Smrg You might have modified some files without having the 360129be1b7Smrg proper tools for further handling them. Check the \`README' file, 361129be1b7Smrg it often tells you about the needed prerequisites for installing 362129be1b7Smrg this package. You may also peek at any GNU archive site, in case 363129be1b7Smrg some other package would contain this missing \`$1' program." 364129be1b7Smrg exit 1 365129be1b7Smrg ;; 366129be1b7Smrgesac 367129be1b7Smrg 368129be1b7Smrgexit 0 369a9a39c43Smrg 370a9a39c43Smrg# Local variables: 371a9a39c43Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372a9a39c43Smrg# time-stamp-start: "scriptversion=" 373a9a39c43Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374a9a39c43Smrg# time-stamp-time-zone: "UTC" 375a9a39c43Smrg# time-stamp-end: "; # UTC" 376a9a39c43Smrg# End: 377