build: Add basic flags for address santizer

To use:
    ./autogen.sh --enable-asan=yes

(Currently don't have check for gcc > 4.8).

Closes #637
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
This commit is contained in:
Grant Murphy 2014-06-03 19:22:55 +10:00 committed by Marius Vollmer
parent f5e057eb9e
commit 1265023af0

View file

@ -216,6 +216,23 @@ changequote([,])dnl
AC_CHECK_FUNCS(fdwalk)
# Address sanitizer
AC_MSG_CHECKING([for asan flags])
AC_ARG_ENABLE(asan,
AC_HELP_STRING([--enable-asan=no/yes],
[Turn the Address Sanitizer on or off])
)
if test "$enable_asan" = "yes"; then
CFLAGS="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
asan_status="yes"
else
asan_status="no"
fi
AM_CONDITIONAL(WITH_ASAN, test "$enable_asan" = "yes")
AC_MSG_RESULT($asan_status)
# Debug
AC_MSG_CHECKING([for debug mode])
@ -310,4 +327,5 @@ echo "
Building api docs: ${enable_gtk_doc}
Debug mode: ${debug_status}
With coverage: ${enable_coverage}
With address sanitizer: ${asan_status}
"