1# Writes the 'config.h' header..
2INCLUDE(CheckFunctionExists)
3INCLUDE(CheckIncludeFiles)
4INCLUDE(CheckSymbolExists)
5
6IF(UNIX)
7    CHECK_FUNCTION_EXISTS(gethrtime HAVE_GETHRTIME)
8    CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
9    CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
10    CHECK_FUNCTION_EXISTS(setitimer HAVE_SETITIMER)
11    CHECK_SYMBOL_EXISTS(htonll arpa/inet.h HAVE_HTONLL)
12    CHECK_SYMBOL_EXISTS(res_search resolv.h HAVE_RES_SEARCH)
13    CHECK_INCLUDE_FILES(dlfcn.h HAVE_DLFCN_H)
14    CHECK_INCLUDE_FILES(netdb.h HAVE_NETDB_H)
15    CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)
16    CHECK_INCLUDE_FILES(strings.h HAVE_STRINGS_H)
17    CHECK_INCLUDE_FILES(sys/socket.h HAVE_SYS_SOCKET_H)
18    CHECK_INCLUDE_FILES(sys/stat.h HAVE_SYS_STAT_H)
19    CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)
20    CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
21    CHECK_INCLUDE_FILES(sys/uio.h HAVE_SYS_UIO_H)
22    CHECK_INCLUDE_FILES(fcntl.h HAVE_FCNTL_H)
23    CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H)
24    CHECK_INCLUDE_FILES(arpa/inet.h HAVE_ARPA_INET_H)
25    CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H)
26    CHECK_INCLUDE_FILES(arpa/nameser.h HAVE_ARPA_NAMESER_H)
27ENDIF()
28
29SET(CMAKE_TEST_SHARED_OBJECT "libm.so")
30IF (WIN32)
31  SET(CMAKE_TEST_SHARED_OBJECT "kernel32.dll.")
32ELSEIF (APPLE)
33  SET(CMAKE_TEST_SHARED_OBJECT "libm.dylib")
34ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "Linux")
35  EXECUTE_PROCESS(COMMAND ${CMAKE_LINKER} -lm -t
36    OUTPUT_VARIABLE LIBM_SO_TRACE
37    ERROR_QUIET
38    OUTPUT_STRIP_TRAILING_WHITESPACE)
39  STRING(REGEX MATCH [a-z0-9/]+libm.so[.0-9]* LIBM_SO_PATH ${LIBM_SO_TRACE})
40  IF (EXISTS "${LIBM_SO_PATH}")
41    GET_FILENAME_COMPONENT(CMAKE_TEST_SHARED_OBJECT ${LIBM_SO_PATH} NAME)
42  ENDIF()
43ENDIF()
44
45CONFIGURE_FILE(
46    ${PROJECT_SOURCE_DIR}/cmake/config-cmake.h.in
47    ${LCB_GENSRCDIR}/config.h)
48