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