1130803Smarcel#! /bin/sh 2130803Smarcel# Common stub for a few missing GNU programs while installing. 3130803Smarcel# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. 4130803Smarcel# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 5130803Smarcel 6130803Smarcel# This program is free software; you can redistribute it and/or modify 7130803Smarcel# it under the terms of the GNU General Public License as published by 8130803Smarcel# the Free Software Foundation; either version 2, or (at your option) 9130803Smarcel# any later version. 10130803Smarcel 11130803Smarcel# This program is distributed in the hope that it will be useful, 12130803Smarcel# but WITHOUT ANY WARRANTY; without even the implied warranty of 13130803Smarcel# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14130803Smarcel# GNU General Public License for more details. 15130803Smarcel 16130803Smarcel# You should have received a copy of the GNU General Public License 17130803Smarcel# along with this program; if not, write to the Free Software 18130803Smarcel# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19130803Smarcel# 02111-1307, USA. 20130803Smarcel 21130803Smarcel# As a special exception to the GNU General Public License, if you 22130803Smarcel# distribute this file as part of a program that contains a 23130803Smarcel# configuration script generated by Autoconf, you may include it under 24130803Smarcel# the same distribution terms that you use for the rest of that program. 25130803Smarcel 26130803Smarcelif test $# -eq 0; then 27130803Smarcel echo 1>&2 "Try \`$0 --help' for more information" 28130803Smarcel exit 1 29130803Smarcelfi 30130803Smarcel 31130803Smarcelrun=: 32130803Smarcel 33130803Smarcel# In the cases where this matters, `missing' is being run in the 34130803Smarcel# srcdir already. 35130803Smarcelif test -f configure.ac; then 36130803Smarcel configure_ac=configure.ac 37130803Smarcelelse 38130803Smarcel configure_ac=configure.in 39130803Smarcelfi 40130803Smarcel 41130803Smarcelcase "$1" in 42130803Smarcel--run) 43130803Smarcel # Try to run requested program, and just exit if it succeeds. 44130803Smarcel run= 45130803Smarcel shift 46130803Smarcel "$@" && exit 0 47130803Smarcel ;; 48130803Smarcelesac 49130803Smarcel 50130803Smarcel# If it does not exist, or fails to run (possibly an outdated version), 51130803Smarcel# try to emulate it. 52130803Smarcelcase "$1" in 53130803Smarcel 54130803Smarcel -h|--h|--he|--hel|--help) 55130803Smarcel echo "\ 56130803Smarcel$0 [OPTION]... PROGRAM [ARGUMENT]... 57130803Smarcel 58130803SmarcelHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 59130803Smarcelerror status if there is no known handling for PROGRAM. 60130803Smarcel 61130803SmarcelOptions: 62130803Smarcel -h, --help display this help and exit 63130803Smarcel -v, --version output version information and exit 64130803Smarcel --run try to run the given command, and emulate it if it fails 65130803Smarcel 66130803SmarcelSupported PROGRAM values: 67130803Smarcel aclocal touch file \`aclocal.m4' 68130803Smarcel autoconf touch file \`configure' 69130803Smarcel autoheader touch file \`config.h.in' 70130803Smarcel automake touch all \`Makefile.in' files 71130803Smarcel bison create \`y.tab.[ch]', if possible, from existing .[ch] 72130803Smarcel flex create \`lex.yy.c', if possible, from existing .c 73130803Smarcel help2man touch the output file 74130803Smarcel lex create \`lex.yy.c', if possible, from existing .c 75130803Smarcel makeinfo touch the output file 76130803Smarcel tar try tar, gnutar, gtar, then tar without non-portable flags 77130803Smarcel yacc create \`y.tab.[ch]', if possible, from existing .[ch]" 78130803Smarcel ;; 79130803Smarcel 80130803Smarcel -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 81130803Smarcel echo "missing 0.4 - GNU automake" 82130803Smarcel ;; 83130803Smarcel 84130803Smarcel -*) 85130803Smarcel echo 1>&2 "$0: Unknown \`$1' option" 86130803Smarcel echo 1>&2 "Try \`$0 --help' for more information" 87130803Smarcel exit 1 88130803Smarcel ;; 89130803Smarcel 90130803Smarcel aclocal*) 91130803Smarcel if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 92130803Smarcel # We have it, but it failed. 93130803Smarcel exit 1 94130803Smarcel fi 95130803Smarcel 96130803Smarcel echo 1>&2 "\ 97130803SmarcelWARNING: \`$1' is missing on your system. You should only need it if 98130803Smarcel you modified \`acinclude.m4' or \`${configure_ac}'. You might want 99130803Smarcel to install the \`Automake' and \`Perl' packages. Grab them from 100130803Smarcel any GNU archive site." 101130803Smarcel touch aclocal.m4 102130803Smarcel ;; 103130803Smarcel 104130803Smarcel autoconf) 105130803Smarcel if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 106130803Smarcel # We have it, but it failed. 107130803Smarcel exit 1 108130803Smarcel fi 109130803Smarcel 110130803Smarcel echo 1>&2 "\ 111130803SmarcelWARNING: \`$1' is missing on your system. You should only need it if 112130803Smarcel you modified \`${configure_ac}'. You might want to install the 113130803Smarcel \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 114130803Smarcel archive site." 115130803Smarcel touch configure 116130803Smarcel ;; 117130803Smarcel 118130803Smarcel autoheader) 119130803Smarcel if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 120130803Smarcel # We have it, but it failed. 121130803Smarcel exit 1 122130803Smarcel fi 123130803Smarcel 124130803Smarcel echo 1>&2 "\ 125130803SmarcelWARNING: \`$1' is missing on your system. You should only need it if 126130803Smarcel you modified \`acconfig.h' or \`${configure_ac}'. You might want 127130803Smarcel to install the \`Autoconf' and \`GNU m4' packages. Grab them 128130803Smarcel from any GNU archive site." 129130803Smarcel files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 130130803Smarcel test -z "$files" && files="config.h" 131130803Smarcel touch_files= 132130803Smarcel for f in $files; do 133130803Smarcel case "$f" in 134130803Smarcel *:*) touch_files="$touch_files "`echo "$f" | 135130803Smarcel sed -e 's/^[^:]*://' -e 's/:.*//'`;; 136130803Smarcel *) touch_files="$touch_files $f.in";; 137130803Smarcel esac 138130803Smarcel done 139130803Smarcel touch $touch_files 140130803Smarcel ;; 141130803Smarcel 142130803Smarcel automake*) 143130803Smarcel if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 144130803Smarcel # We have it, but it failed. 145130803Smarcel exit 1 146130803Smarcel fi 147130803Smarcel 148130803Smarcel echo 1>&2 "\ 149130803SmarcelWARNING: \`$1' is missing on your system. You should only need it if 150130803Smarcel you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 151130803Smarcel You might want to install the \`Automake' and \`Perl' packages. 152130803Smarcel Grab them from any GNU archive site." 153130803Smarcel find . -type f -name Makefile.am -print | 154130803Smarcel sed 's/\.am$/.in/' | 155130803Smarcel while read f; do touch "$f"; done 156130803Smarcel ;; 157130803Smarcel 158130803Smarcel autom4te) 159130803Smarcel if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 160130803Smarcel # We have it, but it failed. 161130803Smarcel exit 1 162130803Smarcel fi 163130803Smarcel 164130803Smarcel echo 1>&2 "\ 165130803SmarcelWARNING: \`$1' is needed, and you do not seem to have it handy on your 166130803Smarcel system. You might have modified some files without having the 167130803Smarcel proper tools for further handling them. 168130803Smarcel You can get \`$1' as part of \`Autoconf' from any GNU 169130803Smarcel archive site." 170130803Smarcel 171130803Smarcel file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 172130803Smarcel test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 173130803Smarcel if test -f "$file"; then 174130803Smarcel touch $file 175130803Smarcel else 176130803Smarcel test -z "$file" || exec >$file 177130803Smarcel echo "#! /bin/sh" 178130803Smarcel echo "# Created by GNU Automake missing as a replacement of" 179130803Smarcel echo "# $ $@" 180130803Smarcel echo "exit 0" 181130803Smarcel chmod +x $file 182130803Smarcel exit 1 183130803Smarcel fi 184130803Smarcel ;; 185130803Smarcel 186130803Smarcel bison|yacc) 187130803Smarcel echo 1>&2 "\ 188130803SmarcelWARNING: \`$1' is missing on your system. You should only need it if 189130803Smarcel you modified a \`.y' file. You may need the \`Bison' package 190130803Smarcel in order for those modifications to take effect. You can get 191130803Smarcel \`Bison' from any GNU archive site." 192130803Smarcel rm -f y.tab.c y.tab.h 193130803Smarcel if [ $# -ne 1 ]; then 194130803Smarcel eval LASTARG="\${$#}" 195130803Smarcel case "$LASTARG" in 196130803Smarcel *.y) 197130803Smarcel SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 198130803Smarcel if [ -f "$SRCFILE" ]; then 199130803Smarcel cp "$SRCFILE" y.tab.c 200130803Smarcel fi 201130803Smarcel SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 202130803Smarcel if [ -f "$SRCFILE" ]; then 203130803Smarcel cp "$SRCFILE" y.tab.h 204130803Smarcel fi 205130803Smarcel ;; 206130803Smarcel esac 207130803Smarcel fi 208130803Smarcel if [ ! -f y.tab.h ]; then 209130803Smarcel echo >y.tab.h 210130803Smarcel fi 211130803Smarcel if [ ! -f y.tab.c ]; then 212130803Smarcel echo 'main() { return 0; }' >y.tab.c 213130803Smarcel fi 214130803Smarcel ;; 215130803Smarcel 216130803Smarcel lex|flex) 217130803Smarcel echo 1>&2 "\ 218130803SmarcelWARNING: \`$1' is missing on your system. You should only need it if 219130803Smarcel you modified a \`.l' file. You may need the \`Flex' package 220130803Smarcel in order for those modifications to take effect. You can get 221130803Smarcel \`Flex' from any GNU archive site." 222130803Smarcel rm -f lex.yy.c 223130803Smarcel if [ $# -ne 1 ]; then 224130803Smarcel eval LASTARG="\${$#}" 225130803Smarcel case "$LASTARG" in 226130803Smarcel *.l) 227130803Smarcel SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 228130803Smarcel if [ -f "$SRCFILE" ]; then 229130803Smarcel cp "$SRCFILE" lex.yy.c 230130803Smarcel fi 231130803Smarcel ;; 232130803Smarcel esac 233130803Smarcel fi 234130803Smarcel if [ ! -f lex.yy.c ]; then 235130803Smarcel echo 'main() { return 0; }' >lex.yy.c 236130803Smarcel fi 237130803Smarcel ;; 238130803Smarcel 239130803Smarcel help2man) 240130803Smarcel if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 241130803Smarcel # We have it, but it failed. 242130803Smarcel exit 1 243130803Smarcel fi 244130803Smarcel 245130803Smarcel echo 1>&2 "\ 246130803SmarcelWARNING: \`$1' is missing on your system. You should only need it if 247130803Smarcel you modified a dependency of a manual page. You may need the 248130803Smarcel \`Help2man' package in order for those modifications to take 249130803Smarcel effect. You can get \`Help2man' from any GNU archive site." 250130803Smarcel 251130803Smarcel file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 252130803Smarcel if test -z "$file"; then 253130803Smarcel file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 254130803Smarcel fi 255130803Smarcel if [ -f "$file" ]; then 256130803Smarcel touch $file 257130803Smarcel else 258130803Smarcel test -z "$file" || exec >$file 259130803Smarcel echo ".ab help2man is required to generate this page" 260130803Smarcel exit 1 261130803Smarcel fi 262130803Smarcel ;; 263130803Smarcel 264130803Smarcel makeinfo) 265130803Smarcel if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then 266130803Smarcel # We have makeinfo, but it failed. 267130803Smarcel exit 1 268130803Smarcel fi 269130803Smarcel 270130803Smarcel echo 1>&2 "\ 271130803SmarcelWARNING: \`$1' is missing on your system. You should only need it if 272130803Smarcel you modified a \`.texi' or \`.texinfo' file, or any other file 273130803Smarcel indirectly affecting the aspect of the manual. The spurious 274130803Smarcel call might also be the consequence of using a buggy \`make' (AIX, 275130803Smarcel DU, IRIX). You might want to install the \`Texinfo' package or 276130803Smarcel the \`GNU make' package. Grab either from any GNU archive site." 277130803Smarcel file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 278130803Smarcel if test -z "$file"; then 279130803Smarcel file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 280130803Smarcel file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` 281130803Smarcel fi 282130803Smarcel touch $file 283130803Smarcel ;; 284130803Smarcel 285130803Smarcel tar) 286130803Smarcel shift 287130803Smarcel if test -n "$run"; then 288130803Smarcel echo 1>&2 "ERROR: \`tar' requires --run" 289130803Smarcel exit 1 290130803Smarcel fi 291130803Smarcel 292130803Smarcel # We have already tried tar in the generic part. 293130803Smarcel # Look for gnutar/gtar before invocation to avoid ugly error 294130803Smarcel # messages. 295130803Smarcel if (gnutar --version > /dev/null 2>&1); then 296130803Smarcel gnutar "$@" && exit 0 297130803Smarcel fi 298130803Smarcel if (gtar --version > /dev/null 2>&1); then 299130803Smarcel gtar "$@" && exit 0 300130803Smarcel fi 301130803Smarcel firstarg="$1" 302130803Smarcel if shift; then 303130803Smarcel case "$firstarg" in 304130803Smarcel *o*) 305130803Smarcel firstarg=`echo "$firstarg" | sed s/o//` 306130803Smarcel tar "$firstarg" "$@" && exit 0 307130803Smarcel ;; 308130803Smarcel esac 309130803Smarcel case "$firstarg" in 310130803Smarcel *h*) 311130803Smarcel firstarg=`echo "$firstarg" | sed s/h//` 312130803Smarcel tar "$firstarg" "$@" && exit 0 313130803Smarcel ;; 314130803Smarcel esac 315130803Smarcel fi 316130803Smarcel 317130803Smarcel echo 1>&2 "\ 318130803SmarcelWARNING: I can't seem to be able to run \`tar' with the given arguments. 319130803Smarcel You may want to install GNU tar or Free paxutils, or check the 320130803Smarcel command line arguments." 321130803Smarcel exit 1 322130803Smarcel ;; 323130803Smarcel 324130803Smarcel *) 325130803Smarcel echo 1>&2 "\ 326130803SmarcelWARNING: \`$1' is needed, and you do not seem to have it handy on your 327130803Smarcel system. You might have modified some files without having the 328130803Smarcel proper tools for further handling them. Check the \`README' file, 329130803Smarcel it often tells you about the needed prerequirements for installing 330130803Smarcel this package. You may also peek at any GNU archive site, in case 331130803Smarcel some other package would contain this missing \`$1' program." 332130803Smarcel exit 1 333130803Smarcel ;; 334130803Smarcelesac 335130803Smarcel 336130803Smarcelexit 0 337