summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorThomas Wood <thomas.wood@intel.com>2015-03-23 11:46:25 +0000
committerThomas Wood <thomas.wood@intel.com>2015-03-26 15:50:05 +0000
commit76dad7f41475347f99e8a8ce6af67020dfd7c0f1 (patch)
tree07f924ef1695f180b9a6e466c6139c3447648474 /configure.ac
parent277ca2b992c766581ef6ef01ea210808f456fbe0 (diff)
Add default debug flags for tests
Include debugging symbols in tests by default to improve stack traces and also set the compiler optimisation level to improve the debugging experience. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac14
1 files changed, 14 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index b9ecef8d..51595ade 100644
--- a/configure.ac
+++ b/configure.ac
@@ -196,6 +196,19 @@ if test "x$with_libunwind" = xyes; then
AC_MSG_ERROR([libunwind not found. Use --without-libunwind to disable libunwind support.]))
fi
+# enable debug symbols
+AC_ARG_ENABLE(debug,
+ AS_HELP_STRING([--disable-debug],
+ [Build tests without debug symbols]),
+ [], [enable_debug=yes])
+
+if test "x$enable_debug" = xyes; then
+ AS_COMPILER_FLAG([-g3], [DEBUG_CFLAGS="-g3"], [DEBUG_CFLAGS="-g"])
+ AS_COMPILER_FLAG([-Og], [DEBUG_CFLAGS+=" -Og -Wno-maybe-uninitialized"], # disable maybe-uninitialized due to false positives
+ [DEBUG_CFLAGS+=" -O0"])
+ AC_SUBST([DEBUG_CFLAGS])
+fi
+
# -----------------------------------------------------------------------------
# To build multithread code, gcc uses -pthread, Solaris Studio cc uses -mt
@@ -253,6 +266,7 @@ echo " • Tests:"
echo " Build tests : ${BUILD_TESTS}"
echo " Compile prime tests: ${NOUVEAU}"
echo " Print stack traces : ${with_libunwind}"
+echo " Debug flags : ${DEBUG_CFLAGS}"
echo ""
echo " • Tools:"
echo " Assembler : ${enable_assembler}"