* Use IPv6 header qcommon/wspiapi.h if it has been added by the end user

* Update README to explain the Windows XP requirement
This commit is contained in:
Tim Angus 2008-08-09 19:12:30 +00:00
parent 60eb261185
commit 7edcc7d16a
3 changed files with 60 additions and 49 deletions

View file

@ -423,14 +423,10 @@ ifeq ($(PLATFORM),mingw32)
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-DUSE_ICON -DUSE_ICON
# Require Windows XP or later # In the absence of wspiapi.h, require Windows XP or later
# ifeq ($(shell test -e $(CMDIR)/wspiapi.h; echo $$?),1)
# IPv6 support requires a header wspiapi.h to work on earlier versions of
# windows. There is no MinGW equivalent of this header so we're forced to
# require XP. In theory this restriction can be removed if this header is
# obtained separately from the platform SDK. The MSVC build does not have
# this limitation.
BASE_CFLAGS += -DWINVER=0x501 BASE_CFLAGS += -DWINVER=0x501
endif
ifeq ($(USE_OPENAL),1) ifeq ($(USE_OPENAL),1)
BASE_CFLAGS += -DUSE_OPENAL BASE_CFLAGS += -DUSE_OPENAL

8
README
View file

@ -433,6 +433,14 @@ PNG support
Restart GtkRadiant and PNG textures are now available. Restart GtkRadiant and PNG textures are now available.
Building with MinGW for pre Windows XP
IPv6 support requires a header named "wspiapi.h" to abstract away from
differences in earlier versions of Windows' IPv6 stack. There is no MinGW
equivalent of this header and the Microsoft version is obviously not
redistributable, so in its absence we're forced to require Windows XP.
However if this header is acquired separately and placed in the qcommon/
directory, this restriction is lifted.
------------------------------------------------------------- Contributing ----- ------------------------------------------------------------- Contributing -----

View file

@ -24,61 +24,68 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/qcommon.h" #include "../qcommon/qcommon.h"
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> # include <winsock2.h>
#include <ws2tcpip.h> # include <ws2tcpip.h>
#if WINVER < 0x501 # if WINVER < 0x501
#include <wspiapi.h> # ifdef __MINGW32__
#else // wspiapi.h isn't available on MinGW, so if it's
#include <ws2spi.h> // present it's because the end user has added it
#endif // and we should look for it in our tree
# include "wspiapi.h"
# else
# include <wspiapi.h>
# endif
# else
# include <ws2spi.h>
# endif
typedef int socklen_t; typedef int socklen_t;
#ifdef ADDRESS_FAMILY # ifdef ADDRESS_FAMILY
#define sa_family_t ADDRESS_FAMILY # define sa_family_t ADDRESS_FAMILY
#else # else
typedef unsigned short sa_family_t; typedef unsigned short sa_family_t;
#endif # endif
#define EAGAIN WSAEWOULDBLOCK # define EAGAIN WSAEWOULDBLOCK
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL # define EADDRNOTAVAIL WSAEADDRNOTAVAIL
#define EAFNOSUPPORT WSAEAFNOSUPPORT # define EAFNOSUPPORT WSAEAFNOSUPPORT
#define ECONNRESET WSAECONNRESET # define ECONNRESET WSAECONNRESET
#define socketError WSAGetLastError( ) # define socketError WSAGetLastError( )
static WSADATA winsockdata; static WSADATA winsockdata;
static qboolean winsockInitialized = qfalse; static qboolean winsockInitialized = qfalse;
#else #else
#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 # if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
// needed for socklen_t on OSX 10.2 // needed for socklen_t on OSX 10.2
# define _BSD_SOCKLEN_T_ # define _BSD_SOCKLEN_T_
#endif # endif
#include <arpa/inet.h> # include <arpa/inet.h>
#include <errno.h> # include <errno.h>
#include <netdb.h> # include <netdb.h>
#include <netinet/in.h> # include <netinet/in.h>
#include <sys/socket.h> # include <sys/socket.h>
#include <net/if.h> # include <net/if.h>
#include <sys/ioctl.h> # include <sys/ioctl.h>
#include <sys/types.h> # include <sys/types.h>
#include <sys/time.h> # include <sys/time.h>
#include <unistd.h> # include <unistd.h>
#if !defined(__sun) && !defined(__sgi) # if !defined(__sun) && !defined(__sgi)
#include <ifaddrs.h> # include <ifaddrs.h>
#endif # endif
#ifdef __sun # ifdef __sun
#include <sys/filio.h> # include <sys/filio.h>
#endif # endif
typedef int SOCKET; typedef int SOCKET;
#define INVALID_SOCKET -1 # define INVALID_SOCKET -1
#define SOCKET_ERROR -1 # define SOCKET_ERROR -1
#define closesocket close # define closesocket close
#define ioctlsocket ioctl # define ioctlsocket ioctl
#define socketError errno # define socketError errno
#endif #endif