1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/mythtv_plugin/depcomp Wed Sep 20 23:59:48 2006 +0100
1.3 @@ -0,0 +1,526 @@
1.4 +#! /bin/sh
1.5 +# depcomp - compile a program generating dependencies as side-effects
1.6 +
1.7 +scriptversion=2004-04-25.13
1.8 +
1.9 +# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
1.10 +
1.11 +# This program is free software; you can redistribute it and/or modify
1.12 +# it under the terms of the GNU General Public License as published by
1.13 +# the Free Software Foundation; either version 2, or (at your option)
1.14 +# any later version.
1.15 +
1.16 +# This program is distributed in the hope that it will be useful,
1.17 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1.18 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.19 +# GNU General Public License for more details.
1.20 +
1.21 +# You should have received a copy of the GNU General Public License
1.22 +# along with this program; if not, write to the Free Software
1.23 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1.24 +# 02111-1307, USA.
1.25 +
1.26 +# As a special exception to the GNU General Public License, if you
1.27 +# distribute this file as part of a program that contains a
1.28 +# configuration script generated by Autoconf, you may include it under
1.29 +# the same distribution terms that you use for the rest of that program.
1.30 +
1.31 +# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
1.32 +
1.33 +case $1 in
1.34 + '')
1.35 + echo "$0: No command. Try \`$0 --help' for more information." 1>&2
1.36 + exit 1;
1.37 + ;;
1.38 + -h | --h*)
1.39 + cat <<\EOF
1.40 +Usage: depcomp [--help] [--version] PROGRAM [ARGS]
1.41 +
1.42 +Run PROGRAMS ARGS to compile a file, generating dependencies
1.43 +as side-effects.
1.44 +
1.45 +Environment variables:
1.46 + depmode Dependency tracking mode.
1.47 + source Source file read by `PROGRAMS ARGS'.
1.48 + object Object file output by `PROGRAMS ARGS'.
1.49 + depfile Dependency file to output.
1.50 + tmpdepfile Temporary file to use when outputing dependencies.
1.51 + libtool Whether libtool is used (yes/no).
1.52 +
1.53 +Report bugs to <bug-automake@gnu.org>.
1.54 +EOF
1.55 + exit 0
1.56 + ;;
1.57 + -v | --v*)
1.58 + echo "depcomp $scriptversion"
1.59 + exit 0
1.60 + ;;
1.61 +esac
1.62 +
1.63 +if test -z "$depmode" || test -z "$source" || test -z "$object"; then
1.64 + echo "depcomp: Variables source, object and depmode must be set" 1>&2
1.65 + exit 1
1.66 +fi
1.67 +# `libtool' can also be set to `yes' or `no'.
1.68 +
1.69 +if test -z "$depfile"; then
1.70 + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
1.71 + dir=`echo "$object" | sed 's,/.*$,/,'`
1.72 + if test "$dir" = "$object"; then
1.73 + dir=
1.74 + fi
1.75 + # FIXME: should be _deps on DOS.
1.76 + depfile="$dir.deps/$base"
1.77 +fi
1.78 +
1.79 +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
1.80 +
1.81 +rm -f "$tmpdepfile"
1.82 +
1.83 +# Some modes work just like other modes, but use different flags. We
1.84 +# parameterize here, but still list the modes in the big case below,
1.85 +# to make depend.m4 easier to write. Note that we *cannot* use a case
1.86 +# here, because this file can only contain one case statement.
1.87 +if test "$depmode" = hp; then
1.88 + # HP compiler uses -M and no extra arg.
1.89 + gccflag=-M
1.90 + depmode=gcc
1.91 +fi
1.92 +
1.93 +if test "$depmode" = dashXmstdout; then
1.94 + # This is just like dashmstdout with a different argument.
1.95 + dashmflag=-xM
1.96 + depmode=dashmstdout
1.97 +fi
1.98 +
1.99 +case "$depmode" in
1.100 +gcc3)
1.101 +## gcc 3 implements dependency tracking that does exactly what
1.102 +## we want. Yay! Note: for some reason libtool 1.4 doesn't like
1.103 +## it if -MD -MP comes after the -MF stuff. Hmm.
1.104 + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
1.105 + stat=$?
1.106 + if test $stat -eq 0; then :
1.107 + else
1.108 + rm -f "$tmpdepfile"
1.109 + exit $stat
1.110 + fi
1.111 + mv "$tmpdepfile" "$depfile"
1.112 + ;;
1.113 +
1.114 +gcc)
1.115 +## There are various ways to get dependency output from gcc. Here's
1.116 +## why we pick this rather obscure method:
1.117 +## - Don't want to use -MD because we'd like the dependencies to end
1.118 +## up in a subdir. Having to rename by hand is ugly.
1.119 +## (We might end up doing this anyway to support other compilers.)
1.120 +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
1.121 +## -MM, not -M (despite what the docs say).
1.122 +## - Using -M directly means running the compiler twice (even worse
1.123 +## than renaming).
1.124 + if test -z "$gccflag"; then
1.125 + gccflag=-MD,
1.126 + fi
1.127 + "$@" -Wp,"$gccflag$tmpdepfile"
1.128 + stat=$?
1.129 + if test $stat -eq 0; then :
1.130 + else
1.131 + rm -f "$tmpdepfile"
1.132 + exit $stat
1.133 + fi
1.134 + rm -f "$depfile"
1.135 + echo "$object : \\" > "$depfile"
1.136 + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
1.137 +## The second -e expression handles DOS-style file names with drive letters.
1.138 + sed -e 's/^[^:]*: / /' \
1.139 + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
1.140 +## This next piece of magic avoids the `deleted header file' problem.
1.141 +## The problem is that when a header file which appears in a .P file
1.142 +## is deleted, the dependency causes make to die (because there is
1.143 +## typically no way to rebuild the header). We avoid this by adding
1.144 +## dummy dependencies for each header file. Too bad gcc doesn't do
1.145 +## this for us directly.
1.146 + tr ' ' '
1.147 +' < "$tmpdepfile" |
1.148 +## Some versions of gcc put a space before the `:'. On the theory
1.149 +## that the space means something, we add a space to the output as
1.150 +## well.
1.151 +## Some versions of the HPUX 10.20 sed can't process this invocation
1.152 +## correctly. Breaking it into two sed invocations is a workaround.
1.153 + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
1.154 + rm -f "$tmpdepfile"
1.155 + ;;
1.156 +
1.157 +hp)
1.158 + # This case exists only to let depend.m4 do its work. It works by
1.159 + # looking at the text of this script. This case will never be run,
1.160 + # since it is checked for above.
1.161 + exit 1
1.162 + ;;
1.163 +
1.164 +sgi)
1.165 + if test "$libtool" = yes; then
1.166 + "$@" "-Wp,-MDupdate,$tmpdepfile"
1.167 + else
1.168 + "$@" -MDupdate "$tmpdepfile"
1.169 + fi
1.170 + stat=$?
1.171 + if test $stat -eq 0; then :
1.172 + else
1.173 + rm -f "$tmpdepfile"
1.174 + exit $stat
1.175 + fi
1.176 + rm -f "$depfile"
1.177 +
1.178 + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
1.179 + echo "$object : \\" > "$depfile"
1.180 +
1.181 + # Clip off the initial element (the dependent). Don't try to be
1.182 + # clever and replace this with sed code, as IRIX sed won't handle
1.183 + # lines with more than a fixed number of characters (4096 in
1.184 + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
1.185 + # the IRIX cc adds comments like `#:fec' to the end of the
1.186 + # dependency line.
1.187 + tr ' ' '
1.188 +' < "$tmpdepfile" \
1.189 + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
1.190 + tr '
1.191 +' ' ' >> $depfile
1.192 + echo >> $depfile
1.193 +
1.194 + # The second pass generates a dummy entry for each header file.
1.195 + tr ' ' '
1.196 +' < "$tmpdepfile" \
1.197 + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
1.198 + >> $depfile
1.199 + else
1.200 + # The sourcefile does not contain any dependencies, so just
1.201 + # store a dummy comment line, to avoid errors with the Makefile
1.202 + # "include basename.Plo" scheme.
1.203 + echo "#dummy" > "$depfile"
1.204 + fi
1.205 + rm -f "$tmpdepfile"
1.206 + ;;
1.207 +
1.208 +aix)
1.209 + # The C for AIX Compiler uses -M and outputs the dependencies
1.210 + # in a .u file. In older versions, this file always lives in the
1.211 + # current directory. Also, the AIX compiler puts `$object:' at the
1.212 + # start of each line; $object doesn't have directory information.
1.213 + # Version 6 uses the directory in both cases.
1.214 + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
1.215 + tmpdepfile="$stripped.u"
1.216 + if test "$libtool" = yes; then
1.217 + "$@" -Wc,-M
1.218 + else
1.219 + "$@" -M
1.220 + fi
1.221 + stat=$?
1.222 +
1.223 + if test -f "$tmpdepfile"; then :
1.224 + else
1.225 + stripped=`echo "$stripped" | sed 's,^.*/,,'`
1.226 + tmpdepfile="$stripped.u"
1.227 + fi
1.228 +
1.229 + if test $stat -eq 0; then :
1.230 + else
1.231 + rm -f "$tmpdepfile"
1.232 + exit $stat
1.233 + fi
1.234 +
1.235 + if test -f "$tmpdepfile"; then
1.236 + outname="$stripped.o"
1.237 + # Each line is of the form `foo.o: dependent.h'.
1.238 + # Do two passes, one to just change these to
1.239 + # `$object: dependent.h' and one to simply `dependent.h:'.
1.240 + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
1.241 + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
1.242 + else
1.243 + # The sourcefile does not contain any dependencies, so just
1.244 + # store a dummy comment line, to avoid errors with the Makefile
1.245 + # "include basename.Plo" scheme.
1.246 + echo "#dummy" > "$depfile"
1.247 + fi
1.248 + rm -f "$tmpdepfile"
1.249 + ;;
1.250 +
1.251 +icc)
1.252 + # Intel's C compiler understands `-MD -MF file'. However on
1.253 + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
1.254 + # ICC 7.0 will fill foo.d with something like
1.255 + # foo.o: sub/foo.c
1.256 + # foo.o: sub/foo.h
1.257 + # which is wrong. We want:
1.258 + # sub/foo.o: sub/foo.c
1.259 + # sub/foo.o: sub/foo.h
1.260 + # sub/foo.c:
1.261 + # sub/foo.h:
1.262 + # ICC 7.1 will output
1.263 + # foo.o: sub/foo.c sub/foo.h
1.264 + # and will wrap long lines using \ :
1.265 + # foo.o: sub/foo.c ... \
1.266 + # sub/foo.h ... \
1.267 + # ...
1.268 +
1.269 + "$@" -MD -MF "$tmpdepfile"
1.270 + stat=$?
1.271 + if test $stat -eq 0; then :
1.272 + else
1.273 + rm -f "$tmpdepfile"
1.274 + exit $stat
1.275 + fi
1.276 + rm -f "$depfile"
1.277 + # Each line is of the form `foo.o: dependent.h',
1.278 + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
1.279 + # Do two passes, one to just change these to
1.280 + # `$object: dependent.h' and one to simply `dependent.h:'.
1.281 + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
1.282 + # Some versions of the HPUX 10.20 sed can't process this invocation
1.283 + # correctly. Breaking it into two sed invocations is a workaround.
1.284 + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
1.285 + sed -e 's/$/ :/' >> "$depfile"
1.286 + rm -f "$tmpdepfile"
1.287 + ;;
1.288 +
1.289 +tru64)
1.290 + # The Tru64 compiler uses -MD to generate dependencies as a side
1.291 + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
1.292 + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
1.293 + # dependencies in `foo.d' instead, so we check for that too.
1.294 + # Subdirectories are respected.
1.295 + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
1.296 + test "x$dir" = "x$object" && dir=
1.297 + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
1.298 +
1.299 + if test "$libtool" = yes; then
1.300 + # Dependencies are output in .lo.d with libtool 1.4.
1.301 + # They are output in .o.d with libtool 1.5.
1.302 + tmpdepfile1="$dir.libs/$base.lo.d"
1.303 + tmpdepfile2="$dir.libs/$base.o.d"
1.304 + tmpdepfile3="$dir.libs/$base.d"
1.305 + "$@" -Wc,-MD
1.306 + else
1.307 + tmpdepfile1="$dir$base.o.d"
1.308 + tmpdepfile2="$dir$base.d"
1.309 + tmpdepfile3="$dir$base.d"
1.310 + "$@" -MD
1.311 + fi
1.312 +
1.313 + stat=$?
1.314 + if test $stat -eq 0; then :
1.315 + else
1.316 + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
1.317 + exit $stat
1.318 + fi
1.319 +
1.320 + if test -f "$tmpdepfile1"; then
1.321 + tmpdepfile="$tmpdepfile1"
1.322 + elif test -f "$tmpdepfile2"; then
1.323 + tmpdepfile="$tmpdepfile2"
1.324 + else
1.325 + tmpdepfile="$tmpdepfile3"
1.326 + fi
1.327 + if test -f "$tmpdepfile"; then
1.328 + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
1.329 + # That's a tab and a space in the [].
1.330 + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
1.331 + else
1.332 + echo "#dummy" > "$depfile"
1.333 + fi
1.334 + rm -f "$tmpdepfile"
1.335 + ;;
1.336 +
1.337 +#nosideeffect)
1.338 + # This comment above is used by automake to tell side-effect
1.339 + # dependency tracking mechanisms from slower ones.
1.340 +
1.341 +dashmstdout)
1.342 + # Important note: in order to support this mode, a compiler *must*
1.343 + # always write the preprocessed file to stdout, regardless of -o.
1.344 + "$@" || exit $?
1.345 +
1.346 + # Remove the call to Libtool.
1.347 + if test "$libtool" = yes; then
1.348 + while test $1 != '--mode=compile'; do
1.349 + shift
1.350 + done
1.351 + shift
1.352 + fi
1.353 +
1.354 + # Remove `-o $object'.
1.355 + IFS=" "
1.356 + for arg
1.357 + do
1.358 + case $arg in
1.359 + -o)
1.360 + shift
1.361 + ;;
1.362 + $object)
1.363 + shift
1.364 + ;;
1.365 + *)
1.366 + set fnord "$@" "$arg"
1.367 + shift # fnord
1.368 + shift # $arg
1.369 + ;;
1.370 + esac
1.371 + done
1.372 +
1.373 + test -z "$dashmflag" && dashmflag=-M
1.374 + # Require at least two characters before searching for `:'
1.375 + # in the target name. This is to cope with DOS-style filenames:
1.376 + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
1.377 + "$@" $dashmflag |
1.378 + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
1.379 + rm -f "$depfile"
1.380 + cat < "$tmpdepfile" > "$depfile"
1.381 + tr ' ' '
1.382 +' < "$tmpdepfile" | \
1.383 +## Some versions of the HPUX 10.20 sed can't process this invocation
1.384 +## correctly. Breaking it into two sed invocations is a workaround.
1.385 + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
1.386 + rm -f "$tmpdepfile"
1.387 + ;;
1.388 +
1.389 +dashXmstdout)
1.390 + # This case only exists to satisfy depend.m4. It is never actually
1.391 + # run, as this mode is specially recognized in the preamble.
1.392 + exit 1
1.393 + ;;
1.394 +
1.395 +makedepend)
1.396 + "$@" || exit $?
1.397 + # Remove any Libtool call
1.398 + if test "$libtool" = yes; then
1.399 + while test $1 != '--mode=compile'; do
1.400 + shift
1.401 + done
1.402 + shift
1.403 + fi
1.404 + # X makedepend
1.405 + shift
1.406 + cleared=no
1.407 + for arg in "$@"; do
1.408 + case $cleared in
1.409 + no)
1.410 + set ""; shift
1.411 + cleared=yes ;;
1.412 + esac
1.413 + case "$arg" in
1.414 + -D*|-I*)
1.415 + set fnord "$@" "$arg"; shift ;;
1.416 + # Strip any option that makedepend may not understand. Remove
1.417 + # the object too, otherwise makedepend will parse it as a source file.
1.418 + -*|$object)
1.419 + ;;
1.420 + *)
1.421 + set fnord "$@" "$arg"; shift ;;
1.422 + esac
1.423 + done
1.424 + obj_suffix="`echo $object | sed 's/^.*\././'`"
1.425 + touch "$tmpdepfile"
1.426 + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
1.427 + rm -f "$depfile"
1.428 + cat < "$tmpdepfile" > "$depfile"
1.429 + sed '1,2d' "$tmpdepfile" | tr ' ' '
1.430 +' | \
1.431 +## Some versions of the HPUX 10.20 sed can't process this invocation
1.432 +## correctly. Breaking it into two sed invocations is a workaround.
1.433 + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
1.434 + rm -f "$tmpdepfile" "$tmpdepfile".bak
1.435 + ;;
1.436 +
1.437 +cpp)
1.438 + # Important note: in order to support this mode, a compiler *must*
1.439 + # always write the preprocessed file to stdout.
1.440 + "$@" || exit $?
1.441 +
1.442 + # Remove the call to Libtool.
1.443 + if test "$libtool" = yes; then
1.444 + while test $1 != '--mode=compile'; do
1.445 + shift
1.446 + done
1.447 + shift
1.448 + fi
1.449 +
1.450 + # Remove `-o $object'.
1.451 + IFS=" "
1.452 + for arg
1.453 + do
1.454 + case $arg in
1.455 + -o)
1.456 + shift
1.457 + ;;
1.458 + $object)
1.459 + shift
1.460 + ;;
1.461 + *)
1.462 + set fnord "$@" "$arg"
1.463 + shift # fnord
1.464 + shift # $arg
1.465 + ;;
1.466 + esac
1.467 + done
1.468 +
1.469 + "$@" -E |
1.470 + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
1.471 + sed '$ s: \\$::' > "$tmpdepfile"
1.472 + rm -f "$depfile"
1.473 + echo "$object : \\" > "$depfile"
1.474 + cat < "$tmpdepfile" >> "$depfile"
1.475 + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
1.476 + rm -f "$tmpdepfile"
1.477 + ;;
1.478 +
1.479 +msvisualcpp)
1.480 + # Important note: in order to support this mode, a compiler *must*
1.481 + # always write the preprocessed file to stdout, regardless of -o,
1.482 + # because we must use -o when running libtool.
1.483 + "$@" || exit $?
1.484 + IFS=" "
1.485 + for arg
1.486 + do
1.487 + case "$arg" in
1.488 + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
1.489 + set fnord "$@"
1.490 + shift
1.491 + shift
1.492 + ;;
1.493 + *)
1.494 + set fnord "$@" "$arg"
1.495 + shift
1.496 + shift
1.497 + ;;
1.498 + esac
1.499 + done
1.500 + "$@" -E |
1.501 + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
1.502 + rm -f "$depfile"
1.503 + echo "$object : \\" > "$depfile"
1.504 + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
1.505 + echo " " >> "$depfile"
1.506 + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
1.507 + rm -f "$tmpdepfile"
1.508 + ;;
1.509 +
1.510 +none)
1.511 + exec "$@"
1.512 + ;;
1.513 +
1.514 +*)
1.515 + echo "Unknown depmode $depmode" 1>&2
1.516 + exit 1
1.517 + ;;
1.518 +esac
1.519 +
1.520 +exit 0
1.521 +
1.522 +# Local Variables:
1.523 +# mode: shell-script
1.524 +# sh-indentation: 2
1.525 +# eval: (add-hook 'write-file-hooks 'time-stamp)
1.526 +# time-stamp-start: "scriptversion="
1.527 +# time-stamp-format: "%:y-%02m-%02d.%02H"
1.528 +# time-stamp-end: "$"
1.529 +# End: