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