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