diff --git a/configure.in b/configure.in index bcdd0e5476..efaf1024fd 100644 --- a/configure.in +++ b/configure.in @@ -1804,6 +1804,7 @@ AC_SUBST(netinet_sctph) AC_SUBST(netinet_sctp_uioh) AC_SUBST(netinet_tcph) AC_SUBST(stdargh) +AC_SUBST(stddefh) AC_SUBST(stdioh) AC_SUBST(stdlibh) AC_SUBST(stringh) diff --git a/include/apr.h.in b/include/apr.h.in index ee99deff10..4d8b770333 100644 --- a/include/apr.h.in +++ b/include/apr.h.in @@ -88,6 +88,7 @@ #define APR_HAVE_SEMAPHORE_H @semaphoreh@ #define APR_HAVE_SIGNAL_H @signalh@ #define APR_HAVE_STDARG_H @stdargh@ +#define APR_HAVE_STDDEF_H @stddefh@ #define APR_HAVE_STDINT_H @stdint@ #define APR_HAVE_STDIO_H @stdioh@ #define APR_HAVE_STDLIB_H @stdlibh@ @@ -165,6 +166,10 @@ #include #endif +#if APR_HAVE_STDDEF_H +#include +#endif + #if APR_HAVE_SYS_SOCKET_H #include #endif diff --git a/include/apr_general.h b/include/apr_general.h index fa073c859f..be2d6f14d5 100644 --- a/include/apr_general.h +++ b/include/apr_general.h @@ -103,7 +103,9 @@ typedef int apr_signum_t; * @param field data field within the structure * @return offset */ -#if defined(offsetof) && !defined(__cplusplus) +#if defined(__has_builtin) && __has_builtin(__builtin_offsetof) +#define APR_OFFSETOF(s_type,field) __builtin_offsetof(s_type,field) +#elif defined(offsetof) && !defined(__cplusplus) #define APR_OFFSETOF(s_type,field) offsetof(s_type,field) #else #define APR_OFFSETOF(s_type,field) APR_OFFSET(s_type*,field)