Commit fd8db580 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

refs #5368 add some more system checks


git-svn-id: file:///svn/toku/tokudb@48332 c7de825b-a66e-492c-adef-691d508d4ae1
parent 72b029b8
...@@ -12,6 +12,7 @@ find_package(Valgrind REQUIRED) ...@@ -12,6 +12,7 @@ find_package(Valgrind REQUIRED)
include(CheckIncludeFiles) include(CheckIncludeFiles)
## check for some include files ## check for some include files
check_include_files(alloca.h HAVE_ALLOCA_H)
check_include_files(arpa/inet.h HAVE_ARPA_INET_H) check_include_files(arpa/inet.h HAVE_ARPA_INET_H)
check_include_files(byteswap.h HAVE_BYTESWAP_H) check_include_files(byteswap.h HAVE_BYTESWAP_H)
check_include_files(endian.h HAVE_ENDIAN_H) check_include_files(endian.h HAVE_ENDIAN_H)
...@@ -23,11 +24,14 @@ check_include_files(limits.h HAVE_LIMITS_H) ...@@ -23,11 +24,14 @@ check_include_files(limits.h HAVE_LIMITS_H)
check_include_files(machine/endian.h HAVE_MACHINE_ENDIAN_H) check_include_files(machine/endian.h HAVE_MACHINE_ENDIAN_H)
check_include_files(malloc.h HAVE_MALLOC_H) check_include_files(malloc.h HAVE_MALLOC_H)
check_include_files(malloc/malloc.h HAVE_MALLOC_MALLOC_H) check_include_files(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
check_include_files(malloc_np.h HAVE_MALLOC_NP_H)
check_include_files(pthread.h HAVE_PTHREAD_H) check_include_files(pthread.h HAVE_PTHREAD_H)
check_include_files(pthread_np.h HAVE_PTHREAD_NP_H)
check_include_files(stdint.h HAVE_STDINT_H) check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(stdlib.h HAVE_STDLIB_H) check_include_files(stdlib.h HAVE_STDLIB_H)
check_include_files(string.h HAVE_STRING_H) check_include_files(string.h HAVE_STRING_H)
check_include_files(syscall.h HAVE_SYSCALL_H) check_include_files(syscall.h HAVE_SYSCALL_H)
check_include_files(sys/endian.h HAVE_SYS_ENDIAN_H)
check_include_files(sys/file.h HAVE_SYS_FILE_H) check_include_files(sys/file.h HAVE_SYS_FILE_H)
check_include_files(sys/malloc.h HAVE_SYS_MALLOC_H) check_include_files(sys/malloc.h HAVE_SYS_MALLOC_H)
check_include_files(sys/resource.h HAVE_SYS_RESOURCE_H) check_include_files(sys/resource.h HAVE_SYS_RESOURCE_H)
...@@ -59,15 +63,50 @@ check_function_exists(sched_getaffinity HAVE_SCHED_GETAFFINITY) ...@@ -59,15 +63,50 @@ check_function_exists(sched_getaffinity HAVE_SCHED_GETAFFINITY)
check_function_exists(nrand48 HAVE_NRAND48) check_function_exists(nrand48 HAVE_NRAND48)
check_function_exists(random_r HAVE_RANDOM_R) check_function_exists(random_r HAVE_RANDOM_R)
set(CMAKE_REQUIRED_LIBRARIES "pthread") set(EXTRA_SYSTEM_LIBS "")
check_function_exists(dlsym HAVE_DLSYM_WITHOUT_DL)
if (NOT HAVE_DLSYM_WITHOUT_DL)
set(CMAKE_REQUIRED_LIBRARIES dl)
check_function_exists(dlsym HAVE_DLSYM_WITH_DL)
if (HAVE_DLSYM_WITH_DL)
list(APPEND EXTRA_SYSTEM_LIBS dl)
else ()
message(FATAL_ERROR "Cannot find dlsym(), even with -ldl.")
endif ()
endif ()
check_function_exists(backtrace HAVE_BACKTRACE_WITHOUT_EXECINFO)
if (NOT HAVE_BACKTRACE_WITHOUT_EXECINFO)
set(CMAKE_REQUIRED_LIBRARIES execinfo)
check_function_exists(backtrace HAVE_BACKTRACE_WITH_EXECINFO)
if (HAVE_BACKTRACE_WITH_EXECINFO)
list(APPEND EXTRA_SYSTEM_LIBS execinfo)
else ()
message(FATAL_ERROR "Cannot find backtrace(), even with -lexecinfo.")
endif ()
endif ()
set(CMAKE_REQUIRED_LIBRARIES pthread)
## check whether we can change rwlock preference ## check whether we can change rwlock preference
check_function_exists(pthread_rwlockattr_setkind_np HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP) check_function_exists(pthread_rwlockattr_setkind_np HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP)
## check for the right way to yield using pthreads ## check for the right way to yield using pthreads
check_function_exists(pthread_yield HAVE_PTHREAD_YIELD) check_function_exists(pthread_yield HAVE_PTHREAD_YIELD)
check_function_exists(pthread_yield_np HAVE_PTHREAD_YIELD_NP) check_function_exists(pthread_yield_np HAVE_PTHREAD_YIELD_NP)
## check if we have pthread_getthreadid_np() (i.e. freebsd)
check_function_exists(pthread_getthreadid_np HAVE_PTHREAD_GETTHREADID_NP)
include(CheckCSourceCompiles) include(CheckCSourceCompiles)
if (HAVE_PTHREAD_YIELD)
include(CheckPrototypeDefinition)
check_prototype_definition(pthread_yield "void pthread_yield(void)" 0 "pthread.h" PTHREAD_YIELD_RETURNS_VOID)
check_c_source_compiles("#include <pthread.h>
int main(void) {
int r = pthread_yield();
return r;
}" PTHREAD_YIELD_RETURNS_INT)
endif (HAVE_PTHREAD_YIELD)
## check whether we have gcc-style thread-local storage using a storage class modifier ## check whether we have gcc-style thread-local storage using a storage class modifier
check_c_source_compiles("#include <pthread.h> check_c_source_compiles("#include <pthread.h>
static __thread int tlsvar = 0; static __thread int tlsvar = 0;
......
...@@ -107,7 +107,7 @@ foreach(bin ${bins}) ...@@ -107,7 +107,7 @@ foreach(bin ${bins})
add_executable(${bin}_static ${bin}) add_executable(${bin}_static ${bin})
add_dependencies(${bin}_static install_tdb_h) add_dependencies(${bin}_static install_tdb_h)
target_link_libraries(${bin}_static ft_static z lzma ${LIBTOKUPORTABILITY}_static ${CMAKE_THREAD_LIBS_INIT} dl) target_link_libraries(${bin}_static ft_static z lzma ${LIBTOKUPORTABILITY}_static ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_SYSTEM_LIBS})
add_common_options_to_binary_targets(${bin} ${bin}_static) add_common_options_to_binary_targets(${bin} ${bin}_static)
endforeach(bin) endforeach(bin)
......
...@@ -15,7 +15,7 @@ add_library(${LIBTOKUPORTABILITY}_static STATIC ${tokuportability_srcs}) ...@@ -15,7 +15,7 @@ add_library(${LIBTOKUPORTABILITY}_static STATIC ${tokuportability_srcs})
maybe_add_gcov_to_libraries(${LIBTOKUPORTABILITY} ${LIBTOKUPORTABILITY}_static) maybe_add_gcov_to_libraries(${LIBTOKUPORTABILITY} ${LIBTOKUPORTABILITY}_static)
set_property(TARGET ${LIBTOKUPORTABILITY} ${LIBTOKUPORTABILITY}_static APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE) set_property(TARGET ${LIBTOKUPORTABILITY} ${LIBTOKUPORTABILITY}_static APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
set_target_properties(${LIBTOKUPORTABILITY}_static PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(${LIBTOKUPORTABILITY}_static PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(${LIBTOKUPORTABILITY} LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT} dl) target_link_libraries(${LIBTOKUPORTABILITY} LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_SYSTEM_LIBS})
if (CMAKE_CXX_COMPILER_ID STREQUAL Intel) if (CMAKE_CXX_COMPILER_ID STREQUAL Intel)
## ignore warning about cilkrts linking dynamically ## ignore warning about cilkrts linking dynamically
......
...@@ -27,7 +27,7 @@ target_link_libraries(${LIBTOKUDB} LINK_PUBLIC z) ...@@ -27,7 +27,7 @@ target_link_libraries(${LIBTOKUDB} LINK_PUBLIC z)
add_library(tokudb_static_conv STATIC ${tokudb_srcs}) add_library(tokudb_static_conv STATIC ${tokudb_srcs})
add_dependencies(tokudb_static_conv install_tdb_h generate_log_code) add_dependencies(tokudb_static_conv install_tdb_h generate_log_code)
set_target_properties(tokudb_static_conv PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(tokudb_static_conv PROPERTIES POSITION_INDEPENDENT_CODE ON)
set(tokudb_source_libs tokudb_static_conv lock_tree_static range_tree_static ft_static lzma ${LIBTOKUPORTABILITY} z ${CMAKE_THREAD_LIBS_INIT} dl) set(tokudb_source_libs tokudb_static_conv lock_tree_static range_tree_static ft_static lzma ${LIBTOKUPORTABILITY} z ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_SYSTEM_LIBS})
merge_static_libs(${LIBTOKUDB}_static ${LIBTOKUDB}_static "${tokudb_source_libs}") merge_static_libs(${LIBTOKUDB}_static ${LIBTOKUDB}_static "${tokudb_source_libs}")
## add a version script and set -fvisibility=hidden for the shared library ## add a version script and set -fvisibility=hidden for the shared library
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#define TOKUDB_REVISION @CMAKE_TOKUDB_REVISION@ #define TOKUDB_REVISION @CMAKE_TOKUDB_REVISION@
#cmakedefine HAVE_ALLOCA_H 1
#cmakedefine HAVE_ARPA_INET_H 1 #cmakedefine HAVE_ARPA_INET_H 1
#cmakedefine HAVE_BYTESWAP_H 1 #cmakedefine HAVE_BYTESWAP_H 1
#cmakedefine HAVE_ENDIAN_H 1 #cmakedefine HAVE_ENDIAN_H 1
...@@ -20,11 +21,14 @@ ...@@ -20,11 +21,14 @@
#cmakedefine HAVE_MACHINE_ENDIAN_H 1 #cmakedefine HAVE_MACHINE_ENDIAN_H 1
#cmakedefine HAVE_MALLOC_H 1 #cmakedefine HAVE_MALLOC_H 1
#cmakedefine HAVE_MALLOC_MALLOC_H 1 #cmakedefine HAVE_MALLOC_MALLOC_H 1
#cmakedefine HAVE_MALLOC_NP_H 1
#cmakedefine HAVE_PTHREAD_H 1 #cmakedefine HAVE_PTHREAD_H 1
#cmakedefine HAVE_PTHREAD_NP_H 1
#cmakedefine HAVE_STDINT_H 1 #cmakedefine HAVE_STDINT_H 1
#cmakedefine HAVE_STDLIB_H 1 #cmakedefine HAVE_STDLIB_H 1
#cmakedefine HAVE_STRING_H 1 #cmakedefine HAVE_STRING_H 1
#cmakedefine HAVE_SYSCALL_H 1 #cmakedefine HAVE_SYSCALL_H 1
#cmakedefine HAVE_SYS_ENDIAN_H 1
#cmakedefine HAVE_SYS_FILE_H 1 #cmakedefine HAVE_SYS_FILE_H 1
#cmakedefine HAVE_SYS_MALLOC_H 1 #cmakedefine HAVE_SYS_MALLOC_H 1
#cmakedefine HAVE_SYS_RESOURCE_H 1 #cmakedefine HAVE_SYS_RESOURCE_H 1
...@@ -49,6 +53,10 @@ ...@@ -49,6 +53,10 @@
#cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP 1 #cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP 1
#cmakedefine HAVE_PTHREAD_YIELD 1 #cmakedefine HAVE_PTHREAD_YIELD 1
#cmakedefine HAVE_PTHREAD_YIELD_NP 1 #cmakedefine HAVE_PTHREAD_YIELD_NP 1
#cmakedefine HAVE_PTHREAD_GETTHREADID_NP 1
#cmakedefine PTHREAD_YIELD_RETURNS_INT 1
#cmakedefine PTHREAD_YIELD_RETURNS_VOID 1
#cmakedefine HAVE_GNU_TLS 1 #cmakedefine HAVE_GNU_TLS 1
......
...@@ -10,7 +10,7 @@ foreach(util ${utils}) ...@@ -10,7 +10,7 @@ foreach(util ${utils})
add_executable(${util}_static ${util}) add_executable(${util}_static ${util})
set_target_properties(${util}_static PROPERTIES set_target_properties(${util}_static PROPERTIES
COMPILE_DEFINITIONS "IS_TDB=1;USE_TDB=1;TDB_IS_STATIC=1") COMPILE_DEFINITIONS "IS_TDB=1;USE_TDB=1;TDB_IS_STATIC=1")
target_link_libraries(${util}_static ${LIBTOKUDB}_static z lzma ${LIBTOKUPORTABILITY}_static ${CMAKE_THREAD_LIBS_INIT} dl) target_link_libraries(${util}_static ${LIBTOKUDB}_static z lzma ${LIBTOKUPORTABILITY}_static ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_SYSTEM_LIBS})
add_common_options_to_binary_targets(${util} ${util}_static) add_common_options_to_binary_targets(${util} ${util}_static)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment