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