[sane-devel] [PATCH v2 13/14] bldchn, SANE_CHECK_IPV6 more portable

Ruediger Meier sweet_f_a at gmx.de
Mon Jan 23 23:05:58 UTC 2012


From: Ruediger Meier <ruediger.meier at ga-group.nl>

Even win32 seems to be ipv6 capable now.
---
 acinclude.m4 |   22 +++++++++++++---------
 configure    |   22 +++++++++++++---------
 2 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 7cc4228..d498a7b 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -556,11 +556,19 @@ AC_DEFUN([SANE_CHECK_IPV6],
          fi
       ])
 
+  ipv6_includes="
+    #define INET6
+    $ac_includes_default
+    #ifdef HAVE_SYS_SOCKET_H
+    # include <sys/socket.h>
+    #endif
+    #ifdef HAVE_WINSOCK2_H
+    # include <winsock2.h>
+    #endif"
+
   if test "$ipv6" != "no" ; then
     AC_TRY_COMPILE([
-	#define INET6 
-	#include <sys/types.h> 
-	#include <sys/socket.h> ], [
+	$ipv6_includes], [
 	 /* AF_INET6 available check */  
  	if (socket(AF_INET6, SOCK_STREAM, 0) < 0) 
    	  exit(1); 
@@ -579,9 +587,7 @@ AC_DEFUN([SANE_CHECK_IPV6],
   if test "$ipv6" != "no" ; then
     AC_MSG_CHECKING([whether struct sockaddr_storage has an ss_family member])
     AC_TRY_COMPILE([
-	#define INET6
-	#include <sys/types.h>
-	#include <sys/socket.h> ], [
+	$ipv6_includes], [
 	/* test if the ss_family member exists in struct sockaddr_storage */
 	struct sockaddr_storage ss;
 	ss.ss_family = AF_INET;
@@ -591,9 +597,7 @@ AC_DEFUN([SANE_CHECK_IPV6],
 	AC_DEFINE([HAS_SS_FAMILY], 1, [Define to 1 if struct sockaddr_storage has an ss_family member])
     ], [
 		AC_TRY_COMPILE([
-		#define INET6
-		#include <sys/types.h>
-		#include <sys/socket.h> ], [
+		$ipv6_includes], [
 		/* test if the __ss_family member exists in struct sockaddr_storage */
 		struct sockaddr_storage ss;
 		ss.__ss_family = AF_INET;
diff --git a/configure b/configure
index 7f60bb9..98716d5 100755
--- a/configure
+++ b/configure
@@ -10299,13 +10299,21 @@ $as_echo "no, manually disabled" >&6; }
 fi
 
 
+  ipv6_includes="
+    #define INET6
+    $ac_includes_default
+    #ifdef HAVE_SYS_SOCKET_H
+    # include <sys/socket.h>
+    #endif
+    #ifdef HAVE_WINSOCK2_H
+    # include <winsock2.h>
+    #endif"
+
   if test "$ipv6" != "no" ; then
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-	#define INET6
-	#include <sys/types.h>
-	#include <sys/socket.h>
+	$ipv6_includes
 int
 main ()
 {
@@ -10345,9 +10353,7 @@ $as_echo_n "checking whether struct sockaddr_storage has an ss_family member...
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-	#define INET6
-	#include <sys/types.h>
-	#include <sys/socket.h>
+	$ipv6_includes
 int
 main ()
 {
@@ -10374,9 +10380,7 @@ else
 		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-		#define INET6
-		#include <sys/types.h>
-		#include <sys/socket.h>
+		$ipv6_includes
 int
 main ()
 {
-- 
1.7.6.1




More information about the sane-devel mailing list