File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,10 @@ if test x$enable_debug = xyes; then
185
185
user_CXXFLAGS="$CXXFLAGS" # ac_save_CXXFLAGS is not set yet
186
186
fi
187
187
188
+ # sanitizer
189
+ AC_ARG_ENABLE ( asan , [ --enable-asan address sanitizer] )
190
+ AC_ARG_ENABLE ( ubsan , [ --enable-ubsan undefined behaviour sanitizer] )
191
+
188
192
# do we want the bzflag client?
189
193
AC_ARG_ENABLE ( client , [ --disable-client server-only build] )
190
194
@@ -767,6 +771,16 @@ else
767
771
AC_DEFINE ( NDEBUG , 1 , [ Debugging disabled] )
768
772
fi
769
773
774
+ if test "x$enable_asan" = xyes; then
775
+ CONF_CFLAGS="$CONF_CFLAGS -fsanitize=address"
776
+ CONF_CXXFLAGS="$CONF_CXXFLAGS -fsanitize=address"
777
+ fi
778
+
779
+ if test "x$enable_ubsan" = xyes; then
780
+ CONF_CFLAGS="$CONF_CFLAGS -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow"
781
+ CONF_CXXFLAGS="$CONF_CXXFLAGS -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow"
782
+ fi
783
+
770
784
dnl check for -search_paths_first linker flag when making dynamic libraries
771
785
search_paths_first_flag="-Wl,-search_paths_first -mdynamic-no-pic"
772
786
AC_MSG_CHECKING ( [ if the compiler understands $search_paths_first_flag] )
You can’t perform that action at this time.
0 commit comments