diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2020-09-24 16:59:20 +0100 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2020-09-24 19:44:37 +0100 |
commit | e36e62c0631f73627ff3caec5752eefe37a14948 (patch) | |
tree | c6695f088cf069c0161a0cab4cb9ea9370ae0efe /configure.ac | |
parent | c210bb3d2a0c6131ebeedc44c1d8cc6fc92fb08f (diff) | |
download | ghostpdl-e36e62c0631f73627ff3caec5752eefe37a14948.tar.gz |
Allow configure caller to choose a sanitizer
Our "sanitize" target just uses address sanitizer.
With this commit, we'll still default to address, but the caller can do:
--with-santizer=memory
to opt for the "memory" sanitizer instead.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index d6f346b76..758010970 100644 --- a/configure.ac +++ b/configure.ac @@ -473,17 +473,28 @@ dnl check for sanitize support dnl ---------------------------- AC_MSG_CHECKING([compiler/linker address santizer support]) +AC_ARG_WITH([sanitizer], AC_HELP_STRING([--with-sanitizer=@<:@address/memory@:>@], + [Sanitizer for 'sanitize' target (defaults to 'address')]), + [SANITIZER=$with_sanitizer], [SANITIZER=address]) + CFLAGS_SANITIZE="" -CFLAGS_SANITIZE_TRY="-fsanitize=address -fno-omit-frame-pointer" +CFLAGS_SANITIZE_TRY="-fsanitize=$SANITIZER -fno-omit-frame-pointer" CFLAGS_SAVED="$CFLAGS" CFLAGS="$CFLAGS_SANITIZE_TRY" - AC_LINK_IFELSE( [AC_LANG_PROGRAM([#include <stdio.h>], [ return(0); ])], - [CFLAGS_SANITIZE="$CFLAGS"], [CFLAGS_SANITIZE="'****************ADDRESS_SANITIZER_NOT_SUPPORTED*********************'"]) + [CFLAGS_SANITIZE="$CFLAGS"], + [ + if test x"$with_sanitizer" != x; then + AC_MSG_ERROR([--with-sanitizer=$with_sanitizer not supported by compiler]) + else + CFLAGS_SANITIZE="'****************ADDRESS_SANITIZER_NOT_SUPPORTED*********************'" + fi + ] + ) CFLAGS="$CFLAGS_SAVED" |