Add wxUSE_WINSOCK2 wxMSW option to include winsock2.h
Including <winsock.h> and <winsock2.h> is incompatible and if the application wants to use the latter, it may be convenient to define wxUSE_WINSOCK2 when building wxWidgets instead of having to work around winsock.h implicit inclusion from include/wx/msw/wrapwin.h. Closes https://github.com/wxWidgets/wxWidgets/pull/1122
This commit is contained in:
		@@ -174,6 +174,7 @@ if(WIN32)
 | 
			
		||||
    endif()
 | 
			
		||||
    wx_option(wxUSE_DBGHELP "use dbghelp.dll API" ${wxUSE_DBGHELP_DEFAULT})
 | 
			
		||||
    wx_option(wxUSE_INICONF "use wxIniConfig")
 | 
			
		||||
    wx_option(wxUSE_WINSOCK2 "include <winsock2.h> rather than <winsock.h>" OFF)
 | 
			
		||||
    wx_option(wxUSE_REGKEY "use wxRegKey class")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -714,6 +714,8 @@
 | 
			
		||||
 | 
			
		||||
#cmakedefine01 wxUSE_INICONF
 | 
			
		||||
 | 
			
		||||
#cmakedefine01 wxUSE_WINSOCK2
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#cmakedefine01 wxUSE_DATEPICKCTRL_GENERIC
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -348,6 +348,9 @@ compilers. See also wxUSE_NO_MANIFEST.}
 | 
			
		||||
@itemdef{wxUSE_WIN_METAFILES_ALWAYS, Use wxMetaFile even when wxUSE_ENH_METAFILE=1.}
 | 
			
		||||
@itemdef{wxUSE_WINRT, Enable WinRT support.}
 | 
			
		||||
@itemdef{wxUSE_WXDIB, Use wxDIB class.}
 | 
			
		||||
@itemdef{wxUSE_WINSOCK2, Include @c <winsock2.h> instead of @c <winsock.h>.
 | 
			
		||||
Turned on automatically if ::wxUSE_IPV6 is on (this option is new since
 | 
			
		||||
wxWidgets 3.1.3).}
 | 
			
		||||
@endDefList
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1661,6 +1661,13 @@
 | 
			
		||||
// Recommended setting: 0, nobody uses .INI files any more
 | 
			
		||||
#define wxUSE_INICONF 0
 | 
			
		||||
 | 
			
		||||
// Set to 1 if you need to include <winsock2.h> over <winsock.h>
 | 
			
		||||
//
 | 
			
		||||
// Default is 0.
 | 
			
		||||
//
 | 
			
		||||
// Recommended setting: 0
 | 
			
		||||
#define wxUSE_WINSOCK2 0
 | 
			
		||||
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
// Generic versions of native controls
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
@@ -1713,6 +1713,13 @@
 | 
			
		||||
// Recommended setting: 0, nobody uses .INI files any more
 | 
			
		||||
#define wxUSE_INICONF 0
 | 
			
		||||
 | 
			
		||||
// Set to 1 if you need to include <winsock2.h> over <winsock.h>
 | 
			
		||||
//
 | 
			
		||||
// Default is 0.
 | 
			
		||||
//
 | 
			
		||||
// Recommended setting: 0, set to 1 automatically if wxUSE_IPV6 is 1.
 | 
			
		||||
#define wxUSE_WINSOCK2 0
 | 
			
		||||
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
// Generic versions of native controls
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
@@ -118,6 +118,14 @@
 | 
			
		||||
#    endif
 | 
			
		||||
#endif  /* wxUSE_UXTHEME */
 | 
			
		||||
 | 
			
		||||
#ifndef wxUSE_WINSOCK2
 | 
			
		||||
#    ifdef wxABORT_ON_CONFIG_ERROR
 | 
			
		||||
#        error "wxUSE_WINSOCK2 must be defined."
 | 
			
		||||
#    else
 | 
			
		||||
#        define wxUSE_WINSOCK2 0
 | 
			
		||||
