Hi,

Find attached the patch I used to get libevent compiling under
cygwin.  I couldn't get the tests to compile.

I'm not sure if this is the correct approach, but here is the
patch for those who are interested.

Regards,
Pete


===================================================================


Get libevent compiling under cygwin.

ipv6-internal.h:
        sys/socket.h contains the definition of sa_family_t
        which is used in this header under cygwin.

evutil.c:
        cygwin doesn't define AF_INET6 and thus cannot
        handle ipv6 so conditionally include the ipv6
        code only if you have AF_INET6.

Index: ipv6-internal.h
===================================================================
--- ipv6-internal.h     (revision 1301)
+++ ipv6-internal.h     (working copy)
@@ -31,6 +31,9 @@
 #define _EVENT_IPV6_INTERNAL_H
 
 #include <sys/types.h>
+#ifdef _EVENT_HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
 #include "event-config.h"
 #include <event2/util.h>
 
Index: evutil.c
===================================================================
--- evutil.c    (revision 1301)
+++ evutil.c    (working copy)
@@ -644,7 +644,9 @@
 
        if (!addr_part)
                return -1; /* Should be impossible. */
-       if (is_ipv6) {
+#ifdef AF_INET6
+       if (is_ipv6)
+       {
                struct sockaddr_in6 sin6;
                memset(&sin6, 0, sizeof(sin6));
 #ifdef _EVENT_HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
@@ -660,7 +662,10 @@
                memcpy(out, &sin6, sizeof(sin6));
                 *outlen = sizeof(sin6);
                return 0;
-       } else {
+       }
+       else
+#endif
+       {
                struct sockaddr_in sin;
                memset(&sin, 0, sizeof(sin));
 #ifdef _EVENT_HAVE_STRUCT_SOCKADDR_IN_SIN_LEN

_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users

Reply via email to