configure: support sanitizers
It is now possible to run ./configure --with-sanitizer=address (or any least of valid sanitizers) to build with sanitizers. When --with-sanitizer is specified, we build with -O1 and don't omit frame-pointer. We also enable RTTI (which should be enabled anyway, but just in case). UBSan (undefined) sanitizer can cause 'typeinfo' errors. Fixing the source is best, but as a workaround, disabling vptr sanitizer works. Just pass -fno-sanitize=vptr to CFLAGS and CXXFLAGS. Change-Id: I4031aa872b1b1ef779703135394f3733952e5cd1 Reviewed-on: https://gerrit.libreoffice.org/79329 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>feature/mobile-input
parent
45a7dccbf8
commit
90188d07c1
14
configure.ac
14
configure.ac
|
@ -184,6 +184,10 @@ AC_ARG_WITH([max-documents],
|
|||
AS_HELP_STRING([--with-max-documents],
|
||||
[Set the limit on the total number of documents. Def: 10, Min: 2.]))
|
||||
|
||||
AC_ARG_WITH([sanitizer],
|
||||
AS_HELP_STRING([--with-sanitizer],
|
||||
[Enable one or more compatible sanitizers. E.g. --with-sanitizer=address,undefined,leak]))
|
||||
|
||||
AC_ARG_WITH([compiler-plugins],
|
||||
AS_HELP_STRING([--with-compiler-plugins=<path>],
|
||||
[Experimental! Unlikely to work for anyone except Noel! Enable compiler plugins that will perform additional checks during
|
||||
|
@ -460,6 +464,16 @@ else
|
|||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([whether to turn sanitizers on])
|
||||
if test "x$with_sanitizer" != "x"; then
|
||||
AC_MSG_RESULT([yes ($with_sanitizer)])
|
||||
SANITIZER_FLAGS="-O1 -fno-omit-frame-pointer -fsanitize=$with_sanitizer -frtti -static-libasan"
|
||||
CXXFLAGS="$CXXFLAGS $SANITIZER_FLAGS"
|
||||
CFLAGS="$CFLAGS $SANITIZER_FLAGS"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
# check for C++11 support
|
||||
HAVE_CXX11=
|
||||
AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])
|
||||
|
|
Loading…
Reference in New Issue