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