From: Vincent Bernat Date: Thu, 17 Mar 2016 23:17:16 +0000 (+0100) Subject: build: add an option to enable sanitizers X-Git-Tag: 0.9.2~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=33fd6231767b009cc2389e7fad4f23f97df00a3d;p=thirdparty%2Flldpd.git build: add an option to enable sanitizers A user cannot just use CFLAGS=-fsanitize=address because autoconf is too fragile in some of its test (notably AC_FUNC_MALLOC and AC_FUNC_REALLOC). --- diff --git a/configure.ac b/configure.ac index 8dc1d784..e19a2530 100644 --- a/configure.ac +++ b/configure.ac @@ -115,6 +115,21 @@ if test x"$pie" = x"yes"; then [AX_LDFLAGS_OPTION([-fPIE -Wl,-pie], [LLDP_BIN_LDFLAGS])]) fi +# Sanitizers +AC_ARG_ENABLE([sanitizers], + AS_HELP_STRING( + [--enable-sanitizers], + [Enable code instrumentation with selected sanitizers @<:@default=no@:>@]), + [ +case "$enableval" in + no) sanitizers= ;; + yes) sanitizers="-fsanitize=address" ;; + *) sanitizers="-fsanitize=$enableval" ;; +esac +LLDP_CFLAGS="$LLDP_CFLAGS $sanitizers" +LLDP_LDFLAGS="$LLDP_LDFLAGS $sanitizers" + ]) + # OS lldp_CHECK_OS lldp_CFLAGS_OS