summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/curl/system.h3
-rw-r--r--lib/curl_setup.h14
-rw-r--r--winbuild/MakefileBuild.vc2
3 files changed, 12 insertions, 7 deletions
diff --git a/include/curl/system.h b/include/curl/system.h
index 973c73ad4..e808580eb 100644
--- a/include/curl/system.h
+++ b/include/curl/system.h
@@ -442,9 +442,6 @@
/* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */
/* ws2tcpip.h is required here to properly make type definitions below. */
#ifdef CURL_PULL_WS2TCPIP_H
-# ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-# endif
# include <windows.h>
# include <winsock2.h>
# include <ws2tcpip.h>
diff --git a/lib/curl_setup.h b/lib/curl_setup.h
index eb4f038dd..fc597d75d 100644
--- a/lib/curl_setup.h
+++ b/lib/curl_setup.h
@@ -31,6 +31,17 @@
#define WIN32
#endif
+#ifdef WIN32
+/*
+ * Don't include unneeded stuff in Windows headers to avoid compiler
+ * warnings and macro clashes.
+ * Make sure to define this macro before including any Windows headers.
+ */
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+#endif
+
/*
* Include configuration script results or hand-crafted
* configuration file for platforms which lack config tool.
@@ -237,9 +248,6 @@
# if defined(_UNICODE) && !defined(UNICODE)
# define UNICODE
# endif
-# ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-# endif
# include <windows.h>
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
diff --git a/winbuild/MakefileBuild.vc b/winbuild/MakefileBuild.vc
index eb28efefd..1d8210b3d 100644
--- a/winbuild/MakefileBuild.vc
+++ b/winbuild/MakefileBuild.vc
@@ -60,7 +60,7 @@ CFLAGS = /I. /I../lib /I../include /nologo /W3 /GX /DWIN32 /YX /FD /c /DBUIL
!ELSE
CC_NODEBUG = $(CC) /O2 /DNDEBUG
CC_DEBUG = $(CC) /Od /D_DEBUG /RTC1 /Z7 /LDd /W3
-CFLAGS = /I. /I ../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL /DWIN32_LEAN_AND_MEAN
+CFLAGS = /I. /I ../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL
!ENDIF
LFLAGS = /nologo /machine:$(MACHINE)