|
|
@ -113,6 +113,18 @@ AC_ARG_ENABLE(tests, |
|
|
|
[use_tests=$enableval], |
|
|
|
[use_tests=yes]) |
|
|
|
|
|
|
|
AC_ARG_ENABLE([asan], |
|
|
|
[AS_HELP_STRING([--enable-asan], |
|
|
|
[instrument the executables with asan (default is no)])], |
|
|
|
[use_asan=$enableval], |
|
|
|
[use_asan=no]) |
|
|
|
|
|
|
|
AC_ARG_ENABLE([tsan], |
|
|
|
[AS_HELP_STRING([--enable-tsan], |
|
|
|
[instrument the executables with tsan (default is no)])], |
|
|
|
[use_tsan=$enableval], |
|
|
|
[use_tsan=no]) |
|
|
|
|
|
|
|
AC_ARG_ENABLE([hardening], |
|
|
|
[AS_HELP_STRING([--enable-hardening], |
|
|
|
[attempt to harden the resulting executables (default is yes)])], |
|
|
@ -441,6 +453,29 @@ if test x$TARGET_OS != xwindows; then |
|
|
|
AX_CHECK_COMPILE_FLAG([-fPIC],[PIC_FLAGS="-fPIC"]) |
|
|
|
fi |
|
|
|
|
|
|
|
#asan and tsan cannot be used together |
|
|
|
if test x$use_asan$use_tsan == xyesyes; then |
|
|
|
AC_MSG_ERROR(asan and tsan cannot be simultaneously enabled) |
|
|
|
fi |
|
|
|
|
|
|
|
# using asan flag to enable address sanitizer and undefined behavior sanitizer |
|
|
|
if test x$use_asan == xyes; then |
|
|
|
AX_CHECK_LINK_FLAG([-static-libstdc++],[SAN_LDFLAGS="$SAN_LDFLAGS -static-libstdc++"],[AC_MSG_ERROR(Cannot statically link -static-libstdc++)]) |
|
|
|
AX_CHECK_LINK_FLAG([-static-libasan],[SAN_LDFLAGS="$SAN_LDFLAGS -static-libasan"],[AC_MSG_ERROR(Cannot statically link -static-libasan)]) |
|
|
|
AX_CHECK_COMPILE_FLAG([-fsanitize=address],[SAN_CXXFLAGS="$SAN_CXXFLAGS -fsanitize=address"],[AC_MSG_ERROR(Cannot enable -fsanitize=address)]) |
|
|
|
AX_CHECK_COMPILE_FLAG([-fsanitize=undefined],[SAN_CXXFLAGS="$SAN_CXXFLAGS -fsanitize=undefined"],[AC_MSG_ERROR(Cannot enable -fsanitize=undefined)]) |
|
|
|
AX_CHECK_COMPILE_FLAG([-fno-omit-frame-pointer],[SAN_CXXFLAGS="$SAN_CXXFLAGS -fno-omit-frame-pointer"],[AC_MSG_ERROR(Cannot enable -fno-omit-frame-pointer)]) |
|
|
|
fi |
|
|
|
|
|
|
|
# using tsan flag to enable address thread sanitizer |
|
|
|
# TSAN is supported on Linux x84_64 and tested on Ubuntu 12.04 |
|
|
|
# Non-position-independent executables are not supported. Use with -fPIE and -pie flags |
|
|
|
# libc/libstdc++ static linking is not supported |
|
|
|
if test x$use_tsan == xyes; then |
|
|
|
AX_CHECK_COMPILE_FLAG([-fsanitize=thread],[SAN_CXXFLAGS="$SAN_CXXFLAGS -fsanitize=thread"],[AC_MSG_ERROR(Cannot enable -fsanitize=thread)]) |
|
|
|
AX_CHECK_COMPILE_FLAG([-fno-omit-frame-pointer],[SAN_CXXFLAGS="$SAN_CXXFLAGS -fno-omit-frame-pointer"],[AC_MSG_ERROR(Cannot enable -fno-omit-frame-pointer)]) |
|
|
|
fi |
|
|
|
|
|
|
|
if test x$use_hardening != xno; then |
|
|
|
AX_CHECK_COMPILE_FLAG([-Wformat],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wformat"],[AC_MSG_ERROR(Cannot enable -Wformat)]) |
|
|
|
AX_CHECK_COMPILE_FLAG([-Wformat-security],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wformat-security"],[AC_MSG_ERROR(Cannot enable -Wformat-security)],[-Wformat]) |
|
|
@ -824,6 +859,8 @@ AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes]) |
|
|
|
AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes]) |
|
|
|
AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes]) |
|
|
|
AM_CONDITIONAL([HARDEN],[test x$use_hardening = xyes]) |
|
|
|
AM_CONDITIONAL([ASAN],[test x$use_asan = xyes]) |
|
|
|
AM_CONDITIONAL([TSAN],[test x$use_tsan = xyes]) |
|
|
|
|
|
|
|
AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version]) |
|
|
|
AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version]) |
|
|
@ -843,6 +880,8 @@ AC_SUBST(BITCOIN_TX_NAME) |
|
|
|
|
|
|
|
AC_SUBST(RELDFLAGS) |
|
|
|
AC_SUBST(ERROR_CXXFLAGS) |
|
|
|
AC_SUBST(SAN_CXXFLAGS) |
|
|
|
AC_SUBST(SAN_LDFLAGS) |
|
|
|
AC_SUBST(HARDENED_CXXFLAGS) |
|
|
|
AC_SUBST(HARDENED_CPPFLAGS) |
|
|
|
AC_SUBST(HARDENED_LDFLAGS) |
|
|
|