Skip to content

Commit c62fd76

Browse files
committed
build: option to enable AddressSanitizer
1 parent 919c46e commit c62fd76

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

configure.ac

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ AX_VALGRIND_CHECK
4747
AX_CODE_COVERAGE
4848

4949
# Additional enable flags
50+
# --enable-debug
5051
AC_ARG_ENABLE([debug],
5152
[AS_HELP_STRING([--enable-debug], [Enable debug build (-g -O0)])],
5253
[enable_debug=yes],
@@ -58,13 +59,26 @@ if test "x$enable_debug" = "xyes"; then
5859
AC_DEFINE([DEBUG], [1], [Define if debugging is enabled])
5960
fi
6061

62+
# --disable-tool
6163
AC_ARG_ENABLE([tool],
6264
[AS_HELP_STRING([--disable-tool], [Do not build the asdf command-line tool])],
6365
[asdf_build_tool=$enableval],
6466
[asdf_build_tool=yes])
6567

6668
AM_CONDITIONAL([ASDF_BUILD_TOOL], [test "x$asdf_build_tool" = xyes])
6769

70+
# --with-asan
71+
AC_ARG_WITH([asan],
72+
[AS_HELP_STRING([--with-asan], [Build with AddressSanitizer support])],
73+
[with_asan=yes],
74+
[with_asan=no])
75+
76+
if test "x$with_asan" = "xyes"; then
77+
CFLAGS="$CFLAGS -O1 -g -fsanitize=address -fno-omit-frame-pointer"
78+
LDFLAGS="$LDFLAGS -fsanitize=address"
79+
AC_DEFINE([WITH_ASAN], [1], [Defined if building with AddressSanitizer])
80+
fi
81+
6882
# Checks for libraries.
6983
# Preferably using pkg-config, could fall back on AC_SEARCH_LIBS if not
7084
AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])

0 commit comments

Comments
 (0)