[libxml2] autotools: Fix network checks on Windows
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] autotools: Fix network checks on Windows
- Date: Mon, 5 Sep 2022 01:02:41 +0000 (UTC)
commit 9e5a016ef039db536d30d016e5b9226c70b3c66a
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Mon Sep 5 01:08:33 2022 +0200
autotools: Fix network checks on Windows
configure.ac | 12 ++++++++++--
include/wsockcompat.h | 3 ++-
2 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 82638d6a..eb03a83c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -370,7 +370,11 @@ dnl Determine what socket length (socklen_t) data type is
AC_MSG_CHECKING([for type of socket length (socklen_t)])
AC_TRY_COMPILE2([
#include <stddef.h>
-#include <sys/socket.h>],[
+#ifdef _WIN32
+ #include <ws2tcpip.h>
+#else
+ #include <sys/socket.h>
+#endif],[
(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
AC_MSG_RESULT(socklen_t *)
XML_SOCKLEN_T=socklen_t],[
@@ -402,7 +406,11 @@ fi
if test $enable_ipv6 = yes; then
have_ipv6=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-# include <sys/socket.h>
+ #ifdef _WIN32
+ #include <winsock2.h>
+ #else
+ #include <sys/socket.h>
+ #endif
]], [[
struct sockaddr_storage ss;
socket(AF_INET6, SOCK_STREAM, 0)
diff --git a/include/wsockcompat.h b/include/wsockcompat.h
index 85b9e7d5..b3c97165 100644
--- a/include/wsockcompat.h
+++ b/include/wsockcompat.h
@@ -28,8 +28,9 @@
#define HAVE_GETADDRINFO
#endif
-#undef XML_SOCKLEN_T
+#ifndef XML_SOCKLEN_T
#define XML_SOCKLEN_T int
+#endif
#ifndef ECONNRESET
#define ECONNRESET WSAECONNRESET
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]