[Mesa-dev] [PATCH] configure.ac: Introduce --disable-optimizations

Emil Velikov emil.l.velikov at gmail.com
Tue Jan 8 11:26:05 PST 2013


Allows us to easily disable compiler optimizations without directly dealing
with C{,XX}FLAGS

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 configure.ac | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/configure.ac b/configure.ac
index 1414ce8..4d96ba0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -356,6 +356,28 @@ if test "x$enable_debug" = xyes; then
     fi
 fi
 
+AC_ARG_ENABLE([optimizations],
+    [AS_HELP_STRING([--disable-optimizations],
+        [set compiler optimization level to -O0 @<:@default=enabled@:>@])],
+    [disable_optimizations="$enableval"],
+    [disable_optimizations=no]
+)
+if test "x$disable_optimizations" = xyes; then
+    if test "x$GCC_FOR_BUILD" = xyes; then
+        CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -O0"
+    fi
+    if test "x$GXX_FOR_BUILD" = xyes; then
+        CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -O0"
+    fi
+
+    if test "x$GCC" = xyes; then
+        CFLAGS="$CFLAGS -O0"
+    fi
+    if test "x$GXX" = xyes; then
+        CXXFLAGS="$CXXFLAGS -O0"
+    fi
+fi
+
 dnl
 dnl library names
 dnl
-- 
1.8.1



More information about the mesa-dev mailing list