endif()
endif()
-## uuid
-if(BUILD_TESTING)
- if(NOT MEMCACHED_BINARY)
- find_package(Memcached)
- set(MEMCACHED_BINARY ${MEMCACHED_EXECUTABLE})
- endif()
-endif()
-
## sasl
if(ENABLE_SASL)
check_dependency(LIBSASL sasl2 sasl/sasl.h)
test_big_endian(WORDS_BIGENDIAN)
check_byteswap()
-check_header(alloca.h)
+# most of the following checks are due to mingw or msvc; see gnulib
check_header(arpa/inet.h)
check_header(dlfcn.h)
-check_header(errno.h)
-check_header(fcntl.h)
-check_header(io.h)
-check_header(limits.h)
check_header(netdb.h)
check_header(poll.h)
-check_header(stddef.h)
-check_header(stdlib.h)
check_header(strings.h)
check_header(sys/socket.h)
check_header(sys/time.h)
-check_header(sys/types.h)
check_header(sys/un.h)
-check_header(sys/wait.h)
check_header(time.h)
-check_header(umem.h)
check_header(unistd.h)
-check_header(winsock2.h)
-check_header(ws2tcpip.h)
+if(WIN32)
+ check_header(io.h)
+ check_header(winsock2.h)
+ check_header(ws2tcpip.h)
+endif()
+
+check_decl(abi::__cxa_demangle cxxabi.h)
check_decl(fcntl fcntl.h)
check_decl(htonll arpa/inet.h)
check_decl(MSG_DONTWAIT sys/socket.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_type(in_port_t netinet/in.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)
find_package(Backtrace)
if(Backtrace_FOUND)
INTERFACE_INCLUDE_DIRECTORIES "${Backtrace_INCLUDE_DIR}")
endif()
-check_type(in_port_t netinet/in.h)
-
-check_header(cstdint)
-check_header(cinttypes)
-check_header(inttypes.h)
if(ENABLE_MEMASLAP)
include(CheckAtomics)
+ add_definitions(-D_GNU_SOURCE)
check_atomics()
check_dependency(LIBEVENT event event.h)
check_decl(getline stdio.h)
+ check_decl(_SC_NPROCESSORS_ONLN unistd.h)
+ check_type(cpu_set_t sched.h)
if(HAVE_LIBEVENT AND HAVE_ATOMICS)
add_executable(memaslap
#if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
#endif
-
-#if defined(HAVE_TIME_H)
-# include <time.h>
-#endif
+#include <time.h>
#include "ms_setting.h"
#include "ms_thread.h"
#if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
#endif
-
-#if defined(HAVE_TIME_H)
-# include <time.h>
-#endif
+#include <time.h>
#include "ms_atomic.h"
#include "ms_sigsegv.h"
#include <inttypes.h>
#include <limits.h>
#include <pwd.h>
-#include <strings.h>
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
#include <sys/types.h>
-#include <unistd.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include "ms_setting.h"
#include "ms_conn.h"
#if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
#endif
-
-#if defined(HAVE_TIME_H)
-# include <time.h>
-#endif
+#include <time.h>
+#include <inttypes.h>
#include "ms_thread.h"
#include "ms_setting.h"
#if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
#endif
-
-#if defined(HAVE_TIME_H)
-# include <time.h>
-#endif
+#include <time.h>
#include "ms_thread.h"
#include "ms_setting.h"
#include <cassert>
#include <sys/types.h>
#include <cstdio>
-#include <unistd.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <fcntl.h>
#include <cerrno>
#include <cstdlib>
#include <cstring>
#include <fcntl.h>
#include <sys/types.h>
-#include <unistd.h>
-
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <libmemcachedprotocol-0.0/handler.h>
#include <example/byteorder.h>
#include "example/memcached_light.h"
#include <getopt.h>
#include <iostream>
#include <sys/types.h>
-#include <unistd.h>
-
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
extern memcached_binary_protocol_callback_st interface_v0_impl;
extern memcached_binary_protocol_callback_st interface_v1_impl;
#if !defined(__cplusplus)
# include <stdbool.h>
+# include <inttypes.h>
+#else
+# include <cinttypes>
#endif
-#include <inttypes.h>
#include <sys/types.h>
#include <libhashkit-1.0/visibility.h>
#cmakedefine01 LIBMEMCACHED_ENABLE_DEPRECATED
#cmakedefine01 LIBMEMCACHED_WITH_SASL_SUPPORT
+#cmakedefine HAVE_IN_PORT_T 1
+#cmakedefine HAVE_NETDB_H 1
+
#define LIBMEMCACHED_VERSION_STRING "@LIBMEMCACHED_VERSION@"
#define LIBMEMCACHED_VERSION_HEX @LIBMEMCACHED_VERSION_HEX@
#endif
#ifdef __cplusplus
-# if __cplusplus >= 201103L
-# include <cinttypes>
-# else
-# include <inttypes.h>
-# endif
+# include <cinttypes>
# include <cstddef>
# include <cstdlib>
#else
# include "libmemcached/exception.hpp"
#endif
-#include <string.h>
-
+#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#pragma once
+#include "libmemcached-1.0/configure.h"
+
#if defined(_WIN32)
# include <winsock2.h>
# include <ws2tcpip.h>
#pragma once
+#include "libmemcached-1.0/configure.h"
+
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#include <cstdio>
#include <cstdlib>
#include <cstring>
-#include <ctype.h>
+#include <cctype>
#include <fcntl.h>
-#include <inttypes.h>
+#include <cinttypes>
#include <pthread.h>
-#include <signal.h>
+#include <csignal>
#include <sys/types.h>
-#include <unistd.h>
-
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include "libmemcached-1.0/memcached.h"
#include "libmemcached/socket.hpp"
#include "libhashkit/hashkitcon.h"
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
+#include <cassert>
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cmath>
#ifndef __WORDSIZE
# ifdef __MINGW32__
#include "libhashkit/common.h"
-#include <string.h>
+#include <cstring>
#include <sys/types.h>
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#pragma once
-//-----------------------------------------------------------------------------
+#include <cstdint>
void MurmurHash3_x86_32(const void *key, int len, uint32_t seed, void *out);
-
-//-----------------------------------------------------------------------------
+--------------------------------------------------------------------+
*/
-#include <assert.h>
-#include <stdlib.h>
+#include <cassert>
+#include <cstdlib>
#include "libhashkit/rijndael.hpp"
# ifdef _WIN32
# include <malloc.h>
-# elif HAVE_ALLOCA_H
-# include <alloca.h>
# endif
# ifdef __cplusplus
# endif
#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
+#include <sys/types.h>
uint64_t memcached_ntohll(uint64_t value) {
#ifdef HAVE_HTONLL
extern "C" {
#endif
+#include <stdint.h>
+
uint64_t memcached_ntohll(uint64_t);
uint64_t memcached_htonll(uint64_t);
# include <cerrno>
# include <climits>
#else
-# ifdef HAVE_STDDEF_H
-# include <stddef.h>
-# endif
-# ifdef HAVE_STDLIB_H
-# include <stdio.h>
-# endif
-# ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
+# include <stddef.h>
+# include <stdio.h>
+# include <stdlib.h>
# include <string.h>
-# ifdef HAVE_TIME_H
-# include <time.h>
-# endif
-# ifdef HAVE_ERRNO_H
-# include <errno.h>
-# endif
-# ifdef HAVE_LIMITS_H
-# include <limits.h>
-# endif
+# include <time.h>
+# include <errno.h>
+# include <limits.h>
#endif
#ifdef HAVE_SYS_UN_H
# include <sys/time.h>
#endif
-#ifdef HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
+#include <fcntl.h>
+#include <sys/types.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#elif defined(HAVE_STRERROR_R) && HAVE_STRERROR_R
strerror_r(local_errno, errmsg, sizeof(errmsg));
errmsg_ptr = errmsg;
-#elif defined(HAVE_STRERROR) && HAVE_STRERROR
+#else
snprintf(errmsg, sizeof(errmsg), "%s", strerror(local_errno));
errmsg_ptr = errmsg;
#endif
#include "libmemcached/common.h"
-#include <sys/time.h>
+#if HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <time.h>
#include "libmemcached/virtual_bucket.h"
#include "libmemcached/assert.hpp"
#include <cmath>
-#include <sys/time.h>
+#if HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <time.h>
/* Protoypes (static) */
static memcached_return_t update_continuum(Memcached *ptr);
#if defined(_WIN32)
# include "libmemcached/poll.h"
-
-# include <sys/time.h>
-# include <strings.h>
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# endif
+# include <time.h>
+# if HAVE_STRINGS_H
+# include <strings.h>
+# endif
int poll(struct pollfd fds[], nfds_t nfds, int tmo) {
fd_set readfds, writefds, errorfds;
+check_header(umem.h)
add_library(libmemcachedprotocol SHARED
ascii_handler.c
#include <errno.h>
#include <stdbool.h>
#include <string.h>
-#include <strings.h>
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
#include <ctype.h>
#include <stdio.h>
#include <sys/types.h>
-#include <sys/socket.h>
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
/*
** **********************************************************************
#cmakedefine HAVE_CXX_STDATOMIC 1
#cmakedefine HAVE_ATOMICS 1
+#cmakedefine HAVE__SC_NPROCESSORS_ONLN 1
#cmakedefine HAVE_ABI____CXA_DEMANGLE 1
#cmakedefine HAVE_BACKTRACE 1
#cmakedefine HAVE_BYTESWAP 1
-#cmakedefine HAVE_ALLOCA_H 1
#cmakedefine HAVE_ARPA_INET_H 1
+#cmakedefine HAVE_CPU_SET_T 1
#cmakedefine HAVE_DLFCN_H 1
#cmakedefine HAVE_DTRACE 1
-#cmakedefine HAVE_ERRNO_H 1
#cmakedefine HAVE_FCNTL 1
-#cmakedefine HAVE_FCNTL_H 1
#cmakedefine HAVE_FNV64_HASH 1
-#cmakedefine HAVE_GETLINE
+#cmakedefine HAVE_GETLINE 1
#cmakedefine HAVE_HSIEH_HASH 1
#cmakedefine HAVE_HTONLL 1
#cmakedefine HAVE_IN_PORT_T 1
#cmakedefine HAVE_IO_H 1
#cmakedefine HAVE_LIBEVENT 1
#cmakedefine HAVE_LIBSASL 1
-#cmakedefine HAVE_LIBUUID 1
-#cmakedefine HAVE_LIMITS_H 1
#cmakedefine HAVE_MSG_DONTWAIT 1
#cmakedefine HAVE_MSG_MORE 1
#cmakedefine HAVE_MSG_NOSIGNAL 1
#cmakedefine HAVE_POLL_H 1
#cmakedefine HAVE_SASL_SASL_H 1
#cmakedefine HAVE_SETENV 1
-#cmakedefine HAVE_SHARED_ENABLED 1
#cmakedefine HAVE_SO_RCVTIMEO 1
#cmakedefine HAVE_SO_SNDTIMEO 1
-#cmakedefine HAVE_STDDEF_H 1
-#cmakedefine HAVE_STDLIB_H 1
-#cmakedefine HAVE_STRERROR 1
#cmakedefine HAVE_STRERROR_R 1
#cmakedefine HAVE_STRERROR_R_CHAR_P 1
#cmakedefine HAVE_STRINGS_H 1
#cmakedefine HAVE_SYS_SOCKET_H 1
#cmakedefine HAVE_SYS_TIME_H 1
-#cmakedefine HAVE_SYS_TYPES_H 1
#cmakedefine HAVE_SYS_WAIT_H 1
#cmakedefine HAVE_SYS_UN_H 1
-#cmakedefine HAVE_TIME_H 1
#cmakedefine HAVE_UMEM_H 1
#cmakedefine HAVE_UNISTD_H 1
#cmakedefine HAVE_VISIBILITY 1
#cmakedefine HAVE_WINSOCK2_H 1
#cmakedefine HAVE_WS2TCPIP_H 1
-#cmakedefine HAVE_INTTYPES_H 1
-#cmakedefine HAVE_CINTTYPES 1
-#cmakedefine HAVE_CSTDINT 1
-#if defined __cplusplus
-# if defined HAVE_CINTTYPES
-# include <cinttypes>
-# elif defined HAVE_CSTDINT
-# include <cstdint>
-# endif
-#elif defined HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-
#if HAVE_BACKTRACE
# define BACKTRACE_HEADER <@Backtrace_HEADER@>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
+#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#include <signal.h>
-#include <unistd.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <sys/select.h>
#include <util/daemon.hpp>
#include <netinet/in.h>
#include <poll.h>
#include <sstream>
-#include <sys/socket.h>
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <sstream>
#include <sys/stat.h>
#include <sys/types.h>
-#include <unistd.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
namespace datadifferential {
namespace util {
#include <sstream>
#include <sys/stat.h>
#include <sys/types.h>
-#include <unistd.h>
+#if #if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
extern "C" {
include(Catch)
include(CheckTbb)
-if(NOT MEMCACHED_BINARY)
- message(SEND_ERROR "Could not find memcached(1) binary")
- set(ENV{INVALID_CONFIGURATION} 1)
-endif()
-
check_decl(pipe2 unistd.h)
check_decl(SOCK_NONBLOCK sys/socket.h)
check_decl(SOCK_CLOEXEC sys/socket.h)
+check_header(sys/wait.h)
check_decl(waitid sys/wait.h)
if(HAVE_WAITID)
- check_compiles(HAVE_WAITID_NOWAIT "siginfo_t s; waitid(P_ALL, 0, &s, WNOWAIT|WEXITED);" sys/types.h sys/wait.h)
+ check_compiles(HAVE_WAITID_NOWAIT "
+ siginfo_t s;
+ waitid(P_ALL, 0, &s, WNOWAIT|WEXITED);"
+ sys/types.h sys/wait.h)
+endif()
+if(NOT HAVE_SYS_WAIT_H)
+ message(SEND_ERROR "Could not find header <sys/wait.h>")
+ set(ENV{INVALID_CONFIGURATION} 1)
+endif()
+
+# parallelism
+if(NOT (thread IN_LIST ENABLE_SANITIZERS))
+ check_tbb()
+endif()
+
+# memcached(1)
+if(NOT MEMCACHED_BINARY)
+ find_package(Memcached)
+ set(MEMCACHED_BINARY ${MEMCACHED_EXECUTABLE})
+endif()
+if(NOT MEMCACHED_BINARY)
+ message(SEND_ERROR "Could not find memcached(1) binary")
+ set(ENV{INVALID_CONFIGURATION} 1)
endif()
file(GLOB_RECURSE TESTING_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
${CMAKE_BINARY_DIR}/src)
target_link_libraries(runtests PRIVATE libhashkit libmemcachedinternal libmemcachedutil)
-if(NOT (thread IN_LIST ENABLE_SANITIZERS))
- check_tbb()
- if(HAVE_TBB)
- target_link_libraries(runtests PRIVATE ${LIBTBB})
- endif()
+if(HAVE_TBB)
+ target_link_libraries(runtests PRIVATE ${LIBTBB})
endif()
add_dependencies(runtests ${CLIENTS})
#include <cerrno>
#include <sys/poll.h>
-#include <unistd.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#if !(HAVE_SOCK_NONBLOCK && HAVE_SOCK_CLOEXEC)
# include <fcntl.h>
#include <fcntl.h>
#include <sys/poll.h>
-#include <unistd.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <spawn.h>
#if !HAVE_PIPE2
#include "ForkAndExec.hpp"
#include <sys/wait.h>
-#include <unistd.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
Server::Server(string binary_, Server::argv_t args_)
: binary{move(binary_)}
#include "test/lib/random.hpp"
#include "test/lib/Connection.hpp"
-#include <unistd.h> // getpid()
-
+#if HAVE_UNISTD_H
+# include <unistd.h> // getpid()
+#endif
mt19937_64 rnd_eng;
mutex rnd_mtx;
#include <csignal>
#include <iostream>
#include <string>
-#include <unistd.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
static void sigchld(int, siginfo_t *si, void *) {
switch (si->si_code) {
#include <semaphore.h>
#include <signal.h>
#include <sys/stat.h>
-#include <sys/time.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <time.h>
#include <sys/types.h>
-#include <unistd.h>
-
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <iostream>
#include "libtest/server.h"
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <unistd.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <ctime>
#include <string>