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:
@@ -41,5 +41,6 @@ uqm_USE_PLATFORM_ACCEL='@USE_PLATFORM_ACCEL@'
|
||||
uqm_NETPLAY='@NETPLAY@'
|
||||
DEBUG='@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_HAVE_OPENGL uqm_USE_ZIP_IO uqm_USE_PLATFORM_ACCEL uqm_NETPLAY
|
||||
|
||||
@@ -48,6 +48,12 @@ uqm_requirements()
|
||||
# Add defines for HAVE_GETOPT_LONG and HAVE_REGEX_H
|
||||
define_have_symbol getopt_long
|
||||
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()
|
||||
|
||||
@@ -538,7 +538,7 @@ EOF
|
||||
}
|
||||
|
||||
# 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.
|
||||
# Arguments: $1 - the name of the symbol
|
||||
define_have_symbol() {
|
||||
@@ -600,9 +600,9 @@ EOF
|
||||
}
|
||||
|
||||
# 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".
|
||||
# Arguments: $1 - the name of the symbol
|
||||
# Arguments: $1 - the name of the header file
|
||||
define_have_header() {
|
||||
local NAME VALUE
|
||||
NAME=`$TR /.[:lower:] __[:upper:] << EOF
|
||||
@@ -618,6 +618,48 @@ EOF
|
||||
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
|
||||
# $HAVE_SYMBOLS will contain the variable names of all
|
||||
# symbols added by define_have_symbol and should be passed to
|
||||
|
||||
+5
-1
@@ -128,9 +128,13 @@ typedef unsigned short wchar_t;
|
||||
typedef unsigned int wint_t;
|
||||
#endif
|
||||
|
||||
#if defined (_MSC_VER) || defined(__MINGW32__)
|
||||
# define USE_WINSOCK
|
||||
#endif
|
||||
|
||||
// errno error numbers. The values used don't matter, as long as they
|
||||
// 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>
|
||||
# ifndef E2BIG
|
||||
# define E2BIG 0x01000001
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef _MSC_VER
|
||||
#ifdef USE_WINSOCK
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
# include <wspiapi.h>
|
||||
|
||||
@@ -32,14 +32,14 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#ifdef _MSC_VER
|
||||
#ifdef USE_WINSOCK
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
#else
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
# ifdef _MSC_VER
|
||||
# ifdef USE_WINSOCK
|
||||
# include <wspiapi.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,9 @@ typedef enum {
|
||||
typedef struct ListenError ListenError;
|
||||
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
|
||||
// code that includes this file.
|
||||
// Note that listen.c itself includes winsock2.h; SOCKLEN_T is used there
|
||||
|
||||
@@ -28,9 +28,10 @@ typedef enum {
|
||||
} ResolveStateState;
|
||||
typedef struct ResolveState ResolveState;
|
||||
|
||||
#include "port.h"
|
||||
|
||||
// For addrinfo.
|
||||
#ifdef _MSC_VER
|
||||
#ifdef USE_WINSOCK
|
||||
// Not including <winsock2.h> because of possible conflicts with files
|
||||
// including this file.
|
||||
struct addrinfo;
|
||||
@@ -63,13 +64,13 @@ typedef void (*ResolveErrorCallback)(ResolveState *resolveState,
|
||||
const ResolveError *error);
|
||||
|
||||
#ifdef RESOLVE_INTERNAL
|
||||
#ifdef _MSC_VER
|
||||
#ifdef USE_WINSOCK
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
# include <wspiapi.h>
|
||||
#else /* !defined(_MSC_VER) */
|
||||
#else /* !defined(USE_WINSOCK) */
|
||||
# include <netdb.h>
|
||||
#endif /* !defined(_MSC_VER) */
|
||||
#endif /* !defined(USE_WINSOCK) */
|
||||
|
||||
struct ResolveState {
|
||||
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
|
||||
#define _NETMANAGER_H
|
||||
|
||||
#include "port.h"
|
||||
#include "types.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef USE_WINSOCK
|
||||
# include "netmanager_win.h"
|
||||
#else
|
||||
# include "netmanager_bsd.h"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "port.h"
|
||||
#include "netport.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef USE_WINSOCK
|
||||
# include <winsock2.h>
|
||||
|
||||
int
|
||||
@@ -87,5 +87,5 @@ int
|
||||
getWinsockErrno(void) {
|
||||
return winsockErrorToErrno(WSAGetLastError());
|
||||
}
|
||||
#endif /* defined (_MSC_VER) */
|
||||
#endif /* defined (USE_WINSOCK) */
|
||||
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
#ifndef _NETPORT_H
|
||||
#define _NETPORT_H
|
||||
|
||||
#if defined (_MSC_VER)
|
||||
#include "port.h"
|
||||
|
||||
#if defined (USE_WINSOCK)
|
||||
int winsockErrorToErrno(int winsockError);
|
||||
int getWinsockErrno(void);
|
||||
# define EAI_SYSTEM 0x02000001
|
||||
|
||||
@@ -16,10 +16,12 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "port.h"
|
||||
|
||||
#define SOCKET_INTERNAL
|
||||
#include "socket.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef USE_WINSOCK
|
||||
# include <winsock2.h>
|
||||
#else
|
||||
# include <sys/socket.h>
|
||||
|
||||
@@ -24,7 +24,7 @@ typedef struct Socket Socket;
|
||||
|
||||
#include "port.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef USE_WINSOCK
|
||||
# include "socket_win.h"
|
||||
#else
|
||||
# include "socket_bsd.h"
|
||||
|
||||
Reference in New Issue
Block a user