diff --git a/configure.ac b/configure.ac index dd8ff09f..f39eb738 100644 --- a/configure.ac +++ b/configure.ac @@ -1495,6 +1495,8 @@ dnl --------------------------------------------------------------------------- AC_CHECK_HEADERS([stdarg.h stdint.h netinet/in.h arpa/inet.h netdb.h sys/socket.h time.h sys/time.h sys/select.h endian.h limits.h sys/limits.h],,, [AC_INCLUDES_DEFAULT]) +AC_REPLACE_FUNCS(gettimeofday) + dnl Check the printf-format attribute (if any) dnl result in HAVE_ATTR_FORMAT. dnl @@ -1729,6 +1731,10 @@ int inet_pton(int af, const char* src, void* dst); const char *inet_ntop(int af, const void *src, char *dst, size_t size); #endif +#ifndef HAVE_GETTIMEOFDAY +int gettimeofday(struct timeval* tv, void* tz); +#endif + #ifdef USE_WINSOCK # ifndef _CUSTOM_VSNPRINTF # define _CUSTOM_VSNPRINTF diff --git a/src/anchor.c b/src/anchor.c index 16fd8042..4cab4e65 100644 --- a/src/anchor.c +++ b/src/anchor.c @@ -33,7 +33,7 @@ #include "debug.h" #include "anchor.h" #include -#include +#include #include #include "types-internal.h" #include "context.h" diff --git a/src/compat/gettimeofday.c b/src/compat/gettimeofday.c index d8fe91bc..a417562d 100644 --- a/src/compat/gettimeofday.c +++ b/src/compat/gettimeofday.c @@ -21,8 +21,9 @@ */ #include "config.h" -#ifdef GETDNS_ON_WINDOWS -int gettimeofday(struct timeval* tv, struct timezone* tz) +#ifndef HAVE_GETTIMEOFDAY + +int gettimeofday(struct timeval* tv, void* tz) { FILETIME ft; uint64_t now = 0; @@ -70,4 +71,4 @@ int gettimeofday(struct timeval* tv, struct timezone* tz) return 0; } -#endif /* GETDNS_ON_WINDOWS */ \ No newline at end of file +#endif /* HAVE_GETTIMEOFDAY */ diff --git a/src/compat/inet_ntop.c b/src/compat/inet_ntop.c index bd418ae7..a5c844a0 100644 --- a/src/compat/inet_ntop.c +++ b/src/compat/inet_ntop.c @@ -19,7 +19,7 @@ #include -#ifndef HAVE_INET_NTOP +#ifndef HAVE_DECL_INET_NTOP #include #include @@ -215,4 +215,4 @@ inet_ntop6(const u_char *src, char *dst, size_t size) return (dst); } -#endif /* !HAVE_INET_NTOP */ +#endif /* !HAVE_DECL_INET_NTOP */ diff --git a/src/compat/inet_pton.c b/src/compat/inet_pton.c index 15780d0b..1ae11b0d 100644 --- a/src/compat/inet_pton.c +++ b/src/compat/inet_pton.c @@ -18,6 +18,8 @@ #include +#ifndef HAVE_DECL_INET_PTON + #include #include #include @@ -228,3 +230,4 @@ inet_pton6(src, dst) memcpy(dst, tmp, NS_IN6ADDRSZ); return (1); } +#endif /* HAVE_DECL_INET_PTON */ diff --git a/src/context.c b/src/context.c index 395c1539..9413cf19 100644 --- a/src/context.c +++ b/src/context.c @@ -55,7 +55,6 @@ typedef unsigned short in_port_t; #include #include -#include #include #include diff --git a/src/dnssec.c b/src/dnssec.c index ab4aa8a0..522cc3f2 100644 --- a/src/dnssec.c +++ b/src/dnssec.c @@ -192,7 +192,6 @@ #include "debug.h" #include #include -#include #include #include "getdns/getdns.h" #include "context.h" diff --git a/src/getdns/getdns_extra.h.in b/src/getdns/getdns_extra.h.in index a11b52ea..d515ef08 100644 --- a/src/getdns/getdns_extra.h.in +++ b/src/getdns/getdns_extra.h.in @@ -36,10 +36,14 @@ #define _GETDNS_EXTRA_H_ #include -#include -#include -#include #include +#include +#if defined(_WIN32) +/* For struct timeval, see getdns_context_get_num_pending_requests */ +#include +#else +#include +#endif #ifdef __cplusplus extern "C" { diff --git a/src/gldns/gbuffer.h b/src/gldns/gbuffer.h index e04aa23a..a8588348 100644 --- a/src/gldns/gbuffer.h +++ b/src/gldns/gbuffer.h @@ -13,6 +13,12 @@ #ifndef GLDNS_SBUFFER_H #define GLDNS_SBUFFER_H +#include +#if defined(_MSC_VER) +#include +typedef SSIZE_T ssize_t; +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/src/gldns/parse.c b/src/gldns/parse.c index a353c503..64fe67cb 100644 --- a/src/gldns/parse.c +++ b/src/gldns/parse.c @@ -13,7 +13,6 @@ #include "gldns/gbuffer.h" #include -#include gldns_lookup_table gldns_directive_types[] = { { GLDNS_DIR_TTL, "$TTL" }, diff --git a/src/gldns/parseutil.c b/src/gldns/parseutil.c index bc4738b9..9c2347e8 100644 --- a/src/gldns/parseutil.c +++ b/src/gldns/parseutil.c @@ -14,7 +14,6 @@ #include "config.h" #include "gldns/parseutil.h" -#include #include #include diff --git a/src/gldns/wire2str.c b/src/gldns/wire2str.c index 28b7863b..2e15ead2 100644 --- a/src/gldns/wire2str.c +++ b/src/gldns/wire2str.c @@ -25,7 +25,9 @@ #ifdef HAVE_TIME_H #include #endif +#ifdef HAVE_SYS_TIME_H #include +#endif #include #include #ifdef HAVE_NETDB_H diff --git a/src/ssl_dane b/src/ssl_dane index dd093e58..ae85ab13 160000 --- a/src/ssl_dane +++ b/src/ssl_dane @@ -1 +1 @@ -Subproject commit dd093e585a237e0321d303ec35e84c393ef739f4 +Subproject commit ae85ab134df4762d8f6396fee93c04ed1ebdf152 diff --git a/src/tls/anchor-internal.c b/src/tls/anchor-internal.c index a981f556..b045eac1 100644 --- a/src/tls/anchor-internal.c +++ b/src/tls/anchor-internal.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include "types-internal.h" #include "context.h" diff --git a/src/util/lookup3.c b/src/util/lookup3.c index cc110748..46e56271 100644 --- a/src/util/lookup3.c +++ b/src/util/lookup3.c @@ -49,8 +49,16 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy. #include "util/storage/lookup3.h" #include /* defines printf for tests */ #include /* defines time_t for timings in the test */ -/*#include defines uint32_t etc (from config.h) */ -#include /* attempt to define endianness */ + +#if defined(HAVE_TARGET_ENDIANNESS) +# if defined(TARGET_IS_BIG_ENDIAN) +# define HASH_LITTLE_ENDIAN 0 +# define HASH_BIG_ENDIAN 1 +# else +# define HASH_LITTLE_ENDIAN 1 +# define HASH_BIG_ENDIAN 0 +# endif +#else #ifdef HAVE_SYS_TYPES_H # include /* attempt to define endianness (solaris) */ #endif @@ -65,15 +73,6 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy. #include /* attempt to define endianness */ #endif -/* random initial value */ -static uint32_t raninit = (uint32_t)0xdeadbeef; - -void -hash_set_raninit(uint32_t v) -{ - raninit = v; -} - /* * My best guess at if you are big-endian or little-endian. This may * need adjustment. @@ -103,6 +102,16 @@ hash_set_raninit(uint32_t v) # define HASH_LITTLE_ENDIAN 0 # define HASH_BIG_ENDIAN 0 #endif +#endif /* defined(TARGET_IS_BIG_ENDIAN) */ + +/* random initial value */ +static uint32_t raninit = (uint32_t)0xdeadbeef; + +void +hash_set_raninit(uint32_t v) +{ + raninit = v; +} #define hashsize(n) ((uint32_t)1<<(n)) #define hashmask(n) (hashsize(n)-1) diff --git a/src/util/orig-headers/locks.h b/src/util/orig-headers/locks.h index d86ee492..6f971e19 100644 --- a/src/util/orig-headers/locks.h +++ b/src/util/orig-headers/locks.h @@ -219,6 +219,7 @@ void* ub_thread_key_get(ub_thread_key_type key); #else /* we do not HAVE_SOLARIS_THREADS and no PTHREADS */ /******************* WINDOWS THREADS ************************/ #ifdef HAVE_WINDOWS_THREADS +#include #include /* Use a mutex */