windows: simplify detecting and using system headers

- autotools, cmake: assume that if we detect Windows, `windows.h`,
  `winsock2.h` and `ws2tcpip.h` do exist.
- lib: fix 3 outlier `#if` conditions to use `USE_WINSOCK` instead of
  looking for `winsock2.h`.
- autotools: merge 3 Windows check methods into one.
- move Watt-32 and lwIP socket support to `setup-win32.h` from
  `config-win32.h`. It opens up using these with all build tools. Also
  merge logic with Windows Sockets.
- fix to assume Windows sockets with the mingw32ce toolchain.
  Follow-up to: 2748c64d60
- cmake: delete unused variable `signature_call_conv` since
  eb33ccd533.
- autotools: simplify `CURL_CHECK_WIN32_LARGEFILE` detection.
- examples/externalsocket: fix header order.
- cmake/OtherTests.cmake: delete Windows-specific `_source_epilogue`
  that wasn't used anymore.
- cmake/OtherTests.cmake: set `WIN32_LEAN_AND_MEAN` for test
  `SIZEOF_STRUCT_SOCKADDR_STORAGE`.

After this patch curl universally uses `_WIN32` to guard
Windows-specific logic. It guards Windows Sockets-specific logic with
`USE_WINSOCK` (this might need further work).

Reviewed-by: Jay Satiro
Closes #12495
This commit is contained in:
Viktor Szakats 2023-12-09 20:37:11 +00:00
parent 3829759bd0
commit c1bc090d65
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
15 changed files with 125 additions and 369 deletions

View File

@ -164,13 +164,11 @@ int main(void) { ; return 0; }
#ifdef HAVE_IOCTLSOCKET #ifdef HAVE_IOCTLSOCKET
/* includes start */ /* includes start */
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
# ifndef WIN32_LEAN_AND_MEAN # ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# endif # endif
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h> # include <winsock2.h>
# endif
# include <windows.h> # include <windows.h>
#endif #endif
int main(void) int main(void)
@ -186,13 +184,11 @@ int main(void)
#ifdef HAVE_IOCTLSOCKET_CAMEL #ifdef HAVE_IOCTLSOCKET_CAMEL
/* includes start */ /* includes start */
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
# ifndef WIN32_LEAN_AND_MEAN # ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# endif # endif
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h> # include <winsock2.h>
# endif
# include <windows.h> # include <windows.h>
#endif #endif
int main(void) int main(void)
@ -207,13 +203,11 @@ int main(void)
#ifdef HAVE_IOCTLSOCKET_CAMEL_FIONBIO #ifdef HAVE_IOCTLSOCKET_CAMEL_FIONBIO
/* includes start */ /* includes start */
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
# ifndef WIN32_LEAN_AND_MEAN # ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# endif # endif
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h> # include <winsock2.h>
# endif
# include <windows.h> # include <windows.h>
#endif #endif
int main(void) int main(void)
@ -229,13 +223,11 @@ int main(void)
#ifdef HAVE_IOCTLSOCKET_FIONBIO #ifdef HAVE_IOCTLSOCKET_FIONBIO
/* includes start */ /* includes start */
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
# ifndef WIN32_LEAN_AND_MEAN # ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# endif # endif
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h> # include <winsock2.h>
# endif
# include <windows.h> # include <windows.h>
#endif #endif
int main(void) int main(void)
@ -307,13 +299,11 @@ int main(void)
#ifdef HAVE_SETSOCKOPT_SO_NONBLOCK #ifdef HAVE_SETSOCKOPT_SO_NONBLOCK
/* includes start */ /* includes start */
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
# ifndef WIN32_LEAN_AND_MEAN # ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# endif # endif
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h> # include <winsock2.h>
# endif
# include <windows.h> # include <windows.h>
#endif #endif
/* includes start */ /* includes start */

View File

