From e2472ddb562e9118ed607b5938c7797af6a79e0c Mon Sep 17 00:00:00 2001 From: dequis Date: Mon, 24 Nov 2014 02:16:05 -0300 Subject: configure: --asan=1 parameter for AddressSanitizer Requires gcc >=4.8 or clang >=3.1 AddressSanitizer (ASan) is a fast memory error detector. See also: https://code.google.com/p/address-sanitizer/wiki/AddressSanitizer --- configure | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'configure') diff --git a/configure b/configure index 580ece7c..d2913f13 100755 --- a/configure +++ b/configure @@ -39,6 +39,7 @@ purple=0 debug=0 strip=1 gcov=0 +asan=0 plugins=1 otr=0 skype=0 @@ -88,6 +89,7 @@ Option Description Default --strip=0/1 Disable/enable binary stripping $strip --pie=0/1 Build position independent executable $pie --gcov=0/1 Disable/enable test coverage reporting $gcov +--asan=0/1 Disable/enable AddressSanitizer $asan --plugins=0/1 Disable/enable plugins support $plugins --otr=0/1/auto/plugin Disable/enable OTR encryption support $otr @@ -199,10 +201,15 @@ if [ -n "$target" ]; then systemlibdirs="/usr/$target/lib" fi +if [ "$asan" = "1" ]; then + CFLAGS="$CFLAGS -fsanitize=address" + LDFLAGS="$LDFLAGS -fsanitize=address" + debug=1 +fi if [ "$debug" = "1" ]; then echo 'DEBUG=1' >> Makefile.settings - CFLAGS="$CFLAGS -g -DDEBUG" + CFLAGS="$CFLAGS -g3 -DDEBUG -O0" else [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing" fi @@ -826,6 +833,12 @@ else echo ' Debugging disabled.' fi +if [ "$asan" = "1" ]; then + echo ' AddressSanitizer (ASAN) enabled.' +else + echo ' AddressSanitizer (ASAN) disabled.' +fi + if [ "$pie" = "1" ]; then echo ' Building PIE executable' else -- cgit v1.2.3