More fixes for MinGW build.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2470 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+3
-1
@@ -41,7 +41,9 @@ uqm_USE_PLATFORM_ACCEL='@USE_PLATFORM_ACCEL@'
|
||||
uqm_NETPLAY='@NETPLAY@'
|
||||
uqm_USE_WINSOCK='@USE_WINSOCK@'
|
||||
DEBUG='@DEBUG@'
|
||||
MACRO_WIN32='@MACRO_WIN32@'
|
||||
MACRO___MINGW32__='@MACRO___MINGW32__@'
|
||||
export BUILD_SYSTEM HOST_SYSTEM DEBUG
|
||||
export MACRO_WIN32 MACRO__MCS_VER MACRO___MINGW32__
|
||||
export MACRO_WIN32 MACRO___MINGW32__
|
||||
export uqm_SOUNDMODULE uqm_USE_INTERNAL_MIKMOD uqm_HAVE_REGEX uqm_USE_WINSOCK
|
||||
export uqm_HAVE_OPENGL uqm_USE_ZIP_IO uqm_USE_PLATFORM_ACCEL uqm_NETPLAY
|
||||
|
||||
@@ -346,7 +346,7 @@ uqm_process_config() {
|
||||
HAVE_OPENGL HAVE_REGEX_H_FLAG USE_ZIP_IO \
|
||||
USE_PLATFORM_ACCEL USE_WINSOCK \
|
||||
INSTALL_LIBDIR INSTALL_BINDIR INSTALL_SHAREDIR \
|
||||
REZ WINDRES"
|
||||
REZ WINDRES $HAVE_SYMBOLS"
|
||||
SUBSTITUTE_FILES="build.vars"
|
||||
substitute_vars SUBSTITUTE_VARS SUBSTITUTE_FILES . "$BUILD_WORK"
|
||||
|
||||
|
||||
@@ -1439,6 +1439,10 @@ SOURCE=..\sc2code\libs\network\socket\socket_win.h
|
||||
# End Source File
|
||||
# End Group
|
||||
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\sc2code\libs\network\wspiapiwrap.h
|
||||
# End Source File
|
||||
# End Group
|
||||
|
||||
# Begin Source File
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef __MINGW32__
|
||||
// Microsoft Windows headers expect this to be set. The MSVC compiler sets
|
||||
// it, but MinGW doesn't.
|
||||
# if defined(_X86_)
|
||||
# define _M_IX86
|
||||
# elif defined(_IA64_)
|
||||
# define _M_IA64
|
||||
# elif defined(__amd64__)
|
||||
# define _M_AMD64
|
||||
# elif defined(__m68k__)
|
||||
# define _68K_
|
||||
# elif defined(__ppc__)
|
||||
# define _M_PPC
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <io.h>
|
||||
#else
|
||||
@@ -30,6 +46,10 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
|
||||
# define inline __inline
|
||||
#else
|
||||
# define inline __inline__
|
||||
# ifdef __MINGW32__
|
||||
// For when including Microsoft Windows header files.
|
||||
# define _inline inline
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Directories
|
||||
|
||||
@@ -4,6 +4,8 @@ bytesex.h Functions for endianness conversions.
|
||||
network.h Functions for initialising the network subsystem.
|
||||
network_bsd.c Network subsystem functions for BSD sockets.
|
||||
network_win.c Network subsystem functions for Winsock sockets.
|
||||
wspiapiwrap.{c,h} Hack to make sure <wspiapi.h> is #included in exactly
|
||||
one file.
|
||||
|
||||
In libs/network/netmanager/:
|
||||
ndesc.{c,h} Defines network descriptors.
|
||||
|
||||
@@ -2,6 +2,9 @@ uqm_SUBDIRS="connect netmanager socket"
|
||||
uqm_CFILES="netport.c"
|
||||
if [ -n "$uqm_USE_WINSOCK" ]; then
|
||||
uqm_CFILES="$uqm_CFILES network_win.c"
|
||||
if [ -n "$MACRO___MINGW32__" ]; then
|
||||
uqm_CFILES="$uqm_CFILES wspiapiwrap.c"
|
||||
fi
|
||||
else
|
||||
uqm_CFILES="$uqm_CFILES network_bsd.c"
|
||||
fi
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#ifdef USE_WINSOCK
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
# include <wspiapi.h>
|
||||
# include "../wspiapiwrap.h"
|
||||
#else
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
# ifdef USE_WINSOCK
|
||||
# include <wspiapi.h>
|
||||
# include "../wspiapiwrap.h"
|
||||
# endif
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -29,6 +29,7 @@ typedef enum {
|
||||
typedef struct ResolveState ResolveState;
|
||||
|
||||
#include "port.h"
|
||||
#include "../netport.h"
|
||||
|
||||
// For addrinfo.
|
||||
#ifdef USE_WINSOCK
|
||||
@@ -67,7 +68,7 @@ typedef void (*ResolveErrorCallback)(ResolveState *resolveState,
|
||||
#ifdef USE_WINSOCK
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
# include <wspiapi.h>
|
||||
# include "../wspiapiwrap.h"
|
||||
#else /* !defined(USE_WINSOCK) */
|
||||
# include <netdb.h>
|
||||
#endif /* !defined(USE_WINSOCK) */
|
||||
|
||||
@@ -26,6 +26,16 @@ int winsockErrorToErrno(int winsockError);
|
||||
int getWinsockErrno(void);
|
||||
# define EAI_SYSTEM 0x02000001
|
||||
// Any value will do that doesn't conflict with an existing value.
|
||||
|
||||
#ifdef __MINGW32__
|
||||
// MinGW does not have a working gai_strerror() yet.
|
||||
static inline const char *
|
||||
gai_strerror(int err) {
|
||||
(void) err;
|
||||
return "[gai_strerror() is not available on MinGW]";
|
||||
}
|
||||
#endif /* defined(__MINGW32__) */
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _NETPORT_H */
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#define PORT_WANT_ERRNO
|
||||
#include "port.h"
|
||||
#include "../netport.h"
|
||||
|
||||
#define SOCKET_INTERNAL
|
||||
#include "socket.h"
|
||||
|
||||
@@ -27,6 +27,7 @@ struct Socket {
|
||||
#endif /* SOCKET_INTERNAL */
|
||||
|
||||
typedef int socklen_t;
|
||||
struct sockaddr;
|
||||
|
||||
#endif /* _SOCKET_WIN_H */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user