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