WIP
authorMichael Wallner <mike@php.net>
Wed, 25 Nov 2020 14:28:27 +0000 (15:28 +0100)
committerMichael Wallner <mike@php.net>
Wed, 25 Nov 2020 14:28:27 +0000 (15:28 +0100)
44 files changed:
CMake/_Include.cmake
contrib/bin/memaslap/CMakeLists.txt
contrib/bin/memaslap/ms_conn.c
contrib/bin/memaslap/ms_main.c
contrib/bin/memaslap/ms_setting.c
contrib/bin/memaslap/ms_task.c
contrib/bin/memaslap/ms_thread.c
example/interface_v0.cc
example/interface_v1.cc
example/memcached_light.cc
include/libhashkit-1.0/hashkit.h
include/libmemcached-1.0/configure.h.in
include/libmemcached-1.0/memcached.h
include/libmemcached-1.0/memcached.hpp
include/libmemcached-1.0/platform.h
include/libmemcached-1.0/struct/server.h
src/bin/memcapable.cc
src/libhashkit/common.h
src/libhashkit/md5.cc
src/libhashkit/murmur3.h
src/libhashkit/rijndael.cc
src/libmemcached/assert.hpp
src/libmemcached/byteorder.cc
src/libmemcached/byteorder.h
src/libmemcached/common.h
src/libmemcached/error.cc
src/libmemcached/hash.cc
src/libmemcached/hosts.cc
src/libmemcached/poll.cc
src/libmemcachedprotocol/CMakeLists.txt
src/libmemcachedprotocol/handler.c
src/mem_config.h.in
src/util/daemon.cc
src/util/instance.cc
src/util/logfile.cc
src/util/pidfile.cc
test/CMakeLists.txt
test/lib/Connection.cpp
test/lib/ForkAndExec.cpp
test/lib/Server.cpp
test/lib/random.cpp
test/setup.cpp
tests/libmemcached-1.0/mem_functions.cc
tests/libmemcached-1.0/plus.cpp

index 9dbd3dfaaa221dafd27f12cdb1d61819500352d9..c09936b9c9b5359750848c1d36b7e2a48ee18192 100644 (file)
@@ -44,14 +44,6 @@ if(ENABLE_DTRACE)
     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)
@@ -76,29 +68,25 @@ endif()
 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)
@@ -110,9 +98,12 @@ check_decl(setenv stdlib.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)
@@ -124,8 +115,3 @@ 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)
index 648b76874f491d85bbe0db29f15af6377266edca..4f453610262e3c8c470d2514d992fa8e868a145a 100644 (file)
@@ -1,8 +1,11 @@
 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
index f4375ae87bea7c318859d550fcd8b19b0991615b..10737de543dad9a490838a7dbb2903ac93baa8e5 100644 (file)
 #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"
index d7573eb56a1b7dcd0a1d52a117d56b77a73a2a9d..2cab6e05241bd36138bd6b943377f44910482d9f 100644 (file)
 #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"
index 9d328ddcf62ae831908c57b89ffd0b91a908aeed..38a5cbbcb62697e25a3f76c491f577c8ee281dcb 100644 (file)
 #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"
index 63d7fed865957356840b7db0e9a3782239940938..fc8ff47559b9d3fd0b377edaf9594ed49b1c8029 100644 (file)
 #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"
index 1d960cfa758806da97e5250ef4575c5380a754eb..334b4e16c907a3636f58f9944b6285a1cbe4fcf3 100644 (file)
 #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"
index 64debddcf1a5af12e486b45effc4283dec5fbbb9..cf6001243b1cc6b08fabe642170a6e12402d2f85 100644 (file)
@@ -10,7 +10,9 @@
 #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>
index 61dd929d0f3f96280d16acd1a748e06703bd18fa..c6f5bf199f9c83929df65bb36cac3f5e83659ad9 100644 (file)
@@ -17,8 +17,9 @@
 #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"
index c5385d75950e60714e7e12ca2c02e3aa474ea495..714bb16f3dedafb216c753a81cb870f9b074df6e 100644 (file)
@@ -48,8 +48,9 @@ using namespace datadifferential;
 #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;
 
index f4155eacb8a716adf07ebac68a4b61d6105a1e86..9842f8eb5e0723a203b4c9eccee477113ec9ce37 100644 (file)
 
 #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>
