[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - configure.ac

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 10 12:55:34 UTC 2019


 configure.ac |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit ac1d0192d3ebcd23106d695452308a63f11dbe2b
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Sep 21 16:29:56 2019 -0400
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Oct 10 14:55:13 2019 +0200

    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/79336
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/configure.ac b/configure.ac
index 63470b4bc..0cc245430 100644
--- a/configure.ac
+++ b/configure.ac
@@ -153,6 +153,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,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
@@ -341,6 +345,17 @@ 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" # -fno-sanitize=vptr
+    CXXFLAGS="$CXXFLAGS $SANITIZER_FLAGS"
+    CFLAGS="$CFLAGS $SANITIZER_FLAGS"
+    LIBS="$LIBS -ldl"
+else
+    AC_MSG_RESULT([no])
+fi
+
 # check for C++11 support
 HAVE_CXX11=
 AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])


More information about the Libreoffice-commits mailing list