sysfs_fuse.c sysfs_fuse.h \
utils.c utils.h
liblxcfs_la_CFLAGS = $(AM_CFLAGS)
+
+if ENABLE_ASAN
+liblxcfs_la_CFLAGS += -fsanitize=address \
+ -fno-omit-frame-pointer
+endif
+
+if ENABLE_UBSAN
+liblxcfs_la_CFLAGS += -fsanitize=undefined
+endif
+
liblxcfs_la_LDFLAGS = $(AM_CFLAGS) -module -avoid-version -shared
liblxcfstest_la_SOURCES = api_extension.h \
sysfs_fuse.c sysfs_fuse.h \
utils.c utils.h
liblxcfstest_la_CFLAGS = $(AM_CFLAGS) -DRELOADTEST
+
+if ENABLE_ASAN
+liblxcfstest_la_CFLAGS += -fsanitize=address \
+ -fno-omit-frame-pointer
+endif
+
+if ENABLE_UBSAN
+liblxcfstest_la_CFLAGS += -fsanitize=undefined
+endif
+
liblxcfstest_la_LDFLAGS = $(AM_CFLAGS) -module -avoid-version -shared
noinst_HEADERS = bindings.h \
AX_CHECK_LINK_FLAG([-z relro], [LDFLAGS="$LDFLAGS -z relro"],,[])
AX_CHECK_LINK_FLAG([-z now], [LDFLAGS="$LDFLAGS -z now"],,[])
+# Build with ASAN commands
+AC_ARG_ENABLE([asan],
+ [AS_HELP_STRING([--enable-asan], [build with address sanitizer enabled [default=no]])],
+ [enable_asan=$enableval], [enable_asan=no])
+AM_CONDITIONAL([ENABLE_ASAN], [test "x$enable_asan" = "xyes"])
+
+# Build with UBSAN commands
+AC_ARG_ENABLE([ubsan],
+ [AS_HELP_STRING([--enable-ubsan], [build with ubsan sanitizer enabled [default=no]])],
+ [enable_asan=$enableval], [enable_ubsan=no])
+AM_CONDITIONAL([ENABLE_UBSAN], [test "x$enable_ubsan" = "xyes"])
+
AC_OUTPUT
+
+# Configuration overview
+cat << EOF
+
+----------------------------
+Environment:
+ - compiler: $CC
+
+Debugging:
+ - tests: $enable_tests
+ - ASAN: $enable_asan
+ - mutex debugging: $enable_mutex_debugging
+EOF