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