From: Michael Wallner Date: Wed, 25 Nov 2020 14:28:27 +0000 (+0100) Subject: WIP X-Git-Tag: 1.1.0-beta1~87 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=6b7d2bf0319e0bd48bd6aa4ad8c56a935f98b0d2;p=m6w6%2Flibmemcached WIP --- diff --git a/CMake/_Include.cmake b/CMake/_Include.cmake index 9dbd3dfa..c09936b9 100644 --- a/CMake/_Include.cmake +++ b/CMake/_Include.cmake @@ -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) diff --git a/contrib/bin/memaslap/CMakeLists.txt b/contrib/bin/memaslap/CMakeLists.txt index 648b7687..4f453610 100644 --- a/contrib/bin/memaslap/CMakeLists.txt +++ b/contrib/bin/memaslap/CMakeLists.txt @@ -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 diff --git a/contrib/bin/memaslap/ms_conn.c b/contrib/bin/memaslap/ms_conn.c index f4375ae8..10737de5 100644 --- a/contrib/bin/memaslap/ms_conn.c +++ b/contrib/bin/memaslap/ms_conn.c @@ -31,10 +31,7 @@ #if defined(HAVE_SYS_TIME_H) # include #endif - -#if defined(HAVE_TIME_H) -# include -#endif +#include #include "ms_setting.h" #include "ms_thread.h" diff --git a/contrib/bin/memaslap/ms_main.c b/contrib/bin/memaslap/ms_main.c index d7573eb5..2cab6e05 100644 --- a/contrib/bin/memaslap/ms_main.c +++ b/contrib/bin/memaslap/ms_main.c @@ -24,10 +24,7 @@ #if defined(HAVE_SYS_TIME_H) # include #endif - -#if defined(HAVE_TIME_H) -# include -#endif +#include #include "ms_atomic.h" #include "ms_sigsegv.h" diff --git a/contrib/bin/memaslap/ms_setting.c b/contrib/bin/memaslap/ms_setting.c index 9d328ddc..38a5cbbc 100644 --- a/contrib/bin/memaslap/ms_setting.c +++ b/contrib/bin/memaslap/ms_setting.c @@ -21,9 +21,13 @@ #include #include #include -#include +#if HAVE_STRINGS_H +# include +#endif #include -#include +#if HAVE_UNISTD_H +# include +#endif #include "ms_setting.h" #include "ms_conn.h" diff --git a/contrib/bin/memaslap/ms_task.c b/contrib/bin/memaslap/ms_task.c index 63d7fed8..fc8ff475 100644 --- a/contrib/bin/memaslap/ms_task.c +++ b/contrib/bin/memaslap/ms_task.c @@ -18,10 +18,8 @@ #if defined(HAVE_SYS_TIME_H) # include #endif - -#if defined(HAVE_TIME_H) -# include -#endif +#include +#include #include "ms_thread.h" #include "ms_setting.h" diff --git a/contrib/bin/memaslap/ms_thread.c b/contrib/bin/memaslap/ms_thread.c index 1d960cfa..334b4e16 100644 --- a/contrib/bin/memaslap/ms_thread.c +++ b/contrib/bin/memaslap/ms_thread.c @@ -18,10 +18,7 @@ #if defined(HAVE_SYS_TIME_H) # include #endif - -#if defined(HAVE_TIME_H) -# include -#endif +#include #include "ms_thread.h" #include "ms_setting.h" diff --git a/example/interface_v0.cc b/example/interface_v0.cc index 64debddc..cf600124 100644 --- a/example/interface_v0.cc +++ b/example/interface_v0.cc @@ -10,7 +10,9 @@ #include #include #include -#include +#if HAVE_UNISTD_H +# include +#endif #include #include #include diff --git a/example/interface_v1.cc b/example/interface_v1.cc index 61dd929d..c6f5bf19 100644 --- a/example/interface_v1.cc +++ b/example/interface_v1.cc @@ -17,8 +17,9 @@ #include #include #include -#include - +#if HAVE_UNISTD_H +# include +#endif #include #include #include "example/memcached_light.h" diff --git a/example/memcached_light.cc b/example/memcached_light.cc index c5385d75..714bb16f 100644 --- a/example/memcached_light.cc +++ b/example/memcached_light.cc @@ -48,8 +48,9 @@ using namespace datadifferential; #include #include #include -#include - +#if HAVE_UNISTD_H +# include +#endif extern memcached_binary_protocol_callback_st interface_v0_impl; extern memcached_binary_protocol_callback_st interface_v1_impl; diff --git a/include/libhashkit-1.0/hashkit.h b/include/libhashkit-1.0/hashkit.h index f4155eac..9842f8eb 100644 --- a/include/libhashkit-1.0/hashkit.h +++ b/include/libhashkit-1.0/hashkit.h @@ -17,8 +17,10 @@ #if !defined(__cplusplus) # include +# include +#else +# include #endif -#include #include #include diff --git a/include/libmemcached-1.0/configure.h.in b/include/libmemcached-1.0/configure.h.in index f1bf37fc..91e3f1ce 100644 --- a/include/libmemcached-1.0/configure.h.in +++ b/include/libmemcached-1.0/configure.h.in @@ -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@ diff --git a/include/libmemcached-1.0/memcached.h b/include/libmemcached-1.0/memcached.h index 065fb24f..f2ef0642 100644 --- a/include/libmemcached-1.0/memcached.h +++ b/include/libmemcached-1.0/memcached.h @@ -22,11 +22,7 @@ #endif #ifdef __cplusplus -# if __cplusplus >= 201103L -# include -# else -# include -# endif +# include # include # include #else diff --git a/include/libmemcached-1.0/memcached.hpp b/include/libmemcached-1.0/memcached.hpp index 54e89cf3..aaeb4df7 100644 --- a/include/libmemcached-1.0/memcached.hpp +++ b/include/libmemcached-1.0/memcached.hpp @@ -20,8 +20,7 @@ # include "libmemcached/exception.hpp" #endif -#include - +#include #include #include #include diff --git a/include/libmemcached-1.0/platform.h b/include/libmemcached-1.0/platform.h index 55f7688e..a3ccd3d7 100644 --- a/include/libmemcached-1.0/platform.h +++ b/include/libmemcached-1.0/platform.h @@ -15,6 +15,8 @@ #pragma once +#include "libmemcached-1.0/configure.h" + #if defined(_WIN32) # include # include diff --git a/include/libmemcached-1.0/struct/server.h b/include/libmemcached-1.0/struct/server.h index e3ff9e76..e74767ad 100644 --- a/include/libmemcached-1.0/struct/server.h +++ b/include/libmemcached-1.0/struct/server.h @@ -15,6 +15,8 @@ #pragma once +#include "libmemcached-1.0/configure.h" + #ifdef HAVE_NETDB_H # include #endif diff --git a/src/bin/memcapable.cc b/src/bin/memcapable.cc index 017a42b4..d90c7168 100644 --- a/src/bin/memcapable.cc +++ b/src/bin/memcapable.cc @@ -28,14 +28,15 @@ #include #include #include -#include +#include #include -#include +#include #include -#include +#include #include -#include - +#if HAVE_UNISTD_H +# include +#endif #include "libmemcached-1.0/memcached.h" #include "libmemcached/socket.hpp" diff --git a/src/libhashkit/common.h b/src/libhashkit/common.h index ba51ee0c..140d8815 100644 --- a/src/libhashkit/common.h +++ b/src/libhashkit/common.h @@ -17,11 +17,11 @@ #include "libhashkit/hashkitcon.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #ifndef __WORDSIZE # ifdef __MINGW32__ diff --git a/src/libhashkit/md5.cc b/src/libhashkit/md5.cc index 39b7cd4e..aa417cb4 100644 --- a/src/libhashkit/md5.cc +++ b/src/libhashkit/md5.cc @@ -15,7 +15,7 @@ #include "libhashkit/common.h" -#include +#include #include #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) diff --git a/src/libhashkit/murmur3.h b/src/libhashkit/murmur3.h index 9ed074c1..f0410099 100644 --- a/src/libhashkit/murmur3.h +++ b/src/libhashkit/murmur3.h @@ -15,8 +15,6 @@ #pragma once -//----------------------------------------------------------------------------- +#include void MurmurHash3_x86_32(const void *key, int len, uint32_t seed, void *out); - -//----------------------------------------------------------------------------- diff --git a/src/libhashkit/rijndael.cc b/src/libhashkit/rijndael.cc index a8021c52..663d3d9d 100644 --- a/src/libhashkit/rijndael.cc +++ b/src/libhashkit/rijndael.cc @@ -13,8 +13,8 @@ +--------------------------------------------------------------------+ */ -#include -#include +#include +#include #include "libhashkit/rijndael.hpp" diff --git a/src/libmemcached/assert.hpp b/src/libmemcached/assert.hpp index 062ebd9c..4088c0f1 100644 --- a/src/libmemcached/assert.hpp +++ b/src/libmemcached/assert.hpp @@ -32,8 +32,6 @@ # ifdef _WIN32 # include -# elif HAVE_ALLOCA_H -# include # endif # ifdef __cplusplus diff --git a/src/libmemcached/byteorder.cc b/src/libmemcached/byteorder.cc index 1bfe12b9..aa2a33df 100644 --- a/src/libmemcached/byteorder.cc +++ b/src/libmemcached/byteorder.cc @@ -37,9 +37,7 @@ static inline uint64_t swap64(uint64_t in) { # endif #endif -#ifdef HAVE_SYS_TYPES_H -# include -#endif +#include uint64_t memcached_ntohll(uint64_t value) { #ifdef HAVE_HTONLL diff --git a/src/libmemcached/byteorder.h b/src/libmemcached/byteorder.h index 30c393e9..ecc89467 100644 --- a/src/libmemcached/byteorder.h +++ b/src/libmemcached/byteorder.h @@ -19,6 +19,8 @@ extern "C" { #endif +#include + uint64_t memcached_ntohll(uint64_t); uint64_t memcached_htonll(uint64_t); diff --git a/src/libmemcached/common.h b/src/libmemcached/common.h index 4b025fb3..f9b20c4e 100644 --- a/src/libmemcached/common.h +++ b/src/libmemcached/common.h @@ -27,25 +27,13 @@ # include # include #else -# ifdef HAVE_STDDEF_H -# include -# endif -# ifdef HAVE_STDLIB_H -# include -# endif -# ifdef HAVE_STDLIB_H -# include -# endif +# include +# include +# include # include -# ifdef HAVE_TIME_H -# include -# endif -# ifdef HAVE_ERRNO_H -# include -# endif -# ifdef HAVE_LIMITS_H -# include -# endif +# include +# include +# include #endif #ifdef HAVE_SYS_UN_H @@ -56,13 +44,8 @@ # include #endif -#ifdef HAVE_FCNTL_H -# include -#endif - -#ifdef HAVE_SYS_TYPES_H -# include -#endif +#include +#include #ifdef HAVE_UNISTD_H # include diff --git a/src/libmemcached/error.cc b/src/libmemcached/error.cc index d148aafe..b8f0cc33 100644 --- a/src/libmemcached/error.cc +++ b/src/libmemcached/error.cc @@ -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 diff --git a/src/libmemcached/hash.cc b/src/libmemcached/hash.cc index e062e4e7..cb1ca464 100644 --- a/src/libmemcached/hash.cc +++ b/src/libmemcached/hash.cc @@ -15,7 +15,10 @@ #include "libmemcached/common.h" -#include +#if HAVE_SYS_TIME_H +# include +#endif +#include #include "libmemcached/virtual_bucket.h" diff --git a/src/libmemcached/hosts.cc b/src/libmemcached/hosts.cc index b478881c..39247287 100644 --- a/src/libmemcached/hosts.cc +++ b/src/libmemcached/hosts.cc @@ -17,7 +17,10 @@ #include "libmemcached/assert.hpp" #include -#include +#if HAVE_SYS_TIME_H +# include +#endif +#include /* Protoypes (static) */ static memcached_return_t update_continuum(Memcached *ptr); diff --git a/src/libmemcached/poll.cc b/src/libmemcached/poll.cc index b8324caa..81062cae 100644 --- a/src/libmemcached/poll.cc +++ b/src/libmemcached/poll.cc @@ -17,9 +17,13 @@ #if defined(_WIN32) # include "libmemcached/poll.h" - -# include -# include +# if HAVE_SYS_TIME_H +# include +# endif +# include +# if HAVE_STRINGS_H +# include +# endif int poll(struct pollfd fds[], nfds_t nfds, int tmo) { fd_set readfds, writefds, errorfds; diff --git a/src/libmemcachedprotocol/CMakeLists.txt b/src/libmemcachedprotocol/CMakeLists.txt index 915a3da1..c0c3cffa 100644 --- a/src/libmemcachedprotocol/CMakeLists.txt +++ b/src/libmemcachedprotocol/CMakeLists.txt @@ -1,3 +1,4 @@ +check_header(umem.h) add_library(libmemcachedprotocol SHARED ascii_handler.c diff --git a/src/libmemcachedprotocol/handler.c b/src/libmemcachedprotocol/handler.c index b412b9e9..b8484072 100644 --- a/src/libmemcachedprotocol/handler.c +++ b/src/libmemcachedprotocol/handler.c @@ -20,12 +20,16 @@ #include #include #include -#include +#if HAVE_STRINGS_H +# include +#endif #include #include #include -#include +#ifdef HAVE_SYS_SOCKET_H +# include +#endif /* ** ********************************************************************** diff --git a/src/mem_config.h.in b/src/mem_config.h.in index d0b3a3e6..7ab23f90 100644 --- a/src/mem_config.h.in +++ b/src/mem_config.h.in @@ -30,26 +30,23 @@ #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 @@ -58,40 +55,21 @@ #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 -# elif defined HAVE_CSTDINT -# include -# endif -#elif defined HAVE_INTTYPES_H -# include -#endif - #if HAVE_BACKTRACE # define BACKTRACE_HEADER <@Backtrace_HEADER@> #endif diff --git a/src/util/daemon.cc b/src/util/daemon.cc index 3c65a7bb..429187b6 100644 --- a/src/util/daemon.cc +++ b/src/util/daemon.cc @@ -42,9 +42,12 @@ #include #include #include +#if HAVE_SYS_WAIT_H #include #include -#include +#if HAVE_UNISTD_H +# include +#endif #include #include diff --git a/src/util/instance.cc b/src/util/instance.cc index 8f5d1738..f136d7b7 100644 --- a/src/util/instance.cc +++ b/src/util/instance.cc @@ -46,7 +46,9 @@ #include #include #include -#include +#ifdef HAVE_SYS_SOCKET_H +# include +#endif #include #ifdef HAVE_UNISTD_H diff --git a/src/util/logfile.cc b/src/util/logfile.cc index 810424d0..0ae40392 100644 --- a/src/util/logfile.cc +++ b/src/util/logfile.cc @@ -49,7 +49,9 @@ #include #include #include -#include +#if HAVE_UNISTD_H +# include +#endif namespace datadifferential { namespace util { diff --git a/src/util/pidfile.cc b/src/util/pidfile.cc index 90a6d178..dd26f257 100644 --- a/src/util/pidfile.cc +++ b/src/util/pidfile.cc @@ -48,7 +48,9 @@ #include #include #include -#include +#if #if HAVE_UNISTD_H +# include +#endif extern "C" { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 19330d39..0279f60c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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 ") + 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}) diff --git a/test/lib/Connection.cpp b/test/lib/Connection.cpp index 0530d38b..806ce502 100644 --- a/test/lib/Connection.cpp +++ b/test/lib/Connection.cpp @@ -2,7 +2,9 @@ #include #include -#include +#if HAVE_UNISTD_H +# include +#endif #if !(HAVE_SOCK_NONBLOCK && HAVE_SOCK_CLOEXEC) # include diff --git a/test/lib/ForkAndExec.cpp b/test/lib/ForkAndExec.cpp index 5af789f6..753e06ee 100644 --- a/test/lib/ForkAndExec.cpp +++ b/test/lib/ForkAndExec.cpp @@ -4,7 +4,9 @@ #include #include -#include +#if HAVE_UNISTD_H +# include +#endif #include #if !HAVE_PIPE2 diff --git a/test/lib/Server.cpp b/test/lib/Server.cpp index dddb68d9..cf520094 100644 --- a/test/lib/Server.cpp +++ b/test/lib/Server.cpp @@ -3,7 +3,9 @@ #include "ForkAndExec.hpp" #include -#include +#if HAVE_UNISTD_H +# include +#endif Server::Server(string binary_, Server::argv_t args_) : binary{move(binary_)} diff --git a/test/lib/random.cpp b/test/lib/random.cpp index 1d9a20c9..76c04971 100644 --- a/test/lib/random.cpp +++ b/test/lib/random.cpp @@ -1,8 +1,9 @@ #include "test/lib/random.hpp" #include "test/lib/Connection.hpp" -#include // getpid() - +#if HAVE_UNISTD_H +# include // getpid() +#endif mt19937_64 rnd_eng; mutex rnd_mtx; diff --git a/test/setup.cpp b/test/setup.cpp index a506976a..8ee8bda0 100644 --- a/test/setup.cpp +++ b/test/setup.cpp @@ -8,7 +8,9 @@ #include #include #include -#include +#if HAVE_UNISTD_H +# include +#endif static void sigchld(int, siginfo_t *si, void *) { switch (si->si_code) { diff --git a/tests/libmemcached-1.0/mem_functions.cc b/tests/libmemcached-1.0/mem_functions.cc index fa9ce010..2c12f9d7 100644 --- a/tests/libmemcached-1.0/mem_functions.cc +++ b/tests/libmemcached-1.0/mem_functions.cc @@ -60,10 +60,14 @@ #include #include #include -#include +#ifdef HAVE_SYS_TIME_H +# include +#endif +#include #include -#include - +#if HAVE_UNISTD_H +# include +#endif #include #include "libtest/server.h" diff --git a/tests/libmemcached-1.0/plus.cpp b/tests/libmemcached-1.0/plus.cpp index b0f92f6e..1077ae72 100644 --- a/tests/libmemcached-1.0/plus.cpp +++ b/tests/libmemcached-1.0/plus.cpp @@ -49,7 +49,9 @@ #include #include #include -#include +#if HAVE_UNISTD_H +# include +#endif #include #include