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