missing revision d4401354
1d4401354Smrg#! /bin/sh 2d4401354Smrg# Common stub for a few missing GNU programs while installing. 3d4401354Smrg 4d4401354Smrgscriptversion=2009-04-28.21; # UTC 5d4401354Smrg 6d4401354Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7d4401354Smrg# 2008, 2009 Free Software Foundation, Inc. 8d4401354Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9d4401354Smrg 10d4401354Smrg# This program is free software; you can redistribute it and/or modify 11d4401354Smrg# it under the terms of the GNU General Public License as published by 12d4401354Smrg# the Free Software Foundation; either version 2, or (at your option) 13d4401354Smrg# any later version. 14d4401354Smrg 15d4401354Smrg# This program is distributed in the hope that it will be useful, 16d4401354Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17d4401354Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18d4401354Smrg# GNU General Public License for more details. 19d4401354Smrg 20d4401354Smrg# You should have received a copy of the GNU General Public License 21d4401354Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22d4401354Smrg 23d4401354Smrg# As a special exception to the GNU General Public License, if you 24d4401354Smrg# distribute this file as part of a program that contains a 25d4401354Smrg# configuration script generated by Autoconf, you may include it under 26d4401354Smrg# the same distribution terms that you use for the rest of that program. 27d4401354Smrg 28d4401354Smrgif test $# -eq 0; then 29d4401354Smrg echo 1>&2 "Try \`$0 --help' for more information" 30d4401354Smrg exit 1 31d4401354Smrgfi 32d4401354Smrg 33d4401354Smrgrun=: 34d4401354Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35d4401354Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36d4401354Smrg 37d4401354Smrg# In the cases where this matters, `missing' is being run in the 38d4401354Smrg# srcdir already. 39d4401354Smrgif test -f configure.ac; then 40d4401354Smrg configure_ac=configure.ac 41d4401354Smrgelse 42d4401354Smrg configure_ac=configure.in 43d4401354Smrgfi 44d4401354Smrg 45d4401354Smrgmsg="missing on your system" 46d4401354Smrg 47d4401354Smrgcase $1 in 48d4401354Smrg--run) 49d4401354Smrg # Try to run requested program, and just exit if it succeeds. 50d4401354Smrg run= 51d4401354Smrg shift 52d4401354Smrg "$@" && exit 0 53d4401354Smrg # Exit code 63 means version mismatch. This often happens 54d4401354Smrg # when the user try to use an ancient version of a tool on 55d4401354Smrg # a file that requires a minimum version. In this case we 56d4401354Smrg # we should proceed has if the program had been absent, or 57d4401354Smrg # if --run hadn't been passed. 58d4401354Smrg if test $? = 63; then 59d4401354Smrg run=: 60d4401354Smrg msg="probably too old" 61d4401354Smrg fi 62d4401354Smrg ;; 63d4401354Smrg 64d4401354Smrg -h|--h|--he|--hel|--help) 65d4401354Smrg echo "\ 66d4401354Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67d4401354Smrg 68d4401354SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69d4401354Smrgerror status if there is no known handling for PROGRAM. 70d4401354Smrg 71d4401354SmrgOptions: 72d4401354Smrg -h, --help display this help and exit 73d4401354Smrg -v, --version output version information and exit 74d4401354Smrg --run try to run the given command, and emulate it if it fails 75d4401354Smrg 76d4401354SmrgSupported PROGRAM values: 77d4401354Smrg aclocal touch file \`aclocal.m4' 78d4401354Smrg autoconf touch file \`configure' 79d4401354Smrg autoheader touch file \`config.h.in' 80d4401354Smrg autom4te touch the output file, or create a stub one 81d4401354Smrg automake touch all \`Makefile.in' files 82d4401354Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83d4401354Smrg flex create \`lex.yy.c', if possible, from existing .c 84d4401354Smrg help2man touch the output file 85d4401354Smrg lex create \`lex.yy.c', if possible, from existing .c 86d4401354Smrg makeinfo touch the output file 87d4401354Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 88d4401354Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89d4401354Smrg 90d4401354SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91d4401354Smrg\`g' are ignored when checking the name. 92d4401354Smrg 93d4401354SmrgSend bug reports to <bug-automake@gnu.org>." 94d4401354Smrg exit $? 95d4401354Smrg ;; 96d4401354Smrg 97d4401354Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98d4401354Smrg echo "missing $scriptversion (GNU Automake)" 99d4401354Smrg exit $? 100d4401354Smrg ;; 101d4401354Smrg 102d4401354Smrg -*) 103d4401354Smrg echo 1>&2 "$0: Unknown \`$1' option" 104d4401354Smrg echo 1>&2 "Try \`$0 --help' for more information" 105d4401354Smrg exit 1 106d4401354Smrg ;; 107d4401354Smrg 108d4401354Smrgesac 109d4401354Smrg 110d4401354Smrg# normalize program name to check for. 111d4401354Smrgprogram=`echo "$1" | sed ' 112d4401354Smrg s/^gnu-//; t 113d4401354Smrg s/^gnu//; t 114d4401354Smrg s/^g//; t'` 115d4401354Smrg 116d4401354Smrg# Now exit if we have it, but it failed. Also exit now if we 117d4401354Smrg# don't have it and --version was passed (most likely to detect 118d4401354Smrg# the program). This is about non-GNU programs, so use $1 not 119d4401354Smrg# $program. 120d4401354Smrgcase $1 in 121d4401354Smrg lex*|yacc*) 122d4401354Smrg # Not GNU programs, they don't have --version. 123d4401354Smrg ;; 124d4401354Smrg 125d4401354Smrg tar*) 126d4401354Smrg if test -n "$run"; then 127d4401354Smrg echo 1>&2 "ERROR: \`tar' requires --run" 128d4401354Smrg exit 1 129d4401354Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130d4401354Smrg exit 1 131d4401354Smrg fi 132d4401354Smrg ;; 133d4401354Smrg 134d4401354Smrg *) 135d4401354Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136d4401354Smrg # We have it, but it failed. 137d4401354Smrg exit 1 138d4401354Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139d4401354Smrg # Could not run --version or --help. This is probably someone 140d4401354Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 141d4401354Smrg # $TOOL exists and not knowing $TOOL uses missing. 142d4401354Smrg exit 1 143d4401354Smrg fi 144d4401354Smrg ;; 145d4401354Smrgesac 146d4401354Smrg 147d4401354Smrg# If it does not exist, or fails to run (possibly an outdated version), 148d4401354Smrg# try to emulate it. 149d4401354Smrgcase $program in 150d4401354Smrg aclocal*) 151d4401354Smrg echo 1>&2 "\ 152d4401354SmrgWARNING: \`$1' is $msg. You should only need it if 153d4401354Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154d4401354Smrg to install the \`Automake' and \`Perl' packages. Grab them from 155d4401354Smrg any GNU archive site." 156d4401354Smrg touch aclocal.m4 157d4401354Smrg ;; 158d4401354Smrg 159d4401354Smrg autoconf*) 160d4401354Smrg echo 1>&2 "\ 161d4401354SmrgWARNING: \`$1' is $msg. You should only need it if 162d4401354Smrg you modified \`${configure_ac}'. You might want to install the 163d4401354Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164d4401354Smrg archive site." 165d4401354Smrg touch configure 166d4401354Smrg ;; 167d4401354Smrg 168d4401354Smrg autoheader*) 169d4401354Smrg echo 1>&2 "\ 170d4401354SmrgWARNING: \`$1' is $msg. You should only need it if 171d4401354Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172d4401354Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173d4401354Smrg from any GNU archive site." 174d4401354Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175d4401354Smrg test -z "$files" && files="config.h" 176d4401354Smrg touch_files= 177d4401354Smrg for f in $files; do 178d4401354Smrg case $f in 179d4401354Smrg *:*) touch_files="$touch_files "`echo "$f" | 180d4401354Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181d4401354Smrg *) touch_files="$touch_files $f.in";; 182d4401354Smrg esac 183d4401354Smrg done 184d4401354Smrg touch $touch_files 185d4401354Smrg ;; 186d4401354Smrg 187d4401354Smrg automake*) 188d4401354Smrg echo 1>&2 "\ 189d4401354SmrgWARNING: \`$1' is $msg. You should only need it if 190d4401354Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191d4401354Smrg You might want to install the \`Automake' and \`Perl' packages. 192d4401354Smrg Grab them from any GNU archive site." 193d4401354Smrg find . -type f -name Makefile.am -print | 194d4401354Smrg sed 's/\.am$/.in/' | 195d4401354Smrg while read f; do touch "$f"; done 196d4401354Smrg ;; 197d4401354Smrg 198d4401354Smrg autom4te*) 199d4401354Smrg echo 1>&2 "\ 200d4401354SmrgWARNING: \`$1' is needed, but is $msg. 201d4401354Smrg You might have modified some files without having the 202d4401354Smrg proper tools for further handling them. 203d4401354Smrg You can get \`$1' as part of \`Autoconf' from any GNU 204d4401354Smrg archive site." 205d4401354Smrg 206d4401354Smrg file=`echo "$*" | sed -n "$sed_output"` 207d4401354Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208d4401354Smrg if test -f "$file"; then 209d4401354Smrg touch $file 210d4401354Smrg else 211d4401354Smrg test -z "$file" || exec >$file 212d4401354Smrg echo "#! /bin/sh" 213d4401354Smrg echo "# Created by GNU Automake missing as a replacement of" 214d4401354Smrg echo "# $ $@" 215d4401354Smrg echo "exit 0" 216d4401354Smrg chmod +x $file 217d4401354Smrg exit 1 218d4401354Smrg fi 219d4401354Smrg ;; 220d4401354Smrg 221d4401354Smrg bison*|yacc*) 222d4401354Smrg echo 1>&2 "\ 223d4401354SmrgWARNING: \`$1' $msg. You should only need it if 224d4401354Smrg you modified a \`.y' file. You may need the \`Bison' package 225d4401354Smrg in order for those modifications to take effect. You can get 226d4401354Smrg \`Bison' from any GNU archive site." 227d4401354Smrg rm -f y.tab.c y.tab.h 228d4401354Smrg if test $# -ne 1; then 229d4401354Smrg eval LASTARG="\${$#}" 230d4401354Smrg case $LASTARG in 231d4401354Smrg *.y) 232d4401354Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233d4401354Smrg if test -f "$SRCFILE"; then 234d4401354Smrg cp "$SRCFILE" y.tab.c 235d4401354Smrg fi 236d4401354Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237d4401354Smrg if test -f "$SRCFILE"; then 238d4401354Smrg cp "$SRCFILE" y.tab.h 239d4401354Smrg fi 240d4401354Smrg ;; 241d4401354Smrg esac 242d4401354Smrg fi 243d4401354Smrg if test ! -f y.tab.h; then 244d4401354Smrg echo >y.tab.h 245d4401354Smrg fi 246d4401354Smrg if test ! -f y.tab.c; then 247d4401354Smrg echo 'main() { return 0; }' >y.tab.c 248d4401354Smrg fi 249d4401354Smrg ;; 250d4401354Smrg 251d4401354Smrg lex*|flex*) 252d4401354Smrg echo 1>&2 "\ 253d4401354SmrgWARNING: \`$1' is $msg. You should only need it if 254d4401354Smrg you modified a \`.l' file. You may need the \`Flex' package 255d4401354Smrg in order for those modifications to take effect. You can get 256d4401354Smrg \`Flex' from any GNU archive site." 257d4401354Smrg rm -f lex.yy.c 258d4401354Smrg if test $# -ne 1; then 259d4401354Smrg eval LASTARG="\${$#}" 260d4401354Smrg case $LASTARG in 261d4401354Smrg *.l) 262d4401354Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263d4401354Smrg if test -f "$SRCFILE"; then 264d4401354Smrg cp "$SRCFILE" lex.yy.c 265d4401354Smrg fi 266d4401354Smrg ;; 267d4401354Smrg esac 268d4401354Smrg fi 269d4401354Smrg if test ! -f lex.yy.c; then 270d4401354Smrg echo 'main() { return 0; }' >lex.yy.c 271d4401354Smrg fi 272d4401354Smrg ;; 273d4401354Smrg 274d4401354Smrg help2man*) 275d4401354Smrg echo 1>&2 "\ 276d4401354SmrgWARNING: \`$1' is $msg. You should only need it if 277d4401354Smrg you modified a dependency of a manual page. You may need the 278d4401354Smrg \`Help2man' package in order for those modifications to take 279d4401354Smrg effect. You can get \`Help2man' from any GNU archive site." 280d4401354Smrg 281d4401354Smrg file=`echo "$*" | sed -n "$sed_output"` 282d4401354Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283d4401354Smrg if test -f "$file"; then 284d4401354Smrg touch $file 285d4401354Smrg else 286d4401354Smrg test -z "$file" || exec >$file 287d4401354Smrg echo ".ab help2man is required to generate this page" 288d4401354Smrg exit $? 289d4401354Smrg fi 290d4401354Smrg ;; 291d4401354Smrg 292d4401354Smrg makeinfo*) 293d4401354Smrg echo 1>&2 "\ 294d4401354SmrgWARNING: \`$1' is $msg. You should only need it if 295d4401354Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 296d4401354Smrg indirectly affecting the aspect of the manual. The spurious 297d4401354Smrg call might also be the consequence of using a buggy \`make' (AIX, 298d4401354Smrg DU, IRIX). You might want to install the \`Texinfo' package or 299d4401354Smrg the \`GNU make' package. Grab either from any GNU archive site." 300d4401354Smrg # The file to touch is that specified with -o ... 301d4401354Smrg file=`echo "$*" | sed -n "$sed_output"` 302d4401354Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303d4401354Smrg if test -z "$file"; then 304d4401354Smrg # ... or it is the one specified with @setfilename ... 305d4401354Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306d4401354Smrg file=`sed -n ' 307d4401354Smrg /^@setfilename/{ 308d4401354Smrg s/.* \([^ ]*\) *$/\1/ 309d4401354Smrg p 310d4401354Smrg q 311d4401354Smrg }' $infile` 312d4401354Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313d4401354Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314d4401354Smrg fi 315d4401354Smrg # If the file does not exist, the user really needs makeinfo; 316d4401354Smrg # let's fail without touching anything. 317d4401354Smrg test -f $file || exit 1 318d4401354Smrg touch $file 319d4401354Smrg ;; 320d4401354Smrg 321d4401354Smrg tar*) 322d4401354Smrg shift 323d4401354Smrg 324d4401354Smrg # We have already tried tar in the generic part. 325d4401354Smrg # Look for gnutar/gtar before invocation to avoid ugly error 326d4401354Smrg # messages. 327d4401354Smrg if (gnutar --version > /dev/null 2>&1); then 328d4401354Smrg gnutar "$@" && exit 0 329d4401354Smrg fi 330d4401354Smrg if (gtar --version > /dev/null 2>&1); then 331d4401354Smrg gtar "$@" && exit 0 332d4401354Smrg fi 333d4401354Smrg firstarg="$1" 334d4401354Smrg if shift; then 335d4401354Smrg case $firstarg in 336d4401354Smrg *o*) 337d4401354Smrg firstarg=`echo "$firstarg" | sed s/o//` 338d4401354Smrg tar "$firstarg" "$@" && exit 0 339d4401354Smrg ;; 340d4401354Smrg esac 341d4401354Smrg case $firstarg in 342d4401354Smrg *h*) 343d4401354Smrg firstarg=`echo "$firstarg" | sed s/h//` 344d4401354Smrg tar "$firstarg" "$@" && exit 0 345d4401354Smrg ;; 346d4401354Smrg esac 347d4401354Smrg fi 348d4401354Smrg 349d4401354Smrg echo 1>&2 "\ 350d4401354SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351d4401354Smrg You may want to install GNU tar or Free paxutils, or check the 352d4401354Smrg command line arguments." 353d4401354Smrg exit 1 354d4401354Smrg ;; 355d4401354Smrg 356d4401354Smrg *) 357d4401354Smrg echo 1>&2 "\ 358d4401354SmrgWARNING: \`$1' is needed, and is $msg. 359d4401354Smrg You might have modified some files without having the 360d4401354Smrg proper tools for further handling them. Check the \`README' file, 361d4401354Smrg it often tells you about the needed prerequisites for installing 362d4401354Smrg this package. You may also peek at any GNU archive site, in case 363d4401354Smrg some other package would contain this missing \`$1' program." 364d4401354Smrg exit 1 365d4401354Smrg ;; 366d4401354Smrgesac 367d4401354Smrg 368d4401354Smrgexit 0 369d4401354Smrg 370d4401354Smrg# Local variables: 371d4401354Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372d4401354Smrg# time-stamp-start: "scriptversion=" 373d4401354Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374d4401354Smrg# time-stamp-time-zone: "UTC" 375d4401354Smrg# time-stamp-end: "; # UTC" 376d4401354Smrg# End: 377