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