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