2 configure_init(${CMAKE_BINARY_DIR}/mem_config.h)
4 if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
8 include(CMakePushCheckState)
9 include(CMakePackageConfigHelpers)
11 macro(make_have_identifier NAME ID)
12 string(MAKE_C_IDENTIFIER ${NAME} _make_have_identifier)
13 string(TOUPPER ${_make_have_identifier} _make_have_identifier)
14 set(${ID} HAVE_${_make_have_identifier})
17 include(CheckCCompilerFlag)
18 macro(check_flag FLAG HAVE)
19 configure_define(${HAVE})
20 check_c_compiler_flag("${FLAG}" ${HAVE})
22 include(CheckCXXCompilerFlag)
23 macro(check_cxx_flag FLAG HAVE)
24 configure_define(${HAVE})
25 check_cxx_compiler_flag("${FLAG}" ${HAVE})
27 include(CheckSymbolExists)
28 macro(check_symbol NAME HEADER)
29 make_have_identifier(${NAME} HAVE)
30 configure_define(${HAVE})
31 cmake_push_check_state()
33 string(APPEND CMAKE_REQUIRED_FLAGS " ${ARGV2}")
35 check_symbol_exists(${NAME} ${HEADER} ${HAVE})
36 cmake_pop_check_state()
38 include(CheckCXXSymbolExists)
39 macro(check_cxx_symbol NAME HEADER)
40 make_have_identifier(${NAME} HAVE)
41 configure_define(${HAVE})
42 cmake_push_check_state()
44 string(APPEND CMAKE_REQUIRED_FLAGS " ${ARGN}")
46 check_cxx_symbol_exists(${NAME} ${HEADER} ${HAVE})
47 cmake_pop_check_state()
49 include(CheckIncludeFile)
50 macro(check_include HEADER)
51 make_have_identifier(${HEADER} HAVE)
52 configure_define(${HAVE})
53 cmake_push_check_state()
55 string(APPEND CMAKE_REQUIRED_FLAGS " ${ARGN}")
57 check_include_file(${HEADER} ${HAVE})
58 cmake_pop_check_state()
60 include(CheckIncludeFileCXX)
61 macro(check_cxx_include HEADER)
62 make_have_identifier(${HEADER} HAVE)
63 configure_define(${HAVE})
64 cmake_push_check_state()
66 string(APPEND CMAKE_REQUIRED_FLAGS " ${ARGN}")
68 check_include_file_cxx(${HEADER} ${HAVE})
69 cmake_pop_check_state()
71 include(CheckTypeSize)
72 macro(check_type TYPE)
73 make_have_identifier(${TYPE} HAVE)
74 configure_define(${HAVE})
75 cmake_push_check_state()
77 list(APPEND CMAKE_EXTRA_INCLUDE_FILES ${ARGN})
79 check_type_size(${TYPE} ${HAVE})
80 cmake_pop_check_state()
82 include(CheckCSourceCompiles)
83 macro(check_c_source SOURCE HAVE)
84 configure_define(${HAVE})
85 check_c_source_compiles("${SOURCE}" ${HAVE})
87 include(CheckCXXSourceCompiles)
88 macro(check_cxx_source SOURCE HAVE)
89 configure_define(${HAVE})
90 check_cxx_source_compiles("${SOURCE}" ${HAVE})
93 include(CheckBacktrace)
94 include(CheckByteswap)
95 include(CheckDependency)
100 include(CheckVisibility)
101 include(InstallPublicHeaders)
104 configure_define_01(LIBMEMCACHED_WITH_SASL_SUPPORT)
106 check_dependency(LIBSASL sasl2)
108 set(LIBMEMCACHED_WITH_SASL_SUPPORT 1)
113 configure_set(HAVE_FNV64_HASH ${ENABLE_HASH_FNV64})
114 configure_set(HAVE_MURMUR_HASH ${ENABLE_HASH_MURMUR})
115 configure_set(HAVE_HSIEH_HASH ${ENABLE_HASH_HSIEH})
117 check_include(alloca.h)
118 check_include(arpa/inet.h)
119 check_include(dlfcn.h)
120 check_include(getopt.h)
121 check_include(libgen.h)
122 check_include(netdb.h)
123 check_include(netinet/in.h)
124 check_include(netinet/tcp.h)
125 check_include(poll.h)
126 check_include(strings.h)
127 check_include(sys/poll.h)
128 check_include(sys/socket.h)
129 check_include(sys/time.h)
130 check_include(sys/un.h)
131 check_include(unistd.h)
133 check_type(in_port_t netinet/in.h)
134 check_type(pid_t sys/types.h)
135 check_type(ssize_t sys/types.h)
136 check_type("struct msghdr" sys/socket.h)
137 check_type("struct timespec" time.h)
139 check_cxx_symbol(abi::__cxa_demangle cxxabi.h)
140 check_symbol(CLOCK_MONOTONIC time.h)
141 check_symbol(clock_gettime time.h)
142 check_symbol(ERESTART errno.h)
143 check_symbol(fcntl fcntl.h)
144 check_symbol(gettimeofday sys/time.h)
145 check_symbol(htonll arpa/inet.h)
146 check_symbol(index strings.h)
147 check_symbol(MSG_DONTWAIT sys/socket.h)
148 check_symbol(MSG_MORE sys/socket.h)
149 check_symbol(MSG_NOSIGNAL sys/socket.h)
150 check_symbol(SO_RCVTIMEO sys/socket.h)
151 check_symbol(SO_SNDTIMEO sys/socket.h)
152 check_symbol(rand stdlib.h)
153 check_symbol(random stdlib.h)
154 check_symbol(realpath stdlib.h)
155 check_symbol(sendmsg sys/socket.h)
156 check_symbol(setenv stdlib.h)
157 check_symbol(strerror_r string.h)
162 return *strerror_r(0, &x, 1);
164 HAVE_STRERROR_R_CHAR_P
169 check_include(winsock2.h)
170 check_include(ws2tcpip.h)
172 check_symbol(htonll winsock2.h)