X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=CMake%2F_Include.cmake;h=8a33f964ebe9791fdea56cd997c08460cd94a3d8;hb=f2ab0a0c16503c35c23c6ad1ba11913d054ccdad;hp=9f6891c2a35145492ed15ccc3694813bfe801631;hpb=49aa94b8c4df6c3fd9d5c9688651c6f928f9aad1;p=awesomized%2Flibmemcached diff --git a/CMake/_Include.cmake b/CMake/_Include.cmake index 9f6891c2..8a33f964 100644 --- a/CMake/_Include.cmake +++ b/CMake/_Include.cmake @@ -1,10 +1,19 @@ -set(THREADS_PREFER_PTHREAD_FLAG ON) # globals -include(CTest) +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + include(CTest) +endif() include(GNUInstallDirs) +include(CMakePackageConfigHelpers) +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD") + find_program(PKGCONF pkgconf) + if(PKGCONF) + set(PKG_CONFIG_EXECUTABLE ${PKGCONF}) + endif() +endif() find_package(PkgConfig) +set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) # locals @@ -14,8 +23,11 @@ include(CheckDebug) include(CheckDecl) include(CheckDependency) include(CheckHeader) +include(CheckCompiles) include(CheckType) include(CheckStdatomic) +include(TestBigEndian) +include(CheckByteswap) # configuration @@ -27,15 +39,28 @@ if(ENABLE_MEMASLAP) check_stdatomic() check_dependency(LIBEVENT event event.h) check_decl(getline stdio.h) + if(LIBEVENT AND HAVE_C_STDATOMIC) + set(HAVE_MEMASLAP 1) + endif() endif() ## dtrace +include(EnableDtrace) if(ENABLE_DTRACE) - set(HAVE_DTRACE 1) + find_package(DTrace) + if(DTRACE_EXECUTABLE) + set(HAVE_DTRACE 1) + else() + message(WARNING "The dtrace command is required to enable dtrace/systemtap support.") + endif() endif() -##uuid +## uuid if(BUILD_TESTING) + if(NOT MEMCACHED_BINARY) + find_package(Memcached) + set(MEMCACHED_BINARY ${MEMCACHED_EXECUTABLE}) + endif() check_dependency(LIBUUID uuid uuid/uuid.h) endif() @@ -48,22 +73,25 @@ if(ENABLE_SASL) endif() ## hashes -if(ENABLE_FNV64_HASH) +if(ENABLE_HASH_FNV64) set(HAVE_FNV64_HASH 1) endif() -if(ENABLE_MURMUR_HASH) +if(ENABLE_HASH_MURMUR) set(HAVE_MURMUR_HASH 1) endif() -if(ENABLE_HSIEH_HASH) +if(ENABLE_HASH_HSIEH) set(HAVE_HSIEH_HASH 1) endif() # system checks +test_big_endian(WORDS_BIGENDIAN) +check_byteswap() + +check_header(alloca.h) check_header(arpa/inet.h) check_header(dlfcn.h) check_header(errno.h) -check_header(execinfo.h) check_header(fcntl.h) check_header(io.h) check_header(limits.h) @@ -88,12 +116,20 @@ check_decl(htonll arpa/inet.h) check_decl(MSG_DONTWAIT sys/socket.h) check_decl(MSG_MORE sys/socket.h) check_decl(MSG_NOSIGNAL sys/socket.h) -check_decl(rcvtimeo sys/socket.h) -check_decl(sndtimeo sys/socket.h) -check_decl(strerror_r string.h) +check_decl(SO_RCVTIMEO sys/socket.h) +check_decl(SO_SNDTIMEO sys/socket.h) +check_decl(setenv stdlib.h) check_decl(strerror string.h) +check_decl(strerror_r string.h) + +check_compiles(HAVE_STRERROR_R_CHAR_P "char x, y = *strerror_r(0,&x,1);" string.h) + check_decl(abi::__cxa_demangle cxxabi.h) -set(HAVE_GCC_ABI_DEMANGLE ${HAVE_ABI____CXA_DEMANGLE}) + +find_package(Backtrace) +if(Backtrace_FOUND) + set(HAVE_BACKTRACE 1) +endif() check_type(in_port_t netinet/in.h)