diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -268,31 +268,6 @@ find_library(RT_LIBRARY rt) target_link_libraries(util ${RT_LIBRARY}) - #__fdelt_chk's params and return type have changed from long unsigned int to - # long int. See which one is present here. - include(CheckPrototypeDefinition) - - set(CMAKE_REQUIRED_DEFINITIONS -D_FORTIFY_SOURCE=2) - # Without some optimization the compiler won't detect the prototype conflict - # and always succeed to build. - set(CMAKE_REQUIRED_FLAGS -O2) - - check_prototype_definition( - __fdelt_warn - "extern long unsigned int __fdelt_warn(long unsigned int a)" - "0" - "sys/select.h" - FDELT_PROTOTYPE_LONG_UNSIGNED_INT - ) - - if(FDELT_PROTOTYPE_LONG_UNSIGNED_INT) - set(FDELT_TYPE "long unsigned int") - else() - set(FDELT_TYPE "long int") - endif() - - target_compile_definitions(util PRIVATE "-DFDELT_TYPE=${FDELT_TYPE}") - # Wrap some glibc functions with ours add_linker_flags(-Wl,--wrap=__divmoddi4) add_linker_flags(-Wl,--wrap=log2f) diff --git a/src/config/CMakeLists.txt b/src/config/CMakeLists.txt --- a/src/config/CMakeLists.txt +++ b/src/config/CMakeLists.txt @@ -170,6 +170,29 @@ } " HAVE_FUNC_ATTRIBUTE_DLLEXPORT) +#__fdelt_chk's params and return type have changed from long unsigned int to +# long int. See which one is present here. +include(CheckPrototypeDefinition) + +set(CMAKE_REQUIRED_DEFINITIONS -D_FORTIFY_SOURCE=2) +# Without some optimization the compiler won't detect the prototype conflict +# and always succeed to build. +set(CMAKE_REQUIRED_FLAGS -O2) + +check_prototype_definition( + __fdelt_warn + "extern long unsigned int __fdelt_warn(long unsigned int a)" + "0" + "sys/select.h" + FDELT_PROTOTYPE_LONG_UNSIGNED_INT +) + +if(FDELT_PROTOTYPE_LONG_UNSIGNED_INT) + set(FDELT_TYPE "long unsigned int") +else() + set(FDELT_TYPE "long int") +endif() + # OpenSSL functionality set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_CRYPTO_INCLUDES}) set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) diff --git a/src/config/bitcoin-config.h.cmake.in b/src/config/bitcoin-config.h.cmake.in --- a/src/config/bitcoin-config.h.cmake.in +++ b/src/config/bitcoin-config.h.cmake.in @@ -60,6 +60,8 @@ #cmakedefine HAVE_DECL_EVP_MD_CTX_NEW 1 +#define FDELT_TYPE ${FDELT_TYPE} + #cmakedefine ENABLE_WALLET 1 #cmakedefine ENABLE_ZMQ 1