* Move SDL library version check to sys_main.c as it's proving difficult to

make the Makefile check sufficiently portable
* Remove unnecessary GL PFN... casts from SDL_GL_GetProcAddress calls
* Replace OS X uname workaround with Solaris workaround, as I believe OS X
  uname now behaves the same as GNU name
This commit is contained in:
Tim Angus 2007-11-25 23:41:01 +00:00
parent 3f3e1a51a1
commit 6bd4bb16a0
3 changed files with 18 additions and 30 deletions

View file

@ -6,8 +6,8 @@
COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]') COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]')
ifeq ($(COMPILE_PLATFORM),darwin) ifeq ($(COMPILE_PLATFORM),sunos)
# Apple does some things a little differently... # Solaris uname and GNU uname differ
COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/i386/) COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/i386/)
else else
COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/i386/) COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/i386/)
@ -794,6 +794,9 @@ ifeq ($(USE_SVN),1)
BASE_CFLAGS += -DSVN_VERSION=\\\"$(SVN_VERSION)\\\" BASE_CFLAGS += -DSVN_VERSION=\\\"$(SVN_VERSION)\\\"
endif endif
# Require a minimum version of SDL
BASE_CFLAGS += -DMINSDL_MAJOR=1 -DMINSDL_MINOR=2 -DMINSDL_PATCH=7
ifeq ($(V),1) ifeq ($(V),1)
echo_cmd=@: echo_cmd=@:
Q= Q=
@ -866,7 +869,7 @@ release:
# Create the build directories, check libraries and print out # Create the build directories, check libraries and print out
# an informational message, then start building # an informational message, then start building
targets: makedirs libversioncheck targets: makedirs
@echo "" @echo ""
@echo "Building ioquake3 in $(B):" @echo "Building ioquake3 in $(B):"
@echo " PLATFORM: $(PLATFORM)" @echo " PLATFORM: $(PLATFORM)"
@ -1055,29 +1058,6 @@ $(Q3ASM): $(Q3ASMOBJ)
$(Q)$(CC) $(TOOLS_LDFLAGS) -o $@ $^ $(Q)$(CC) $(TOOLS_LDFLAGS) -o $@ $^
#############################################################################
# LIBRARY VERSION CHECKS
#############################################################################
MINSDL_MAJOR = 1
MINSDL_MINOR = 2
MINSDL_PATCH = 7
BASE_CFLAGS += -DMINSDL_MAJOR=$(MINSDL_MAJOR) \
-DMINSDL_MINOR=$(MINSDL_MINOR) \
-DMINSDL_PATCH=$(MINSDL_PATCH)
libversioncheck:
@/bin/echo -e "#include \"SDL_version.h\"\n" \
"#if SDL_VERSION_ATLEAST(" \
"$(MINSDL_MAJOR),$(MINSDL_MINOR),$(MINSDL_PATCH)" \
")\nMINSDL_PASSED\n#endif" | \
$(CC) $(BASE_CFLAGS) -E - | grep -q MINSDL_PASSED || \
( /bin/echo "SDL version" \
"$(MINSDL_MAJOR).$(MINSDL_MINOR).$(MINSDL_PATCH)" \
"or greater required" && exit 1 )
############################################################################# #############################################################################
# CLIENT/SERVER # CLIENT/SERVER
############################################################################# #############################################################################
@ -1924,6 +1904,6 @@ TOOLSOBJ_D_FILES=$(filter %.d,$(TOOLSOBJ:%.o=%.d))
-include $(OBJ_D_FILES) $(TOOLSOBJ_D_FILES) -include $(OBJ_D_FILES) $(TOOLSOBJ_D_FILES)
.PHONY: all clean clean2 clean-debug clean-release copyfiles \ .PHONY: all clean clean2 clean-debug clean-release copyfiles \
debug default dist distclean installer libversioncheck makedirs \ debug default dist distclean installer makedirs \
release targets \ release targets \
toolsclean toolsclean2 toolsclean-debug toolsclean-release toolsclean toolsclean2 toolsclean-debug toolsclean-release

View file

@ -396,9 +396,9 @@ static void GLimp_InitExtensions( void )
{ {
if ( r_ext_multitexture->value ) if ( r_ext_multitexture->value )
{ {
qglMultiTexCoord2fARB = ( PFNGLMULTITEXCOORD2FARBPROC ) SDL_GL_GetProcAddress( "glMultiTexCoord2fARB" ); qglMultiTexCoord2fARB = SDL_GL_GetProcAddress( "glMultiTexCoord2fARB" );
qglActiveTextureARB = ( PFNGLACTIVETEXTUREARBPROC ) SDL_GL_GetProcAddress( "glActiveTextureARB" ); qglActiveTextureARB = SDL_GL_GetProcAddress( "glActiveTextureARB" );
qglClientActiveTextureARB = ( PFNGLCLIENTACTIVETEXTUREARBPROC ) SDL_GL_GetProcAddress( "glClientActiveTextureARB" ); qglClientActiveTextureARB = SDL_GL_GetProcAddress( "glClientActiveTextureARB" );
if ( qglActiveTextureARB ) if ( qglActiveTextureARB )
{ {

View file

@ -587,6 +587,14 @@ int main( int argc, char **argv )
char commandLine[ MAX_STRING_CHARS ] = { 0 }; char commandLine[ MAX_STRING_CHARS ] = { 0 };
#ifndef DEDICATED #ifndef DEDICATED
// SDL version check
// Compile time
# if !SDL_VERSION_ATLEAST(MINSDL_MAJOR,MINSDL_MINOR,MINSDL_PATCH)
# error A more recent version of SDL is required
# endif
// Run time
const SDL_version *ver = SDL_Linked_Version( ); const SDL_version *ver = SDL_Linked_Version( );
#define STRING(s) #s #define STRING(s) #s