@ -29,20 +29,15 @@ set(_source_epilogue "#undef inline")
macro(add_header_include check header) macro(add_header_include check header)
if(${check}) if(${check})
set(_source_epilogue "${_source_epilogue}\n#include <${header}>") set(_source_epilogue "${_source_epilogue}
#include <${header}>")
endif() endif()
endmacro() endmacro()
set(signature_call_conv)
if(HAVE_WINDOWS_H)
set(_source_epilogue
"${_source_epilogue}\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif")
add_header_include(HAVE_WINSOCK2_H "winsock2.h")
add_header_include(HAVE_WINDOWS_H "windows.h")
set(signature_call_conv "PASCAL")
if(WIN32) if(WIN32)
set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
set(CMAKE_REQUIRED_DEFINITIONS "-DWIN32_LEAN_AND_MEAN")
set(CMAKE_REQUIRED_LIBRARIES "ws2_32") set(CMAKE_REQUIRED_LIBRARIES "ws2_32")
endif()
else() else()
add_header_include(HAVE_SYS_TYPES_H "sys/types.h") add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h") add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
@ -57,7 +52,7 @@ check_c_source_compiles("${_source_epilogue}
return 0; return 0;
}" HAVE_MSG_NOSIGNAL) }" HAVE_MSG_NOSIGNAL)
if(NOT HAVE_WINDOWS_H) if(NOT WIN32)
add_header_include(HAVE_SYS_TIME_H "sys/time.h") add_header_include(HAVE_SYS_TIME_H "sys/time.h")
endif() endif()
check_c_source_compiles("${_source_epilogue} check_c_source_compiles("${_source_epilogue}
@ -70,9 +65,7 @@ int main(void) {
return 0; return 0;
}" HAVE_STRUCT_TIMEVAL) }" HAVE_STRUCT_TIMEVAL)
if(HAVE_WINDOWS_H) if(NOT WIN32)
set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h")
else()
set(CMAKE_EXTRA_INCLUDE_FILES) set(CMAKE_EXTRA_INCLUDE_FILES)
if(HAVE_SYS_SOCKET_H) if(HAVE_SYS_SOCKET_H)
set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h") set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")

View File

@ -351,9 +351,6 @@ include(CheckCSourceCompiles)
# On windows preload settings # On windows preload settings
if(WIN32) if(WIN32)
set(HAVE_WINDOWS_H 1)
set(HAVE_WS2TCPIP_H 1)
set(HAVE_WINSOCK2_H 1)
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/Platforms/WindowsCache.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/Platforms/WindowsCache.cmake)
endif() endif()
@ -770,7 +767,7 @@ if(NOT CURL_DISABLE_LDAP)
endif() endif()
set(NEED_LBER_H ON) set(NEED_LBER_H ON)
set(_HEADER_LIST) set(_HEADER_LIST)
if(HAVE_WINDOWS_H) if(WIN32)
list(APPEND _HEADER_LIST "windows.h") list(APPEND _HEADER_LIST "windows.h")
endif() endif()
if(HAVE_SYS_TYPES_H) if(HAVE_SYS_TYPES_H)
@ -1053,9 +1050,9 @@ endif()
# Check for header files # Check for header files
if(WIN32) if(WIN32)
check_include_file_concat("winsock2.h" HAVE_WINSOCK2_H) set(CURL_INCLUDES ${CURL_INCLUDES} "winsock2.h")
check_include_file_concat("ws2tcpip.h" HAVE_WS2TCPIP_H) set(CURL_INCLUDES ${CURL_INCLUDES} "ws2tcpip.h")
check_include_file_concat("windows.h" HAVE_WINDOWS_H) set(CURL_INCLUDES ${CURL_INCLUDES} "windows.h")
endif() endif()
if(WIN32) if(WIN32)
@ -1391,7 +1388,7 @@ endif()
# TODO test which of these headers are required # TODO test which of these headers are required
if(WIN32) if(WIN32)
set(CURL_PULL_WS2TCPIP_H ${HAVE_WS2TCPIP_H}) set(CURL_PULL_WS2TCPIP_H 1)
else() else()
set(CURL_PULL_SYS_TYPES_H ${HAVE_SYS_TYPES_H}) set(CURL_PULL_SYS_TYPES_H ${HAVE_SYS_TYPES_H})
set(CURL_PULL_SYS_SOCKET_H ${HAVE_SYS_SOCKET_H}) set(CURL_PULL_SYS_SOCKET_H ${HAVE_SYS_SOCKET_H})

View File

