From: Ruediger Meier <ruediger.me...@ga-group.nl> Here I just want to fix conflicts for win32 systems. Generally I'd say that we should never "#define socklen_t int" within config.h. But this may decide somebody else.
Note this patch may break the build on systems where socklen_t is available now but the right headers are not included yet. For example for win32 you need to add #ifdef HAVE_WS2TCPIP_H #include <ws2tcpip.h> #endif wherever socklen_t is used. --- configure | 14 +++++++++++--- configure.in | 12 ++++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 5da8db8..ba1df33 100755 --- a/configure +++ b/configure @@ -8257,12 +8257,20 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_long_long" >&5 $as_echo "$have_long_long" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t in <sys/socket.h>" >&5 -$as_echo_n "checking for socklen_t in <sys/socket.h>... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t" >&5 +$as_echo_n "checking for socklen_t... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <sys/socket.h> +#ifdef HAVE_SYS_SOCKET_H +# include <sys/socket.h> +#endif +#ifdef HAVE_WINSOCK2_H +# include <winsock2.h> +#endif +#ifdef HAVE_WS2TCPIP_H +# include <ws2tcpip.h> +#endif" int main () diff --git a/configure.in b/configure.in index 060b8b6..b30dd92 100644 --- a/configure.in +++ b/configure.in @@ -232,9 +232,17 @@ have_long_long=no AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG, 1, [Define if the long long type is available.]) have_long_long=yes) AC_MSG_RESULT($have_long_long) -AC_MSG_CHECKING([for socklen_t in <sys/socket.h>]) +AC_MSG_CHECKING([for socklen_t]) AC_TRY_COMPILE([ -#include <sys/socket.h> +#ifdef HAVE_SYS_SOCKET_H +# include <sys/socket.h> +#endif +#ifdef HAVE_WINSOCK2_H +# include <winsock2.h> +#endif +#ifdef HAVE_WS2TCPIP_H +# include <ws2tcpip.h> +#endif" ],[socklen_t len],AC_MSG_RESULT(yes), [AC_MSG_RESULT(no); AC_DEFINE(socklen_t,int, [Define socklen_t as \'int\' if necessary.])]) -- 1.7.6.1