diff configure.in @ 3354:98c5b421426e

Fixed bug #828 Added support for --disable-dependency-tracking to configure.in
author Sam Lantinga <slouken@libsdl.org>
date Thu, 08 Oct 2009 09:07:58 +0000
parents 8e0182c236d8
children 1164528004ff
line wrap: on
line diff
--- 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