@ -171,56 +171,16 @@ AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [
]) ])
dnl CURL_CHECK_HEADER_WINDOWS
dnl -------------------------------------------------
dnl Check for compilable and valid windows.h header
AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
AC_CACHE_CHECK([for windows.h], [curl_cv_header_windows_h], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef inline
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
]],[[
#if defined(__CYGWIN__) || defined(__CEGCC__)
HAVE_WINDOWS_H shall not be defined.
#else
int dummy=2*WINVER;
#endif
]])
],[
curl_cv_header_windows_h="yes"
],[
curl_cv_header_windows_h="no"
])
])
case "$curl_cv_header_windows_h" in
yes)
AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
[Define to 1 if you have the windows.h header file.])
;;
esac
])
dnl CURL_CHECK_NATIVE_WINDOWS dnl CURL_CHECK_NATIVE_WINDOWS
dnl ------------------------------------------------- dnl -------------------------------------------------
dnl Check if building a native Windows target dnl Check if building a native Windows target
AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [ AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
AC_CACHE_CHECK([whether build target is a native Windows one], [curl_cv_native_windows], [ AC_CACHE_CHECK([whether build target is a native Windows one], [curl_cv_native_windows], [
if test "$curl_cv_header_windows_h" = "no"; then
curl_cv_native_windows="no"
else
AC_COMPILE_IFELSE([ AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
]],[[ ]],[[
#if defined(__MINGW32__) || defined(__MINGW32CE__) || \ #ifdef _WIN32
(defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))
int dummy=1; int dummy=1;
#else #else
Not a native Windows build target. Not a native Windows build target.
@ -231,99 +191,23 @@ AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
],[ ],[
curl_cv_native_windows="no" curl_cv_native_windows="no"
]) ])
fi
]) ])
AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$curl_cv_native_windows" = xyes) AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$curl_cv_native_windows" = xyes)
]) ])
dnl CURL_CHECK_HEADER_WINSOCK2
dnl -------------------------------------------------
dnl Check for compilable and valid winsock2.h header
AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
AC_CACHE_CHECK([for winsock2.h], [curl_cv_header_winsock2_h], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef inline
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <winsock2.h>
]],[[
#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
HAVE_WINSOCK2_H shall not be defined.
#else
int dummy=2*IPPROTO_ESP;
#endif
]])
],[
curl_cv_header_winsock2_h="yes"
],[
curl_cv_header_winsock2_h="no"
])
])
case "$curl_cv_header_winsock2_h" in
yes)
AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
[Define to 1 if you have the winsock2.h header file.])
;;
esac
])
dnl CURL_CHECK_HEADER_WS2TCPIP
dnl -------------------------------------------------
dnl Check for compilable and valid ws2tcpip.h header
AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
AC_CACHE_CHECK([for ws2tcpip.h], [curl_cv_header_ws2tcpip_h], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#undef inline
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
]],[[
#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
HAVE_WS2TCPIP_H shall not be defined.
#else
int dummy=2*IP_PKTINFO;
#endif
]])
],[
curl_cv_header_ws2tcpip_h="yes"
],[
curl_cv_header_ws2tcpip_h="no"
])
])
case "$curl_cv_header_ws2tcpip_h" in
yes)
AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
[Define to 1 if you have the ws2tcpip.h header file.])
;;
esac
])
dnl CURL_CHECK_HEADER_LBER dnl CURL_CHECK_HEADER_LBER
dnl ------------------------------------------------- dnl -------------------------------------------------
dnl Check for compilable and valid lber.h header, dnl Check for compilable and valid lber.h header,
dnl and check if it is needed even with ldap.h dnl and check if it is needed even with ldap.h
AC_DEFUN([CURL_CHECK_HEADER_LBER], [ AC_DEFUN([CURL_CHECK_HEADER_LBER], [
AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
AC_CACHE_CHECK([for lber.h], [curl_cv_header_lber_h], [ AC_CACHE_CHECK([for lber.h], [curl_cv_header_lber_h], [
AC_COMPILE_IFELSE([ AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
@ -355,7 +239,7 @@ AC_DEFUN([CURL_CHECK_HEADER_LBER], [
AC_COMPILE_IFELSE([ AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
@ -403,7 +287,7 @@ AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
AC_COMPILE_IFELSE([ AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
@ -449,7 +333,7 @@ AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
AC_COMPILE_IFELSE([ AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
@ -534,7 +418,7 @@ AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
AC_LINK_IFELSE([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
@ -632,7 +516,7 @@ AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
AC_LINK_IFELSE([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
@ -701,13 +585,11 @@ AC_DEFUN([TYPE_SOCKADDR_STORAGE],
[if struct sockaddr_storage is defined]), , [if struct sockaddr_storage is defined]), ,
[ [
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h> #include <winsock2.h>
#endif
#include <windows.h> #include <windows.h>
#else #else
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
@ -731,7 +613,7 @@ dnl -------------------------------------------------
dnl Test if the socket recv() function is available, dnl Test if the socket recv() function is available,
AC_DEFUN([CURL_CHECK_FUNC_RECV], [ AC_DEFUN([CURL_CHECK_FUNC_RECV], [
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
AC_CHECK_HEADERS(sys/types.h sys/socket.h) AC_CHECK_HEADERS(sys/types.h sys/socket.h)
# #
@ -739,13 +621,11 @@ AC_DEFUN([CURL_CHECK_FUNC_RECV], [
AC_LINK_IFELSE([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h> #include <winsock2.h>
#endif
#include <windows.h> #include <windows.h>
#else #else
$curl_includes_bsdsocket $curl_includes_bsdsocket
@ -782,7 +662,7 @@ dnl -------------------------------------------------
dnl Test if the socket send() function is available, dnl Test if the socket send() function is available,
AC_DEFUN([CURL_CHECK_FUNC_SEND], [ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
AC_CHECK_HEADERS(sys/types.h sys/socket.h) AC_CHECK_HEADERS(sys/types.h sys/socket.h)
# #
@ -790,13 +670,11 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
AC_LINK_IFELSE([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h> #include <winsock2.h>
#endif
#include <windows.h> #include <windows.h>
#else #else
$curl_includes_bsdsocket $curl_includes_bsdsocket
@ -837,13 +715,11 @@ AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
AC_COMPILE_IFELSE([ AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h> #include <winsock2.h>
#endif
#include <windows.h> #include <windows.h>
#else #else
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
@ -876,19 +752,17 @@ dnl -------------------------------------------------
dnl Check for timeval struct dnl Check for timeval struct
AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
AC_CHECK_HEADERS(sys/types.h sys/time.h sys/socket.h) AC_CHECK_HEADERS(sys/types.h sys/time.h sys/socket.h)
AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [ AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [
AC_COMPILE_IFELSE([ AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h> #include <winsock2.h>
#endif
#include <windows.h> #include <windows.h>
#endif #endif
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
@ -937,13 +811,11 @@ AC_DEFUN([TYPE_IN_ADDR_T], [
AC_LINK_IFELSE([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h> #include <winsock2.h>
#endif
#include <windows.h> #include <windows.h>
#else #else
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
@ -979,13 +851,11 @@ AC_DEFUN([TYPE_IN_ADDR_T], [
esac esac
],[ ],[
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h> #include <winsock2.h>
#endif
#include <windows.h> #include <windows.h>
#else #else
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
@ -1197,7 +1067,7 @@ AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
$curl_includes_winsock2 $curl_includes_winsock2
$curl_includes_bsdsocket $curl_includes_bsdsocket
#if !defined(HAVE_WINDOWS_H) && !defined(HAVE_PROTO_BSDSOCKET_H) #if !defined(_WIN32) && !defined(HAVE_PROTO_BSDSOCKET_H)
int connect(int, void*, int); int connect(int, void*, int);
#endif #endif
]],[[ ]],[[
@ -1294,13 +1164,11 @@ AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
AC_LINK_IFELSE([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#undef inline #undef inline
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h> #include <winsock2.h>
#endif
#include <windows.h> #include <windows.h>
#endif #endif
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
@ -1310,7 +1178,7 @@ AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#include <time.h> #include <time.h>
#ifndef HAVE_WINDOWS_H #ifndef _WIN32
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> #include <sys/select.h>
#elif defined(HAVE_UNISTD_H) #elif defined(HAVE_UNISTD_H)
@ -1547,17 +1415,15 @@ dnl -------------------------------------------------
dnl Check if curl's WIN32 large file will be used dnl Check if curl's WIN32 large file will be used
AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [ AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
AC_MSG_CHECKING([whether build target supports WIN32 file API]) AC_MSG_CHECKING([whether build target supports WIN32 file API])
curl_win32_file_api="no" curl_win32_file_api="no"
if test "$curl_cv_header_windows_h" = "yes"; then if test "$curl_cv_native_windows" = "yes"; then
if test x"$enable_largefile" != "xno"; then if test x"$enable_largefile" != "xno"; then
AC_COMPILE_IFELSE([ AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
]],[[ ]],[[
#if !defined(_WIN32_WCE) && \ #if !defined(_WIN32_WCE) && (defined(__MINGW32__) || defined(_MSC_VER))
(defined(__MINGW32__) || \
(defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))))
int dummy=1; int dummy=1;
#else #else
WIN32 large file API not supported. WIN32 large file API not supported.
@ -1606,10 +1472,10 @@ dnl -------------------------------------------------
dnl Check if curl's WIN32 crypto lib can be used dnl Check if curl's WIN32 crypto lib can be used
AC_DEFUN([CURL_CHECK_WIN32_CRYPTO], [ AC_DEFUN([CURL_CHECK_WIN32_CRYPTO], [
AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
AC_MSG_CHECKING([whether build target supports WIN32 crypto API]) AC_MSG_CHECKING([whether build target supports WIN32 crypto API])
curl_win32_crypto_api="no" curl_win32_crypto_api="no"
if test "$curl_cv_header_windows_h" = "yes"; then if test "$curl_cv_native_windows" = "yes"; then
AC_COMPILE_IFELSE([ AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#undef inline #undef inline

View File

@ -503,6 +503,7 @@ dnl platform/compiler/architecture specific checks/flags
dnl ********************************************************************** dnl **********************************************************************
CURL_CHECK_COMPILER CURL_CHECK_COMPILER
CURL_CHECK_NATIVE_WINDOWS
CURL_SET_COMPILER_BASIC_OPTS CURL_SET_COMPILER_BASIC_OPTS
CURL_SET_COMPILER_DEBUG_OPTS CURL_SET_COMPILER_DEBUG_OPTS
CURL_SET_COMPILER_OPTIMIZE_OPTS CURL_SET_COMPILER_OPTIMIZE_OPTS
@ -583,25 +584,6 @@ dnl **********************************************************************
dnl Compilation based checks should not be done before this point. dnl Compilation based checks should not be done before this point.
dnl ********************************************************************** dnl **********************************************************************
dnl **********************************************************************
dnl Make sure that our checks for headers windows.h winsock2.h
dnl and ws2tcpip.h take precedence over any other further checks which
dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
dnl this specific header files. And do them before its results are used.
dnl **********************************************************************
CURL_CHECK_HEADER_WINDOWS
CURL_CHECK_NATIVE_WINDOWS
case X-"$curl_cv_native_windows" in
X-yes)
CURL_CHECK_HEADER_WINSOCK2
CURL_CHECK_HEADER_WS2TCPIP
;;
*)
curl_cv_header_winsock2_h="no"
curl_cv_header_ws2tcpip_h="no"
;;
esac
CURL_CHECK_WIN32_LARGEFILE CURL_CHECK_WIN32_LARGEFILE
CURL_CHECK_WIN32_CRYPTO CURL_CHECK_WIN32_CRYPTO
@ -1130,23 +1112,19 @@ fi
if test "$HAVE_GETHOSTBYNAME" != "1" if test "$HAVE_GETHOSTBYNAME" != "1"
then then
dnl This is for winsock systems dnl This is for winsock systems
if test "$curl_cv_header_windows_h" = "yes"; then if test "$curl_cv_native_windows" = "yes"; then
if test "$curl_cv_header_winsock2_h" = "yes"; then
winsock_LIB="-lws2_32" winsock_LIB="-lws2_32"
fi
if test ! -z "$winsock_LIB"; then if test ! -z "$winsock_LIB"; then
my_ac_save_LIBS=$LIBS my_ac_save_LIBS=$LIBS
LIBS="$winsock_LIB $LIBS" LIBS="$winsock_LIB $LIBS"
AC_MSG_CHECKING([for gethostbyname in $winsock_LIB]) AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
AC_LINK_IFELSE([ AC_LINK_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h> #include <winsock2.h>
#endif
#include <windows.h> #include <windows.h>
#endif #endif
]],[[ ]],[[
@ -1668,7 +1646,7 @@ AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
AC_RUN_IFELSE([AC_LANG_SOURCE([[ AC_RUN_IFELSE([AC_LANG_SOURCE([[
/* are AF_INET6 and sockaddr_in6 available? */ /* are AF_INET6 and sockaddr_in6 available? */
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_WINSOCK2_H #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#else #else
@ -1707,7 +1685,7 @@ if test "$ipv6" = yes; then
AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member]) AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_WINSOCK2_H #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#else #else
@ -3473,14 +3451,12 @@ AC_CHECK_TYPE(sa_family_t,
AC_DEFINE(CURL_SA_FAMILY_T, ADDRESS_FAMILY, [IP address type in sockaddr]), AC_DEFINE(CURL_SA_FAMILY_T, ADDRESS_FAMILY, [IP address type in sockaddr]),
AC_DEFINE(CURL_SA_FAMILY_T, unsigned short, [IP address type in sockaddr]), AC_DEFINE(CURL_SA_FAMILY_T, unsigned short, [IP address type in sockaddr]),
[ [
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h> #include <winsock2.h>
#endif #endif
#endif
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif

View File

@ -31,9 +31,9 @@
#include <curl/curl.h> #include <curl/curl.h>
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h>
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#include <windows.h>
#define close closesocket #define close closesocket
#else #else
#include <sys/types.h> /* socket types */ #include <sys/types.h> /* socket types */

View File

@ -137,14 +137,14 @@ static void nosigpipe(struct Curl_easy *data,
#define nosigpipe(x,y) Curl_nop_stmt #define nosigpipe(x,y) Curl_nop_stmt
#endif #endif
#if defined(__DragonFly__) || defined(HAVE_WINSOCK2_H) #if defined(__DragonFly__) || defined(USE_WINSOCK)
/* DragonFlyBSD and Windows use millisecond units */ /* DragonFlyBSD and Windows use millisecond units */
#define KEEPALIVE_FACTOR(x) (x *= 1000) #define KEEPALIVE_FACTOR(x) (x *= 1000)
#else #else
#define KEEPALIVE_FACTOR(x) #define KEEPALIVE_FACTOR(x)
#endif #endif
#if defined(HAVE_WINSOCK2_H) && !defined(SIO_KEEPALIVE_VALS) #if defined(USE_WINSOCK) && !defined(SIO_KEEPALIVE_VALS)
#define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR,4) #define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR,4)
struct tcp_keepalive { struct tcp_keepalive {

View File

@ -97,15 +97,6 @@
#define HAVE_UNISTD_H 1 #define HAVE_UNISTD_H 1
#endif #endif
/* Define if you have the <windows.h> header file. */
#define HAVE_WINDOWS_H 1
/* Define if you have the <winsock2.h> header file. */
#define HAVE_WINSOCK2_H 1
/* Define if you have the <ws2tcpip.h> header file. */
#define HAVE_WS2TCPIP_H 1
/* Define to 1 if you have the <libgen.h> header file. */ /* Define to 1 if you have the <libgen.h> header file. */
#if defined(__MINGW32__) #if defined(__MINGW32__)
#define HAVE_LIBGEN_H 1 #define HAVE_LIBGEN_H 1
@ -292,52 +283,6 @@
/* Define to the size of `curl_off_t', as computed by sizeof. */ /* Define to the size of `curl_off_t', as computed by sizeof. */
#define SIZEOF_CURL_OFF_T 8 #define SIZEOF_CURL_OFF_T 8
/* ---------------------------------------------------------------- */
/* BSD-style lwIP TCP/IP stack SPECIFIC */
/* ---------------------------------------------------------------- */
/* Define to use BSD-style lwIP TCP/IP stack. */
/* #define USE_LWIPSOCK 1 */
#ifdef USE_LWIPSOCK
# undef USE_WINSOCK
# undef HAVE_WINSOCK2_H
# undef HAVE_WS2TCPIP_H
# undef HAVE_GETHOSTNAME
# undef LWIP_POSIX_SOCKETS_IO_NAMES
# undef RECV_TYPE_ARG1
# undef RECV_TYPE_ARG3
# undef SEND_TYPE_ARG1
# undef SEND_TYPE_ARG3
# define HAVE_GETHOSTBYNAME_R
# define HAVE_GETHOSTBYNAME_R_6
# define LWIP_POSIX_SOCKETS_IO_NAMES 0
# define RECV_TYPE_ARG1 int
# define RECV_TYPE_ARG3 size_t
# define SEND_TYPE_ARG1 int
# define SEND_TYPE_ARG3 size_t
#endif
/* ---------------------------------------------------------------- */
/* Watt-32 tcp/ip SPECIFIC */
/* ---------------------------------------------------------------- */
#ifdef USE_WATT32
#include <tcp.h>
#undef byte
#undef word
#undef USE_WINSOCK
#undef HAVE_WINSOCK2_H
#undef HAVE_WS2TCPIP_H
#define HAVE_SYS_IOCTL_H
#define HAVE_SYS_SOCKET_H
#define HAVE_NETINET_IN_H
#define HAVE_NETDB_H
#define HAVE_ARPA_INET_H
#define SOCKET int
#endif
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* COMPILER SPECIFIC */ /* COMPILER SPECIFIC */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */

View File

@ -85,15 +85,6 @@
#define HAVE_UNISTD_H 1 #define HAVE_UNISTD_H 1
#endif #endif
/* Define if you have the <windows.h> header file. */
#define HAVE_WINDOWS_H 1
/* Define if you have the <winsock2.h> header file. */
#define HAVE_WINSOCK2_H 1
/* Define if you have the <ws2tcpip.h> header file. */
#define HAVE_WS2TCPIP_H 1
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* OTHER HEADER INFO */ /* OTHER HEADER INFO */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */

View File

@ -599,18 +599,9 @@
/* Define to 1 if you have the <utime.h> header file. */ /* Define to 1 if you have the <utime.h> header file. */
#cmakedefine HAVE_UTIME_H 1 #cmakedefine HAVE_UTIME_H 1
/* Define to 1 if you have the windows.h header file. */
#cmakedefine HAVE_WINDOWS_H 1
/* Define to 1 if you have the winsock2.h header file. */
#cmakedefine HAVE_WINSOCK2_H 1
/* Define this symbol if your OS supports changing the contents of argv */ /* Define this symbol if your OS supports changing the contents of argv */
#cmakedefine HAVE_WRITABLE_ARGV 1 #cmakedefine HAVE_WRITABLE_ARGV 1
/* Define to 1 if you have the ws2tcpip.h header file. */
#cmakedefine HAVE_WS2TCPIP_H 1
/* Define to 1 if you need the lber.h header file even with ldap.h */ /* Define to 1 if you need the lber.h header file even with ldap.h */
#cmakedefine NEED_LBER_H 1 #cmakedefine NEED_LBER_H 1

View File

@ -253,7 +253,7 @@
* Windows setup file includes some system headers. * Windows setup file includes some system headers.
*/ */
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
# include "setup-win32.h" # include "setup-win32.h"
#endif #endif
@ -725,10 +725,7 @@
*/ */
#if defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H) #if defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H)
# if defined(SOCKET) || \ # if defined(SOCKET) || defined(USE_WINSOCK)
defined(USE_WINSOCK) || \
defined(HAVE_WINSOCK2_H) || \
defined(HAVE_WS2TCPIP_H)
# error "WinSock and lwIP TCP/IP stack definitions shall not coexist!" # error "WinSock and lwIP TCP/IP stack definitions shall not coexist!"
# endif # endif
#endif #endif

View File

@ -31,7 +31,7 @@ int Curl_inet_pton(int, const char *, void *);
#ifdef HAVE_INET_PTON #ifdef HAVE_INET_PTON
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>
#elif defined(HAVE_WS2TCPIP_H) #elif defined(USE_WINSOCK)
/* inet_pton() exists in Vista or later */ /* inet_pton() exists in Vista or later */
#include <ws2tcpip.h> #include <ws2tcpip.h>
#endif #endif

View File

@ -24,18 +24,53 @@
* *
***************************************************************************/ ***************************************************************************/
#undef USE_WINSOCK
/* ---------------------------------------------------------------- */
/* Watt-32 TCP/IP SPECIFIC */
/* ---------------------------------------------------------------- */
#ifdef USE_WATT32
# include <tcp.h>
# undef byte
# undef word
# define HAVE_SYS_IOCTL_H
# define HAVE_SYS_SOCKET_H
# define HAVE_NETINET_IN_H
# define HAVE_NETDB_H
# define HAVE_ARPA_INET_H
# define SOCKET int
/* ---------------------------------------------------------------- */
/* BSD-style lwIP TCP/IP stack SPECIFIC */
/* ---------------------------------------------------------------- */
#elif defined(USE_LWIPSOCK)
/* Define to use BSD-style lwIP TCP/IP stack. */
/* #define USE_LWIPSOCK 1 */
# undef HAVE_GETHOSTNAME
# undef LWIP_POSIX_SOCKETS_IO_NAMES
# undef RECV_TYPE_ARG1
# undef RECV_TYPE_ARG3
# undef SEND_TYPE_ARG1
# undef SEND_TYPE_ARG3
# define HAVE_GETHOSTBYNAME_R
# define HAVE_GETHOSTBYNAME_R_6
# define LWIP_POSIX_SOCKETS_IO_NAMES 0
# define RECV_TYPE_ARG1 int
# define RECV_TYPE_ARG3 size_t
# define SEND_TYPE_ARG1 int
# define SEND_TYPE_ARG3 size_t
#elif defined(_WIN32)
# define USE_WINSOCK 2
#endif
/* /*
* Include header files for windows builds before redefining anything. * Include header files for windows builds before redefining anything.
* Use this preprocessor block only to include or exclude windows.h, * Use this preprocessor block only to include or exclude windows.h,
* winsock2.h or ws2tcpip.h. Any other windows thing belongs * winsock2.h or ws2tcpip.h. Any other windows thing belongs
* to any other further and independent block. Under Cygwin things work * to any other further and independent block. Under Cygwin things work
* just as under linux (e.g. <sys/socket.h>) and the winsock headers should * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
* never be included when __CYGWIN__ is defined. configure script takes * never be included when __CYGWIN__ is defined.
* care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK2_H,
* neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
*/ */
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
# if defined(UNICODE) && !defined(_UNICODE) # if defined(UNICODE) && !defined(_UNICODE)
# error "UNICODE is defined but _UNICODE is not defined" # error "UNICODE is defined but _UNICODE is not defined"
# endif # endif
@ -53,12 +88,8 @@
# ifndef NOGDI # ifndef NOGDI
# define NOGDI # define NOGDI
# endif # endif
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h> # include <winsock2.h>
# ifdef HAVE_WS2TCPIP_H
# include <ws2tcpip.h> # include <ws2tcpip.h>
# endif
# endif
# include <windows.h> # include <windows.h>
# include <winerror.h> # include <winerror.h>
# include <tchar.h> # include <tchar.h>
@ -67,17 +98,6 @@
# endif # endif
#endif #endif
/*
* Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
* undefine USE_WINSOCK.
*/
#undef USE_WINSOCK
#ifdef HAVE_WINSOCK2_H
# define USE_WINSOCK 2
#endif
/* /*
* Define _WIN32_WINNT_[OS] symbols because not all Windows build systems have * Define _WIN32_WINNT_[OS] symbols because not all Windows build systems have
* those symbols to compare against, and even those that do may be missing * those symbols to compare against, and even those that do may be missing

View File

@ -194,7 +194,6 @@ AC_DEFUN([CURL_CHECK_COMPILER_GNU_C], [
flags_opt_all="-O -O0 -O1 -O2 -O3 -Os -Og -Ofast" flags_opt_all="-O -O0 -O1 -O2 -O3 -Os -Og -Ofast"
flags_opt_yes="-O2" flags_opt_yes="-O2"
flags_opt_off="-O0" flags_opt_off="-O0"
CURL_CHECK_DEF([_WIN32], [], [silent])
else else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
fi fi
@ -1035,7 +1034,7 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
dnl Only gcc 4.5 or later dnl Only gcc 4.5 or later
if test "$compiler_num" -ge "405"; then if test "$compiler_num" -ge "405"; then
dnl Only windows targets dnl Only windows targets
if test "$curl_cv_have_def__WIN32" = "yes"; then if test "$curl_cv_native_windows" = "yes"; then
tmp_CFLAGS="$tmp_CFLAGS -Wno-pedantic-ms-format" tmp_CFLAGS="$tmp_CFLAGS -Wno-pedantic-ms-format"
fi fi
fi fi

View File

@ -46,7 +46,7 @@ curl_includes_arpa_inet="\
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h> # include <arpa/inet.h>
#endif #endif
#ifdef HAVE_WINSOCK2_H #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#endif #endif
@ -414,18 +414,15 @@ dnl included when winsock2.h is to be included.
AC_DEFUN([CURL_INCLUDES_WINSOCK2], [ AC_DEFUN([CURL_INCLUDES_WINSOCK2], [
curl_includes_winsock2="\ curl_includes_winsock2="\
/* includes start */ /* includes start */
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
# ifndef WIN32_LEAN_AND_MEAN # ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# endif # endif
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h> # include <winsock2.h>
# endif
# include <windows.h> # include <windows.h>
#endif #endif
/* includes end */" /* includes end */"
CURL_CHECK_HEADER_WINDOWS CURL_CHECK_NATIVE_WINDOWS
CURL_CHECK_HEADER_WINSOCK2
]) ])
@ -437,22 +434,16 @@ dnl included when ws2tcpip.h is to be included.
AC_DEFUN([CURL_INCLUDES_WS2TCPIP], [ AC_DEFUN([CURL_INCLUDES_WS2TCPIP], [
curl_includes_ws2tcpip="\ curl_includes_ws2tcpip="\
/* includes start */ /* includes start */
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
# ifndef WIN32_LEAN_AND_MEAN # ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# endif # endif
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h> # include <winsock2.h>
# ifdef HAVE_WS2TCPIP_H
# include <ws2tcpip.h> # include <ws2tcpip.h>
# endif
# endif
# include <windows.h> # include <windows.h>
#endif #endif
/* includes end */" /* includes end */"
CURL_CHECK_HEADER_WINDOWS CURL_CHECK_NATIVE_WINDOWS
CURL_CHECK_HEADER_WINSOCK2
CURL_CHECK_HEADER_WS2TCPIP
]) ])
@ -510,7 +501,7 @@ dnl defines function calling convention.
AC_DEFUN([CURL_PREPROCESS_CALLCONV], [ AC_DEFUN([CURL_PREPROCESS_CALLCONV], [
curl_preprocess_callconv="\ curl_preprocess_callconv="\
/* preprocess start */ /* preprocess start */
#ifdef HAVE_WINDOWS_H #ifdef _WIN32
# define FUNCALLCONV __stdcall # define FUNCALLCONV __stdcall
#else #else
# define FUNCALLCONV # define FUNCALLCONV
@ -1794,7 +1785,7 @@ AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [
struct addrinfo *ai = 0; struct addrinfo *ai = 0;
int error; int error;
#ifdef HAVE_WINSOCK2_H #ifdef _WIN32
WSADATA wsa; WSADATA wsa;
if(WSAStartup(MAKEWORD(2, 2), &wsa)) if(WSAStartup(MAKEWORD(2, 2), &wsa))
exit(2); exit(2);