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