#    endif
 | 
			
		||||
#endif  /* wxUSE_WINSOCK2 */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Unfortunately we can't use compiler TLS support if the library can be used
 | 
			
		||||
 * inside a dynamically loaded DLL under Windows XP, as this can result in hard
 | 
			
		||||
@@ -455,4 +463,14 @@
 | 
			
		||||
#   define wxUSE_POSTSCRIPT 1
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
    IPv6 support requires winsock2.h, but the default of wxUSE_WINSOCK2 is 0.
 | 
			
		||||
    Don't require changing it explicitly and just turn it on automatically if
 | 
			
		||||
    wxUSE_IPV6 is on.
 | 
			
		||||
 */
 | 
			
		||||
#if wxUSE_IPV6 && !wxUSE_WINSOCK2
 | 
			
		||||
    #undef wxUSE_WINSOCK2
 | 
			
		||||
    #define wxUSE_WINSOCK2 1
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /* _WX_MSW_CHKCONF_H_ */
 | 
			
		||||
 
 | 
			
		||||
@@ -1713,6 +1713,13 @@
 | 
			
		||||
// Recommended setting: 0, nobody uses .INI files any more
 | 
			
		||||
#define wxUSE_INICONF 0
 | 
			
		||||
 | 
			
		||||
// Set to 1 if you need to include <winsock2.h> over <winsock.h>
 | 
			
		||||
//
 | 
			
		||||
// Default is 0.
 | 
			
		||||
//
 | 
			
		||||
// Recommended setting: 0, set to 1 automatically if wxUSE_IPV6 is 1.
 | 
			
		||||
#define wxUSE_WINSOCK2 0
 | 
			
		||||
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
// Generic versions of native controls
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
@@ -156,6 +156,13 @@
 | 
			
		||||
// Recommended setting: 0, nobody uses .INI files any more
 | 
			
		||||
#define wxUSE_INICONF 0
 | 
			
		||||
 | 
			
		||||
// Set to 1 if you need to include <winsock2.h> over <winsock.h>
 | 
			
		||||
//
 | 
			
		||||
// Default is 0.
 | 
			
		||||
//
 | 
			
		||||
// Recommended setting: 0, set to 1 automatically if wxUSE_IPV6 is 1.
 | 
			
		||||
#define wxUSE_WINSOCK2 0
 | 
			
		||||
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
// Generic versions of native controls
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
@@ -28,9 +28,10 @@
 | 
			
		||||
#endif // NOMINMAX
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// For IPv6 support, we must include winsock2.h before winsock.h, and
 | 
			
		||||
// windows.h include winsock.h so do it before including it
 | 
			
		||||
#if wxUSE_IPV6
 | 
			
		||||
// When the application wants to use <winsock2.h> (this is required for IPv6
 | 
			
		||||
// support, for example), we must include it before winsock.h, and as windows.h
 | 
			
		||||
// includes winsock.h, we have to do it before including it.
 | 
			
		||||
#if wxUSE_WINSOCK2
 | 
			
		||||
    #include <winsock2.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1661,6 +1661,13 @@
 | 
			
		||||
// Recommended setting: 0, nobody uses .INI files any more
 | 
			
		||||
#define wxUSE_INICONF 0
 | 
			
		||||
 | 
			
		||||
// Set to 1 if you need to include <winsock2.h> over <winsock.h>
 | 
			
		||||
//
 | 
			
		||||
// Default is 0.
 | 
			
		||||
//
 | 
			
		||||
// Recommended setting: 0
 | 
			
		||||
#define wxUSE_WINSOCK2 0
 | 
			
		||||
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
// Generic versions of native controls
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
@@ -714,6 +714,8 @@
 | 
			
		||||
 | 
			
		||||
#define wxUSE_INICONF 0
 | 
			
		||||
 | 
			
		||||
#define wxUSE_WINSOCK2 0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define wxUSE_DATEPICKCTRL_GENERIC 0
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user