[glib] Check for <wspiapi.h> and use it if present



commit 8dc200db043fb7251baed6e346a7c5542a24a7b9
Author: Tor Lillqvist <tml iki fi>
Date:   Mon Dec 14 03:09:46 2009 +0200

    Check for <wspiapi.h> and use it if present
    
    Should help bug #603527 if glib is built in an environment that has
    <wspiapi.h>.

 config.h.win32.in    |    7 +++++++
 configure.in         |    2 +-
 gio/gwin32resolver.c |    8 ++++++++
 3 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/config.h.win32.in b/config.h.win32.in
index 104cd9d..d72ad80 100644
--- a/config.h.win32.in
+++ b/config.h.win32.in
@@ -607,6 +607,13 @@
 /* Have a working bcopy */
 /* #undef HAVE_WORKING_BCOPY */
 
+/* Define to 1 if you have the <wspiapi.h> header file. */
+#ifndef _MSC_VER
+/* #undef HAVE_WSPIAPI_H */
+#else
+#define HAVE_WSPIAPI_H 1
+#endif
+
 /* Define to 1 if xattr is available */
 /* #undef HAVE_XATTR */
 
diff --git a/configure.in b/configure.in
index 723311f..f7b1a0a 100644
--- a/configure.in
+++ b/configure.in
@@ -1006,7 +1006,7 @@ if $glib_failed ; then
 fi
 
 AC_CHECK_FUNCS(getprotobyname_r endservent)
-AC_CHECK_HEADERS([netdb.h winsock2.h mswsock.h])
+AC_CHECK_HEADERS([netdb.h winsock2.h mswsock.h wspiapi.h])
 
 # For gio/libasyncns
 if test $glib_native_win32 = no; then
diff --git a/gio/gwin32resolver.c b/gio/gwin32resolver.c
index 5198b95..13cb45e 100644
--- a/gio/gwin32resolver.c
+++ b/gio/gwin32resolver.c
@@ -34,6 +34,14 @@
 #include "gsimpleasyncresult.h"
 #include "gsocketaddress.h"
 
+#ifdef HAVE_WSPIAPI_H
+/* <wspiapi.h> in the Windows SDK and in mingw-w64 has wrappers for
+ * inline workarounds for getaddrinfo, getnameinfo and freeaddrinfo if
+ * they aren't present at run-time (on Windows 2000).
+ */
+#include <wspiapi.h>
+#endif
+
 #include "gioalias.h"
 
 G_DEFINE_TYPE (GWin32Resolver, g_win32_resolver, G_TYPE_THREADED_RESOLVER)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]