From 18e613e795cc5228acf4bb4fbe4572e4fcdc81ee Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cl=C3=A9ment=20DAVID?= Date: Thu, 16 May 2019 22:05:15 +0200 Subject: [PATCH] Linux: fix build after e78c5951 - ASAN support * reset CFLAGS to the previous one * disable ASAN by default Change-Id: I506fccc527b5925c8c25833c3ccdb5b11aea55ab --- scilab/configure | 15 ++++++--------- scilab/m4/compiler.m4 | 14 +++++--------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/scilab/configure b/scilab/configure index 2bf33f1..0bf3627 100755 --- a/scilab/configure +++ b/scilab/configure @@ -49885,6 +49885,7 @@ fi # Check if -fsanitize=address is supported at compile time and link time +saved_CFLAGS="$CFLAGS" saved_LDFLAGS="$LDFLAGS" asan_supported=no @@ -49906,7 +49907,7 @@ See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -const char hw[] = "Hello, World\n"; +const char hw[] = "Hello, AddressSanitizer\n"; #ifdef F77_DUMMY_MAIN # ifdef __cplusplus @@ -49941,21 +49942,17 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu +CFLAGS="$saved_CFLAGS" LDFLAGS="$saved_LDFLAGS" -if test "x$asan_supported" == "xno" -a "x$enable_address_sanitizer" == "xyes"; - then +if test "x$asan_supported" == "xno" -a "x$enable_address_sanitizer" == "xyes"; then as_fn_error $? "The $CC compiler does not support the options -fsanitize=address . Update your compiler and/or install the AddressSanitizer runtime library." "$LINENO" 5 -fi - -if test "x$asan_supported" == "xno"; - then - echo "fsanitize=address not supported, AddressSanitizer disabled" - else +elif test "x$enable_address_sanitizer" == "xyes"; then COMPILER_CFLAGS="$COMPILER_CFLAGS -fsanitize=address" COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -fsanitize=address" COMPILER_LDFLAGS="$COMPILER_LDFLAGS -fsanitize=address" fi + if test "x$enable_address_sanitizer" == "xyes"; then USE_ADDRESS_SANITIZER_TRUE= USE_ADDRESS_SANITIZER_FALSE='#' diff --git a/scilab/m4/compiler.m4 b/scilab/m4/compiler.m4 index 7eec777..2c2a09f 100644 --- a/scilab/m4/compiler.m4 +++ b/scilab/m4/compiler.m4 @@ -82,6 +82,7 @@ AC_ARG_ENABLE(address-sanitizer, AS_HELP_STRING([--enable-address-sanitizer], [Enable AddressSanitizer instrumentation])) # Check if -fsanitize=address is supported at compile time and link time +saved_CFLAGS="$CFLAGS" saved_LDFLAGS="$LDFLAGS" asan_supported=no @@ -89,19 +90,14 @@ CFLAGS="$CFLAGS -fsanitize=address" LDFLAGS="$LDFLAGS -fsanitize=address" AC_MSG_CHECKING([whether the C compiler accepts -fsanitize=address]) AC_LANG_PUSH(C) -AC_RUN_IFELSE([AC_LANG_PROGRAM([[const char hw[] = "Hello, World\n";]], [])], [AC_MSG_RESULT([yes]); asan_supported=yes], [AC_MSG_RESULT([no])]) +AC_RUN_IFELSE([AC_LANG_PROGRAM([[const char hw[] = "Hello, AddressSanitizer\n";]], [])], [AC_MSG_RESULT([yes]); asan_supported=yes], [AC_MSG_RESULT([no])]) AC_LANG_POP(C) +CFLAGS="$saved_CFLAGS" LDFLAGS="$saved_LDFLAGS" -if test "x$asan_supported" == "xno" -a "x$enable_address_sanitizer" == "xyes"; - then +if test "x$asan_supported" == "xno" -a "x$enable_address_sanitizer" == "xyes"; then AC_MSG_ERROR([The $CC compiler does not support the options -fsanitize=address . Update your compiler and/or install the AddressSanitizer runtime library.]) -fi - -if test "x$asan_supported" == "xno"; - then - echo "fsanitize=address not supported, AddressSanitizer disabled" - else +elif test "x$enable_address_sanitizer" == "xyes"; then COMPILER_CFLAGS="$COMPILER_CFLAGS -fsanitize=address" COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -fsanitize=address" COMPILER_LDFLAGS="$COMPILER_LDFLAGS -fsanitize=address" -- 1.7.9.5