masqmail

annotate missing @ 248:018cfd163f5c

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