Some improvements towards successful build with netplay on MinGW.

Proabaly not completely there yet.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2464 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2006-10-27 01:20:13 +00:00
parent 620c00c52c
commit c243c3a73f
15 changed files with 92 additions and 20 deletions
+1
View File
@@ -41,5 +41,6 @@ uqm_USE_PLATFORM_ACCEL='@USE_PLATFORM_ACCEL@'
uqm_NETPLAY='@NETPLAY@' uqm_NETPLAY='@NETPLAY@'
DEBUG='@DEBUG@' DEBUG='@DEBUG@'
export BUILD_SYSTEM HOST_SYSTEM DEBUG export BUILD_SYSTEM HOST_SYSTEM DEBUG
export MACRO_WIN32 MACRO__MCS_VER MACRO___MINGW32__
export uqm_SOUNDMODULE uqm_USE_INTERNAL_MIKMOD uqm_HAVE_REGEX export uqm_SOUNDMODULE uqm_USE_INTERNAL_MIKMOD uqm_HAVE_REGEX
export uqm_HAVE_OPENGL uqm_USE_ZIP_IO uqm_USE_PLATFORM_ACCEL uqm_NETPLAY export uqm_HAVE_OPENGL uqm_USE_ZIP_IO uqm_USE_PLATFORM_ACCEL uqm_NETPLAY
+6
View File
@@ -48,6 +48,12 @@ uqm_requirements()
# Add defines for HAVE_GETOPT_LONG and HAVE_REGEX_H # Add defines for HAVE_GETOPT_LONG and HAVE_REGEX_H
define_have_symbol getopt_long define_have_symbol getopt_long
define_have_header regex.h define_have_header regex.h
# Add an environment variable for MACRO_WIN32, MACRO__MCS_VER, and
# MACRO___MINGW32__
define_have_macro WIN32
define_have_macro _MCS_VER
define_have_macro __MINGW32__
} }
uqm_prepare_config() uqm_prepare_config()
+45 -3
View File
@@ -538,7 +538,7 @@ EOF
} }
# Description: check if a symbol is defined. # Description: check if a symbol is defined.
# set HAVE_<NAME> accordingly, where <NAME> is the capitalized # sets HAVE_<NAME> accordingly, where <NAME> is the capitalized
# name of the symbol. # name of the symbol.
# Arguments: $1 - the name of the symbol # Arguments: $1 - the name of the symbol
define_have_symbol() { define_have_symbol() {
@@ -600,9 +600,9 @@ EOF
} }
# Description: check if a header is available. # Description: check if a header is available.
# set HAVE_<NAME> accordingly, where <NAME> is the capitalized # sets HAVE_<NAME> accordingly, where <NAME> is the capitalized
# name of the header file. "sys/time.h" becomes "SYS_TIME_H". # name of the header file. "sys/time.h" becomes "SYS_TIME_H".
# Arguments: $1 - the name of the symbol # Arguments: $1 - the name of the header file
define_have_header() { define_have_header() {
local NAME VALUE local NAME VALUE
NAME=`$TR /.[:lower:] __[:upper:] << EOF NAME=`$TR /.[:lower:] __[:upper:] << EOF
@@ -618,6 +618,48 @@ EOF
fi fi
} }
# Description: check if a macro is available.
# Arguments: $1 - the name of the macro
have_macro() {
local MACRO EXTRA
MACRO="$1"
EXTRA=`evalVar MACRO_${NAME}_EXTRA`
try_compile_c "$TEMP_CFLAGS" "$TEMP_LDFLAGS" << EOF > /dev/null 2>&1
$EXTRA
#ifndef $MACRO
# error
#endif
int main() {
return 0;
}
EOF
if [ $? -gt 0 ]; then
build_message "Preprocessor macro '$MACRO' not found."
return 1
fi
build_message "Preprocessor macro '$MACRO' found."
return 0
}
# Description: check if a macro is defined
# sets MACRO_<NAME> to a non-empty string if the macro with
# the specified name is defined, and to an empty string if it
# is not.
# Arguments: $1 - the name of the symbol
define_have_macro() {
local NAME
NAME=$1
if have_macro "$1"; then
add_symbol "MACRO_$NAME" "1"
else
add_symbol "MACRO_$NAME" ""
fi
}
# Description: Add a symbol to be replaced by substitute_vars # Description: Add a symbol to be replaced by substitute_vars
# $HAVE_SYMBOLS will contain the variable names of all # $HAVE_SYMBOLS will contain the variable names of all
# symbols added by define_have_symbol and should be passed to # symbols added by define_have_symbol and should be passed to
+5 -1
View File
@@ -128,9 +128,13 @@ typedef unsigned short wchar_t;
typedef unsigned int wint_t; typedef unsigned int wint_t;
#endif #endif
#if defined (_MSC_VER) || defined(__MINGW32__)
# define USE_WINSOCK
#endif
// errno error numbers. The values used don't matter, as long as they // errno error numbers. The values used don't matter, as long as they
// don't conflict with existing errno error numbers. // don't conflict with existing errno error numbers.
#if defined (PORT_WANT_ERRNO) && defined (_MSC_VER) #if defined (PORT_WANT_ERRNO) && defined (USE_WINSOCK)
# include <errno.h> # include <errno.h>
# ifndef E2BIG # ifndef E2BIG
# define E2BIG 0x01000001 # define E2BIG 0x01000001
+6 -1
View File
@@ -1,3 +1,8 @@
uqm_SUBDIRS="connect netmanager socket" uqm_SUBDIRS="connect netmanager socket"
uqm_CFILES="netport.c network_bsd.c" uqm_CFILES="netport.c"
if [ -n "$MACRO___MINGW32__" ]; then
uqm_CFILES="$uqm_CFILES network_win.c"
else
uqm_CFILES="$uqm_CFILES network_bsd.c"
fi
@@ -33,7 +33,7 @@
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef _MSC_VER #ifdef USE_WINSOCK
# include <winsock2.h> # include <winsock2.h>
# include <ws2tcpip.h> # include <ws2tcpip.h>
# include <wspiapi.h> # include <wspiapi.h>
@@ -32,14 +32,14 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#ifdef _MSC_VER #ifdef USE_WINSOCK
# include <winsock2.h> # include <winsock2.h>
# include <ws2tcpip.h> # include <ws2tcpip.h>
#else #else
# include <netdb.h> # include <netdb.h>
#endif #endif
#ifdef DEBUG #ifdef DEBUG
# ifdef _MSC_VER # ifdef USE_WINSOCK
# include <wspiapi.h> # include <wspiapi.h>
# endif # endif
#endif #endif
@@ -28,7 +28,9 @@ typedef enum {
typedef struct ListenError ListenError; typedef struct ListenError ListenError;
typedef struct ListenState ListenState; typedef struct ListenState ListenState;
#ifdef _MSC_VER #include "port.h"
#ifdef USE_WINSOCK
// I do not want to include winsock2.h, because of possible conflicts with // I do not want to include winsock2.h, because of possible conflicts with
// code that includes this file. // code that includes this file.
// Note that listen.c itself includes winsock2.h; SOCKLEN_T is used there // Note that listen.c itself includes winsock2.h; SOCKLEN_T is used there
@@ -28,9 +28,10 @@ typedef enum {
} ResolveStateState; } ResolveStateState;
typedef struct ResolveState ResolveState; typedef struct ResolveState ResolveState;
#include "port.h"
// For addrinfo. // For addrinfo.
#ifdef _MSC_VER #ifdef USE_WINSOCK
// Not including <winsock2.h> because of possible conflicts with files // Not including <winsock2.h> because of possible conflicts with files
// including this file. // including this file.
struct addrinfo; struct addrinfo;
@@ -63,13 +64,13 @@ typedef void (*ResolveErrorCallback)(ResolveState *resolveState,
const ResolveError *error); const ResolveError *error);
#ifdef RESOLVE_INTERNAL #ifdef RESOLVE_INTERNAL
#ifdef _MSC_VER #ifdef USE_WINSOCK
# include <winsock2.h> # include <winsock2.h>
# include <ws2tcpip.h> # include <ws2tcpip.h>
# include <wspiapi.h> # include <wspiapi.h>
#else /* !defined(_MSC_VER) */ #else /* !defined(USE_WINSOCK) */
# include <netdb.h> # include <netdb.h>
#endif /* !defined(_MSC_VER) */ #endif /* !defined(USE_WINSOCK) */
struct ResolveState { struct ResolveState {
RefCount refCount; RefCount refCount;
@@ -1,2 +1,8 @@
uqm_CFILES="ndesc.c netmanager_bsd.c" uqm_CFILES="ndesc.c"
if [ -n "$MACRO___MINGW32__" ]; then
uqm_CFILES="$uqm_CFILES netmanager_win.c"
else
uqm_CFILES="$uqm_CFILES netmanager_bsd.c"
fi
@@ -19,9 +19,10 @@
#ifndef _NETMANAGER_H #ifndef _NETMANAGER_H
#define _NETMANAGER_H #define _NETMANAGER_H
#include "port.h"
#include "types.h" #include "types.h"
#ifdef WIN32 #ifdef USE_WINSOCK
# include "netmanager_win.h" # include "netmanager_win.h"
#else #else
# include "netmanager_bsd.h" # include "netmanager_bsd.h"
+2 -2
View File
@@ -20,7 +20,7 @@
#include "port.h" #include "port.h"
#include "netport.h" #include "netport.h"
#ifdef _MSC_VER #ifdef USE_WINSOCK
# include <winsock2.h> # include <winsock2.h>
int int
@@ -87,5 +87,5 @@ int
getWinsockErrno(void) { getWinsockErrno(void) {
return winsockErrorToErrno(WSAGetLastError()); return winsockErrorToErrno(WSAGetLastError());
} }
#endif /* defined (_MSC_VER) */ #endif /* defined (USE_WINSOCK) */
+3 -1
View File
@@ -19,7 +19,9 @@
#ifndef _NETPORT_H #ifndef _NETPORT_H
#define _NETPORT_H #define _NETPORT_H
#if defined (_MSC_VER) #include "port.h"
#if defined (USE_WINSOCK)
int winsockErrorToErrno(int winsockError); int winsockErrorToErrno(int winsockError);
int getWinsockErrno(void); int getWinsockErrno(void);
# define EAI_SYSTEM 0x02000001 # define EAI_SYSTEM 0x02000001
+3 -1
View File
@@ -16,10 +16,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "port.h"
#define SOCKET_INTERNAL #define SOCKET_INTERNAL
#include "socket.h" #include "socket.h"
#ifdef _MSC_VER #ifdef USE_WINSOCK
# include <winsock2.h> # include <winsock2.h>
#else #else
# include <sys/socket.h> # include <sys/socket.h>
+1 -1
View File
@@ -24,7 +24,7 @@ typedef struct Socket Socket;
#include "port.h" #include "port.h"
#ifdef WIN32 #ifdef USE_WINSOCK
# include "socket_win.h" # include "socket_win.h"
#else #else
# include "socket_bsd.h" # include "socket_bsd.h"