--- /dev/null
+#! /bin/sh\r
+# depcomp - compile a program generating dependencies as side-effects\r
+\r
+scriptversion=2005-07-09.11\r
+\r
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.\r
+\r
+# This program is free software; you can redistribute it and/or modify\r
+# it under the terms of the GNU General Public License as published by\r
+# the Free Software Foundation; either version 2, or (at your option)\r
+# any later version.\r
+\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+\r
+# You should have received a copy of the GNU General Public License\r
+# along with this program; if not, write to the Free Software\r
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
+# 02110-1301, USA.\r
+\r
+# As a special exception to the GNU General Public License, if you\r
+# distribute this file as part of a program that contains a\r
+# configuration script generated by Autoconf, you may include it under\r
+# the same distribution terms that you use for the rest of that program.\r
+\r
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.\r
+\r
+case $1 in\r
+ '')\r
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2\r
+ exit 1;\r
+ ;;\r
+ -h | --h*)\r
+ cat <<\EOF\r
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]\r
+\r
+Run PROGRAMS ARGS to compile a file, generating dependencies\r
+as side-effects.\r
+\r
+Environment variables:\r
+ depmode Dependency tracking mode.\r
+ source Source file read by `PROGRAMS ARGS'.\r
+ object Object file output by `PROGRAMS ARGS'.\r
+ DEPDIR directory where to store dependencies.\r
+ depfile Dependency file to output.\r
+ tmpdepfile Temporary file to use when outputing dependencies.\r
+ libtool Whether libtool is used (yes/no).\r
+\r
+Report bugs to <bug-automake@gnu.org>.\r
+EOF\r
+ exit $?\r
+ ;;\r
+ -v | --v*)\r
+ echo "depcomp $scriptversion"\r
+ exit $?\r
+ ;;\r
+esac\r
+\r
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then\r
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2\r
+ exit 1\r
+fi\r
+\r
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.\r
+depfile=${depfile-`echo "$object" |\r
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}\r
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}\r
+\r
+rm -f "$tmpdepfile"\r
+\r
+# Some modes work just like other modes, but use different flags. We\r
+# parameterize here, but still list the modes in the big case below,\r
+# to make depend.m4 easier to write. Note that we *cannot* use a case\r
+# here, because this file can only contain one case statement.\r
+if test "$depmode" = hp; then\r
+ # HP compiler uses -M and no extra arg.\r
+ gccflag=-M\r
+ depmode=gcc\r
+fi\r
+\r
+if test "$depmode" = dashXmstdout; then\r
+ # This is just like dashmstdout with a different argument.\r
+ dashmflag=-xM\r
+ depmode=dashmstdout\r
+fi\r
+\r
+case "$depmode" in\r
+gcc3)\r
+## gcc 3 implements dependency tracking that does exactly what\r
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like\r
+## it if -MD -MP comes after the -MF stuff. Hmm.\r
+ "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"\r
+ stat=$?\r
+ if test $stat -eq 0; then :\r
+ else\r
+ rm -f "$tmpdepfile"\r
+ exit $stat\r
+ fi\r
+ mv "$tmpdepfile" "$depfile"\r
+ ;;\r
+\r
+gcc)\r
+## There are various ways to get dependency output from gcc. Here's\r
+## why we pick this rather obscure method:\r
+## - Don't want to use -MD because we'd like the dependencies to end\r
+## up in a subdir. Having to rename by hand is ugly.\r
+## (We might end up doing this anyway to support other compilers.)\r
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like\r
+## -MM, not -M (despite what the docs say).\r
+## - Using -M directly means running the compiler twice (even worse\r
+## than renaming).\r
+ if test -z "$gccflag"; then\r
+ gccflag=-MD,\r
+ fi\r
+ "$@" -Wp,"$gccflag$tmpdepfile"\r
+ stat=$?\r
+ if test $stat -eq 0; then :\r
+ else\r
+ rm -f "$tmpdepfile"\r
+ exit $stat\r
+ fi\r
+ rm -f "$depfile"\r
+ echo "$object : \\" > "$depfile"\r
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\r
+## The second -e expression handles DOS-style file names with drive letters.\r
+ sed -e 's/^[^:]*: / /' \\r
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"\r
+## This next piece of magic avoids the `deleted header file' problem.\r
+## The problem is that when a header file which appears in a .P file\r
+## is deleted, the dependency causes make to die (because there is\r
+## typically no way to rebuild the header). We avoid this by adding\r
+## dummy dependencies for each header file. Too bad gcc doesn't do\r
+## this for us directly.\r
+ tr ' ' '\r
+' < "$tmpdepfile" |\r
+## Some versions of gcc put a space before the `:'. On the theory\r
+## that the space means something, we add a space to the output as\r
+## well.\r
+## Some versions of the HPUX 10.20 sed can't process this invocation\r
+## correctly. Breaking it into two sed invocations is a workaround.\r
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"\r
+ rm -f "$tmpdepfile"\r
+ ;;\r
+\r
+hp)\r
+ # This case exists only to let depend.m4 do its work. It works by\r
+ # looking at the text of this script. This case will never be run,\r
+ # since it is checked for above.\r
+ exit 1\r
+ ;;\r
+\r
+sgi)\r
+ if test "$libtool" = yes; then\r
+ "$@" "-Wp,-MDupdate,$tmpdepfile"\r
+ else\r
+ "$@" -MDupdate "$tmpdepfile"\r
+ fi\r
+ stat=$?\r
+ if test $stat -eq 0; then :\r
+ else\r
+ rm -f "$tmpdepfile"\r
+ exit $stat\r
+ fi\r
+ rm -f "$depfile"\r
+\r
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files\r
+ echo "$object : \\" > "$depfile"\r
+\r
+ # Clip off the initial element (the dependent). Don't try to be\r
+ # clever and replace this with sed code, as IRIX sed won't handle\r
+ # lines with more than a fixed number of characters (4096 in\r
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;\r
+ # the IRIX cc adds comments like `#:fec' to the end of the\r
+ # dependency line.\r
+ tr ' ' '\r
+' < "$tmpdepfile" \\r
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \\r
+ tr '\r
+' ' ' >> $depfile\r
+ echo >> $depfile\r
+\r
+ # The second pass generates a dummy entry for each header file.\r
+ tr ' ' '\r
+' < "$tmpdepfile" \\r
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \\r
+ >> $depfile\r
+ else\r
+ # The sourcefile does not contain any dependencies, so just\r
+ # store a dummy comment line, to avoid errors with the Makefile\r
+ # "include basename.Plo" scheme.\r
+ echo "#dummy" > "$depfile"\r
+ fi\r
+ rm -f "$tmpdepfile"\r
+ ;;\r
+\r
+aix)\r
+ # The C for AIX Compiler uses -M and outputs the dependencies\r
+ # in a .u file. In older versions, this file always lives in the\r
+ # current directory. Also, the AIX compiler puts `$object:' at the\r
+ # start of each line; $object doesn't have directory information.\r
+ # Version 6 uses the directory in both cases.\r
+ stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`\r
+ tmpdepfile="$stripped.u"\r
+ if test "$libtool" = yes; then\r
+ "$@" -Wc,-M\r
+ else\r
+ "$@" -M\r
+ fi\r
+ stat=$?\r
+\r
+ if test -f "$tmpdepfile"; then :\r
+ else\r
+ stripped=`echo "$stripped" | sed 's,^.*/,,'`\r
+ tmpdepfile="$stripped.u"\r
+ fi\r
+\r
+ if test $stat -eq 0; then :\r
+ else\r
+ rm -f "$tmpdepfile"\r
+ exit $stat\r
+ fi\r
+\r
+ if test -f "$tmpdepfile"; then\r
+ outname="$stripped.o"\r
+ # Each line is of the form `foo.o: dependent.h'.\r
+ # Do two passes, one to just change these to\r
+ # `$object: dependent.h' and one to simply `dependent.h:'.\r
+ sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"\r
+ sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"\r
+ else\r
+ # The sourcefile does not contain any dependencies, so just\r
+ # store a dummy comment line, to avoid errors with the Makefile\r
+ # "include basename.Plo" scheme.\r
+ echo "#dummy" > "$depfile"\r
+ fi\r
+ rm -f "$tmpdepfile"\r
+ ;;\r
+\r
+icc)\r
+ # Intel's C compiler understands `-MD -MF file'. However on\r
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c\r
+ # ICC 7.0 will fill foo.d with something like\r
+ # foo.o: sub/foo.c\r
+ # foo.o: sub/foo.h\r
+ # which is wrong. We want:\r
+ # sub/foo.o: sub/foo.c\r
+ # sub/foo.o: sub/foo.h\r
+ # sub/foo.c:\r
+ # sub/foo.h:\r
+ # ICC 7.1 will output\r
+ # foo.o: sub/foo.c sub/foo.h\r
+ # and will wrap long lines using \ :\r
+ # foo.o: sub/foo.c ... \\r
+ # sub/foo.h ... \\r
+ # ...\r
+\r
+ "$@" -MD -MF "$tmpdepfile"\r
+ stat=$?\r
+ if test $stat -eq 0; then :\r
+ else\r
+ rm -f "$tmpdepfile"\r
+ exit $stat\r
+ fi\r
+ rm -f "$depfile"\r
+ # Each line is of the form `foo.o: dependent.h',\r
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.\r
+ # Do two passes, one to just change these to\r
+ # `$object: dependent.h' and one to simply `dependent.h:'.\r
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"\r
+ # Some versions of the HPUX 10.20 sed can't process this invocation\r
+ # correctly. Breaking it into two sed invocations is a workaround.\r
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |\r
+ sed -e 's/$/ :/' >> "$depfile"\r
+ rm -f "$tmpdepfile"\r
+ ;;\r
+\r
+tru64)\r
+ # The Tru64 compiler uses -MD to generate dependencies as a side\r
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.\r
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put\r
+ # dependencies in `foo.d' instead, so we check for that too.\r
+ # Subdirectories are respected.\r
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`\r
+ test "x$dir" = "x$object" && dir=\r
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`\r
+\r
+ if test "$libtool" = yes; then\r
+ # With Tru64 cc, shared objects can also be used to make a\r
+ # static library. This mecanism is used in libtool 1.4 series to\r
+ # handle both shared and static libraries in a single compilation.\r
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.\r
+ #\r
+ # With libtool 1.5 this exception was removed, and libtool now\r
+ # generates 2 separate objects for the 2 libraries. These two\r
+ # compilations output dependencies in in $dir.libs/$base.o.d and\r
+ # in $dir$base.o.d. We have to check for both files, because\r
+ # one of the two compilations can be disabled. We should prefer\r
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is\r
+ # automatically cleaned when .libs/ is deleted, while ignoring\r
+ # the former would cause a distcleancheck panic.\r
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4\r
+ tmpdepfile2=$dir$base.o.d # libtool 1.5\r
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5\r
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504\r
+ "$@" -Wc,-MD\r
+ else\r
+ tmpdepfile1=$dir$base.o.d\r
+ tmpdepfile2=$dir$base.d\r
+ tmpdepfile3=$dir$base.d\r
+ tmpdepfile4=$dir$base.d\r
+ "$@" -MD\r
+ fi\r
+\r
+ stat=$?\r
+ if test $stat -eq 0; then :\r
+ else\r
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"\r
+ exit $stat\r
+ fi\r
+\r
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"\r
+ do\r
+ test -f "$tmpdepfile" && break\r
+ done\r
+ if test -f "$tmpdepfile"; then\r
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"\r
+ # That's a tab and a space in the [].\r
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"\r
+ else\r
+ echo "#dummy" > "$depfile"\r
+ fi\r
+ rm -f "$tmpdepfile"\r
+ ;;\r
+\r
+#nosideeffect)\r
+ # This comment above is used by automake to tell side-effect\r
+ # dependency tracking mechanisms from slower ones.\r
+\r
+dashmstdout)\r
+ # Important note: in order to support this mode, a compiler *must*\r
+ # always write the preprocessed file to stdout, regardless of -o.\r
+ "$@" || exit $?\r
+\r
+ # Remove the call to Libtool.\r
+ if test "$libtool" = yes; then\r
+ while test $1 != '--mode=compile'; do\r
+ shift\r
+ done\r
+ shift\r
+ fi\r
+\r
+ # Remove `-o $object'.\r
+ IFS=" "\r
+ for arg\r
+ do\r
+ case $arg in\r
+ -o)\r
+ shift\r
+ ;;\r
+ $object)\r
+ shift\r
+ ;;\r
+ *)\r
+ set fnord "$@" "$arg"\r
+ shift # fnord\r
+ shift # $arg\r
+ ;;\r
+ esac\r
+ done\r
+\r
+ test -z "$dashmflag" && dashmflag=-M\r
+ # Require at least two characters before searching for `:'\r
+ # in the target name. This is to cope with DOS-style filenames:\r
+ # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.\r
+ "$@" $dashmflag |\r
+ sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"\r
+ rm -f "$depfile"\r
+ cat < "$tmpdepfile" > "$depfile"\r
+ tr ' ' '\r
+' < "$tmpdepfile" | \\r
+## Some versions of the HPUX 10.20 sed can't process this invocation\r
+## correctly. Breaking it into two sed invocations is a workaround.\r
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"\r
+ rm -f "$tmpdepfile"\r
+ ;;\r
+\r
+dashXmstdout)\r
+ # This case only exists to satisfy depend.m4. It is never actually\r
+ # run, as this mode is specially recognized in the preamble.\r
+ exit 1\r
+ ;;\r
+\r
+makedepend)\r
+ "$@" || exit $?\r
+ # Remove any Libtool call\r
+ if test "$libtool" = yes; then\r
+ while test $1 != '--mode=compile'; do\r
+ shift\r
+ done\r
+ shift\r
+ fi\r
+ # X makedepend\r
+ shift\r
+ cleared=no\r
+ for arg in "$@"; do\r
+ case $cleared in\r
+ no)\r
+ set ""; shift\r
+ cleared=yes ;;\r
+ esac\r
+ case "$arg" in\r
+ -D*|-I*)\r
+ set fnord "$@" "$arg"; shift ;;\r
+ # Strip any option that makedepend may not understand. Remove\r
+ # the object too, otherwise makedepend will parse it as a source file.\r
+ -*|$object)\r
+ ;;\r
+ *)\r
+ set fnord "$@" "$arg"; shift ;;\r
+ esac\r
+ done\r
+ obj_suffix="`echo $object | sed 's/^.*\././'`"\r
+ touch "$tmpdepfile"\r
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"\r
+ rm -f "$depfile"\r
+ cat < "$tmpdepfile" > "$depfile"\r
+ sed '1,2d' "$tmpdepfile" | tr ' ' '\r
+' | \\r
+## Some versions of the HPUX 10.20 sed can't process this invocation\r
+## correctly. Breaking it into two sed invocations is a workaround.\r
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"\r
+ rm -f "$tmpdepfile" "$tmpdepfile".bak\r
+ ;;\r
+\r
+cpp)\r
+ # Important note: in order to support this mode, a compiler *must*\r
+ # always write the preprocessed file to stdout.\r
+ "$@" || exit $?\r
+\r
+ # Remove the call to Libtool.\r
+ if test "$libtool" = yes; then\r
+ while test $1 != '--mode=compile'; do\r
+ shift\r
+ done\r
+ shift\r
+ fi\r
+\r
+ # Remove `-o $object'.\r
+ IFS=" "\r
+ for arg\r
+ do\r
+ case $arg in\r
+ -o)\r
+ shift\r
+ ;;\r
+ $object)\r
+ shift\r
+ ;;\r
+ *)\r
+ set fnord "$@" "$arg"\r
+ shift # fnord\r
+ shift # $arg\r
+ ;;\r
+ esac\r
+ done\r
+\r
+ "$@" -E |\r
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \\r
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |\r
+ sed '$ s: \\$::' > "$tmpdepfile"\r
+ rm -f "$depfile"\r
+ echo "$object : \\" > "$depfile"\r
+ cat < "$tmpdepfile" >> "$depfile"\r
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"\r
+ rm -f "$tmpdepfile"\r
+ ;;\r
+\r
+msvisualcpp)\r
+ # Important note: in order to support this mode, a compiler *must*\r
+ # always write the preprocessed file to stdout, regardless of -o,\r
+ # because we must use -o when running libtool.\r
+ "$@" || exit $?\r
+ IFS=" "\r
+ for arg\r
+ do\r
+ case "$arg" in\r
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")\r
+ set fnord "$@"\r
+ shift\r
+ shift\r
+ ;;\r
+ *)\r
+ set fnord "$@" "$arg"\r
+ shift\r
+ shift\r
+ ;;\r
+ esac\r
+ done\r
+ "$@" -E |\r
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"\r
+ rm -f "$depfile"\r
+ echo "$object : \\" > "$depfile"\r
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"\r
+ echo " " >> "$depfile"\r
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"\r
+ rm -f "$tmpdepfile"\r
+ ;;\r
+\r
+none)\r
+ exec "$@"\r
+ ;;\r
+\r
+*)\r
+ echo "Unknown depmode $depmode" 1>&2\r
+ exit 1\r
+ ;;\r
+esac\r
+\r
+exit 0\r
+\r
+# Local Variables:\r
+# mode: shell-script\r
+# sh-indentation: 2\r
+# eval: (add-hook 'write-file-hooks 'time-stamp)\r
+# time-stamp-start: "scriptversion="\r
+# time-stamp-format: "%:y-%02m-%02d.%02H"\r
+# time-stamp-end: "$"\r
+# End:\r