1*43c1707eStholo#! /bin/sh 2*43c1707eStholo# Common stub for a few missing GNU programs while installing. 3*43c1707eStholo# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. 4*43c1707eStholo# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 5*43c1707eStholo 6*43c1707eStholo# This program is free software; you can redistribute it and/or modify 7*43c1707eStholo# it under the terms of the GNU General Public License as published by 8*43c1707eStholo# the Free Software Foundation; either version 2, or (at your option) 9*43c1707eStholo# any later version. 10*43c1707eStholo 11*43c1707eStholo# This program is distributed in the hope that it will be useful, 12*43c1707eStholo# but WITHOUT ANY WARRANTY; without even the implied warranty of 13*43c1707eStholo# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*43c1707eStholo# GNU General Public License for more details. 15*43c1707eStholo 16*43c1707eStholo# You should have received a copy of the GNU General Public License 17*43c1707eStholo# along with this program; if not, write to the Free Software 18*43c1707eStholo# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19*43c1707eStholo# 02111-1307, USA. 20*43c1707eStholo 21*43c1707eStholoif test $# -eq 0; then 22*43c1707eStholo echo 1>&2 "Try \`$0 --help' for more information" 23*43c1707eStholo exit 1 24*43c1707eStholofi 25*43c1707eStholo 26*43c1707eStholorun=: 27*43c1707eStholo 28*43c1707eStholocase "$1" in 29*43c1707eStholo--run) 30*43c1707eStholo # Try to run requested program, and just exit if it succeeds. 31*43c1707eStholo run= 32*43c1707eStholo shift 33*43c1707eStholo "$@" && exit 0 34*43c1707eStholo ;; 35*43c1707eStholoesac 36*43c1707eStholo 37*43c1707eStholo# If it does not exist, or fails to run (possibly an outdated version), 38*43c1707eStholo# try to emulate it. 39*43c1707eStholocase "$1" in 40*43c1707eStholo 41*43c1707eStholo -h|--h|--he|--hel|--help) 42*43c1707eStholo echo "\ 43*43c1707eStholo$0 [OPTION]... PROGRAM [ARGUMENT]... 44*43c1707eStholo 45*43c1707eStholoHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 46*43c1707eStholoerror status if there is no known handling for PROGRAM. 47*43c1707eStholo 48*43c1707eStholoOptions: 49*43c1707eStholo -h, --help display this help and exit 50*43c1707eStholo -v, --version output version information and exit 51*43c1707eStholo --run try to run the given command, and emulate it if it fails 52*43c1707eStholo 53*43c1707eStholoSupported PROGRAM values: 54*43c1707eStholo aclocal touch file \`aclocal.m4' 55*43c1707eStholo autoconf touch file \`configure' 56*43c1707eStholo autoheader touch file \`config.h.in' 57*43c1707eStholo automake touch all \`Makefile.in' files 58*43c1707eStholo bison create \`y.tab.[ch]', if possible, from existing .[ch] 59*43c1707eStholo flex create \`lex.yy.c', if possible, from existing .c 60*43c1707eStholo help2man touch the output file 61*43c1707eStholo lex create \`lex.yy.c', if possible, from existing .c 62*43c1707eStholo makeinfo touch the output file 63*43c1707eStholo tar try tar, gnutar, gtar, then tar without non-portable flags 64*43c1707eStholo yacc create \`y.tab.[ch]', if possible, from existing .[ch]" 65*43c1707eStholo ;; 66*43c1707eStholo 67*43c1707eStholo -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68*43c1707eStholo echo "missing 0.3 - GNU automake" 69*43c1707eStholo ;; 70*43c1707eStholo 71*43c1707eStholo -*) 72*43c1707eStholo echo 1>&2 "$0: Unknown \`$1' option" 73*43c1707eStholo echo 1>&2 "Try \`$0 --help' for more information" 74*43c1707eStholo exit 1 75*43c1707eStholo ;; 76*43c1707eStholo 77*43c1707eStholo aclocal) 78*43c1707eStholo echo 1>&2 "\ 79*43c1707eStholoWARNING: \`$1' is missing on your system. You should only need it if 80*43c1707eStholo you modified \`acinclude.m4' or \`configure.in'. You might want 81*43c1707eStholo to install the \`Automake' and \`Perl' packages. Grab them from 82*43c1707eStholo any GNU archive site." 83*43c1707eStholo touch aclocal.m4 84*43c1707eStholo ;; 85*43c1707eStholo 86*43c1707eStholo autoconf) 87*43c1707eStholo echo 1>&2 "\ 88*43c1707eStholoWARNING: \`$1' is missing on your system. You should only need it if 89*43c1707eStholo you modified \`configure.in'. You might want to install the 90*43c1707eStholo \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 91*43c1707eStholo archive site." 92*43c1707eStholo touch configure 93*43c1707eStholo ;; 94*43c1707eStholo 95*43c1707eStholo autoheader) 96*43c1707eStholo echo 1>&2 "\ 97*43c1707eStholoWARNING: \`$1' is missing on your system. You should only need it if 98*43c1707eStholo you modified \`acconfig.h' or \`configure.in'. You might want 99*43c1707eStholo to install the \`Autoconf' and \`GNU m4' packages. Grab them 100*43c1707eStholo from any GNU archive site." 101*43c1707eStholo files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` 102*43c1707eStholo test -z "$files" && files="config.h" 103*43c1707eStholo touch_files= 104*43c1707eStholo for f in $files; do 105*43c1707eStholo case "$f" in 106*43c1707eStholo *:*) touch_files="$touch_files "`echo "$f" | 107*43c1707eStholo sed -e 's/^[^:]*://' -e 's/:.*//'`;; 108*43c1707eStholo *) touch_files="$touch_files $f.in";; 109*43c1707eStholo esac 110*43c1707eStholo done 111*43c1707eStholo touch $touch_files 112*43c1707eStholo ;; 113*43c1707eStholo 114*43c1707eStholo automake) 115*43c1707eStholo echo 1>&2 "\ 116*43c1707eStholoWARNING: \`$1' is missing on your system. You should only need it if 117*43c1707eStholo you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. 118*43c1707eStholo You might want to install the \`Automake' and \`Perl' packages. 119*43c1707eStholo Grab them from any GNU archive site." 120*43c1707eStholo find . -type f -name Makefile.am -print | 121*43c1707eStholo sed 's/\.am$/.in/' | 122*43c1707eStholo while read f; do touch "$f"; done 123*43c1707eStholo ;; 124*43c1707eStholo 125*43c1707eStholo bison|yacc) 126*43c1707eStholo echo 1>&2 "\ 127*43c1707eStholoWARNING: \`$1' is missing on your system. You should only need it if 128*43c1707eStholo you modified a \`.y' file. You may need the \`Bison' package 129*43c1707eStholo in order for those modifications to take effect. You can get 130*43c1707eStholo \`Bison' from any GNU archive site." 131*43c1707eStholo rm -f y.tab.c y.tab.h 132*43c1707eStholo if [ $# -ne 1 ]; then 133*43c1707eStholo eval LASTARG="\${$#}" 134*43c1707eStholo case "$LASTARG" in 135*43c1707eStholo *.y) 136*43c1707eStholo SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 137*43c1707eStholo if [ -f "$SRCFILE" ]; then 138*43c1707eStholo cp "$SRCFILE" y.tab.c 139*43c1707eStholo fi 140*43c1707eStholo SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 141*43c1707eStholo if [ -f "$SRCFILE" ]; then 142*43c1707eStholo cp "$SRCFILE" y.tab.h 143*43c1707eStholo fi 144*43c1707eStholo ;; 145*43c1707eStholo esac 146*43c1707eStholo fi 147*43c1707eStholo if [ ! -f y.tab.h ]; then 148*43c1707eStholo echo >y.tab.h 149*43c1707eStholo fi 150*43c1707eStholo if [ ! -f y.tab.c ]; then 151*43c1707eStholo echo 'main() { return 0; }' >y.tab.c 152*43c1707eStholo fi 153*43c1707eStholo ;; 154*43c1707eStholo 155*43c1707eStholo lex|flex) 156*43c1707eStholo echo 1>&2 "\ 157*43c1707eStholoWARNING: \`$1' is missing on your system. You should only need it if 158*43c1707eStholo you modified a \`.l' file. You may need the \`Flex' package 159*43c1707eStholo in order for those modifications to take effect. You can get 160*43c1707eStholo \`Flex' from any GNU archive site." 161*43c1707eStholo rm -f lex.yy.c 162*43c1707eStholo if [ $# -ne 1 ]; then 163*43c1707eStholo eval LASTARG="\${$#}" 164*43c1707eStholo case "$LASTARG" in 165*43c1707eStholo *.l) 166*43c1707eStholo SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 167*43c1707eStholo if [ -f "$SRCFILE" ]; then 168*43c1707eStholo cp "$SRCFILE" lex.yy.c 169*43c1707eStholo fi 170*43c1707eStholo ;; 171*43c1707eStholo esac 172*43c1707eStholo fi 173*43c1707eStholo if [ ! -f lex.yy.c ]; then 174*43c1707eStholo echo 'main() { return 0; }' >lex.yy.c 175*43c1707eStholo fi 176*43c1707eStholo ;; 177*43c1707eStholo 178*43c1707eStholo help2man) 179*43c1707eStholo echo 1>&2 "\ 180*43c1707eStholoWARNING: \`$1' is missing on your system. You should only need it if 181*43c1707eStholo you modified a dependency of a manual page. You may need the 182*43c1707eStholo \`Help2man' package in order for those modifications to take 183*43c1707eStholo effect. You can get \`Help2man' from any GNU archive site." 184*43c1707eStholo 185*43c1707eStholo file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 186*43c1707eStholo if test -z "$file"; then 187*43c1707eStholo file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 188*43c1707eStholo fi 189*43c1707eStholo if [ -f "$file" ]; then 190*43c1707eStholo touch $file 191*43c1707eStholo else 192*43c1707eStholo test -z "$file" || exec >$file 193*43c1707eStholo echo ".ab help2man is required to generate this page" 194*43c1707eStholo exit 1 195*43c1707eStholo fi 196*43c1707eStholo ;; 197*43c1707eStholo 198*43c1707eStholo makeinfo) 199*43c1707eStholo echo 1>&2 "\ 200*43c1707eStholoWARNING: \`$1' is missing on your system. You should only need it if 201*43c1707eStholo you modified a \`.texi' or \`.texinfo' file, or any other file 202*43c1707eStholo indirectly affecting the aspect of the manual. The spurious 203*43c1707eStholo call might also be the consequence of using a buggy \`make' (AIX, 204*43c1707eStholo DU, IRIX). You might want to install the \`Texinfo' package or 205*43c1707eStholo the \`GNU make' package. Grab either from any GNU archive site." 206*43c1707eStholo file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 207*43c1707eStholo if test -z "$file"; then 208*43c1707eStholo file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 209*43c1707eStholo file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` 210*43c1707eStholo fi 211*43c1707eStholo touch $file 212*43c1707eStholo ;; 213*43c1707eStholo 214*43c1707eStholo tar) 215*43c1707eStholo shift 216*43c1707eStholo if test -n "$run"; then 217*43c1707eStholo echo 1>&2 "ERROR: \`tar' requires --run" 218*43c1707eStholo exit 1 219*43c1707eStholo fi 220*43c1707eStholo 221*43c1707eStholo # We have already tried tar in the generic part. 222*43c1707eStholo # Look for gnutar/gtar before invocation to avoid ugly error 223*43c1707eStholo # messages. 224*43c1707eStholo if (gnutar --version > /dev/null 2>&1); then 225*43c1707eStholo gnutar ${1+"$@"} && exit 0 226*43c1707eStholo fi 227*43c1707eStholo if (gtar --version > /dev/null 2>&1); then 228*43c1707eStholo gtar ${1+"$@"} && exit 0 229*43c1707eStholo fi 230*43c1707eStholo firstarg="$1" 231*43c1707eStholo if shift; then 232*43c1707eStholo case "$firstarg" in 233*43c1707eStholo *o*) 234*43c1707eStholo firstarg=`echo "$firstarg" | sed s/o//` 235*43c1707eStholo tar "$firstarg" ${1+"$@"} && exit 0 236*43c1707eStholo ;; 237*43c1707eStholo esac 238*43c1707eStholo case "$firstarg" in 239*43c1707eStholo *h*) 240*43c1707eStholo firstarg=`echo "$firstarg" | sed s/h//` 241*43c1707eStholo tar "$firstarg" ${1+"$@"} && exit 0 242*43c1707eStholo ;; 243*43c1707eStholo esac 244*43c1707eStholo fi 245*43c1707eStholo 246*43c1707eStholo echo 1>&2 "\ 247*43c1707eStholoWARNING: I can't seem to be able to run \`tar' with the given arguments. 248*43c1707eStholo You may want to install GNU tar or Free paxutils, or check the 249*43c1707eStholo command line arguments." 250*43c1707eStholo exit 1 251*43c1707eStholo ;; 252*43c1707eStholo 253*43c1707eStholo *) 254*43c1707eStholo echo 1>&2 "\ 255*43c1707eStholoWARNING: \`$1' is needed, and you do not seem to have it handy on your 256*43c1707eStholo system. You might have modified some files without having the 257*43c1707eStholo proper tools for further handling them. Check the \`README' file, 258*43c1707eStholo it often tells you about the needed prerequirements for installing 259*43c1707eStholo this package. You may also peek at any GNU archive site, in case 260*43c1707eStholo some other package would contain this missing \`$1' program." 261*43c1707eStholo exit 1 262*43c1707eStholo ;; 263*43c1707eStholoesac 264*43c1707eStholo 265*43c1707eStholoexit 0 266