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