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