Skip to content

Commit a30937b

Browse files
committed
Merge pull request #484 from chief1983/asan_flag
AddressSanitizer toggle flag for configure.ac
2 parents af22ab3 + c8785dc commit a30937b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

configure.ac

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ AC_ARG_ENABLE(generic-architecture,
9595
[fs2_generic_architecture=no],
9696
)
9797

98+
AC_ARG_ENABLE(asan,
99+
AC_HELP_STRING([--enable-asan],
100+
[Attempt to link against AddressSanitizer library (https://github.com/google/sanitizers/wiki/AddressSanitizer)]),
101+
[fs2_asan=$enableval],
102+
[fs2_asan=no],
103+
)
104+
98105
AC_ARG_WITH(static-ogg,
99106
AC_HELP_STRING([--with-static-ogg=DIR],
100107
[Link staticly with OGG, Vorbis and Theora libs from this directory]),
@@ -249,6 +256,11 @@ if test "$fs2_fred" = "yes" ; then
249256
FS2_LIBS="$FS2_LIBS $WX_LIBS"
250257
fi
251258

259+
if test "$fs2_asan" = "yes" ; then
260+
D_CFLAGS="$D_CFLAGS -fsanitize=address -fno-omit-frame-pointer"
261+
D_LDFLAGS="$D_LDFLAGS -fsanitize=address"
262+
fi
263+
252264
if test "$fs2_debug" = "yes" ; then
253265
AC_DEFINE([_DEBUG])
254266
D_CFLAGS="$D_CFLAGS -O0 -g -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-write-strings -Wshadow -funroll-loops"
@@ -549,4 +561,7 @@ echo NoWarn Allowed ......... : $fs2_nowarn
549561
echo Debug build ............ : $fs2_debug
550562
echo GProf support .......... : $fs2_gprof
551563
echo Fatal warnings ......... : $fs2_fatal_warnings
564+
echo Generic build .......... : $fs2_generic_architecture
565+
echo ASan enabled ........... : $fs2_asan
566+
echo Building wxFred2 ....... : $fs2_fred
552567
echo

0 commit comments

Comments
 (0)