2 configure_init(${CMAKE_BINARY_DIR}/mem_config.h)
4 if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
8 include(CMakePushCheckState)
9 include(GNUInstallDirs)
10 include(CMakePackageConfigHelpers)
12 macro(make_have_identifier NAME ID)
13 string(MAKE_C_IDENTIFIER ${NAME} _make_have_identifier)
14 string(TOUPPER ${_make_have_identifier} _make_have_identifier)
15 set(${ID} HAVE_${_make_have_identifier})
18 include(CheckCCompilerFlag)
19 macro(check_flag FLAG HAVE)
20 configure_define(${HAVE})
21 check_c_compiler_flag("${FLAG}" ${HAVE})
23 include(CheckCXXCompilerFlag)
24 macro(check_cxx_flag FLAG HAVE)
25 configure_define(${HAVE})
26 check_cxx_compiler_flag("${FLAG}" ${HAVE})
28 include(CheckSymbolExists)
29 macro(check_symbol NAME HEADER)
30 make_have_identifier(${NAME} HAVE)
31 configure_define(${HAVE})
32 cmake_push_check_state()
34 string(APPEND CMAKE_REQUIRED_FLAGS " ${ARGV2}")
36 check_symbol_exists(${NAME} ${HEADER} ${HAVE})
37 cmake_pop_check_state()
39 include(CheckCXXSymbolExists)
40 macro(check_cxx_symbol NAME HEADER)
41 make_have_identifier(${NAME} HAVE)
42 configure_define(${HAVE})
43 cmake_push_check_state()
45 string(APPEND CMAKE_REQUIRED_FLAGS " ${ARGN}")
47 check_cxx_symbol_exists(${NAME} ${HEADER} ${HAVE})
48 cmake_pop_check_state()
50 include(CheckIncludeFile)
51 macro(check_include HEADER)
52 make_have_identifier(${HEADER} HAVE)
53 configure_define(${HAVE})
54 cmake_push_check_state()
56 string(APPEND CMAKE_REQUIRED_FLAGS " ${ARGN}")
58 check_include_file(${HEADER} ${HAVE})
59 cmake_pop_check_state()
61 include(CheckIncludeFileCXX)
62 macro(check_cxx_include HEADER)
63 make_have_identifier(${HEADER} HAVE)
64 configure_define(${HAVE})
65 cmake_push_check_state()
67 string(APPEND CMAKE_REQUIRED_FLAGS " ${ARGN}")
69 check_include_file_cxx(${HEADER} ${HAVE})
70 cmake_pop_check_state()
72 include(CheckTypeSize)
73 macro(check_type TYPE)
74 make_have_identifier(${TYPE} HAVE)
75 configure_define(${HAVE})
76 cmake_push_check_state()
78 list(APPEND CMAKE_EXTRA_INCLUDE_FILES ${ARGN})
80 check_type_size(${TYPE} ${HAVE})
81 cmake_pop_check_state()
83 include(CheckCSourceCompiles)
84 macro(check_c_source SOURCE HAVE)
85 configure_define(${HAVE})
86 check_c_source_compiles("${SOURCE}" ${HAVE})
88 include(CheckCXXSourceCompiles)
89 macro(check_cxx_source SOURCE HAVE)
90 configure_define(${HAVE})
91 check_cxx_source_compiles("${SOURCE}" ${HAVE})
94 include(CheckBacktrace)
95 include(CheckByteswap)
96 include(CheckDependency)
100 include(CheckThreads)
101 include(CheckVisibility)
102 include(InstallPublicHeaders)
105 configure_define_01(LIBMEMCACHED_WITH_SASL_SUPPORT)
107 check_dependency(LIBSASL sasl2)
109 set(LIBMEMCACHED_WITH_SASL_SUPPORT 1)
114 configure_set(HAVE_FNV64_HASH ${ENABLE_HASH_FNV64})
115 configure_set(HAVE_MURMUR_HASH ${ENABLE_HASH_MURMUR})
116 configure_set(HAVE_HSIEH_HASH ${ENABLE_HASH_HSIEH})
118 check_include(alloca.h)
119 check_include(arpa/inet.h)
120 check_include(dlfcn.h)
121 check_include(getopt.h)
122 check_include(libgen.h)
123 check_include(netdb.h)
124 check_include(netinet/in.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)
138 check_cxx_symbol(abi::__cxa_demangle cxxabi.h)
139 check_symbol(fcntl fcntl.h)
140 check_symbol(gettimeofday sys/time.h)
141 check_symbol(htonll arpa/inet.h)
142 check_symbol(index strings.h)
143 check_symbol(MSG_DONTWAIT sys/socket.h)
144 check_symbol(MSG_MORE sys/socket.h)
145 check_symbol(MSG_NOSIGNAL sys/socket.h)
146 check_symbol(SO_RCVTIMEO sys/socket.h)
147 check_symbol(SO_SNDTIMEO sys/socket.h)
148 check_symbol(rand stdlib.h)
149 check_symbol(random stdlib.h)
150 check_symbol(realpath stdlib.h)
151 check_symbol(sendmsg sys/socket.h)
152 check_symbol(setenv stdlib.h)
153 check_symbol(strerror_r string.h)
158 return *strerror_r(0, &x, 1);
160 HAVE_STRERROR_R_CHAR_P
165 check_include(winsock2.h)
166 check_include(ws2tcpip.h)
168 check_symbol(htonll winsock2.h)