index f1bf37fc4c542a776d416f38152a66ab233cdea4..91e3f1ceba5763fe4a8da3265bee2bf0bb9852e6 100644 (file)
@@ -18,6 +18,9 @@
 #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@
 
index 065fb24f2f71076521d6a65cfc7637a24833217d..f2ef064275899e1c60208c8e4252642d47cec6c7 100644 (file)
 #endif
 
 #ifdef __cplusplus
-#  if __cplusplus >= 201103L
-#    include <cinttypes>
-#  else
-#    include <inttypes.h>
-#  endif
+#  include <cinttypes>
 #  include <cstddef>
 #  include <cstdlib>
 #else
index 54e89cf355a665cf463cdfd3e7a03afb5bc750f6..aaeb4df7c0c78dfcda19da360bb6bea4811dc6f5 100644 (file)
@@ -20,8 +20,7 @@
 #  include "libmemcached/exception.hpp"
 #endif
 
-#include <string.h>
-
+#include <cstring>
 #include <sstream>
 #include <string>
 #include <vector>
index 55f7688ea7081c50ad0079c3ae4e96d2623096e6..a3ccd3d737ded861284109cacba695b969154b49 100644 (file)
@@ -15,6 +15,8 @@
 
 #pragma once
 
+#include "libmemcached-1.0/configure.h"
+
 #if defined(_WIN32)
 #  include <winsock2.h>
 #  include <ws2tcpip.h>
index e3ff9e76bc09235c92a05321da5fecb876555eeb..e74767ada8c7f8d1cd4c9578b5cf006a5d5dd2cc 100644 (file)
@@ -15,6 +15,8 @@
 
 #pragma once
 
+#include "libmemcached-1.0/configure.h"
+
 #ifdef HAVE_NETDB_H
 #  include <netdb.h>
 #endif
index 017a42b4bef2c1f77c5cf7dde865267f3bc3c299..d90c71688b7f6c91d88031df3f54687a6d288e9a 100644 (file)
 #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"
index ba51ee0cb8cc8669a5d789c65adcc414c589712f..140d88154147a13ba11a43e504e1a76521444825 100644 (file)
 
 #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__
index 39b7cd4eae882f0c1526da25334a15e1bb9dfd4a..aa417cb4f19dc6a0814d413af47561a6bd28f519 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "libhashkit/common.h"
 
-#include <string.h>
+#include <cstring>
 #include <sys/types.h>
 
 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
index 9ed074c1d1603710864a6c4fd83e69b49b000f70..f0410099746a47366ec33bb86e54d8f6b23b494f 100644 (file)
@@ -15,8 +15,6 @@
 
 #pragma once
 
-//-----------------------------------------------------------------------------
+#include <cstdint>
 
 void MurmurHash3_x86_32(const void *key, int len, uint32_t seed, void *out);
-
-//-----------------------------------------------------------------------------
index a8021c523554a802d53fdd81e088ac1ccfb400ce..663d3d9ddcd7afc180e584bcba833f495319d268 100644 (file)
@@ -13,8 +13,8 @@
     +--------------------------------------------------------------------+
 */
 
-#include <assert.h>
-#include <stdlib.h>
+#include <cassert>
+#include <cstdlib>
 
 #include "libhashkit/rijndael.hpp"
 
index 062ebd9c8347c8a8b3dc3f4d82b37b478d3819c4..4088c0f10e813b9cf4beb8c88d2fa209f202c7f1 100644 (file)
@@ -32,8 +32,6 @@
 
 #  ifdef _WIN32
 #    include <malloc.h>
-#  elif HAVE_ALLOCA_H
-#    include <alloca.h>
 #  endif
 
 #  ifdef __cplusplus
