missing revision 9ef7378b
1c19de146Smrg#! /bin/sh 2c19de146Smrg# Common stub for a few missing GNU programs while installing. 39ef7378bSmrg 49ef7378bSmrgscriptversion=2009-04-28.21; # UTC 59ef7378bSmrg 69ef7378bSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 79ef7378bSmrg# 2008, 2009 Free Software Foundation, Inc. 8c19de146Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9c19de146Smrg 10c19de146Smrg# This program is free software; you can redistribute it and/or modify 11c19de146Smrg# it under the terms of the GNU General Public License as published by 12c19de146Smrg# the Free Software Foundation; either version 2, or (at your option) 13c19de146Smrg# any later version. 14c19de146Smrg 15c19de146Smrg# This program is distributed in the hope that it will be useful, 16c19de146Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17c19de146Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18c19de146Smrg# GNU General Public License for more details. 19c19de146Smrg 20c19de146Smrg# You should have received a copy of the GNU General Public License 219ef7378bSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22c19de146Smrg 23c19de146Smrg# As a special exception to the GNU General Public License, if you 24c19de146Smrg# distribute this file as part of a program that contains a 25c19de146Smrg# configuration script generated by Autoconf, you may include it under 26c19de146Smrg# the same distribution terms that you use for the rest of that program. 27c19de146Smrg 28c19de146Smrgif test $# -eq 0; then 29c19de146Smrg echo 1>&2 "Try \`$0 --help' for more information" 30c19de146Smrg exit 1 31c19de146Smrgfi 32c19de146Smrg 33c19de146Smrgrun=: 349ef7378bSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 359ef7378bSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36c19de146Smrg 37c19de146Smrg# In the cases where this matters, `missing' is being run in the 38c19de146Smrg# srcdir already. 39c19de146Smrgif test -f configure.ac; then 40c19de146Smrg configure_ac=configure.ac 41c19de146Smrgelse 42c19de146Smrg configure_ac=configure.in 43c19de146Smrgfi 44c19de146Smrg 459ef7378bSmrgmsg="missing on your system" 469ef7378bSmrg 479ef7378bSmrgcase $1 in 48c19de146Smrg--run) 49c19de146Smrg # Try to run requested program, and just exit if it succeeds. 50c19de146Smrg run= 51c19de146Smrg shift 52c19de146Smrg "$@" && exit 0 539ef7378bSmrg # Exit code 63 means version mismatch. This often happens 549ef7378bSmrg # when the user try to use an ancient version of a tool on 559ef7378bSmrg # a file that requires a minimum version. In this case we 569ef7378bSmrg # we should proceed has if the program had been absent, or 579ef7378bSmrg # if --run hadn't been passed. 589ef7378bSmrg if test $? = 63; then 599ef7378bSmrg run=: 609ef7378bSmrg msg="probably too old" 619ef7378bSmrg fi 62c19de146Smrg ;; 63c19de146Smrg 64c19de146Smrg -h|--h|--he|--hel|--help) 65c19de146Smrg echo "\ 66c19de146Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67c19de146Smrg 68c19de146SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69c19de146Smrgerror status if there is no known handling for PROGRAM. 70c19de146Smrg 71c19de146SmrgOptions: 72c19de146Smrg -h, --help display this help and exit 73c19de146Smrg -v, --version output version information and exit 74c19de146Smrg --run try to run the given command, and emulate it if it fails 75c19de146Smrg 76c19de146SmrgSupported PROGRAM values: 77c19de146Smrg aclocal touch file \`aclocal.m4' 78c19de146Smrg autoconf touch file \`configure' 79c19de146Smrg autoheader touch file \`config.h.in' 809ef7378bSmrg autom4te touch the output file, or create a stub one 81c19de146Smrg automake touch all \`Makefile.in' files 82c19de146Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83c19de146Smrg flex create \`lex.yy.c', if possible, from existing .c 84c19de146Smrg help2man touch the output file 85c19de146Smrg lex create \`lex.yy.c', if possible, from existing .c 86c19de146Smrg makeinfo touch the output file 87c19de146Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 889ef7378bSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 899ef7378bSmrg 909ef7378bSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 919ef7378bSmrg\`g' are ignored when checking the name. 929ef7378bSmrg 939ef7378bSmrgSend bug reports to <bug-automake@gnu.org>." 949ef7378bSmrg exit $? 95c19de146Smrg ;; 96c19de146Smrg 97c19de146Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 989ef7378bSmrg echo "missing $scriptversion (GNU Automake)" 999ef7378bSmrg exit $? 100c19de146Smrg ;; 101c19de146Smrg 102c19de146Smrg -*) 103c19de146Smrg echo 1>&2 "$0: Unknown \`$1' option" 104c19de146Smrg echo 1>&2 "Try \`$0 --help' for more information" 105c19de146Smrg exit 1 106c19de146Smrg ;; 107c19de146Smrg 1089ef7378bSmrgesac 1099ef7378bSmrg 1109ef7378bSmrg# normalize program name to check for. 1119ef7378bSmrgprogram=`echo "$1" | sed ' 1129ef7378bSmrg s/^gnu-//; t 1139ef7378bSmrg s/^gnu//; t 1149ef7378bSmrg s/^g//; t'` 1159ef7378bSmrg 1169ef7378bSmrg# Now exit if we have it, but it failed. Also exit now if we 1179ef7378bSmrg# don't have it and --version was passed (most likely to detect 1189ef7378bSmrg# the program). This is about non-GNU programs, so use $1 not 1199ef7378bSmrg# $program. 1209ef7378bSmrgcase $1 in 1219ef7378bSmrg lex*|yacc*) 1229ef7378bSmrg # Not GNU programs, they don't have --version. 1239ef7378bSmrg ;; 1249ef7378bSmrg 1259ef7378bSmrg tar*) 1269ef7378bSmrg if test -n "$run"; then 1279ef7378bSmrg echo 1>&2 "ERROR: \`tar' requires --run" 1289ef7378bSmrg exit 1 1299ef7378bSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1309ef7378bSmrg exit 1 1319ef7378bSmrg fi 1329ef7378bSmrg ;; 1339ef7378bSmrg 1349ef7378bSmrg *) 135c19de146Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136c19de146Smrg # We have it, but it failed. 137c19de146Smrg exit 1 1389ef7378bSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1399ef7378bSmrg # Could not run --version or --help. This is probably someone 1409ef7378bSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 1419ef7378bSmrg # $TOOL exists and not knowing $TOOL uses missing. 1429ef7378bSmrg exit 1 143c19de146Smrg fi 1449ef7378bSmrg ;; 1459ef7378bSmrgesac 146c19de146Smrg 1479ef7378bSmrg# If it does not exist, or fails to run (possibly an outdated version), 1489ef7378bSmrg# try to emulate it. 1499ef7378bSmrgcase $program in 1509ef7378bSmrg aclocal*) 151c19de146Smrg echo 1>&2 "\ 1529ef7378bSmrgWARNING: \`$1' is $msg. You should only need it if 153c19de146Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154c19de146Smrg to install the \`Automake' and \`Perl' packages. Grab them from 155c19de146Smrg any GNU archive site." 156c19de146Smrg touch aclocal.m4 157c19de146Smrg ;; 158c19de146Smrg 1599ef7378bSmrg autoconf*) 160c19de146Smrg echo 1>&2 "\ 1619ef7378bSmrgWARNING: \`$1' is $msg. You should only need it if 162c19de146Smrg you modified \`${configure_ac}'. You might want to install the 163c19de146Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164c19de146Smrg archive site." 165c19de146Smrg touch configure 166c19de146Smrg ;; 167c19de146Smrg 1689ef7378bSmrg autoheader*) 169c19de146Smrg echo 1>&2 "\ 1709ef7378bSmrgWARNING: \`$1' is $msg. You should only need it if 171c19de146Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172c19de146Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173c19de146Smrg from any GNU archive site." 174c19de146Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175c19de146Smrg test -z "$files" && files="config.h" 176c19de146Smrg touch_files= 177c19de146Smrg for f in $files; do 1789ef7378bSmrg case $f in 179c19de146Smrg *:*) touch_files="$touch_files "`echo "$f" | 180c19de146Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181c19de146Smrg *) touch_files="$touch_files $f.in";; 182c19de146Smrg esac 183c19de146Smrg done 184c19de146Smrg touch $touch_files 185c19de146Smrg ;; 186c19de146Smrg 187c19de146Smrg automake*) 188c19de146Smrg echo 1>&2 "\ 1899ef7378bSmrgWARNING: \`$1' is $msg. You should only need it if 190c19de146Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191c19de146Smrg You might want to install the \`Automake' and \`Perl' packages. 192c19de146Smrg Grab them from any GNU archive site." 193c19de146Smrg find . -type f -name Makefile.am -print | 194c19de146Smrg sed 's/\.am$/.in/' | 195c19de146Smrg while read f; do touch "$f"; done 196c19de146Smrg ;; 197c19de146Smrg 1989ef7378bSmrg autom4te*) 199c19de146Smrg echo 1>&2 "\ 2009ef7378bSmrgWARNING: \`$1' is needed, but is $msg. 2019ef7378bSmrg You might have modified some files without having the 202c19de146Smrg proper tools for further handling them. 203c19de146Smrg You can get \`$1' as part of \`Autoconf' from any GNU 204c19de146Smrg archive site." 205c19de146Smrg 2069ef7378bSmrg file=`echo "$*" | sed -n "$sed_output"` 2079ef7378bSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208c19de146Smrg if test -f "$file"; then 209c19de146Smrg touch $file 210c19de146Smrg else 211c19de146Smrg test -z "$file" || exec >$file 212c19de146Smrg echo "#! /bin/sh" 213c19de146Smrg echo "# Created by GNU Automake missing as a replacement of" 214c19de146Smrg echo "# $ $@" 215c19de146Smrg echo "exit 0" 216c19de146Smrg chmod +x $file 217c19de146Smrg exit 1 218c19de146Smrg fi 219c19de146Smrg ;; 220c19de146Smrg 2219ef7378bSmrg bison*|yacc*) 222c19de146Smrg echo 1>&2 "\ 2239ef7378bSmrgWARNING: \`$1' $msg. You should only need it if 224c19de146Smrg you modified a \`.y' file. You may need the \`Bison' package 225c19de146Smrg in order for those modifications to take effect. You can get 226c19de146Smrg \`Bison' from any GNU archive site." 227c19de146Smrg rm -f y.tab.c y.tab.h 2289ef7378bSmrg if test $# -ne 1; then 229c19de146Smrg eval LASTARG="\${$#}" 2309ef7378bSmrg case $LASTARG in 231c19de146Smrg *.y) 232c19de146Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2339ef7378bSmrg if test -f "$SRCFILE"; then 234c19de146Smrg cp "$SRCFILE" y.tab.c 235c19de146Smrg fi 236c19de146Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2379ef7378bSmrg if test -f "$SRCFILE"; then 238c19de146Smrg cp "$SRCFILE" y.tab.h 239c19de146Smrg fi 240c19de146Smrg ;; 241c19de146Smrg esac 242c19de146Smrg fi 2439ef7378bSmrg if test ! -f y.tab.h; then 244c19de146Smrg echo >y.tab.h 245c19de146Smrg fi 2469ef7378bSmrg if test ! -f y.tab.c; then 247c19de146Smrg echo 'main() { return 0; }' >y.tab.c 248c19de146Smrg fi 249c19de146Smrg ;; 250c19de146Smrg 2519ef7378bSmrg lex*|flex*) 252c19de146Smrg echo 1>&2 "\ 2539ef7378bSmrgWARNING: \`$1' is $msg. You should only need it if 254c19de146Smrg you modified a \`.l' file. You may need the \`Flex' package 255c19de146Smrg in order for those modifications to take effect. You can get 256c19de146Smrg \`Flex' from any GNU archive site." 257c19de146Smrg rm -f lex.yy.c 2589ef7378bSmrg if test $# -ne 1; then 259c19de146Smrg eval LASTARG="\${$#}" 2609ef7378bSmrg case $LASTARG in 261c19de146Smrg *.l) 262c19de146Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2639ef7378bSmrg if test -f "$SRCFILE"; then 264c19de146Smrg cp "$SRCFILE" lex.yy.c 265c19de146Smrg fi 266c19de146Smrg ;; 267c19de146Smrg esac 268c19de146Smrg fi 2699ef7378bSmrg if test ! -f lex.yy.c; then 270c19de146Smrg echo 'main() { return 0; }' >lex.yy.c 271c19de146Smrg fi 272c19de146Smrg ;; 273c19de146Smrg 2749ef7378bSmrg help2man*) 275c19de146Smrg echo 1>&2 "\ 2769ef7378bSmrgWARNING: \`$1' is $msg. You should only need it if 277c19de146Smrg you modified a dependency of a manual page. You may need the 278c19de146Smrg \`Help2man' package in order for those modifications to take 279c19de146Smrg effect. You can get \`Help2man' from any GNU archive site." 280c19de146Smrg 2819ef7378bSmrg file=`echo "$*" | sed -n "$sed_output"` 2829ef7378bSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2839ef7378bSmrg if test -f "$file"; then 284c19de146Smrg touch $file 285c19de146Smrg else 286c19de146Smrg test -z "$file" || exec >$file 287c19de146Smrg echo ".ab help2man is required to generate this page" 2889ef7378bSmrg exit $? 289c19de146Smrg fi 290c19de146Smrg ;; 291c19de146Smrg 2929ef7378bSmrg makeinfo*) 293c19de146Smrg echo 1>&2 "\ 2949ef7378bSmrgWARNING: \`$1' is $msg. You should only need it if 295c19de146Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 296c19de146Smrg indirectly affecting the aspect of the manual. The spurious 297c19de146Smrg call might also be the consequence of using a buggy \`make' (AIX, 298c19de146Smrg DU, IRIX). You might want to install the \`Texinfo' package or 299c19de146Smrg the \`GNU make' package. Grab either from any GNU archive site." 3009ef7378bSmrg # The file to touch is that specified with -o ... 3019ef7378bSmrg file=`echo "$*" | sed -n "$sed_output"` 3029ef7378bSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303c19de146Smrg if test -z "$file"; then 3049ef7378bSmrg # ... or it is the one specified with @setfilename ... 3059ef7378bSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 3069ef7378bSmrg file=`sed -n ' 3079ef7378bSmrg /^@setfilename/{ 3089ef7378bSmrg s/.* \([^ ]*\) *$/\1/ 3099ef7378bSmrg p 3109ef7378bSmrg q 3119ef7378bSmrg }' $infile` 3129ef7378bSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3139ef7378bSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314c19de146Smrg fi 3159ef7378bSmrg # If the file does not exist, the user really needs makeinfo; 3169ef7378bSmrg # let's fail without touching anything. 3179ef7378bSmrg test -f $file || exit 1 318c19de146Smrg touch $file 319c19de146Smrg ;; 320c19de146Smrg 3219ef7378bSmrg tar*) 322c19de146Smrg shift 323c19de146Smrg 324c19de146Smrg # We have already tried tar in the generic part. 325c19de146Smrg # Look for gnutar/gtar before invocation to avoid ugly error 326c19de146Smrg # messages. 327c19de146Smrg if (gnutar --version > /dev/null 2>&1); then 328c19de146Smrg gnutar "$@" && exit 0 329c19de146Smrg fi 330c19de146Smrg if (gtar --version > /dev/null 2>&1); then 331c19de146Smrg gtar "$@" && exit 0 332c19de146Smrg fi 333c19de146Smrg firstarg="$1" 334c19de146Smrg if shift; then 3359ef7378bSmrg case $firstarg in 336c19de146Smrg *o*) 337c19de146Smrg firstarg=`echo "$firstarg" | sed s/o//` 338c19de146Smrg tar "$firstarg" "$@" && exit 0 339c19de146Smrg ;; 340c19de146Smrg esac 3419ef7378bSmrg case $firstarg in 342c19de146Smrg *h*) 343c19de146Smrg firstarg=`echo "$firstarg" | sed s/h//` 344c19de146Smrg tar "$firstarg" "$@" && exit 0 345c19de146Smrg ;; 346c19de146Smrg esac 347c19de146Smrg fi 348c19de146Smrg 349c19de146Smrg echo 1>&2 "\ 350c19de146SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351c19de146Smrg You may want to install GNU tar or Free paxutils, or check the 352c19de146Smrg command line arguments." 353c19de146Smrg exit 1 354c19de146Smrg ;; 355c19de146Smrg 356c19de146Smrg *) 357c19de146Smrg echo 1>&2 "\ 3589ef7378bSmrgWARNING: \`$1' is needed, and is $msg. 3599ef7378bSmrg You might have modified some files without having the 360c19de146Smrg proper tools for further handling them. Check the \`README' file, 361c19de146Smrg it often tells you about the needed prerequisites for installing 362c19de146Smrg this package. You may also peek at any GNU archive site, in case 363c19de146Smrg some other package would contain this missing \`$1' program." 364c19de146Smrg exit 1 365c19de146Smrg ;; 366c19de146Smrgesac 367c19de146Smrg 368c19de146Smrgexit 0 3699ef7378bSmrg 3709ef7378bSmrg# Local variables: 3719ef7378bSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3729ef7378bSmrg# time-stamp-start: "scriptversion=" 3739ef7378bSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3749ef7378bSmrg# time-stamp-time-zone: "UTC" 3759ef7378bSmrg# time-stamp-end: "; # UTC" 3769ef7378bSmrg# End: 377