Skip to content

Commit

Permalink
build: Add --enable-sanitizer=(address|thread)
Browse files Browse the repository at this point in the history
  • Loading branch information
lhmouse committed Oct 16, 2020
1 parent cd3e8bb commit 8b429d5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,18 @@ AM_COND_IF([enable_debug_checks], [
AC_DEFINE([_DEBUG], [1], [Define to 1 to enable debug checks of MSVC standard library.])
])

AC_ARG_ENABLE([sanitizer], AS_HELP_STRING([--enable-sanitizer=address|thread],
[enable sanitizer (address sanitizer and thread sanitizer cannot be enabled at the same time)]))
AM_CONDITIONAL([enable_address_sanitizer], [test "${enable_sanitizer}" == "address"])
AM_COND_IF([enable_address_sanitizer], [
AC_CHECK_LIB([asan], [__asan_report_error], [], [AC_MSG_ERROR([address sanitizer not found])])
AC_DEFINE([POSEIDON_ENABLE_ADDRESS_SANITIZER], [1], [Define to 1 to enable address sanitizer.])
])
AM_CONDITIONAL([enable_thread_sanitizer], [test "${enable_sanitizer}" == "thread"])
AM_COND_IF([enable_thread_sanitizer], [
AC_CHECK_LIB([tsan], [__tsan_on_report], [], [AC_MSG_ERROR([thread sanitizer not found])])
AC_DEFINE([POSEIDON_ENABLE_THREAD_SANITIZER], [1], [Define to 1 to enable thread sanitizer.])
])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT

0 comments on commit 8b429d5

Please sign in to comment.