From: Ruediger Meier <ruediger.me...@ga-group.nl> This patch is needed because currently we fail always where both ws2tcpip.h and socklen_t is needed.
Now there is no "#define socklen_t int" in config.h anymore. Thus you have to do #ifdef HAVE_SOCKLEN_T typedef int socklen_t; #endif wherever it's needed. Note this patch may also discover missing includes on systems where socklen_t is available but the right headers are not included yet. For example on win32 we need #ifdef HAVE_WS2TCPIP_H # include <ws2tcpip.h> #endif Further patches should fix this. Signed-off-by: Ruediger Meier <ruediger.meier at ga-group.nl> --- configure | 37 ++++++++++++++++--------------------- configure.in | 17 +++++++++++------ include/sane/config.h.in | 6 +++--- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/configure b/configure index ba864b0..606b8e9 100755 --- a/configure +++ b/configure @@ -8257,31 +8257,26 @@ 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; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include <sys/socket.h> +ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "$ac_includes_default +#ifdef HAVE_NETDB_H +# include <sys/socket.h> +#endif +#ifdef HAVE_WINSOCK2_H +# include <winsock2.h> +#endif +#ifdef HAVE_WS2TCPIP_H +# include <ws2tcpip.h> +#endif +" +if test "x$ac_cv_type_socklen_t" = xyes; then : -int -main () -{ -socklen_t len - ; - return 0; -} +cat >>confdefs.h <<_ACEOF +#define HAVE_SOCKLEN_T 1 _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; }; -$as_echo "#define socklen_t int" >>confdefs.h + fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for union semun in <sys/sem.h>" >&5 $as_echo_n "checking for union semun in <sys/sem.h>... " >&6; } diff --git a/configure.in b/configure.in index 6fac904..8fc0fcb 100644 --- a/configure.in +++ b/configure.in @@ -232,12 +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_TRY_COMPILE([ -#include <sys/socket.h> -],[socklen_t len],AC_MSG_RESULT(yes), -[AC_MSG_RESULT(no); AC_DEFINE(socklen_t,int, -[Define socklen_t as \'int\' if necessary.])]) +AC_CHECK_TYPES([socklen_t],,, +[$ac_includes_default +#ifdef HAVE_NETDB_H +# include <sys/socket.h> +#endif +#ifdef HAVE_WINSOCK2_H +# include <winsock2.h> +#endif +#ifdef HAVE_WS2TCPIP_H +# include <ws2tcpip.h> +#endif]) AC_MSG_CHECKING([for union semun in <sys/sem.h>]) AC_TRY_COMPILE([ diff --git a/include/sane/config.h.in b/include/sane/config.h.in index 00c8669..fb78824 100644 --- a/include/sane/config.h.in +++ b/include/sane/config.h.in @@ -282,6 +282,9 @@ /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF +/* Define to 1 if the system has the type `socklen_t'. */ +#undef HAVE_SOCKLEN_T + /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H @@ -584,9 +587,6 @@ /* Define to `unsigned int' if <sys/types.h> does not define. */ #undef size_t -/* Define socklen_t as \'int\' if necessary. */ -#undef socklen_t - /* Define to `long' if <sys/types.h> does not define. */ #undef ssize_t -- 1.7.6.1