From 4c7e1bd99ca8a6c2a4062cfcf9611395eda18392 Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo Date: Sun, 9 Nov 2014 10:43:56 +1000 Subject: [PATCH] configure.ac : Add detection of -fsanitizer=undefined. Both Clang and GCC-4.9 now support the undefined behaviour sanitizer so detect and enable it when configuring with --enable-sanitizer. Also improve configure reporting of sanitizer and stack smash protection. --- configure.ac | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 52bc3e11..c01ff6f5 100644 --- a/configure.ac +++ b/configure.ac @@ -138,7 +138,7 @@ AC_ARG_ENABLE(test-coverage, AM_CONDITIONAL([ENABLE_TEST_COVERAGE], [test "$enable_test_coverage" = yes]) AC_ARG_ENABLE(sanitizer, - AC_HELP_STRING([--sanitizer], [enable ggc/clang code sanitizier runtime checks])) + AC_HELP_STRING([--enable-sanitizer], [enable ggc/clang code sanitizier runtime checks])) #==================================================================================== # Check types and their sizes. @@ -579,11 +579,13 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then if test x$enable_sanitizer = "xyes" ; then MN_ADD_CFLAGS([-fsanitize=address]) MN_ADD_CFLAGS([-fsanitize=integer]) + MN_ADD_CFLAGS([-fsanitize=undefined]) # If we enable it for the C compiler we have to do it for the C++ compiler as well. AC_LANG_PUSH([C++]) MN_ADD_CXXFLAGS([-fsanitize=address]) MN_ADD_CXXFLAGS([-fsanitize=integer]) + MN_ADD_CXXFLAGS([-fsanitize=undefined]) AC_LANG_POP([C++]) fi @@ -707,6 +709,8 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then echo " ** Compile with GCC version 3.X or above to avoid this problem." fi fi +echo " Sanitizer enabled : ................... ${enable_sanitizer:-no}" +echo " Stack smash protection : .............. ${enable_stack_smash_protection:-no}" ./echo-install-dirs