Skip to content
This repository

fix windows build on GHC 7.4 #25

Merged
merged 2 commits into from about 2 years ago

2 participants

Holger Reinhardt Johan Tibell
Holger Reinhardt

This probably also fixes issue #17

added some commits
Holger Reinhardt replace HAVE_WINSOCK_H with HAVE_WINSOCK2_H
since we are using winsock2.h we shouldn't use HAVE_WINSOCK_H.
ebdaf5d
Holger Reinhardt use #if instead of #ifdef for HAVE_DECL_IPV6_V6ONLY (continued)
In 2f4cafd not all occurences were changed
25927d0
Johan Tibell tibbe merged commit 25927d0 into from
Johan Tibell tibbe closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Feb 03, 2012
Holger Reinhardt replace HAVE_WINSOCK_H with HAVE_WINSOCK2_H
since we are using winsock2.h we shouldn't use HAVE_WINSOCK_H.
ebdaf5d
Feb 08, 2012
Holger Reinhardt use #if instead of #ifdef for HAVE_DECL_IPV6_V6ONLY (continued)
In 2f4cafd not all occurences were changed
25927d0
This page is out of date. Refresh to see the latest.
6  Network/BSD.hsc
@@ -166,7 +166,7 @@ instance Storable ServiceEntry where
166 166
         return (ServiceEntry {
167 167
                         serviceName     = s_name,
168 168
                         serviceAliases  = s_aliases,
169  
-#if defined(HAVE_WINSOCK_H) && !defined(cygwin32_HOST_OS)
  169
+#if defined(HAVE_WINSOCK2_H) && !defined(cygwin32_HOST_OS)
170 170
                         servicePort     = PortNum (fromIntegral (s_port :: CShort)),
171 171
 #else
172 172
                            -- s_port is already in network byte order, but it
@@ -263,7 +263,7 @@ instance Storable ProtocolEntry where
263 263
         p_aliases <- (#peek struct protoent, p_aliases) p
264 264
                            >>= peekArray0 nullPtr
265 265
                            >>= mapM peekCString
266  
-#if defined(HAVE_WINSOCK_H) && !defined(cygwin32_HOST_OS)
  266
+#if defined(HAVE_WINSOCK2_H) && !defined(cygwin32_HOST_OS)
267 267
          -- With WinSock, the protocol number is only a short;
268 268
          -- hoist it in as such, but represent it on the Haskell side
269 269
          -- as a CInt.
@@ -359,7 +359,7 @@ instance Storable HostEntry where
359 359
         return (HostEntry {
360 360
                         hostName       = h_name,
361 361
                         hostAliases    = h_aliases,
362  
-#if defined(HAVE_WINSOCK_H) && !defined(cygwin32_HOST_OS)
  362
+#if defined(HAVE_WINSOCK2_H) && !defined(cygwin32_HOST_OS)
363 363
                         hostFamily     = unpackFamily (fromIntegral (h_addrtype :: CShort)),
364 364
 #else
365 365
                         hostFamily     = unpackFamily h_addrtype,
10  Network/Socket.hsc
@@ -169,7 +169,7 @@ import Hugs.IO ( openFd )
169 169
 # if HAVE_STRUCT_MSGHDR_MSG_CONTROL || HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
170 170
 {-# CFILES cbits/ancilData.c #-}
171 171
 # endif
172  
-# if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
  172
+# if defined(HAVE_WINSOCK2_H) && !defined(__CYGWIN__)
173 173
 {-# CFILES cbits/initWinSock.c cbits/winSockErr.c #-}
174 174
 # endif
175 175
 #endif
@@ -423,7 +423,7 @@ socket family stype protocol = do
423 423
 #endif
424 424
     socket_status <- newMVar NotConnected
425 425
     let sock = MkSocket fd family stype protocol socket_status
426  
-#ifdef HAVE_DECL_IPV6_V6ONLY
  426
+#if HAVE_DECL_IPV6_V6ONLY
427 427
     when (family == AF_INET6) $ setSocketOption sock IPv6Only 0
428 428
 #endif
429 429
     return sock
@@ -505,7 +505,7 @@ connect sock@(MkSocket s _family _stype _protocol socketStatus) addr = do
505 505
            r <- c_connect s p_addr (fromIntegral sz)
506 506
            if r == -1
507 507
                then do 
508  
-#if !(defined(HAVE_WINSOCK_H) && !defined(cygwin32_HOST_OS))
  508
+#if !(defined(HAVE_WINSOCK2_H) && !defined(cygwin32_HOST_OS))
509 509
                    err <- getErrno
510 510
                    case () of
511 511
                      _ | err == eINTR       -> connectLoop
@@ -921,7 +921,7 @@ data SocketOption
921 921
 #ifdef SO_USELOOPBACK
922 922
     | UseLoopBack   {- SO_USELOOPBACK -}
923 923
 #endif
924  
-#ifdef HAVE_DECL_IPV6_V6ONLY
  924
+#if HAVE_DECL_IPV6_V6ONLY
925 925
     | IPv6Only      {- IPV6_V6ONLY -}
926 926
 #endif
927 927
     deriving Typeable
@@ -938,7 +938,7 @@ socketOptLevel so =
938 938
 #ifdef TCP_NODELAY
939 939
     NoDelay      -> #const IPPROTO_TCP
940 940
 #endif
941  
-#ifdef HAVE_DECL_IPV6_V6ONLY
  941
+#if HAVE_DECL_IPV6_V6ONLY
942 942
     IPv6Only     -> #const IPPROTO_IPV6
943 943
 #endif
944 944
     _            -> #const SOL_SOCKET
3  cbits/asyncAccept.c
@@ -5,7 +5,8 @@
5 5
 #include "HsNet.h"
6 6
 #include "HsFFI.h"
7 7
 
8  
-#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__) && !defined(__HUGS__)
  8
+#if defined(HAVE_WINSOCK2_H) && !defined(__CYGWIN__) && !defined(__HUGS__)
  9
+
9 10
 /* all the way to the end */
10 11
 
11 12
 /*
2  cbits/initWinSock.c
... ...
@@ -1,7 +1,7 @@
1 1
 #include "HsNet.h"
2 2
 #include "HsFFI.h"
3 3
 
4  
-#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
  4
+#if defined(HAVE_WINSOCK2_H) && !defined(__CYGWIN__)
5 5
 
6 6
 static int winsock_inited = 0;
7 7
 static int winsock_uninited = 0;
2  cbits/winSockErr.c
... ...
@@ -1,7 +1,7 @@
1 1
 #include "HsNet.h"
2 2
 #include "HsFFI.h"
3 3
 
4  
-#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
  4
+#if defined(HAVE_WINSOCK2_H) && !defined(__CYGWIN__)
5 5
 #include <stdio.h>
6 6
 
7 7
 /* to the end */
2  include/HsNet.h
@@ -174,7 +174,7 @@ hsnet_freeaddrinfo(struct addrinfo *ai)
174 174
 }
175 175
 #endif
176 176
 
177  
-#if defined(HAVE_WINSOCK_H) && !defined(cygwin32_HOST_OS)
  177
+#if defined(HAVE_WINSOCK2_H) && !defined(cygwin32_HOST_OS)
178 178
 # define WITH_WINSOCK  1
179 179
 #endif
180 180
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.