missing revision 876ff6fe
1876ff6feSmrg#! /bin/sh 2876ff6feSmrg# Common stub for a few missing GNU programs while installing. 3876ff6feSmrg 4876ff6feSmrgscriptversion=2005-06-08.21 5876ff6feSmrg 6876ff6feSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 7876ff6feSmrg# Free Software Foundation, Inc. 8876ff6feSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9876ff6feSmrg 10876ff6feSmrg# This program is free software; you can redistribute it and/or modify 11876ff6feSmrg# it under the terms of the GNU General Public License as published by 12876ff6feSmrg# the Free Software Foundation; either version 2, or (at your option) 13876ff6feSmrg# any later version. 14876ff6feSmrg 15876ff6feSmrg# This program is distributed in the hope that it will be useful, 16876ff6feSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17876ff6feSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18876ff6feSmrg# GNU General Public License for more details. 19876ff6feSmrg 20876ff6feSmrg# You should have received a copy of the GNU General Public License 21876ff6feSmrg# along with this program; if not, write to the Free Software 22876ff6feSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23876ff6feSmrg# 02110-1301, USA. 24876ff6feSmrg 25876ff6feSmrg# As a special exception to the GNU General Public License, if you 26876ff6feSmrg# distribute this file as part of a program that contains a 27876ff6feSmrg# configuration script generated by Autoconf, you may include it under 28876ff6feSmrg# the same distribution terms that you use for the rest of that program. 29876ff6feSmrg 30876ff6feSmrgif test $# -eq 0; then 31876ff6feSmrg echo 1>&2 "Try \`$0 --help' for more information" 32876ff6feSmrg exit 1 33876ff6feSmrgfi 34876ff6feSmrg 35876ff6feSmrgrun=: 36876ff6feSmrg 37876ff6feSmrg# In the cases where this matters, `missing' is being run in the 38876ff6feSmrg# srcdir already. 39876ff6feSmrgif test -f configure.ac; then 40876ff6feSmrg configure_ac=configure.ac 41876ff6feSmrgelse 42876ff6feSmrg configure_ac=configure.in 43876ff6feSmrgfi 44876ff6feSmrg 45876ff6feSmrgmsg="missing on your system" 46876ff6feSmrg 47876ff6feSmrgcase "$1" in 48876ff6feSmrg--run) 49876ff6feSmrg # Try to run requested program, and just exit if it succeeds. 50876ff6feSmrg run= 51876ff6feSmrg shift 52876ff6feSmrg "$@" && exit 0 53876ff6feSmrg # Exit code 63 means version mismatch. This often happens 54876ff6feSmrg # when the user try to use an ancient version of a tool on 55876ff6feSmrg # a file that requires a minimum version. In this case we 56876ff6feSmrg # we should proceed has if the program had been absent, or 57876ff6feSmrg # if --run hadn't been passed. 58876ff6feSmrg if test $? = 63; then 59876ff6feSmrg run=: 60876ff6feSmrg msg="probably too old" 61876ff6feSmrg fi 62876ff6feSmrg ;; 63876ff6feSmrg 64876ff6feSmrg -h|--h|--he|--hel|--help) 65876ff6feSmrg echo "\ 66876ff6feSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67876ff6feSmrg 68876ff6feSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69876ff6feSmrgerror status if there is no known handling for PROGRAM. 70876ff6feSmrg 71876ff6feSmrgOptions: 72876ff6feSmrg -h, --help display this help and exit 73876ff6feSmrg -v, --version output version information and exit 74876ff6feSmrg --run try to run the given command, and emulate it if it fails 75876ff6feSmrg 76876ff6feSmrgSupported PROGRAM values: 77876ff6feSmrg aclocal touch file \`aclocal.m4' 78876ff6feSmrg autoconf touch file \`configure' 79876ff6feSmrg autoheader touch file \`config.h.in' 80876ff6feSmrg automake touch all \`Makefile.in' files 81876ff6feSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 82876ff6feSmrg flex create \`lex.yy.c', if possible, from existing .c 83876ff6feSmrg help2man touch the output file 84876ff6feSmrg lex create \`lex.yy.c', if possible, from existing .c 85876ff6feSmrg makeinfo touch the output file 86876ff6feSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 87876ff6feSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 88876ff6feSmrg 89876ff6feSmrgSend bug reports to <bug-automake@gnu.org>." 90876ff6feSmrg exit $? 91876ff6feSmrg ;; 92876ff6feSmrg 93876ff6feSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 94876ff6feSmrg echo "missing $scriptversion (GNU Automake)" 95876ff6feSmrg exit $? 96876ff6feSmrg ;; 97876ff6feSmrg 98876ff6feSmrg -*) 99876ff6feSmrg echo 1>&2 "$0: Unknown \`$1' option" 100876ff6feSmrg echo 1>&2 "Try \`$0 --help' for more information" 101876ff6feSmrg exit 1 102876ff6feSmrg ;; 103876ff6feSmrg 104876ff6feSmrgesac 105876ff6feSmrg 106876ff6feSmrg# Now exit if we have it, but it failed. Also exit now if we 107876ff6feSmrg# don't have it and --version was passed (most likely to detect 108876ff6feSmrg# the program). 109876ff6feSmrgcase "$1" in 110876ff6feSmrg lex|yacc) 111876ff6feSmrg # Not GNU programs, they don't have --version. 112876ff6feSmrg ;; 113876ff6feSmrg 114876ff6feSmrg tar) 115876ff6feSmrg if test -n "$run"; then 116876ff6feSmrg echo 1>&2 "ERROR: \`tar' requires --run" 117876ff6feSmrg exit 1 118876ff6feSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 119876ff6feSmrg exit 1 120876ff6feSmrg fi 121876ff6feSmrg ;; 122876ff6feSmrg 123876ff6feSmrg *) 124876ff6feSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 125876ff6feSmrg # We have it, but it failed. 126876ff6feSmrg exit 1 127876ff6feSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 128876ff6feSmrg # Could not run --version or --help. This is probably someone 129876ff6feSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 130876ff6feSmrg # $TOOL exists and not knowing $TOOL uses missing. 131876ff6feSmrg exit 1 132876ff6feSmrg fi 133876ff6feSmrg ;; 134876ff6feSmrgesac 135876ff6feSmrg 136876ff6feSmrg# If it does not exist, or fails to run (possibly an outdated version), 137876ff6feSmrg# try to emulate it. 138876ff6feSmrgcase "$1" in 139876ff6feSmrg aclocal*) 140876ff6feSmrg echo 1>&2 "\ 141876ff6feSmrgWARNING: \`$1' is $msg. You should only need it if 142876ff6feSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 143876ff6feSmrg to install the \`Automake' and \`Perl' packages. Grab them from 144876ff6feSmrg any GNU archive site." 145876ff6feSmrg touch aclocal.m4 146876ff6feSmrg ;; 147876ff6feSmrg 148876ff6feSmrg autoconf) 149876ff6feSmrg echo 1>&2 "\ 150876ff6feSmrgWARNING: \`$1' is $msg. You should only need it if 151876ff6feSmrg you modified \`${configure_ac}'. You might want to install the 152876ff6feSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 153876ff6feSmrg archive site." 154876ff6feSmrg touch configure 155876ff6feSmrg ;; 156876ff6feSmrg 157876ff6feSmrg autoheader) 158876ff6feSmrg echo 1>&2 "\ 159876ff6feSmrgWARNING: \`$1' is $msg. You should only need it if 160876ff6feSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 161876ff6feSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 162876ff6feSmrg from any GNU archive site." 163876ff6feSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 164876ff6feSmrg test -z "$files" && files="config.h" 165876ff6feSmrg touch_files= 166876ff6feSmrg for f in $files; do 167876ff6feSmrg case "$f" in 168876ff6feSmrg *:*) touch_files="$touch_files "`echo "$f" | 169876ff6feSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 170876ff6feSmrg *) touch_files="$touch_files $f.in";; 171876ff6feSmrg esac 172876ff6feSmrg done 173876ff6feSmrg touch $touch_files 174876ff6feSmrg ;; 175876ff6feSmrg 176876ff6feSmrg automake*) 177876ff6feSmrg echo 1>&2 "\ 178876ff6feSmrgWARNING: \`$1' is $msg. You should only need it if 179876ff6feSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 180876ff6feSmrg You might want to install the \`Automake' and \`Perl' packages. 181876ff6feSmrg Grab them from any GNU archive site." 182876ff6feSmrg find . -type f -name Makefile.am -print | 183876ff6feSmrg sed 's/\.am$/.in/' | 184876ff6feSmrg while read f; do touch "$f"; done 185876ff6feSmrg ;; 186876ff6feSmrg 187876ff6feSmrg autom4te) 188876ff6feSmrg echo 1>&2 "\ 189876ff6feSmrgWARNING: \`$1' is needed, but is $msg. 190876ff6feSmrg You might have modified some files without having the 191876ff6feSmrg proper tools for further handling them. 192876ff6feSmrg You can get \`$1' as part of \`Autoconf' from any GNU 193876ff6feSmrg archive site." 194876ff6feSmrg 195876ff6feSmrg file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 196876ff6feSmrg test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 197876ff6feSmrg if test -f "$file"; then 198876ff6feSmrg touch $file 199876ff6feSmrg else 200876ff6feSmrg test -z "$file" || exec >$file 201876ff6feSmrg echo "#! /bin/sh" 202876ff6feSmrg echo "# Created by GNU Automake missing as a replacement of" 203876ff6feSmrg echo "# $ $@" 204876ff6feSmrg echo "exit 0" 205876ff6feSmrg chmod +x $file 206876ff6feSmrg exit 1 207876ff6feSmrg fi 208876ff6feSmrg ;; 209876ff6feSmrg 210876ff6feSmrg bison|yacc) 211876ff6feSmrg echo 1>&2 "\ 212876ff6feSmrgWARNING: \`$1' $msg. You should only need it if 213876ff6feSmrg you modified a \`.y' file. You may need the \`Bison' package 214876ff6feSmrg in order for those modifications to take effect. You can get 215876ff6feSmrg \`Bison' from any GNU archive site." 216876ff6feSmrg rm -f y.tab.c y.tab.h 217876ff6feSmrg if [ $# -ne 1 ]; then 218876ff6feSmrg eval LASTARG="\${$#}" 219876ff6feSmrg case "$LASTARG" in 220876ff6feSmrg *.y) 221876ff6feSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 222876ff6feSmrg if [ -f "$SRCFILE" ]; then 223876ff6feSmrg cp "$SRCFILE" y.tab.c 224876ff6feSmrg fi 225876ff6feSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 226876ff6feSmrg if [ -f "$SRCFILE" ]; then 227876ff6feSmrg cp "$SRCFILE" y.tab.h 228876ff6feSmrg fi 229876ff6feSmrg ;; 230876ff6feSmrg esac 231876ff6feSmrg fi 232876ff6feSmrg if [ ! -f y.tab.h ]; then 233876ff6feSmrg echo >y.tab.h 234876ff6feSmrg fi 235876ff6feSmrg if [ ! -f y.tab.c ]; then 236876ff6feSmrg echo 'main() { return 0; }' >y.tab.c 237876ff6feSmrg fi 238876ff6feSmrg ;; 239876ff6feSmrg 240876ff6feSmrg lex|flex) 241876ff6feSmrg echo 1>&2 "\ 242876ff6feSmrgWARNING: \`$1' is $msg. You should only need it if 243876ff6feSmrg you modified a \`.l' file. You may need the \`Flex' package 244876ff6feSmrg in order for those modifications to take effect. You can get 245876ff6feSmrg \`Flex' from any GNU archive site." 246876ff6feSmrg rm -f lex.yy.c 247876ff6feSmrg if [ $# -ne 1 ]; then 248876ff6feSmrg eval LASTARG="\${$#}" 249876ff6feSmrg case "$LASTARG" in 250876ff6feSmrg *.l) 251876ff6feSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 252876ff6feSmrg if [ -f "$SRCFILE" ]; then 253876ff6feSmrg cp "$SRCFILE" lex.yy.c 254876ff6feSmrg fi 255876ff6feSmrg ;; 256876ff6feSmrg esac 257876ff6feSmrg fi 258876ff6feSmrg if [ ! -f lex.yy.c ]; then 259876ff6feSmrg echo 'main() { return 0; }' >lex.yy.c 260876ff6feSmrg fi 261876ff6feSmrg ;; 262876ff6feSmrg 263876ff6feSmrg help2man) 264876ff6feSmrg echo 1>&2 "\ 265876ff6feSmrgWARNING: \`$1' is $msg. You should only need it if 266876ff6feSmrg you modified a dependency of a manual page. You may need the 267876ff6feSmrg \`Help2man' package in order for those modifications to take 268876ff6feSmrg effect. You can get \`Help2man' from any GNU archive site." 269876ff6feSmrg 270876ff6feSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 271876ff6feSmrg if test -z "$file"; then 272876ff6feSmrg file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 273876ff6feSmrg fi 274876ff6feSmrg if [ -f "$file" ]; then 275876ff6feSmrg touch $file 276876ff6feSmrg else 277876ff6feSmrg test -z "$file" || exec >$file 278876ff6feSmrg echo ".ab help2man is required to generate this page" 279876ff6feSmrg exit 1 280876ff6feSmrg fi 281876ff6feSmrg ;; 282876ff6feSmrg 283876ff6feSmrg makeinfo) 284876ff6feSmrg echo 1>&2 "\ 285876ff6feSmrgWARNING: \`$1' is $msg. You should only need it if 286876ff6feSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 287876ff6feSmrg indirectly affecting the aspect of the manual. The spurious 288876ff6feSmrg call might also be the consequence of using a buggy \`make' (AIX, 289876ff6feSmrg DU, IRIX). You might want to install the \`Texinfo' package or 290876ff6feSmrg the \`GNU make' package. Grab either from any GNU archive site." 291876ff6feSmrg # The file to touch is that specified with -o ... 292876ff6feSmrg file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 293876ff6feSmrg if test -z "$file"; then 294876ff6feSmrg # ... or it is the one specified with @setfilename ... 295876ff6feSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 296876ff6feSmrg file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 297876ff6feSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 298876ff6feSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 299876ff6feSmrg fi 300876ff6feSmrg # If the file does not exist, the user really needs makeinfo; 301876ff6feSmrg # let's fail without touching anything. 302876ff6feSmrg test -f $file || exit 1 303876ff6feSmrg touch $file 304876ff6feSmrg ;; 305876ff6feSmrg 306876ff6feSmrg tar) 307876ff6feSmrg shift 308876ff6feSmrg 309876ff6feSmrg # We have already tried tar in the generic part. 310876ff6feSmrg # Look for gnutar/gtar before invocation to avoid ugly error 311876ff6feSmrg # messages. 312876ff6feSmrg if (gnutar --version > /dev/null 2>&1); then 313876ff6feSmrg gnutar "$@" && exit 0 314876ff6feSmrg fi 315876ff6feSmrg if (gtar --version > /dev/null 2>&1); then 316876ff6feSmrg gtar "$@" && exit 0 317876ff6feSmrg fi 318876ff6feSmrg firstarg="$1" 319876ff6feSmrg if shift; then 320876ff6feSmrg case "$firstarg" in 321876ff6feSmrg *o*) 322876ff6feSmrg firstarg=`echo "$firstarg" | sed s/o//` 323876ff6feSmrg tar "$firstarg" "$@" && exit 0 324876ff6feSmrg ;; 325876ff6feSmrg esac 326876ff6feSmrg case "$firstarg" in 327876ff6feSmrg *h*) 328876ff6feSmrg firstarg=`echo "$firstarg" | sed s/h//` 329876ff6feSmrg tar "$firstarg" "$@" && exit 0 330876ff6feSmrg ;; 331876ff6feSmrg esac 332876ff6feSmrg fi 333876ff6feSmrg 334876ff6feSmrg echo 1>&2 "\ 335876ff6feSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 336876ff6feSmrg You may want to install GNU tar or Free paxutils, or check the 337876ff6feSmrg command line arguments." 338876ff6feSmrg exit 1 339876ff6feSmrg ;; 340876ff6feSmrg 341876ff6feSmrg *) 342876ff6feSmrg echo 1>&2 "\ 343876ff6feSmrgWARNING: \`$1' is needed, and is $msg. 344876ff6feSmrg You might have modified some files without having the 345876ff6feSmrg proper tools for further handling them. Check the \`README' file, 346876ff6feSmrg it often tells you about the needed prerequisites for installing 347876ff6feSmrg this package. You may also peek at any GNU archive site, in case 348876ff6feSmrg some other package would contain this missing \`$1' program." 349876ff6feSmrg exit 1 350876ff6feSmrg ;; 351876ff6feSmrgesac 352876ff6feSmrg 353876ff6feSmrgexit 0 354876ff6feSmrg 355876ff6feSmrg# Local variables: 356876ff6feSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 357876ff6feSmrg# time-stamp-start: "scriptversion=" 358876ff6feSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 359876ff6feSmrg# time-stamp-end: "$" 360876ff6feSmrg# End: 361