missing revision 972599cf
1972599cfSmrg#! /bin/sh 2972599cfSmrg# Common stub for a few missing GNU programs while installing. 3972599cfSmrg 4972599cfSmrgscriptversion=2009-04-28.21; # UTC 5972599cfSmrg 6972599cfSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7972599cfSmrg# 2008, 2009 Free Software Foundation, Inc. 8972599cfSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9972599cfSmrg 10972599cfSmrg# This program is free software; you can redistribute it and/or modify 11972599cfSmrg# it under the terms of the GNU General Public License as published by 12972599cfSmrg# the Free Software Foundation; either version 2, or (at your option) 13972599cfSmrg# any later version. 14972599cfSmrg 15972599cfSmrg# This program is distributed in the hope that it will be useful, 16972599cfSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17972599cfSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18972599cfSmrg# GNU General Public License for more details. 19972599cfSmrg 20972599cfSmrg# You should have received a copy of the GNU General Public License 21972599cfSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22972599cfSmrg 23972599cfSmrg# As a special exception to the GNU General Public License, if you 24972599cfSmrg# distribute this file as part of a program that contains a 25972599cfSmrg# configuration script generated by Autoconf, you may include it under 26972599cfSmrg# the same distribution terms that you use for the rest of that program. 27972599cfSmrg 28972599cfSmrgif test $# -eq 0; then 29972599cfSmrg echo 1>&2 "Try \`$0 --help' for more information" 30972599cfSmrg exit 1 31972599cfSmrgfi 32972599cfSmrg 33972599cfSmrgrun=: 34972599cfSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35972599cfSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36972599cfSmrg 37972599cfSmrg# In the cases where this matters, `missing' is being run in the 38972599cfSmrg# srcdir already. 39972599cfSmrgif test -f configure.ac; then 40972599cfSmrg configure_ac=configure.ac 41972599cfSmrgelse 42972599cfSmrg configure_ac=configure.in 43972599cfSmrgfi 44972599cfSmrg 45972599cfSmrgmsg="missing on your system" 46972599cfSmrg 47972599cfSmrgcase $1 in 48972599cfSmrg--run) 49972599cfSmrg # Try to run requested program, and just exit if it succeeds. 50972599cfSmrg run= 51972599cfSmrg shift 52972599cfSmrg "$@" && exit 0 53972599cfSmrg # Exit code 63 means version mismatch. This often happens 54972599cfSmrg # when the user try to use an ancient version of a tool on 55972599cfSmrg # a file that requires a minimum version. In this case we 56972599cfSmrg # we should proceed has if the program had been absent, or 57972599cfSmrg # if --run hadn't been passed. 58972599cfSmrg if test $? = 63; then 59972599cfSmrg run=: 60972599cfSmrg msg="probably too old" 61972599cfSmrg fi 62972599cfSmrg ;; 63972599cfSmrg 64972599cfSmrg -h|--h|--he|--hel|--help) 65972599cfSmrg echo "\ 66972599cfSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67972599cfSmrg 68972599cfSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69972599cfSmrgerror status if there is no known handling for PROGRAM. 70972599cfSmrg 71972599cfSmrgOptions: 72972599cfSmrg -h, --help display this help and exit 73972599cfSmrg -v, --version output version information and exit 74972599cfSmrg --run try to run the given command, and emulate it if it fails 75972599cfSmrg 76972599cfSmrgSupported PROGRAM values: 77972599cfSmrg aclocal touch file \`aclocal.m4' 78972599cfSmrg autoconf touch file \`configure' 79972599cfSmrg autoheader touch file \`config.h.in' 80972599cfSmrg autom4te touch the output file, or create a stub one 81972599cfSmrg automake touch all \`Makefile.in' files 82972599cfSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83972599cfSmrg flex create \`lex.yy.c', if possible, from existing .c 84972599cfSmrg help2man touch the output file 85972599cfSmrg lex create \`lex.yy.c', if possible, from existing .c 86972599cfSmrg makeinfo touch the output file 87972599cfSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 88972599cfSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89972599cfSmrg 90972599cfSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91972599cfSmrg\`g' are ignored when checking the name. 92972599cfSmrg 93972599cfSmrgSend bug reports to <bug-automake@gnu.org>." 94972599cfSmrg exit $? 95972599cfSmrg ;; 96972599cfSmrg 97972599cfSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98972599cfSmrg echo "missing $scriptversion (GNU Automake)" 99972599cfSmrg exit $? 100972599cfSmrg ;; 101972599cfSmrg 102972599cfSmrg -*) 103972599cfSmrg echo 1>&2 "$0: Unknown \`$1' option" 104972599cfSmrg echo 1>&2 "Try \`$0 --help' for more information" 105972599cfSmrg exit 1 106972599cfSmrg ;; 107972599cfSmrg 108972599cfSmrgesac 109972599cfSmrg 110972599cfSmrg# normalize program name to check for. 111972599cfSmrgprogram=`echo "$1" | sed ' 112972599cfSmrg s/^gnu-//; t 113972599cfSmrg s/^gnu//; t 114972599cfSmrg s/^g//; t'` 115972599cfSmrg 116972599cfSmrg# Now exit if we have it, but it failed. Also exit now if we 117972599cfSmrg# don't have it and --version was passed (most likely to detect 118972599cfSmrg# the program). This is about non-GNU programs, so use $1 not 119972599cfSmrg# $program. 120972599cfSmrgcase $1 in 121972599cfSmrg lex*|yacc*) 122972599cfSmrg # Not GNU programs, they don't have --version. 123972599cfSmrg ;; 124972599cfSmrg 125972599cfSmrg tar*) 126972599cfSmrg if test -n "$run"; then 127972599cfSmrg echo 1>&2 "ERROR: \`tar' requires --run" 128972599cfSmrg exit 1 129972599cfSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130972599cfSmrg exit 1 131972599cfSmrg fi 132972599cfSmrg ;; 133972599cfSmrg 134972599cfSmrg *) 135972599cfSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136972599cfSmrg # We have it, but it failed. 137972599cfSmrg exit 1 138972599cfSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139972599cfSmrg # Could not run --version or --help. This is probably someone 140972599cfSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 141972599cfSmrg # $TOOL exists and not knowing $TOOL uses missing. 142972599cfSmrg exit 1 143972599cfSmrg fi 144972599cfSmrg ;; 145972599cfSmrgesac 146972599cfSmrg 147972599cfSmrg# If it does not exist, or fails to run (possibly an outdated version), 148972599cfSmrg# try to emulate it. 149972599cfSmrgcase $program in 150972599cfSmrg aclocal*) 151972599cfSmrg echo 1>&2 "\ 152972599cfSmrgWARNING: \`$1' is $msg. You should only need it if 153972599cfSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154972599cfSmrg to install the \`Automake' and \`Perl' packages. Grab them from 155972599cfSmrg any GNU archive site." 156972599cfSmrg touch aclocal.m4 157972599cfSmrg ;; 158972599cfSmrg 159972599cfSmrg autoconf*) 160972599cfSmrg echo 1>&2 "\ 161972599cfSmrgWARNING: \`$1' is $msg. You should only need it if 162972599cfSmrg you modified \`${configure_ac}'. You might want to install the 163972599cfSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164972599cfSmrg archive site." 165972599cfSmrg touch configure 166972599cfSmrg ;; 167972599cfSmrg 168972599cfSmrg autoheader*) 169972599cfSmrg echo 1>&2 "\ 170972599cfSmrgWARNING: \`$1' is $msg. You should only need it if 171972599cfSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172972599cfSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173972599cfSmrg from any GNU archive site." 174972599cfSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175972599cfSmrg test -z "$files" && files="config.h" 176972599cfSmrg touch_files= 177972599cfSmrg for f in $files; do 178972599cfSmrg case $f in 179972599cfSmrg *:*) touch_files="$touch_files "`echo "$f" | 180972599cfSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181972599cfSmrg *) touch_files="$touch_files $f.in";; 182972599cfSmrg esac 183972599cfSmrg done 184972599cfSmrg touch $touch_files 185972599cfSmrg ;; 186972599cfSmrg 187972599cfSmrg automake*) 188972599cfSmrg echo 1>&2 "\ 189972599cfSmrgWARNING: \`$1' is $msg. You should only need it if 190972599cfSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191972599cfSmrg You might want to install the \`Automake' and \`Perl' packages. 192972599cfSmrg Grab them from any GNU archive site." 193972599cfSmrg find . -type f -name Makefile.am -print | 194972599cfSmrg sed 's/\.am$/.in/' | 195972599cfSmrg while read f; do touch "$f"; done 196972599cfSmrg ;; 197972599cfSmrg 198972599cfSmrg autom4te*) 199972599cfSmrg echo 1>&2 "\ 200972599cfSmrgWARNING: \`$1' is needed, but is $msg. 201972599cfSmrg You might have modified some files without having the 202972599cfSmrg proper tools for further handling them. 203972599cfSmrg You can get \`$1' as part of \`Autoconf' from any GNU 204972599cfSmrg archive site." 205972599cfSmrg 206972599cfSmrg file=`echo "$*" | sed -n "$sed_output"` 207972599cfSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208972599cfSmrg if test -f "$file"; then 209972599cfSmrg touch $file 210972599cfSmrg else 211972599cfSmrg test -z "$file" || exec >$file 212972599cfSmrg echo "#! /bin/sh" 213972599cfSmrg echo "# Created by GNU Automake missing as a replacement of" 214972599cfSmrg echo "# $ $@" 215972599cfSmrg echo "exit 0" 216972599cfSmrg chmod +x $file 217972599cfSmrg exit 1 218972599cfSmrg fi 219972599cfSmrg ;; 220972599cfSmrg 221972599cfSmrg bison*|yacc*) 222972599cfSmrg echo 1>&2 "\ 223972599cfSmrgWARNING: \`$1' $msg. You should only need it if 224972599cfSmrg you modified a \`.y' file. You may need the \`Bison' package 225972599cfSmrg in order for those modifications to take effect. You can get 226972599cfSmrg \`Bison' from any GNU archive site." 227972599cfSmrg rm -f y.tab.c y.tab.h 228972599cfSmrg if test $# -ne 1; then 229972599cfSmrg eval LASTARG="\${$#}" 230972599cfSmrg case $LASTARG in 231972599cfSmrg *.y) 232972599cfSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233972599cfSmrg if test -f "$SRCFILE"; then 234972599cfSmrg cp "$SRCFILE" y.tab.c 235972599cfSmrg fi 236972599cfSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237972599cfSmrg if test -f "$SRCFILE"; then 238972599cfSmrg cp "$SRCFILE" y.tab.h 239972599cfSmrg fi 240972599cfSmrg ;; 241972599cfSmrg esac 242972599cfSmrg fi 243972599cfSmrg if test ! -f y.tab.h; then 244972599cfSmrg echo >y.tab.h 245972599cfSmrg fi 246972599cfSmrg if test ! -f y.tab.c; then 247972599cfSmrg echo 'main() { return 0; }' >y.tab.c 248972599cfSmrg fi 249972599cfSmrg ;; 250972599cfSmrg 251972599cfSmrg lex*|flex*) 252972599cfSmrg echo 1>&2 "\ 253972599cfSmrgWARNING: \`$1' is $msg. You should only need it if 254972599cfSmrg you modified a \`.l' file. You may need the \`Flex' package 255972599cfSmrg in order for those modifications to take effect. You can get 256972599cfSmrg \`Flex' from any GNU archive site." 257972599cfSmrg rm -f lex.yy.c 258972599cfSmrg if test $# -ne 1; then 259972599cfSmrg eval LASTARG="\${$#}" 260972599cfSmrg case $LASTARG in 261972599cfSmrg *.l) 262972599cfSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263972599cfSmrg if test -f "$SRCFILE"; then 264972599cfSmrg cp "$SRCFILE" lex.yy.c 265972599cfSmrg fi 266972599cfSmrg ;; 267972599cfSmrg esac 268972599cfSmrg fi 269972599cfSmrg if test ! -f lex.yy.c; then 270972599cfSmrg echo 'main() { return 0; }' >lex.yy.c 271972599cfSmrg fi 272972599cfSmrg ;; 273972599cfSmrg 274972599cfSmrg help2man*) 275972599cfSmrg echo 1>&2 "\ 276972599cfSmrgWARNING: \`$1' is $msg. You should only need it if 277972599cfSmrg you modified a dependency of a manual page. You may need the 278972599cfSmrg \`Help2man' package in order for those modifications to take 279972599cfSmrg effect. You can get \`Help2man' from any GNU archive site." 280972599cfSmrg 281972599cfSmrg file=`echo "$*" | sed -n "$sed_output"` 282972599cfSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283972599cfSmrg if test -f "$file"; then 284972599cfSmrg touch $file 285972599cfSmrg else 286972599cfSmrg test -z "$file" || exec >$file 287972599cfSmrg echo ".ab help2man is required to generate this page" 288972599cfSmrg exit $? 289972599cfSmrg fi 290972599cfSmrg ;; 291972599cfSmrg 292972599cfSmrg makeinfo*) 293972599cfSmrg echo 1>&2 "\ 294972599cfSmrgWARNING: \`$1' is $msg. You should only need it if 295972599cfSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 296972599cfSmrg indirectly affecting the aspect of the manual. The spurious 297972599cfSmrg call might also be the consequence of using a buggy \`make' (AIX, 298972599cfSmrg DU, IRIX). You might want to install the \`Texinfo' package or 299972599cfSmrg the \`GNU make' package. Grab either from any GNU archive site." 300972599cfSmrg # The file to touch is that specified with -o ... 301972599cfSmrg file=`echo "$*" | sed -n "$sed_output"` 302972599cfSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303972599cfSmrg if test -z "$file"; then 304972599cfSmrg # ... or it is the one specified with @setfilename ... 305972599cfSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306972599cfSmrg file=`sed -n ' 307972599cfSmrg /^@setfilename/{ 308972599cfSmrg s/.* \([^ ]*\) *$/\1/ 309972599cfSmrg p 310972599cfSmrg q 311972599cfSmrg }' $infile` 312972599cfSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313972599cfSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314972599cfSmrg fi 315972599cfSmrg # If the file does not exist, the user really needs makeinfo; 316972599cfSmrg # let's fail without touching anything. 317972599cfSmrg test -f $file || exit 1 318972599cfSmrg touch $file 319972599cfSmrg ;; 320972599cfSmrg 321972599cfSmrg tar*) 322972599cfSmrg shift 323972599cfSmrg 324972599cfSmrg # We have already tried tar in the generic part. 325972599cfSmrg # Look for gnutar/gtar before invocation to avoid ugly error 326972599cfSmrg # messages. 327972599cfSmrg if (gnutar --version > /dev/null 2>&1); then 328972599cfSmrg gnutar "$@" && exit 0 329972599cfSmrg fi 330972599cfSmrg if (gtar --version > /dev/null 2>&1); then 331972599cfSmrg gtar "$@" && exit 0 332972599cfSmrg fi 333972599cfSmrg firstarg="$1" 334972599cfSmrg if shift; then 335972599cfSmrg case $firstarg in 336972599cfSmrg *o*) 337972599cfSmrg firstarg=`echo "$firstarg" | sed s/o//` 338972599cfSmrg tar "$firstarg" "$@" && exit 0 339972599cfSmrg ;; 340972599cfSmrg esac 341972599cfSmrg case $firstarg in 342972599cfSmrg *h*) 343972599cfSmrg firstarg=`echo "$firstarg" | sed s/h//` 344972599cfSmrg tar "$firstarg" "$@" && exit 0 345972599cfSmrg ;; 346972599cfSmrg esac 347972599cfSmrg fi 348972599cfSmrg 349972599cfSmrg echo 1>&2 "\ 350972599cfSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351972599cfSmrg You may want to install GNU tar or Free paxutils, or check the 352972599cfSmrg command line arguments." 353972599cfSmrg exit 1 354972599cfSmrg ;; 355972599cfSmrg 356972599cfSmrg *) 357972599cfSmrg echo 1>&2 "\ 358972599cfSmrgWARNING: \`$1' is needed, and is $msg. 359972599cfSmrg You might have modified some files without having the 360972599cfSmrg proper tools for further handling them. Check the \`README' file, 361972599cfSmrg it often tells you about the needed prerequisites for installing 362972599cfSmrg this package. You may also peek at any GNU archive site, in case 363972599cfSmrg some other package would contain this missing \`$1' program." 364972599cfSmrg exit 1 365972599cfSmrg ;; 366972599cfSmrgesac 367972599cfSmrg 368972599cfSmrgexit 0 369972599cfSmrg 370972599cfSmrg# Local variables: 371972599cfSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372972599cfSmrg# time-stamp-start: "scriptversion=" 373972599cfSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374972599cfSmrg# time-stamp-time-zone: "UTC" 375972599cfSmrg# time-stamp-end: "; # UTC" 376972599cfSmrg# End: 377