From cc894a72098322e12700e543297dc333b11951de Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Fri, 11 Jul 2014 21:24:50 +0200 Subject: Implement --enable-sanitizers[=sanitizers] Similar to debugging with Valgrind, it's very useful to enable -fsanitize= switches to catch bugs at runtime. $ ./configure Result: no sanitizer enabled $ ./configure --enable-sanitizers Result: -fsanitize=address,undefined $ ./configure --enable-sanitizers=address,thread,undefined Result: -fsanitize=address,thread,undefined $ ./configure --enable-sanitizers=undefined Result: -fsanitize=undefined --- erts/configure.in | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'erts') diff --git a/erts/configure.in b/erts/configure.in index f66110b98b..40b335849c 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -4820,6 +4820,26 @@ if test "x$GCC" = xyes; then CFLAGS="$WERRORFLAGS $CFLAGS" fi +dnl ---------------------------------------------------------------------- +dnl Enable -fsanitize= flags. +dnl ---------------------------------------------------------------------- + +m4_define(DEFAULT_SANITIZERS, [address,undefined]) +AC_ARG_ENABLE( + sanitizers, + AS_HELP_STRING( + [--enable-sanitizers@<:@=comma-separated list of sanitizers@:>@], + [Default=DEFAULT_SANITIZERS]), +[ +case "$enableval" in + no) sanitizers= ;; + yes) sanitizers="-fsanitize=DEFAULT_SANITIZERS" ;; + *) sanitizers="-fsanitize=$enableval" ;; +esac +CFLAGS="$CFLAGS $sanitizers" +LDFLAGS="$LDFLAGS $sanitizers" +]) + dnl ---------------------------------------------------------------------- dnl Output the result. dnl ---------------------------------------------------------------------- -- cgit v1.2.3