missing revision 209ff23f
1209ff23fSmrg#! /bin/sh 2209ff23fSmrg# Common stub for a few missing GNU programs while installing. 3209ff23fSmrg 4209ff23fSmrgscriptversion=2006-05-10.23 5209ff23fSmrg 6209ff23fSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 7209ff23fSmrg# Free Software Foundation, Inc. 8209ff23fSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9209ff23fSmrg 10209ff23fSmrg# This program is free software; you can redistribute it and/or modify 11209ff23fSmrg# it under the terms of the GNU General Public License as published by 12209ff23fSmrg# the Free Software Foundation; either version 2, or (at your option) 13209ff23fSmrg# any later version. 14209ff23fSmrg 15209ff23fSmrg# This program is distributed in the hope that it will be useful, 16209ff23fSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17209ff23fSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18209ff23fSmrg# GNU General Public License for more details. 19209ff23fSmrg 20209ff23fSmrg# You should have received a copy of the GNU General Public License 21209ff23fSmrg# along with this program; if not, write to the Free Software 22209ff23fSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23209ff23fSmrg# 02110-1301, USA. 24209ff23fSmrg 25209ff23fSmrg# As a special exception to the GNU General Public License, if you 26209ff23fSmrg# distribute this file as part of a program that contains a 27209ff23fSmrg# configuration script generated by Autoconf, you may include it under 28209ff23fSmrg# the same distribution terms that you use for the rest of that program. 29209ff23fSmrg 30209ff23fSmrgif test $# -eq 0; then 31209ff23fSmrg echo 1>&2 "Try \`$0 --help' for more information" 32209ff23fSmrg exit 1 33209ff23fSmrgfi 34209ff23fSmrg 35209ff23fSmrgrun=: 36209ff23fSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 37209ff23fSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 38209ff23fSmrg 39209ff23fSmrg# In the cases where this matters, `missing' is being run in the 40209ff23fSmrg# srcdir already. 41209ff23fSmrgif test -f configure.ac; then 42209ff23fSmrg configure_ac=configure.ac 43209ff23fSmrgelse 44209ff23fSmrg configure_ac=configure.in 45209ff23fSmrgfi 46209ff23fSmrg 47209ff23fSmrgmsg="missing on your system" 48209ff23fSmrg 49209ff23fSmrgcase $1 in 50209ff23fSmrg--run) 51209ff23fSmrg # Try to run requested program, and just exit if it succeeds. 52209ff23fSmrg run= 53209ff23fSmrg shift 54209ff23fSmrg "$@" && exit 0 55209ff23fSmrg # Exit code 63 means version mismatch. This often happens 56209ff23fSmrg # when the user try to use an ancient version of a tool on 57209ff23fSmrg # a file that requires a minimum version. In this case we 58209ff23fSmrg # we should proceed has if the program had been absent, or 59209ff23fSmrg # if --run hadn't been passed. 60209ff23fSmrg if test $? = 63; then 61209ff23fSmrg run=: 62209ff23fSmrg msg="probably too old" 63209ff23fSmrg fi 64209ff23fSmrg ;; 65209ff23fSmrg 66209ff23fSmrg -h|--h|--he|--hel|--help) 67209ff23fSmrg echo "\ 68209ff23fSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 69209ff23fSmrg 70209ff23fSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 71209ff23fSmrgerror status if there is no known handling for PROGRAM. 72209ff23fSmrg 73209ff23fSmrgOptions: 74209ff23fSmrg -h, --help display this help and exit 75209ff23fSmrg -v, --version output version information and exit 76209ff23fSmrg --run try to run the given command, and emulate it if it fails 77209ff23fSmrg 78209ff23fSmrgSupported PROGRAM values: 79209ff23fSmrg aclocal touch file \`aclocal.m4' 80209ff23fSmrg autoconf touch file \`configure' 81209ff23fSmrg autoheader touch file \`config.h.in' 82209ff23fSmrg autom4te touch the output file, or create a stub one 83209ff23fSmrg automake touch all \`Makefile.in' files 84209ff23fSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 85209ff23fSmrg flex create \`lex.yy.c', if possible, from existing .c 86209ff23fSmrg help2man touch the output file 87209ff23fSmrg lex create \`lex.yy.c', if possible, from existing .c 88209ff23fSmrg makeinfo touch the output file 89209ff23fSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 90209ff23fSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 91209ff23fSmrg 92209ff23fSmrgSend bug reports to <bug-automake@gnu.org>." 93209ff23fSmrg exit $? 94209ff23fSmrg ;; 95209ff23fSmrg 96209ff23fSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 97209ff23fSmrg echo "missing $scriptversion (GNU Automake)" 98209ff23fSmrg exit $? 99209ff23fSmrg ;; 100209ff23fSmrg 101209ff23fSmrg -*) 102209ff23fSmrg echo 1>&2 "$0: Unknown \`$1' option" 103209ff23fSmrg echo 1>&2 "Try \`$0 --help' for more information" 104209ff23fSmrg exit 1 105209ff23fSmrg ;; 106209ff23fSmrg 107209ff23fSmrgesac 108209ff23fSmrg 109209ff23fSmrg# Now exit if we have it, but it failed. Also exit now if we 110209ff23fSmrg# don't have it and --version was passed (most likely to detect 111209ff23fSmrg# the program). 112209ff23fSmrgcase $1 in 113209ff23fSmrg lex|yacc) 114209ff23fSmrg # Not GNU programs, they don't have --version. 115209ff23fSmrg ;; 116209ff23fSmrg 117209ff23fSmrg tar) 118209ff23fSmrg if test -n "$run"; then 119209ff23fSmrg echo 1>&2 "ERROR: \`tar' requires --run" 120209ff23fSmrg exit 1 121209ff23fSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 122209ff23fSmrg exit 1 123209ff23fSmrg fi 124209ff23fSmrg ;; 125209ff23fSmrg 126209ff23fSmrg *) 127209ff23fSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 128209ff23fSmrg # We have it, but it failed. 129209ff23fSmrg exit 1 130209ff23fSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 131209ff23fSmrg # Could not run --version or --help. This is probably someone 132209ff23fSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 133209ff23fSmrg # $TOOL exists and not knowing $TOOL uses missing. 134209ff23fSmrg exit 1 135209ff23fSmrg fi 136209ff23fSmrg ;; 137209ff23fSmrgesac 138209ff23fSmrg 139209ff23fSmrg# If it does not exist, or fails to run (possibly an outdated version), 140209ff23fSmrg# try to emulate it. 141209ff23fSmrgcase $1 in 142209ff23fSmrg aclocal*) 143209ff23fSmrg echo 1>&2 "\ 144209ff23fSmrgWARNING: \`$1' is $msg. You should only need it if 145209ff23fSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 146209ff23fSmrg to install the \`Automake' and \`Perl' packages. Grab them from 147209ff23fSmrg any GNU archive site." 148209ff23fSmrg touch aclocal.m4 149209ff23fSmrg ;; 150209ff23fSmrg 151209ff23fSmrg autoconf) 152209ff23fSmrg echo 1>&2 "\ 153209ff23fSmrgWARNING: \`$1' is $msg. You should only need it if 154209ff23fSmrg you modified \`${configure_ac}'. You might want to install the 155209ff23fSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 156209ff23fSmrg archive site." 157209ff23fSmrg touch configure 158209ff23fSmrg ;; 159209ff23fSmrg 160209ff23fSmrg autoheader) 161209ff23fSmrg echo 1>&2 "\ 162209ff23fSmrgWARNING: \`$1' is $msg. You should only need it if 163209ff23fSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 164209ff23fSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 165209ff23fSmrg from any GNU archive site." 166209ff23fSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 167209ff23fSmrg test -z "$files" && files="config.h" 168209ff23fSmrg touch_files= 169209ff23fSmrg for f in $files; do 170209ff23fSmrg case $f in 171209ff23fSmrg *:*) touch_files="$touch_files "`echo "$f" | 172209ff23fSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 173209ff23fSmrg *) touch_files="$touch_files $f.in";; 174209ff23fSmrg esac 175209ff23fSmrg done 176209ff23fSmrg touch $touch_files 177209ff23fSmrg ;; 178209ff23fSmrg 179209ff23fSmrg automake*) 180209ff23fSmrg echo 1>&2 "\ 181209ff23fSmrgWARNING: \`$1' is $msg. You should only need it if 182209ff23fSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 183209ff23fSmrg You might want to install the \`Automake' and \`Perl' packages. 184209ff23fSmrg Grab them from any GNU archive site." 185209ff23fSmrg find . -type f -name Makefile.am -print | 186209ff23fSmrg sed 's/\.am$/.in/' | 187209ff23fSmrg while read f; do touch "$f"; done 188209ff23fSmrg ;; 189209ff23fSmrg 190209ff23fSmrg autom4te) 191209ff23fSmrg echo 1>&2 "\ 192209ff23fSmrgWARNING: \`$1' is needed, but is $msg. 193209ff23fSmrg You might have modified some files without having the 194209ff23fSmrg proper tools for further handling them. 195209ff23fSmrg You can get \`$1' as part of \`Autoconf' from any GNU 196209ff23fSmrg archive site." 197209ff23fSmrg 198209ff23fSmrg file=`echo "$*" | sed -n "$sed_output"` 199209ff23fSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 200209ff23fSmrg if test -f "$file"; then 201209ff23fSmrg touch $file 202209ff23fSmrg else 203209ff23fSmrg test -z "$file" || exec >$file 204209ff23fSmrg echo "#! /bin/sh" 205209ff23fSmrg echo "# Created by GNU Automake missing as a replacement of" 206209ff23fSmrg echo "# $ $@" 207209ff23fSmrg echo "exit 0" 208209ff23fSmrg chmod +x $file 209209ff23fSmrg exit 1 210209ff23fSmrg fi 211209ff23fSmrg ;; 212209ff23fSmrg 213209ff23fSmrg bison|yacc) 214209ff23fSmrg echo 1>&2 "\ 215209ff23fSmrgWARNING: \`$1' $msg. You should only need it if 216209ff23fSmrg you modified a \`.y' file. You may need the \`Bison' package 217209ff23fSmrg in order for those modifications to take effect. You can get 218209ff23fSmrg \`Bison' from any GNU archive site." 219209ff23fSmrg rm -f y.tab.c y.tab.h 220209ff23fSmrg if test $# -ne 1; then 221209ff23fSmrg eval LASTARG="\${$#}" 222209ff23fSmrg case $LASTARG in 223209ff23fSmrg *.y) 224209ff23fSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 225209ff23fSmrg if test -f "$SRCFILE"; then 226209ff23fSmrg cp "$SRCFILE" y.tab.c 227209ff23fSmrg fi 228209ff23fSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 229209ff23fSmrg if test -f "$SRCFILE"; then 230209ff23fSmrg cp "$SRCFILE" y.tab.h 231209ff23fSmrg fi 232209ff23fSmrg ;; 233209ff23fSmrg esac 234209ff23fSmrg fi 235209ff23fSmrg if test ! -f y.tab.h; then 236209ff23fSmrg echo >y.tab.h 237209ff23fSmrg fi 238209ff23fSmrg if test ! -f y.tab.c; then 239209ff23fSmrg echo 'main() { return 0; }' >y.tab.c 240209ff23fSmrg fi 241209ff23fSmrg ;; 242209ff23fSmrg 243209ff23fSmrg lex|flex) 244209ff23fSmrg echo 1>&2 "\ 245209ff23fSmrgWARNING: \`$1' is $msg. You should only need it if 246209ff23fSmrg you modified a \`.l' file. You may need the \`Flex' package 247209ff23fSmrg in order for those modifications to take effect. You can get 248209ff23fSmrg \`Flex' from any GNU archive site." 249209ff23fSmrg rm -f lex.yy.c 250209ff23fSmrg if test $# -ne 1; then 251209ff23fSmrg eval LASTARG="\${$#}" 252209ff23fSmrg case $LASTARG in 253209ff23fSmrg *.l) 254209ff23fSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 255209ff23fSmrg if test -f "$SRCFILE"; then 256209ff23fSmrg cp "$SRCFILE" lex.yy.c 257209ff23fSmrg fi 258209ff23fSmrg ;; 259209ff23fSmrg esac 260209ff23fSmrg fi 261209ff23fSmrg if test ! -f lex.yy.c; then 262209ff23fSmrg echo 'main() { return 0; }' >lex.yy.c 263209ff23fSmrg fi 264209ff23fSmrg ;; 265209ff23fSmrg 266209ff23fSmrg help2man) 267209ff23fSmrg echo 1>&2 "\ 268209ff23fSmrgWARNING: \`$1' is $msg. You should only need it if 269209ff23fSmrg you modified a dependency of a manual page. You may need the 270209ff23fSmrg \`Help2man' package in order for those modifications to take 271209ff23fSmrg effect. You can get \`Help2man' from any GNU archive site." 272209ff23fSmrg 273209ff23fSmrg file=`echo "$*" | sed -n "$sed_output"` 274209ff23fSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 275209ff23fSmrg if test -f "$file"; then 276209ff23fSmrg touch $file 277209ff23fSmrg else 278209ff23fSmrg test -z "$file" || exec >$file 279209ff23fSmrg echo ".ab help2man is required to generate this page" 280209ff23fSmrg exit 1 281209ff23fSmrg fi 282209ff23fSmrg ;; 283209ff23fSmrg 284209ff23fSmrg makeinfo) 285209ff23fSmrg echo 1>&2 "\ 286209ff23fSmrgWARNING: \`$1' is $msg. You should only need it if 287209ff23fSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 288209ff23fSmrg indirectly affecting the aspect of the manual. The spurious 289209ff23fSmrg call might also be the consequence of using a buggy \`make' (AIX, 290209ff23fSmrg DU, IRIX). You might want to install the \`Texinfo' package or 291209ff23fSmrg the \`GNU make' package. Grab either from any GNU archive site." 292209ff23fSmrg # The file to touch is that specified with -o ... 293209ff23fSmrg file=`echo "$*" | sed -n "$sed_output"` 294209ff23fSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 295209ff23fSmrg if test -z "$file"; then 296209ff23fSmrg # ... or it is the one specified with @setfilename ... 297209ff23fSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 298209ff23fSmrg file=`sed -n ' 299209ff23fSmrg /^@setfilename/{ 300209ff23fSmrg s/.* \([^ ]*\) *$/\1/ 301209ff23fSmrg p 302209ff23fSmrg q 303209ff23fSmrg }' $infile` 304209ff23fSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 305209ff23fSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 306209ff23fSmrg fi 307209ff23fSmrg # If the file does not exist, the user really needs makeinfo; 308209ff23fSmrg # let's fail without touching anything. 309209ff23fSmrg test -f $file || exit 1 310209ff23fSmrg touch $file 311209ff23fSmrg ;; 312209ff23fSmrg 313209ff23fSmrg tar) 314209ff23fSmrg shift 315209ff23fSmrg 316209ff23fSmrg # We have already tried tar in the generic part. 317209ff23fSmrg # Look for gnutar/gtar before invocation to avoid ugly error 318209ff23fSmrg # messages. 319209ff23fSmrg if (gnutar --version > /dev/null 2>&1); then 320209ff23fSmrg gnutar "$@" && exit 0 321209ff23fSmrg fi 322209ff23fSmrg if (gtar --version > /dev/null 2>&1); then 323209ff23fSmrg gtar "$@" && exit 0 324209ff23fSmrg fi 325209ff23fSmrg firstarg="$1" 326209ff23fSmrg if shift; then 327209ff23fSmrg case $firstarg in 328209ff23fSmrg *o*) 329209ff23fSmrg firstarg=`echo "$firstarg" | sed s/o//` 330209ff23fSmrg tar "$firstarg" "$@" && exit 0 331209ff23fSmrg ;; 332209ff23fSmrg esac 333209ff23fSmrg case $firstarg in 334209ff23fSmrg *h*) 335209ff23fSmrg firstarg=`echo "$firstarg" | sed s/h//` 336209ff23fSmrg tar "$firstarg" "$@" && exit 0 337209ff23fSmrg ;; 338209ff23fSmrg esac 339209ff23fSmrg fi 340209ff23fSmrg 341209ff23fSmrg echo 1>&2 "\ 342209ff23fSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 343209ff23fSmrg You may want to install GNU tar or Free paxutils, or check the 344209ff23fSmrg command line arguments." 345209ff23fSmrg exit 1 346209ff23fSmrg ;; 347209ff23fSmrg 348209ff23fSmrg *) 349209ff23fSmrg echo 1>&2 "\ 350209ff23fSmrgWARNING: \`$1' is needed, and is $msg. 351209ff23fSmrg You might have modified some files without having the 352209ff23fSmrg proper tools for further handling them. Check the \`README' file, 353209ff23fSmrg it often tells you about the needed prerequisites for installing 354209ff23fSmrg this package. You may also peek at any GNU archive site, in case 355209ff23fSmrg some other package would contain this missing \`$1' program." 356209ff23fSmrg exit 1 357209ff23fSmrg ;; 358209ff23fSmrgesac 359209ff23fSmrg 360209ff23fSmrgexit 0 361209ff23fSmrg 362209ff23fSmrg# Local variables: 363209ff23fSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 364209ff23fSmrg# time-stamp-start: "scriptversion=" 365209ff23fSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 366209ff23fSmrg# time-stamp-end: "$" 367209ff23fSmrg# End: 368