annotate missing @ 0:d39e1d0d75b6

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