Browse Source

r13907@Kushana: nickm | 2007-08-02 10:29:13 -0700
Try (once again) to fix mingw build wrt detecting ipv6 types.


svn:r11037

Nick Mathewson 17 years ago
parent
commit
ba28346f2f
3 changed files with 26 additions and 4 deletions
  1. 5 0
      ChangeLog
  2. 14 2
      configure.in
  3. 7 2
      src/common/compat.h

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+Changes in version 0.2.0.5-alpha - 2007-??-??
+  o Major bugfixes (compilation):
+    - Try to fix win32 compilation again: Improve checking for ipv6 types.
+
+
 Changes in version 0.2.0.4-alpha - 2007-08-01
   o Major security fixes:
     - Close immediately after missing authentication on control port;

+ 14 - 2
configure.in

@@ -329,7 +329,7 @@ AC_CHECK_SIZEOF(size_t)
 
 AC_CHECK_TYPES([uint, u_char])
 
-AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, struct sockaddr_storage], , ,
+AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, struct sockaddr_storage, sa_family_t], , ,
 [#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
@@ -341,7 +341,19 @@ AC_CHECK_TYPES([struct in6_addr, struct sockaddr_in6, struct sockaddr_storage],
 #endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
-#endif])
+#endif
+#ifdef MS_WINDOWS
+#define WIN32_WINNT 0x400
+#define _WIN32_WINNT 0x400
+#define WIN32_LEAN_AND_MEAN
+#if defined(_MSC_VER) && (_MSC_VER < 1300)
+#include <winsock.h>
+#else
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
+#endif
+])
 
 if test -z "$CROSS_COMPILE"; then
 AC_CACHE_CHECK([whether time_t is signed], tor_cv_time_t_signed, [

+ 7 - 2
src/common/compat.h

@@ -294,9 +294,14 @@ struct in6_addr
 #endif
 #endif
 
-#if !defined(HAVE_STRUCT_SOCKADDR_IN6)
+#ifndef HAVE_SA_FAMILY_T
+typedef uint16_t sa_family_t;
+#endif
+
+/* XXXX020 detect sockaddr_in6 correctly on ms_windows; this is also a hack. */
+#if !defined(HAVE_STRUCT_SOCKADDR_IN6) && !defined(MS_WINDOWS)
 struct sockaddr_in6 {
-  uint16_t sin6_family; /* XXXX020 right size???? */
+  sa_family_t sin6_family;
   uint16_t sin6_port;
   // uint32_t sin6_flowinfo;
   struct in6_addr sin6_addr;