From a12d96e87e113044ea57cd85ee27e15a1749fc49 Mon Sep 17 00:00:00 2001
From: reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>
Date: Sat, 16 Jan 2010 16:16:50 +0000
Subject: [PATCH 1/2] Fix sockaddr_storage check to work with winsock/MinGW

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30323 b3059339-0415-0410-9bf9-f77b7e298cf2
---
 configure | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index ea66abe902..dbb51126ce 100755
--- a/configure
+++ b/configure
@@ -3103,8 +3103,10 @@ echores "$_socklib"
 if test $_winsock2_h = yes ; then
   _ld_sock="-lws2_32"
   def_winsock2_h='#define HAVE_WINSOCK2_H 1'
+  cc_check_winsock2_h='-DHAVE_WINSOCK2_H=1'
 else
   def_winsock2_h='#define HAVE_WINSOCK2_H 0'
+  cc_check_winsock2_h='-DHAVE_WINSOCK2_H=0'
 fi
 
 
@@ -3112,12 +3114,16 @@ echocheck "netdb.h, struct addrinfo"
 if test "$_struct_addrinfo" = auto; then
   _struct_addrinfo=no
   cat > $TMPC << EOF
+#if HAVE_WINSOCK2_H
+#include <winsock2.h>
+#else
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
+#endif
 int main(void) { struct addrinfo ai; return 0; }
 EOF
-  cc_check && _struct_addrinfo=yes
+  cc_check $cc_check_winsock2_h && _struct_addrinfo=yes
 fi
 echores "$_struct_addrinfo"
 
@@ -3132,12 +3138,16 @@ echocheck "netdb.h, getaddrinfo()"
 if test "$_getaddrinfo" = auto; then
   _getaddrinfo=no
   cat > $TMPC << EOF
+#if HAVE_WINSOCK2_H
+#include <winsock2.h>
+#else
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
+#endif
 int main(void) { (void) getaddrinfo(0, 0, 0, 0); return 0; }
 EOF
-  cc_check && _getaddrinfo=yes
+  cc_check $cc_check_winsock2_h && _getaddrinfo=yes
 fi
 echores "$_getaddrinfo"
 
@@ -3152,10 +3162,14 @@ echocheck "sockaddr_storage"
 if test "$_struct_sockaddr_storage" = auto; then
   _struct_sockaddr_storage=no
   cat > $TMPC << EOF
+#if HAVE_WINSOCK2_H
+#include <winsock2.h>
+#else
 #include <sys/socket.h>
+#endif
 int main(void) { struct sockaddr_storage sas; return 0; }
 EOF
-  cc_check && _struct_sockaddr_storage=yes
+  cc_check $cc_check_winsock2_h && _struct_sockaddr_storage=yes
 fi
 echores "$_struct_sockaddr_storage"
 

From cd2dbe5939814168ff91ae728080c432cc8b3fde Mon Sep 17 00:00:00 2001
From: reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>
Date: Sat, 16 Jan 2010 16:22:57 +0000
Subject: [PATCH 2/2] Fix struct addrinfo check, its definition might not allow
 actually allocating it. Fixes MinGW64 compilation.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30324 b3059339-0415-0410-9bf9-f77b7e298cf2
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index dbb51126ce..0f64bc62ac 100755
--- a/configure
+++ b/configure
@@ -3121,7 +3121,7 @@ if test "$_struct_addrinfo" = auto; then
 #include <sys/socket.h>
 #include <netdb.h>
 #endif
-int main(void) { struct addrinfo ai; return 0; }
+int main(void) { struct addrinfo *ai; return 0; }
 EOF
   cc_check $cc_check_winsock2_h && _struct_addrinfo=yes
 fi