Author: cazfi
Date: Mon Jan 25 13:46:45 2016
New Revision: 31586

URL: http://svn.gna.org/viewcvs/freeciv?rev=31586&view=rev
Log:
Use winsock2 on Windows builds.

See patch #6533

Modified:
    branches/S2_5/client/client_main.c
    branches/S2_5/client/clinet.c
    branches/S2_5/client/connectdlg_common.c
    branches/S2_5/client/gui-sdl/gui_main.c
    branches/S2_5/client/servers.c
    branches/S2_5/common/connection.c
    branches/S2_5/common/dataio.c
    branches/S2_5/common/packets.c
    branches/S2_5/configure.ac
    branches/S2_5/server/meta.c
    branches/S2_5/server/sernet.c
    branches/S2_5/server/srv_main.c
    branches/S2_5/utility/fcthread.h
    branches/S2_5/utility/ioz.c
    branches/S2_5/utility/netintf.c
    branches/S2_5/utility/netintf.h
    branches/S2_5/utility/shared.c
    branches/S2_5/utility/support.c

Modified: branches/S2_5/client/client_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/client_main.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/client/client_main.c  (original)
+++ branches/S2_5/client/client_main.c  Mon Jan 25 13:46:45 2016
@@ -14,6 +14,15 @@
 #ifdef HAVE_CONFIG_H
 #include <fc_config.h>
 #endif
+
+/* Must be before <windows.h> */
+#ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
+#include <winsock.h>
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
 
 #ifdef WIN32_NATIVE
 #include <windows.h>   /* LoadLibrary() */

Modified: branches/S2_5/client/clinet.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/clinet.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/client/clinet.c       (original)
+++ branches/S2_5/client/clinet.c       Mon Jan 25 13:46:45 2016
@@ -54,8 +54,12 @@
 #include <unistd.h>
 #endif
 #ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
 #include <winsock.h>
-#endif
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
 
 /* utility */
 #include "capstr.h"

Modified: branches/S2_5/client/connectdlg_common.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/connectdlg_common.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/client/connectdlg_common.c    (original)
+++ branches/S2_5/client/connectdlg_common.c    Mon Jan 25 13:46:45 2016
@@ -19,6 +19,15 @@
 #include <signal.h>             /* SIGTERM and kill */
 #include <string.h>
 #include <time.h>
+
+/* Must be before <windows.h> */
+#ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
+#include <winsock.h>
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
 
 #ifdef WIN32_NATIVE
 #include <windows.h>

Modified: branches/S2_5/client/gui-sdl/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-sdl/gui_main.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/client/gui-sdl/gui_main.c     (original)
+++ branches/S2_5/client/gui-sdl/gui_main.c     Mon Jan 25 13:46:45 2016
@@ -34,8 +34,12 @@
 #endif
 
 #ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
 #include <winsock.h>
-#endif
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
 
 #include "SDL/SDL.h"
 

Modified: branches/S2_5/client/servers.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/servers.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/client/servers.c      (original)
+++ branches/S2_5/client/servers.c      Mon Jan 25 13:46:45 2016
@@ -49,7 +49,14 @@
 #include <unistd.h>
 #endif
 #ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
 #include <winsock.h>
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
 #endif
 
 /* dependencies */

Modified: branches/S2_5/common/connection.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/connection.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/common/connection.c   (original)
+++ branches/S2_5/common/connection.c   Mon Jan 25 13:46:45 2016
@@ -30,8 +30,12 @@
 #include <unistd.h>
 #endif
 #ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
 #include <winsock.h>
-#endif
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
 
 /* utility */
 #include "fcintl.h"

Modified: branches/S2_5/common/dataio.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/dataio.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/common/dataio.c       (original)
+++ branches/S2_5/common/dataio.c       Mon Jan 25 13:46:45 2016
@@ -43,8 +43,12 @@
 #include <arpa/inet.h>
 #endif
 #ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
 #include <winsock.h>
-#endif
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
 
 /* utility */
 #include "bitvector.h"

Modified: branches/S2_5/common/packets.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/packets.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/common/packets.c      (original)
+++ branches/S2_5/common/packets.c      Mon Jan 25 13:46:45 2016
@@ -27,8 +27,12 @@
 #include <netinet/in.h>
 #endif
 #ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
 #include <winsock.h>
-#endif
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
 
 /* utility */
 #include "capability.h"

Modified: branches/S2_5/configure.ac
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/configure.ac?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/configure.ac  (original)
+++ branches/S2_5/configure.ac  Mon Jan 25 13:46:45 2016
@@ -685,8 +685,10 @@
     AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Mingw32])
     AC_DEFINE([WIN32_NATIVE], [1], [Mingw32-specific setting - native])
     AC_DEFINE([HAVE_WINSOCK], [1], [Mingw32-specific setting - winsock])
