From 92a747a7d5d1733ad376335904a2008332f10a0f Mon Sep 17 00:00:00 2001 From: sof <unknown> Date: Sat, 3 Jul 1999 19:15:27 +0000 Subject: [PATCH] [project @ 1999-07-03 19:15:26 by sof] Don't use WinSock under cygwin --- ghc/lib/misc/SocketPrim.lhs | 2 +- ghc/lib/misc/cbits/ghcSockets.h | 4 ++-- ghc/lib/misc/cbits/initWinSock.c | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ghc/lib/misc/SocketPrim.lhs b/ghc/lib/misc/SocketPrim.lhs index d88e3d72e3cb..e76118574e10 100644 --- a/ghc/lib/misc/SocketPrim.lhs +++ b/ghc/lib/misc/SocketPrim.lhs @@ -1252,7 +1252,7 @@ use @withSocketsDo@...: \begin{code} withSocketsDo :: IO a -> IO a -#ifndef _WIN32 +#if !defined(HAVE_WINSOCK_H) || defined(__CYGWIN32__) withSocketsDo x = x #else withSocketsDo act = do diff --git a/ghc/lib/misc/cbits/ghcSockets.h b/ghc/lib/misc/cbits/ghcSockets.h index 175f8b886869..f2f636a11fd8 100644 --- a/ghc/lib/misc/cbits/ghcSockets.h +++ b/ghc/lib/misc/cbits/ghcSockets.h @@ -1,7 +1,7 @@ #ifndef GHC_SOCKETS_H #define GHC_SOCKETS_H -#ifdef HAVE_WINSOCK_H +#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__) #include <winsock.h> #else @@ -94,7 +94,7 @@ StgInt setSocketOption__ (StgInt, StgInt, StgInt); StgInt writeDescriptor (StgInt, StgAddr, StgInt); /* initWinSock.c */ -#ifdef _WIN32 +#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__) StgInt initWinSock(); void shutdownWinSock(); #endif diff --git a/ghc/lib/misc/cbits/initWinSock.c b/ghc/lib/misc/cbits/initWinSock.c index 7ea4de6a9f9c..d1c2b80677e7 100644 --- a/ghc/lib/misc/cbits/initWinSock.c +++ b/ghc/lib/misc/cbits/initWinSock.c @@ -5,10 +5,13 @@ #include "stgio.h" -#ifdef _WIN32 +#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__) +#define USE_WINSOCK +#endif -/* Initialising WinSock... */ +#ifdef USE_WINSOCK +/* Initialising WinSock... */ StgInt initWinSock () { -- GitLab