Fixed bug #828
authorSam Lantinga <slouken@libsdl.org>
Thu, 08 Oct 2009 09:07:58 +0000
changeset 3354 98c5b421426e
parent 3353 6b14223dd5c7
child 3355 3c9e6f2f3c58
Fixed bug #828 Added support for --disable-dependency-tracking to configure.in
configure.in
--- a/configure.in	Thu Oct 08 07:08:45 2009 +0000
+++ b/configure.in	Thu Oct 08 09:07:58 2009 +0000
@@ -109,6 +109,29 @@
 AC_C_INLINE
 AC_C_VOLATILE
 
+dnl See whether we can use gcc style dependency tracking
+AC_ARG_ENABLE(dependency-tracking,
+AC_HELP_STRING([--enable-dependency-tracking],
+               [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
+              , enable_dependency_tracking=yes)
+if test x$enable_dependency_tracking = xyes; then
+    have_gcc_mmd_mt=no
+    AC_MSG_CHECKING(for GCC -MMD -MT option)
+    AC_TRY_COMPILE([
+    #if !defined(__GNUC__) || __GNUC__ < 3
+    #error Dependency tracking requires GCC 3.0 or newer
+    #endif
+    ],[
+    ],[
+    have_gcc_mmd_mt=yes
+    ])
+    AC_MSG_RESULT($have_gcc_mmd_mt)
+
+    if test x$have_gcc_mmd_mt = xyes; then
+        DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
+    fi
+fi
+    
 dnl See whether we are allowed to use the system C library
 AC_ARG_ENABLE(libc,
 AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
@@ -2781,7 +2804,7 @@
     OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
     DEPENDS=`echo "$DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.'$EXT',\\
 $(objects)/\2.lo: \1/\2.'$EXT'\\
-	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -MMD -MT \$@ -c \$< -o \$@,g'`
+	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c $< -o $@,g'`
 done
 
 VERSION_OBJECTS=`echo $VERSION_SOURCES`
@@ -2796,7 +2819,7 @@
 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
 $(objects)/\2.o: \1/\2.c\\
-	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -MMD -MT \$@ -c \$< -o \$@,g'`
+	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c $< -o $@,g'`
 
 # Set runtime shared library paths as needed