From 2aad2cfc537480a7edd6eb670732b3227906f6aa Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 6 May 2026 08:23:26 +0100 Subject: [PATCH] Add a configure flag for ASAN. --- Makefile.am | 4 ++++ configure.ac | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/Makefile.am b/Makefile.am index 3ec467f4..0161999b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,6 +41,10 @@ endif AM_CPPFLAGS += -DDEBUG endif AM_CPPFLAGS += -iquote. +if IS_ASAN +AM_CFLAGS += -fsanitize=address +AM_LDFLAGS += -fsanitize=address +endif endif # Set flags for Solaris. diff --git a/configure.ac b/configure.ac index fa474825..093d855b 100644 --- a/configure.ac +++ b/configure.ac @@ -73,6 +73,15 @@ AC_ARG_ENABLE( ) AM_CONDITIONAL(IS_OPTIMIZED, test "x$enable_optimizations" = xyes) +# Is this --enable-asan? +AC_ARG_ENABLE( + asan, + AS_HELP_STRING(--enable-asan, enable ASAN build flags), + , + enable_asan=no +) +AM_CONDITIONAL(IS_ASAN, test "x$enable_asan" = xyes) + # Is this a static build? AC_ARG_ENABLE( static,