+    AC_DEFINE([HAVE_WINSOCK2], [1], [Mingw32-specific setting - winsock2])
     AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])
-    LIBS="$LIBS -lwsock32"
+    dnl Without WINSOCK2, use: LIBS="$LIBS -lwsock32"
+    LIBS="${LIBS} -lws2_32"
     ;;
 
   *skyos*)
@@ -1159,6 +1161,7 @@
 AC_C_CONST
 AC_HEADER_TIME
 AC_STRUCT_TM
+AC_CHECK_HEADERS([ws2tcpip.h])
 AC_CHECK_TYPES([socklen_t], [], [],
 [#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>

Modified: branches/S2_5/server/meta.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/meta.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/server/meta.c (original)
+++ branches/S2_5/server/meta.c Mon Jan 25 13:46:45 2016
@@ -37,8 +37,12 @@
 #include <arpa/inet.h>
 #endif
 #ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
 #include <winsock.h>
-#endif
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
 
 /* utility */
 #include "fcintl.h"

Modified: branches/S2_5/server/sernet.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/sernet.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/server/sernet.c       (original)
+++ branches/S2_5/server/sernet.c       Mon Jan 25 13:46:45 2016
@@ -56,7 +56,14 @@
 #include <unistd.h>
 #endif
 #ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
 #include <winsock.h>
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
 #endif
 
 /* utility */

Modified: branches/S2_5/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/srv_main.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/server/srv_main.c     (original)
+++ branches/S2_5/server/srv_main.c     Mon Jan 25 13:46:45 2016
@@ -40,8 +40,12 @@
 #include <unistd.h>
 #endif
 #ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
 #include <winsock.h>
-#endif
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
 
 /* utility */
 #include "astring.h"

Modified: branches/S2_5/utility/fcthread.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/fcthread.h?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/utility/fcthread.h    (original)
+++ branches/S2_5/utility/fcthread.h    Mon Jan 25 13:46:45 2016
@@ -28,6 +28,16 @@
 #define fc_thread_cond pthread_cond_t
 
 #elif defined (HAVE_WINTHREADS)
+
+/* No way needed by threading, but if the one including us will ever need it,
+ * it can't be included after we have included <windows.h> directly or 
indirectly. */
+#ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
+#include <winsock.h>
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
 
 #include <windows.h>
 #define fc_thread      HANDLE *

Modified: branches/S2_5/utility/ioz.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/ioz.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/utility/ioz.c (original)
+++ branches/S2_5/utility/ioz.c Mon Jan 25 13:46:45 2016
@@ -37,6 +37,15 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
+
+/* Must be before <windows.h> gets included from anywhere */
+#ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
+#include <winsock.h>
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
 
 #ifdef HAVE_LIBZ
 #include <zlib.h>

Modified: branches/S2_5/utility/netintf.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/netintf.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/utility/netintf.c     (original)
+++ branches/S2_5/utility/netintf.c     Mon Jan 25 13:46:45 2016
@@ -44,8 +44,12 @@
 #include <sys/signal.h>
 #endif
 #ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
 #include <winsock.h>
-#endif
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
 #ifdef WIN32_NATIVE
 #include <windows.h>   /* GetTempPath */
 #endif

Modified: branches/S2_5/utility/netintf.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/netintf.h?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/utility/netintf.h     (original)
+++ branches/S2_5/utility/netintf.h     Mon Jan 25 13:46:45 2016
@@ -41,8 +41,12 @@
 #include <unistd.h>
 #endif
 #ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
 #include <winsock.h>
-#endif
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
 
 /* utility */
 #include "ioz.h"

Modified: branches/S2_5/utility/shared.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/shared.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/utility/shared.c      (original)
+++ branches/S2_5/utility/shared.c      Mon Jan 25 13:46:45 2016
@@ -40,6 +40,16 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+
+/* Must be before <windows.h> */
+#ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
+#include <winsock.h>
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
+
 #ifdef WIN32_NATIVE
 #include <windows.h>
 #include <lmcons.h>    /* UNLEN */

Modified: branches/S2_5/utility/support.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/support.c?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- branches/S2_5/utility/support.c     (original)
+++ branches/S2_5/utility/support.c     Mon Jan 25 13:46:45 2016
@@ -77,13 +77,27 @@
 #ifdef HAVE_LIBZ
 #include <zlib.h>
 #endif
+
+/* Must be before <windows.h> */
+#ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
+#include <winsock.h>
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
+
 #ifdef WIN32_NATIVE
 #include <process.h>
 #include <windows.h>
 #endif
 #ifdef HAVE_WINSOCK
+#ifdef HAVE_WINSOCK2
+#include <winsock2.h>
+#else  /* HAVE_WINSOCK2 */
 #include <winsock.h>
-#endif
+#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK */
 #ifdef HAVE_STRINGS_H
 #  include <strings.h>
 #endif


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to