Skip to content

Commit 180180a

Browse files
committed
Revert "build: remove checks for WinSock 1"
Due to CI issues This reverts commit c2ea04f. Closes curl#7790
1 parent 12246ed commit 180180a

16 files changed

+158
-5
lines changed

CMake/CurlTests.c

+20
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ int main () { ; return 0; }
229229
# include <windows.h>
230230
# ifdef HAVE_WINSOCK2_H
231231
# include <winsock2.h>
232+
# else
233+
# ifdef HAVE_WINSOCK_H
234+
# include <winsock.h>
235+
# endif
232236
# endif
233237
#endif
234238

@@ -254,6 +258,10 @@ main ()
254258
# include <windows.h>
255259
# ifdef HAVE_WINSOCK2_H
256260
# include <winsock2.h>
261+
# else
262+
# ifdef HAVE_WINSOCK_H
263+
# include <winsock.h>
264+
# endif
257265
# endif
258266
#endif
259267

@@ -277,6 +285,10 @@ main ()
277285
# include <windows.h>
278286
# ifdef HAVE_WINSOCK2_H
279287
# include <winsock2.h>
288+
# else
289+
# ifdef HAVE_WINSOCK_H
290+
# include <winsock.h>
291+
# endif
280292
# endif
281293
#endif
282294

@@ -301,6 +313,10 @@ main ()
301313
# include <windows.h>
302314
# ifdef HAVE_WINSOCK2_H
303315
# include <winsock2.h>
316+
# else
317+
# ifdef HAVE_WINSOCK_H
318+
# include <winsock.h>
319+
# endif
304320
# endif
305321
#endif
306322

@@ -387,6 +403,10 @@ main ()
387403
# include <windows.h>
388404
# ifdef HAVE_WINSOCK2_H
389405
# include <winsock2.h>
406+
# else
407+
# ifdef HAVE_WINSOCK_H
408+
# include <winsock.h>
409+
# endif
390410
# endif
391411
#endif
392412
/* includes start */

CMake/OtherTests.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ set(signature_call_conv)
3333
if(HAVE_WINDOWS_H)
3434
add_header_include(HAVE_WINSOCK2_H "winsock2.h")
3535
add_header_include(HAVE_WINDOWS_H "windows.h")
36+
add_header_include(HAVE_WINSOCK_H "winsock.h")
3637
set(_source_epilogue
3738
"${_source_epilogue}\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif")
3839
set(signature_call_conv "PASCAL")

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,7 @@ endif()
910910
# Check for header files
911911
if(NOT UNIX)
912912
check_include_file_concat("windows.h" HAVE_WINDOWS_H)
913+
check_include_file_concat("winsock.h" HAVE_WINSOCK_H)
913914
check_include_file_concat("ws2tcpip.h" HAVE_WS2TCPIP_H)
914915
check_include_file_concat("winsock2.h" HAVE_WINSOCK2_H)
915916
check_include_file_concat("wincrypt.h" HAVE_WINCRYPT_H)

acinclude.m4

+78
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,43 @@ AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
235235
])
236236

237237

