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