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