238+
dnl CURL_CHECK_HEADER_WINSOCK
239+
dnl -------------------------------------------------
240+
dnl Check for compilable and valid winsock.h header
241+
242+
AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
243+
AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
244+
AC_CACHE_CHECK([for winsock.h], [curl_cv_header_winsock_h], [
245+
AC_COMPILE_IFELSE([
246+
AC_LANG_PROGRAM([[
247+
#undef inline
248+
#ifndef WIN32_LEAN_AND_MEAN
249+
#define WIN32_LEAN_AND_MEAN
250+
#endif
251+
#include <windows.h>
252+
#include <winsock.h>
253+
]],[[
254+
#if defined(__CYGWIN__) || defined(__CEGCC__)
255+
HAVE_WINSOCK_H shall not be defined.
256+
#else
257+
int dummy=WSACleanup();
258+
#endif
259+
]])
260+
],[
261+
curl_cv_header_winsock_h="yes"
262+
],[
263+
curl_cv_header_winsock_h="no"
264+
])
265+
])
266+
case "$curl_cv_header_winsock_h" in
267+
yes)
268+
AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
269+
[Define to 1 if you have the winsock.h header file.])
270+
;;
271+
esac
272+
])
273+
274+
238275
dnl CURL_CHECK_HEADER_WINSOCK2
239276
dnl -------------------------------------------------
240277
dnl Check for compilable and valid winsock2.h header
@@ -1021,6 +1058,10 @@ AC_DEFUN([CURL_CHECK_FUNC_RECV], [
10211058
#include <windows.h>
10221059
#ifdef HAVE_WINSOCK2_H
10231060
#include <winsock2.h>
1061+
#else
1062+
#ifdef HAVE_WINSOCK_H
1063+
#include <winsock.h>
1064+
#endif
10241065
#endif
10251066
#else
10261067
#ifdef HAVE_PROTO_BSDSOCKET_H
@@ -1065,6 +1106,10 @@ struct Library *SocketBase = NULL;
10651106
#include <windows.h>
10661107
#ifdef HAVE_WINSOCK2_H
10671108
#include <winsock2.h>
1109+
#else
1110+
#ifdef HAVE_WINSOCK_H
1111+
#include <winsock.h>
1112+
#endif
10681113
#endif
10691114
#define RECVCALLCONV PASCAL
10701115
#else
@@ -1142,6 +1187,7 @@ dnl return value in SEND_TYPE_RETV, and also defining the
11421187
dnl type qualifier of second argument in SEND_QUAL_ARG2.
11431188

11441189
AC_DEFUN([CURL_CHECK_FUNC_SEND], [
1190+
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
11451191
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
11461192
AC_CHECK_HEADERS(sys/types.h sys/socket.h)
11471193
#
@@ -1156,6 +1202,10 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
11561202
#include <windows.h>
11571203
#ifdef HAVE_WINSOCK2_H
11581204
#include <winsock2.h>
1205+
#else
1206+
#ifdef HAVE_WINSOCK_H
1207+
#include <winsock.h>
1208+
#endif
11591209
#endif
11601210
#else
11611211
#ifdef HAVE_PROTO_BSDSOCKET_H
@@ -1200,6 +1250,10 @@ struct Library *SocketBase = NULL;
12001250
#include <windows.h>
12011251
#ifdef HAVE_WINSOCK2_H
12021252
#include <winsock2.h>
1253+
#else
1254+
#ifdef HAVE_WINSOCK_H
1255+
#include <winsock.h>
1256+
#endif
12031257
#endif
12041258
#define SENDCALLCONV PASCAL
12051259
#else
@@ -1314,6 +1368,10 @@ AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
13141368
#include <windows.h>
13151369
#ifdef HAVE_WINSOCK2_H
13161370
#include <winsock2.h>
1371+
#else
1372+
#ifdef HAVE_WINSOCK_H
1373+
#include <winsock.h>
1374+
#endif
13171375
#endif
13181376
#else
13191377
#ifdef HAVE_PROTO_BSDSOCKET_H
@@ -1350,6 +1408,7 @@ dnl -------------------------------------------------
13501408
dnl Check for timeval struct
13511409

13521410
AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
1411+
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
13531412
AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
13541413
AC_CHECK_HEADERS(sys/types.h sys/time.h sys/socket.h)
13551414
AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [
@@ -1363,6 +1422,10 @@ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
13631422
#include <windows.h>
13641423
#ifdef HAVE_WINSOCK2_H
13651424
#include <winsock2.h>
1425+
#else
1426+
#ifdef HAVE_WINSOCK_H
1427+
#include <winsock.h>
1428+
#endif
13661429
#endif
13671430
#endif
13681431
#ifdef HAVE_SYS_TYPES_H
@@ -1418,6 +1481,9 @@ AC_DEFUN([TYPE_IN_ADDR_T], [
14181481
#include <windows.h>
14191482
#ifdef HAVE_WINSOCK2_H
14201483
#include <winsock2.h>
1484+
#else
1485+
#ifdef HAVE_WINSOCK_H
1486+
#include <winsock.h>
14211487
#endif
14221488
#endif
14231489
#else
@@ -1461,6 +1527,10 @@ AC_DEFUN([TYPE_IN_ADDR_T], [
14611527
#include <windows.h>
14621528
#ifdef HAVE_WINSOCK2_H
14631529
#include <winsock2.h>
1530+
#else
1531+
#ifdef HAVE_WINSOCK_H
1532+
#include <winsock.h>
1533+
#endif
14641534
#endif
14651535
#else
14661536
#ifdef HAVE_SYS_TYPES_H
@@ -1753,6 +1823,10 @@ AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
17531823
#include <windows.h>
17541824
#ifdef HAVE_WINSOCK2_H
17551825
#include <winsock2.h>
1826+
#else
1827+
#ifdef HAVE_WINSOCK_H
1828+
#include <winsock.h>
1829+
#endif
17561830
#endif
17571831
#endif
17581832
#ifdef HAVE_SYS_TYPES_H
@@ -1807,6 +1881,10 @@ struct Library *SocketBase = NULL;
18071881
#include <windows.h>
18081882
#ifdef HAVE_WINSOCK2_H
18091883
#include <winsock2.h>
1884+
#else
1885+
#ifdef HAVE_WINSOCK_H
1886+
#include <winsock.h>
1887+
#endif
18101888
#endif
18111889
#define SELECTCALLCONV PASCAL
18121890
#endif

configure.ac

+17-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ dnl Compilation based checks should not be done before this point.
477477
dnl **********************************************************************
478478

479479
dnl **********************************************************************
480-
dnl Make sure that our checks for headers windows.h winsock2.h
480+
dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
481481
dnl and ws2tcpip.h take precedence over any other further checks which
482482
dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
483483
dnl this specific header files. And do them before its results are used.
@@ -487,13 +487,15 @@ CURL_CHECK_HEADER_WINDOWS
487487
CURL_CHECK_NATIVE_WINDOWS
488488
case X-"$curl_cv_native_windows" in
489489
X-yes)
490+
CURL_CHECK_HEADER_WINSOCK
490491
CURL_CHECK_HEADER_WINSOCK2
491492
CURL_CHECK_HEADER_WS2TCPIP
492493
CURL_CHECK_HEADER_WINCRYPT
493494
CURL_CHECK_HEADER_WINLDAP
494495
CURL_CHECK_HEADER_WINBER
495496
;;
496497
*)
498+
curl_cv_header_winsock_h="no"
497499
curl_cv_header_winsock2_h="no"
498500
curl_cv_header_ws2tcpip_h="no"
499501
curl_cv_header_wincrypt_h="no"
@@ -1020,6 +1022,16 @@ if test "$HAVE_GETHOSTBYNAME" != "1"
10201022
then
10211023
dnl This is for winsock systems
10221024
if test "$curl_cv_header_windows_h" = "yes"; then
1025+
if test "$curl_cv_header_winsock_h" = "yes"; then
1026+
case $host in
1027+
*-*-mingw32ce*)
1028+
winsock_LIB="-lwinsock"
1029+
;;
1030+
*)
1031+
winsock_LIB="-lwsock32"
1032+
;;
1033+
esac
1034+
fi
10231035
if test "$curl_cv_header_winsock2_h" = "yes"; then
10241036
winsock_LIB="-lws2_32"
10251037
fi
@@ -1036,6 +1048,10 @@ then
10361048
#include <windows.h>
10371049
#ifdef HAVE_WINSOCK2_H
10381050
#include <winsock2.h>
1051+
#else
1052+
#ifdef HAVE_WINSOCK_H
1053+
#include <winsock.h>
1054+
#endif
10391055
#endif
10401056
#endif
10411057
]],[[

lib/config-os400.h

+3
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@
328328
/* Define if you have the <unistd.h> header file. */
329329
#define HAVE_UNISTD_H
330330

331+
/* Define if you have the <winsock.h> header file. */
332+
#undef HAVE_WINSOCK_H
333+
331334
/* Define if you have the <x509.h> header file. */
332335
#undef HAVE_X509_H
333336

lib/config-riscos.h

+3
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@
305305
/* Define if you have the <unistd.h> header file. */
306306
#define HAVE_UNISTD_H
307307

308+
/* Define if you have the <winsock.h> header file. */
309+
#undef HAVE_WINSOCK_H
310+
308311
/* Define if you have the <x509.h> header file. */
309312
#undef HAVE_X509_H
310313

lib/config-tpf.h

+3
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,9 @@
483483
/* Define to 1 if you have the <winsock2.h> header file. */
484484
/* #undef HAVE_WINSOCK2_H */
485485

486+
/* Define to 1 if you have the <winsock.h> header file. */
487+
/* #undef HAVE_WINSOCK_H */
488+
486489
/* Define this symbol if your OS supports changing the contents of argv */
487490
/* #undef HAVE_WRITABLE_ARGV */
488491

lib/config-vxworks.h

+3
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,9 @@
601601
/* Define to 1 if you have the winsock2.h header file. */
602602
/* #undef HAVE_WINSOCK2_H */
603603

604+
/* Define to 1 if you have the winsock.h header file. */
605+
/* #undef HAVE_WINSOCK_H */
606+
604607
/* Define this symbol if your OS supports changing the contents of argv */
605608
#define HAVE_WRITABLE_ARGV 1
606609

lib/config-win32.h

+5
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@
132132
/* Define if you have the <windows.h> header file. */
133133
#define HAVE_WINDOWS_H 1
134134

135+
/* Define if you have the <winsock.h> header file. */
136+
#define HAVE_WINSOCK_H 1
137+
135138
/* Define if you have the <winsock2.h> header file. */
136139
#ifndef __SALFORDC__
137140
#define HAVE_WINSOCK2_H 1
@@ -378,6 +381,7 @@
378381

379382
#ifdef USE_LWIPSOCK
380383
# undef USE_WINSOCK
384+
# undef HAVE_WINSOCK_H
381385
# undef HAVE_WINSOCK2_H
382386
# undef HAVE_WS2TCPIP_H
383387
# undef HAVE_ERRNO_H
@@ -408,6 +412,7 @@
408412
#undef byte
409413
#undef word
410414
#undef USE_WINSOCK
415+
#undef HAVE_WINSOCK_H
411416
#undef HAVE_WINSOCK2_H
412417
#undef HAVE_WS2TCPIP_H
413418
#define HAVE_GETADDRINFO

lib/config-win32ce.h

+3
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@
110110
/* Define if you have the <windows.h> header file. */
111111
#define HAVE_WINDOWS_H 1
112112

113+
/* Define if you have the <winsock.h> header file. */
114+
#define HAVE_WINSOCK_H 1
115+
113116
/* Define if you have the <winsock2.h> header file. */
114117
#define HAVE_WINSOCK2_H 1
115118

lib/connect.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585

8686
static bool verifyconnect(curl_socket_t sockfd, int *error);
8787

88-
#if defined(__DragonFly__) || defined(HAVE_WINSOCK2_H)
88+
#if defined(__DragonFly__) || defined(HAVE_WINSOCK_H)
8989
/* DragonFlyBSD and Windows use millisecond units */
9090
#define KEEPALIVE_FACTOR(x) (x *= 1000)
9191
#else

lib/curl_config.h.cmake

+3
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,9 @@
710710
/* Define to 1 if you have the winsock2.h header file. */
711711
#cmakedefine HAVE_WINSOCK2_H 1
712712

713+
/* Define to 1 if you have the winsock.h header file. */
714+
#cmakedefine HAVE_WINSOCK_H 1
715+
713716
/* Define this symbol if your OS supports changing the contents of argv */
714717
#cmakedefine HAVE_WRITABLE_ARGV 1
715718

lib/curl_setup.h

+1
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ int netware_init(void);
717717
#if defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H)
718718
# if defined(SOCKET) || \
719719
defined(USE_WINSOCK) || \
720+
defined(HAVE_WINSOCK_H) || \
720721
defined(HAVE_WINSOCK2_H) || \
721722
defined(HAVE_WS2TCPIP_H)
722723
# error "WinSock and lwIP TCP/IP stack definitions shall not coexist!"

0 commit comments

Comments
 (0)