index 1bfe12b9a5bc0a20c8055ed243c36db059b7c438..aa2a33dfe9b9373f09b7f5049049115f5d90f207 100644 (file)
@@ -37,9 +37,7 @@ static inline uint64_t swap64(uint64_t in) {
 #  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
index 30c393e9f1955f2f3e0c5583f78dc5d41a5c49d0..ecc894670848623837dad7c91d4ac149beb0aa3f 100644 (file)
@@ -19,6 +19,8 @@
 extern "C" {
 #endif
 
+#include <stdint.h>
+
 uint64_t memcached_ntohll(uint64_t);
 
 uint64_t memcached_htonll(uint64_t);
index 4b025fb368c2d6de8181fb63eeb4655846148fce..f9b20c4e725b12b6a676282adc9959fcf71880cf 100644 (file)
 #  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>
index d148aafe1c930acd49bc5f769e7e2cb72fed6a0d..b8f0cc336c1b2574370715bcb6b484bcff74f3cb 100644 (file)
@@ -129,7 +129,7 @@ static void _set(Memcached &memc, memcached_string_t *str, memcached_return_t &r
 #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
index e062e4e7fb9286e4e16cb8559855d8b59073e917..cb1ca4641e1a85b93cd23ddfe39b31d8ecae8b34 100644 (file)
 
 #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"
 
index b478881ce7731ac7faa7413e2ba589768e69e2e7..39247287666d55fed37f5b5f72242057fa5f462d 100644 (file)
 #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);
index b8324caa98876c93a8e1e38119913a301b501a36..81062caee33b658e1756f72f82c804b51be1ba48 100644 (file)
 
 #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;
index 915a3da10335527d47d43f26aa5fe946aa964695..c0c3cffad01cfba1b822280ab902edd0faaa6a16 100644 (file)
@@ -1,3 +1,4 @@
+check_header(umem.h)
 
 add_library(libmemcachedprotocol SHARED
         ascii_handler.c
index b412b9e9f9009aad375aa6aee628da63d642e099..b848407245ba07a22a475548cbe962a54a620bf0 100644 (file)
 #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
 
 /*
 ** **********************************************************************
index d0b3a3e6a513988c4cae3ddbe0bdee4360755631..7ab23f908d966a5e702d67016baa6df87ee7da37 100644 (file)
 #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
index 3c65a7bb8a247bb4a2165c53d69052b121eda63c..429187b6fec72f60c3dff09c8c3fe379a142f58e 100644 (file)
 #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>
index 8f5d17383d95d3add0c7e5f0c6a693178328e8ff..f136d7b7d05f788fabd8a2a0537973ae3ffd39e9 100644 (file)
@@ -46,7 +46,9 @@
 #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
index 810424d0ef92e4a53c52a39ebc8d12321aaa99cf..0ae403923af8cf3aa9d65f7b29cede7672130840 100644 (file)
@@ -49,7 +49,9 @@
 #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 {
index 90a6d17818096a77a72ddf4a98b68e9130f3409a..dd26f25742f1b21e5af97f5b95028905d26358af 100644 (file)
@@ -48,7 +48,9 @@
 #include <sstream>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <unistd.h>
+#if #if HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
 
 extern "C" {
 
index 19330d393f87088893970c737b026ce3dd743cec..0279f60ca22553c9ebe362bb25120d566d392234 100644 (file)
@@ -6,17 +6,35 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
 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)
@@ -32,11 +50,8 @@ target_include_directories(runtests PRIVATE
         ${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})
index 0530d38bf7a88525012e58c6cf8ca6e90ff90cec..806ce502e4f36889ee51c4aa9954c07328da1621 100644 (file)
@@ -2,7 +2,9 @@
 
 #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>
index 5af789f65caa57b725d7c19146c44f64a94bebb7..753e06ee88f680104886cc9cc1140f5e9324ef72 100644 (file)
@@ -4,7 +4,9 @@
 
 #include <fcntl.h>
 #include <sys/poll.h>
-#include <unistd.h>
+#if HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
 #include <spawn.h>
 
 #if !HAVE_PIPE2
index dddb68d9f733ceecf98da9ae9f3e5bca83bce323..cf520094029949cb94b0ac7d9d61087858370f04 100644 (file)
@@ -3,7 +3,9 @@
 #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_)}
index 1d9a20c9a9b166e0b5beda1743a04e5ffcfcb906..76c049710432ffbc4b0be42d43aaee59a265c370 100644 (file)
@@ -1,8 +1,9 @@
 #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;
 
index a506976a0c793d750a7d6f23169476e59941bf0d..8ee8bda09a6ec9a1f9167dd207d644f8b3f3c5bc 100644 (file)
@@ -8,7 +8,9 @@
 #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) {
index fa9ce010e42fb7b6fb4ad8f1c44e6f38ee224bca..2c12f9d797cca2a145d3c992ab3aff439c7303ca 100644 (file)
 #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"
index b0f92f6ecb2a459c353b0bc7399d9cfb9670cfeb..1077ae72fd1a80b8ba98d803d400dfbb5d8dbf5e 100644 (file)
@@ -49,7 +49,9 @@
 #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>