[Mesa-dev] [PATCH 2/2] configure: Don't override compiler optimization settings when debugging

Dan Nicholson dbn.lists at gmail.com
Mon Jan 7 05:15:40 PST 2013


As a convenience, --enable-debug will add "-g -O0" to the compiler flags when
GCC is in use. This is helpful but has the drawback that it will override the
user's optimization settings. Instead, only add the convenience "-g -O0" when
the user has not set their compiler flags at all.

Signed-off-by: Dan Nicholson <dbn.lists at gmail.com>
---
 configure.ac |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index eebfef8..bfe551f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -345,18 +345,20 @@ AC_ARG_ENABLE([debug],
 )
 if test "x$enable_debug" = xyes; then
     DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -DDEBUG"
-    if test "x$GCC_FOR_BUILD" = xyes; then
+    if test "x$GCC_FOR_BUILD" = xyes && \
+       test "x$_USER_CFLAGS_FOR_BUILD" = x; then
         CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -g -O0"
     fi
-    if test "x$GXX_FOR_BUILD" = xyes; then
+    if test "x$GXX_FOR_BUILD" = xyes && \
+       test "x$_USER_CXXFLAGS_FOR_BUILD" = x; then
         CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -g -O0"
     fi
 
     DEFINES="$DEFINES -DDEBUG"
-    if test "x$GCC" = xyes; then
+    if test "x$GCC" = xyes && test "x$_USER_CFLAGS" = x; then
         CFLAGS="$CFLAGS -g -O0"
     fi
-    if test "x$GXX" = xyes; then
+    if test "x$GXX" = xyes && test "x$_USER_CXXFLAGS" = x; then
         CXXFLAGS="$CXXFLAGS -g -O0"
     fi
 fi
-- 
1.7.7.6



More information about the mesa-dev mailing list