missing revision 301ea0f4
1301ea0f4Smrg#! /bin/sh 2301ea0f4Smrg# Common stub for a few missing GNU programs while installing. 3301ea0f4Smrg 4301ea0f4Smrgscriptversion=2005-06-08.21 5301ea0f4Smrg 6301ea0f4Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 7301ea0f4Smrg# Free Software Foundation, Inc. 8301ea0f4Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9301ea0f4Smrg 10301ea0f4Smrg# This program is free software; you can redistribute it and/or modify 11301ea0f4Smrg# it under the terms of the GNU General Public License as published by 12301ea0f4Smrg# the Free Software Foundation; either version 2, or (at your option) 13301ea0f4Smrg# any later version. 14301ea0f4Smrg 15301ea0f4Smrg# This program is distributed in the hope that it will be useful, 16301ea0f4Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17301ea0f4Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18301ea0f4Smrg# GNU General Public License for more details. 19301ea0f4Smrg 20301ea0f4Smrg# You should have received a copy of the GNU General Public License 21301ea0f4Smrg# along with this program; if not, write to the Free Software 22301ea0f4Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23301ea0f4Smrg# 02110-1301, USA. 24301ea0f4Smrg 25301ea0f4Smrg# As a special exception to the GNU General Public License, if you 26301ea0f4Smrg# distribute this file as part of a program that contains a 27301ea0f4Smrg# configuration script generated by Autoconf, you may include it under 28301ea0f4Smrg# the same distribution terms that you use for the rest of that program. 29301ea0f4Smrg 30301ea0f4Smrgif test $# -eq 0; then 31301ea0f4Smrg echo 1>&2 "Try \`$0 --help' for more information" 32301ea0f4Smrg exit 1 33301ea0f4Smrgfi 34301ea0f4Smrg 35301ea0f4Smrgrun=: 36301ea0f4Smrg 37301ea0f4Smrg# In the cases where this matters, `missing' is being run in the 38301ea0f4Smrg# srcdir already. 39301ea0f4Smrgif test -f configure.ac; then 40301ea0f4Smrg configure_ac=configure.ac 41301ea0f4Smrgelse 42301ea0f4Smrg configure_ac=configure.in 43301ea0f4Smrgfi 44301ea0f4Smrg 45301ea0f4Smrgmsg="missing on your system" 46301ea0f4Smrg 47301ea0f4Smrgcase "$1" in 48301ea0f4Smrg--run) 49301ea0f4Smrg # Try to run requested program, and just exit if it succeeds. 50301ea0f4Smrg run= 51301ea0f4Smrg shift 52301ea0f4Smrg "$@" && exit 0 53301ea0f4Smrg # Exit code 63 means version mismatch. This often happens 54301ea0f4Smrg # when the user try to use an ancient version of a tool on 55301ea0f4Smrg # a file that requires a minimum version. In this case we 56301ea0f4Smrg # we should proceed has if the program had been absent, or 57301ea0f4Smrg # if --run hadn't been passed. 58301ea0f4Smrg if test $? = 63; then 59301ea0f4Smrg run=: 60301ea0f4Smrg msg="probably too old" 61301ea0f4Smrg fi 62301ea0f4Smrg ;; 63301ea0f4Smrg 64301ea0f4Smrg -h|--h|--he|--hel|--help) 65301ea0f4Smrg echo "\ 66301ea0f4Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67301ea0f4Smrg 68301ea0f4SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69301ea0f4Smrgerror status if there is no known handling for PROGRAM. 70301ea0f4Smrg 71301ea0f4SmrgOptions: 72301ea0f4Smrg -h, --help display this help and exit 73301ea0f4Smrg -v, --version output version information and exit 74301ea0f4Smrg --run try to run the given command, and emulate it if it fails 75301ea0f4Smrg 76301ea0f4SmrgSupported PROGRAM values: 77301ea0f4Smrg aclocal touch file \`aclocal.m4' 78301ea0f4Smrg autoconf touch file \`configure' 79301ea0f4Smrg autoheader touch file \`config.h.in' 80301ea0f4Smrg automake touch all \`Makefile.in' files 81301ea0f4Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 82301ea0f4Smrg flex create \`lex.yy.c', if possible, from existing .c 83301ea0f4Smrg help2man touch the output file 84301ea0f4Smrg lex create \`lex.yy.c', if possible, from existing .c 85301ea0f4Smrg makeinfo touch the output file 86301ea0f4Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 87301ea0f4Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 88301ea0f4Smrg 89301ea0f4SmrgSend bug reports to <bug-automake@gnu.org>." 90301ea0f4Smrg exit $? 91301ea0f4Smrg ;; 92301ea0f4Smrg 93301ea0f4Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 94301ea0f4Smrg echo "missing $scriptversion (GNU Automake)" 95301ea0f4Smrg exit $? 96301ea0f4Smrg ;; 97301ea0f4Smrg 98301ea0f4Smrg -*) 99301ea0f4Smrg echo 1>&2 "$0: Unknown \`$1' option" 100301ea0f4Smrg echo 1>&2 "Try \`$0 --help' for more information" 101301ea0f4Smrg exit 1 102301ea0f4Smrg ;; 103301ea0f4Smrg 104301ea0f4Smrgesac 105301ea0f4Smrg 106301ea0f4Smrg# Now exit if we have it, but it failed. Also exit now if we 107301ea0f4Smrg# don't have it and --version was passed (most likely to detect 108301ea0f4Smrg# the program). 109301ea0f4Smrgcase "$1" in 110301ea0f4Smrg lex|yacc) 111301ea0f4Smrg # Not GNU programs, they don't have --version. 112301ea0f4Smrg ;; 113301ea0f4Smrg 114301ea0f4Smrg tar) 115301ea0f4Smrg if test -n "$run"; then 116301ea0f4Smrg echo 1>&2 "ERROR: \`tar' requires --run" 117301ea0f4Smrg exit 1 118301ea0f4Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 119301ea0f4Smrg exit 1 120301ea0f4Smrg fi 121301ea0f4Smrg ;; 122301ea0f4Smrg 123301ea0f4Smrg *) 124301ea0f4Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 125301ea0f4Smrg # We have it, but it failed. 126301ea0f4Smrg exit 1 127301ea0f4Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 128301ea0f4Smrg # Could not run --version or --help. This is probably someone 129301ea0f4Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 130301ea0f4Smrg # $TOOL exists and not knowing $TOOL uses missing. 131301ea0f4Smrg exit 1 132301ea0f4Smrg fi 133301ea0f4Smrg ;; 134301ea0f4Smrgesac 135301ea0f4Smrg 136301ea0f4Smrg# If it does not exist, or fails to run (possibly an outdated version), 137301ea0f4Smrg# try to emulate it. 138301ea0f4Smrgcase "$1" in 139301ea0f4Smrg aclocal*) 140301ea0f4Smrg echo 1>&2 "\ 141301ea0f4SmrgWARNING: \`$1' is $msg. You should only need it if 142301ea0f4Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 143301ea0f4Smrg to install the \`Automake' and \`Perl' packages. Grab them from 144301ea0f4Smrg any GNU archive site." 145301ea0f4Smrg touch aclocal.m4 146301ea0f4Smrg ;; 147301ea0f4Smrg 148301ea0f4Smrg autoconf) 149301ea0f4Smrg echo 1>&2 "\ 150301ea0f4SmrgWARNING: \`$1' is $msg. You should only need it if 151301ea0f4Smrg you modified \`${configure_ac}'. You might want to install the 152301ea0f4Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 153301ea0f4Smrg archive site." 154301ea0f4Smrg touch configure 155301ea0f4Smrg ;; 156301ea0f4Smrg 157301ea0f4Smrg autoheader) 158301ea0f4Smrg echo 1>&2 "\ 159301ea0f4SmrgWARNING: \`$1' is $msg. You should only need it if 160301ea0f4Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 161301ea0f4Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 162301ea0f4Smrg from any GNU archive site." 163301ea0f4Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 164301ea0f4Smrg test -z "$files" && files="config.h" 165301ea0f4Smrg touch_files= 166301ea0f4Smrg for f in $files; do 167301ea0f4Smrg case "$f" in 168301ea0f4Smrg *:*) touch_files="$touch_files "`echo "$f" | 169301ea0f4Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 170301ea0f4Smrg *) touch_files="$touch_files $f.in";; 171301ea0f4Smrg esac 172301ea0f4Smrg done 173301ea0f4Smrg touch $touch_files 174301ea0f4Smrg ;; 175301ea0f4Smrg 176301ea0f4Smrg automake*) 177301ea0f4Smrg echo 1>&2 "\ 178301ea0f4SmrgWARNING: \`$1' is $msg. You should only need it if 179301ea0f4Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 180301ea0f4Smrg You might want to install the \`Automake' and \`Perl' packages. 181301ea0f4Smrg Grab them from any GNU archive site." 182301ea0f4Smrg find . -type f -name Makefile.am -print | 183301ea0f4Smrg sed 's/\.am$/.in/' | 184301ea0f4Smrg while read f; do touch "$f"; done 185301ea0f4Smrg ;; 186301ea0f4Smrg 187301ea0f4Smrg autom4te) 188301ea0f4Smrg echo 1>&2 "\ 189301ea0f4SmrgWARNING: \`$1' is needed, but is $msg. 190301ea0f4Smrg You might have modified some files without having the 191301ea0f4Smrg proper tools for further handling them. 192301ea0f4Smrg You can get \`$1' as part of \`Autoconf' from any GNU 193301ea0f4Smrg archive site." 194301ea0f4Smrg 195301ea0f4Smrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 196301ea0f4Smrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 197301ea0f4Smrg if test -f "$file"; then 198301ea0f4Smrg touch $file 199301ea0f4Smrg else 200301ea0f4Smrg test -z "$file" || exec >$file 201301ea0f4Smrg echo "#! /bin/sh" 202301ea0f4Smrg echo "# Created by GNU Automake missing as a replacement of" 203301ea0f4Smrg echo "# $ $@" 204301ea0f4Smrg echo "exit 0" 205301ea0f4Smrg chmod +x $file 206301ea0f4Smrg exit 1 207301ea0f4Smrg fi 208301ea0f4Smrg ;; 209301ea0f4Smrg 210301ea0f4Smrg bison|yacc) 211301ea0f4Smrg echo 1>&2 "\ 212301ea0f4SmrgWARNING: \`$1' $msg. You should only need it if 213301ea0f4Smrg you modified a \`.y' file. You may need the \`Bison' package 214301ea0f4Smrg in order for those modifications to take effect. You can get 215301ea0f4Smrg \`Bison' from any GNU archive site." 216301ea0f4Smrg rm -f y.tab.c y.tab.h 217301ea0f4Smrg if [ $# -ne 1 ]; then 218301ea0f4Smrg eval LASTARG="\${$#}" 219301ea0f4Smrg case "$LASTARG" in 220301ea0f4Smrg *.y) 221301ea0f4Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 222301ea0f4Smrg if [ -f "$SRCFILE" ]; then 223301ea0f4Smrg cp "$SRCFILE" y.tab.c 224301ea0f4Smrg fi 225301ea0f4Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 226301ea0f4Smrg if [ -f "$SRCFILE" ]; then 227301ea0f4Smrg cp "$SRCFILE" y.tab.h 228301ea0f4Smrg fi 229301ea0f4Smrg ;; 230301ea0f4Smrg esac 231301ea0f4Smrg fi 232301ea0f4Smrg if [ ! -f y.tab.h ]; then 233301ea0f4Smrg echo >y.tab.h 234301ea0f4Smrg fi 235301ea0f4Smrg if [ ! -f y.tab.c ]; then 236301ea0f4Smrg echo 'main() { return 0; }' >y.tab.c 237301ea0f4Smrg fi 238301ea0f4Smrg ;; 239301ea0f4Smrg 240301ea0f4Smrg lex|flex) 241301ea0f4Smrg echo 1>&2 "\ 242301ea0f4SmrgWARNING: \`$1' is $msg. You should only need it if 243301ea0f4Smrg you modified a \`.l' file. You may need the \`Flex' package 244301ea0f4Smrg in order for those modifications to take effect. You can get 245301ea0f4Smrg \`Flex' from any GNU archive site." 246301ea0f4Smrg rm -f lex.yy.c 247301ea0f4Smrg if [ $# -ne 1 ]; then 248301ea0f4Smrg eval LASTARG="\${$#}" 249301ea0f4Smrg case "$LASTARG" in 250301ea0f4Smrg *.l) 251301ea0f4Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 252301ea0f4Smrg if [ -f "$SRCFILE" ]; then 253301ea0f4Smrg cp "$SRCFILE" lex.yy.c 254301ea0f4Smrg fi 255301ea0f4Smrg ;; 256301ea0f4Smrg esac 257301ea0f4Smrg fi 258301ea0f4Smrg if [ ! -f lex.yy.c ]; then 259301ea0f4Smrg echo 'main() { return 0; }' >lex.yy.c 260301ea0f4Smrg fi 261301ea0f4Smrg ;; 262301ea0f4Smrg 263301ea0f4Smrg help2man) 264301ea0f4Smrg echo 1>&2 "\ 265301ea0f4SmrgWARNING: \`$1' is $msg. You should only need it if 266301ea0f4Smrg you modified a dependency of a manual page. You may need the 267301ea0f4Smrg \`Help2man' package in order for those modifications to take 268301ea0f4Smrg effect. You can get \`Help2man' from any GNU archive site." 269301ea0f4Smrg 270301ea0f4Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 271301ea0f4Smrg if test -z "$file"; then 272301ea0f4Smrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 273301ea0f4Smrg fi 274301ea0f4Smrg if [ -f "$file" ]; then 275301ea0f4Smrg touch $file 276301ea0f4Smrg else 277301ea0f4Smrg test -z "$file" || exec >$file 278301ea0f4Smrg echo ".ab help2man is required to generate this page" 279301ea0f4Smrg exit 1 280301ea0f4Smrg fi 281301ea0f4Smrg ;; 282301ea0f4Smrg 283301ea0f4Smrg makeinfo) 284301ea0f4Smrg echo 1>&2 "\ 285301ea0f4SmrgWARNING: \`$1' is $msg. You should only need it if 286301ea0f4Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 287301ea0f4Smrg indirectly affecting the aspect of the manual. The spurious 288301ea0f4Smrg call might also be the consequence of using a buggy \`make' (AIX, 289301ea0f4Smrg DU, IRIX). You might want to install the \`Texinfo' package or 290301ea0f4Smrg the \`GNU make' package. Grab either from any GNU archive site." 291301ea0f4Smrg # The file to touch is that specified with -o ... 292301ea0f4Smrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 293301ea0f4Smrg if test -z "$file"; then 294301ea0f4Smrg # ... or it is the one specified with @setfilename ... 295301ea0f4Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 296301ea0f4Smrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 297301ea0f4Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 298301ea0f4Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 299301ea0f4Smrg fi 300301ea0f4Smrg # If the file does not exist, the user really needs makeinfo; 301301ea0f4Smrg # let's fail without touching anything. 302301ea0f4Smrg test -f $file || exit 1 303301ea0f4Smrg touch $file 304301ea0f4Smrg ;; 305301ea0f4Smrg 306301ea0f4Smrg tar) 307301ea0f4Smrg shift 308301ea0f4Smrg 309301ea0f4Smrg # We have already tried tar in the generic part. 310301ea0f4Smrg # Look for gnutar/gtar before invocation to avoid ugly error 311301ea0f4Smrg # messages. 312301ea0f4Smrg if (gnutar --version > /dev/null 2>&1); then 313301ea0f4Smrg gnutar "$@" && exit 0 314301ea0f4Smrg fi 315301ea0f4Smrg if (gtar --version > /dev/null 2>&1); then 316301ea0f4Smrg gtar "$@" && exit 0 317301ea0f4Smrg fi 318301ea0f4Smrg firstarg="$1" 319301ea0f4Smrg if shift; then 320301ea0f4Smrg case "$firstarg" in 321301ea0f4Smrg *o*) 322301ea0f4Smrg firstarg=`echo "$firstarg" | sed s/o//` 323301ea0f4Smrg tar "$firstarg" "$@" && exit 0 324301ea0f4Smrg ;; 325301ea0f4Smrg esac 326301ea0f4Smrg case "$firstarg" in 327301ea0f4Smrg *h*) 328301ea0f4Smrg firstarg=`echo "$firstarg" | sed s/h//` 329301ea0f4Smrg tar "$firstarg" "$@" && exit 0 330301ea0f4Smrg ;; 331301ea0f4Smrg esac 332301ea0f4Smrg fi 333301ea0f4Smrg 334301ea0f4Smrg echo 1>&2 "\ 335301ea0f4SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 336301ea0f4Smrg You may want to install GNU tar or Free paxutils, or check the 337301ea0f4Smrg command line arguments." 338301ea0f4Smrg exit 1 339301ea0f4Smrg ;; 340301ea0f4Smrg 341301ea0f4Smrg *) 342301ea0f4Smrg echo 1>&2 "\ 343301ea0f4SmrgWARNING: \`$1' is needed, and is $msg. 344301ea0f4Smrg You might have modified some files without having the 345301ea0f4Smrg proper tools for further handling them. Check the \`README' file, 346301ea0f4Smrg it often tells you about the needed prerequisites for installing 347301ea0f4Smrg this package. You may also peek at any GNU archive site, in case 348301ea0f4Smrg some other package would contain this missing \`$1' program." 349301ea0f4Smrg exit 1 350301ea0f4Smrg ;; 351301ea0f4Smrgesac 352301ea0f4Smrg 353301ea0f4Smrgexit 0 354301ea0f4Smrg 355301ea0f4Smrg# Local variables: 356301ea0f4Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 357301ea0f4Smrg# time-stamp-start: "scriptversion=" 358301ea0f4Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 359301ea0f4Smrg# time-stamp-end: "$" 360301ea0f4Smrg# End: 361