It seems AIX 5.1 doesn't have sockaddr_storage.ss_family.  I don't have any
way to test this, but I am hoping the attached patch will fix the problem.

I don't understand the auto-conf stuff well at all, so it could certainly
use some review.

If the owner of the system below can test out this patch, and see if it fixes
the ares build problem, that would be great!  Otherwise, I'll push the patch
and see if the auto-build starts working properly (and revert/fix the patch
if it causes more harm than good).

02:23   link    1       --D--AZ----     AIX 5.1 (5100-09) VisualAge xlc 5.0.2   
Tor


Thanks,
Ben


--
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
diff --git a/acinclude.m4 b/acinclude.m4
index 336dfab..daa0c92 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -669,6 +669,45 @@ AC_DEFUN([TYPE_SOCKADDR_STORAGE],
    ])
 ])
 
+dnl TYPE_SOCKADDR_STORAGE_SSFAM
+dnl -------------------------------------------------
+dnl Check for struct sockaddr_storage.ss_family
+dnl Seems some AIX systems don't have this.
+
+AC_DEFUN([TYPE_SOCKADDR_STORAGE_SSFAM],
+[
+   CARES_CHECK_STRUCT_MEMBER(
+   [
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#else
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#endif
+],
+       [sockaddr_storage], [ss_family],
+        AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE_SSFAM, 1,
+                  [if struct sockaddr_storage.ss_family is defined]), ,
+   )
+])
+
 
 dnl CURL_CHECK_NI_WITHSCOPEID
 dnl -------------------------------------------------
@@ -1897,6 +1936,26 @@ AC_DEFUN([CARES_CHECK_STRUCT], [
   fi
 ])
 
+dnl This macro determines if the specified struct member exists in the 
specified file
+dnl Syntax:
+dnl CARES_CHECK_STRUCT_MEMBER(headers, struct name, member, if found, [if not 
found])
+
+AC_DEFUN([CARES_CHECK_STRUCT_MEMBER], [
+  AC_MSG_CHECKING([for struct $2.$3])
+  AC_TRY_COMPILE([$1], 
+    [
+      struct $2 struct_instance;
+      void* foo = &(struct_instance.$3);
+    ], ac_struct_member="yes", ac_found="no")
+  if test "$ac_struct_member" = "yes" ; then
+    AC_MSG_RESULT(yes)
+    $4
+  else
+    AC_MSG_RESULT(no)
+    $5
+  fi
+])
+
 dnl This macro determines if the specified constant exists in the specified 
file
 dnl Syntax:
 dnl CARES_CHECK_CONSTANT(headers, constant name, if found, [if not found])
diff --git a/ares_process.c b/ares_process.c
index ccd6cb6..8e9a9cd 100644
--- a/ares_process.c
+++ b/ares_process.c
@@ -434,7 +434,7 @@ static void read_udp_packets(ares_channel channel, fd_set 
*read_fds,
   unsigned char buf[PACKETSZ + 1];
 #ifdef HAVE_RECVFROM
   ares_socklen_t fromlen;
-#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE_SSFAM
   struct sockaddr_storage from;
 #else
   union {
@@ -488,7 +488,7 @@ static void read_udp_packets(ares_channel channel, fd_set 
*read_fds,
         else if (count <= 0)
           handle_error(channel, i, now);
 #ifdef HAVE_RECVFROM
-#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE_SSFAM
         /* This family hack works around compiler warnings about
          * aliases.
          */
@@ -1186,7 +1186,7 @@ static int same_address(struct sockaddr *sa, struct 
ares_addr *aa)
   void *addr1;
   void *addr2;
 
-#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
+#ifndef HAVE_STRUCT_SOCKADDR_STORAGE_SSFAM
   if (sa->sa_family == aa->family)
     {
 #endif
@@ -1207,7 +1207,7 @@ static int same_address(struct sockaddr *sa, struct 
ares_addr *aa)
           default:
             break;
         }
-#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
+#ifndef HAVE_STRUCT_SOCKADDR_STORAGE_SSFAM
     }
 #endif
   return 0; /* different */
diff --git a/configure.ac b/configure.ac
index d505e16..f24892f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -506,6 +506,7 @@ CARES_CONFIGURE_ARES_SOCKLEN_T
 TYPE_IN_ADDR_T
 
 TYPE_SOCKADDR_STORAGE
+TYPE_SOCKADDR_STORAGE_SSFAM
 
 TYPE_SIG_ATOMIC_T
 
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to