diff options
author | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2014-07-11 21:24:50 +0200 |
---|---|---|
committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2014-07-12 10:31:30 +0200 |
commit | cc894a72098322e12700e543297dc333b11951de (patch) | |
tree | b024fec5133fb604534928aef597d78705b81304 /lib/megaco | |
parent | 9a1419a7d4325085dc2235a8531d77e1d96ea689 (diff) | |
download | erlang-cc894a72098322e12700e543297dc333b11951de.tar.gz |
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
Diffstat (limited to 'lib/megaco')
-rw-r--r-- | lib/megaco/configure.in | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/megaco/configure.in b/lib/megaco/configure.in index 64daa959b5..e3c24a58b8 100644 --- a/lib/megaco/configure.in +++ b/lib/megaco/configure.in @@ -167,6 +167,26 @@ if test "x$GCC" = xyes; then LM_TRY_ENABLE_CFLAG([-Werror=return-type], [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 If ${ERL_TOP}/make/otp_ded.mk.in exists and contains DED_MK_VSN > 0, dnl every thing releted to compiling Dynamic Erlang Drivers can be found |