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