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