r1168 - in trunk: . code/qcommon code/sdl code/sys

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Sep 6 14:21:10 EDT 2007


Author: tma
Date: 2007-09-06 14:21:10 -0400 (Thu, 06 Sep 2007)
New Revision: 1168

Modified:
   trunk/Makefile
   trunk/code/qcommon/q_shared.h
   trunk/code/sdl/sdl_glimp.c
   trunk/code/sys/sys_main.c
Log:
* Compile time and runtime checks for SDL >= 1.2.7
* Modified versioning to play nice with the reverted Makefile change


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2007-09-06 08:26:11 UTC (rev 1167)
+++ trunk/Makefile	2007-09-06 18:21:10 UTC (rev 1168)
@@ -1,13 +1,6 @@
 #
-# Quake3 Unix Makefile
+# ioq3 Makefile
 #
-# Nov '98 by Zoid <zoid at idsoftware.com>
-#
-# Loki Hacking by Bernd Kreimeier
-#  and a little more by Ryan C. Gordon.
-#  and a little more by Rafael Barrero
-#  and a little more by the ioq3 cr3w
-#
 # GNU Make required
 #
 
@@ -144,8 +137,8 @@
 LIBSDIR=$(MOUNT_DIR)/libs
 
 # extract version info
-VERSION=$(shell grep "\#define Q3_VERSION" $(CMDIR)/q_shared.h | \
-  sed -e 's/.*".* \([^ ]*\)"/\1/')
+VERSION=$(shell grep "\#define *PRODUCT_VERSION" $(CMDIR)/q_shared.h | \
+  sed -e 's/[^"]*"\(.*\)"/\1/')
 
 USE_SVN=
 ifeq ($(wildcard .svn),.svn)
@@ -738,7 +731,7 @@
 Q=@
 endif
 
-define DO_CC       
+define DO_CC
 $(echo_cmd) "CC $<"
 $(Q)$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -o $@ -c $<
 endef
@@ -800,7 +793,7 @@
 
 # Create the build directories and tools, print out
 # an informational message, then start building
-targets: makedirs tools
+targets: makedirs tools libversioncheck
 	@echo ""
 	@echo "Building ioquake3 in $(B):"
 	@echo "  PLATFORM: $(PLATFORM)"
@@ -870,6 +863,28 @@
 
 
 #############################################################################
+# 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:
+	@echo "#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 || \
+		( echo "SDL version $(MINSDL_MAJOR).$(MINSDL_MINOR).$(MINSDL_PATCH)" \
+		"or greater required" && exit 1 )
+
+
+#############################################################################
 # CLIENT/SERVER
 #############################################################################
 

Modified: trunk/code/qcommon/q_shared.h
===================================================================
--- trunk/code/qcommon/q_shared.h	2007-09-06 08:26:11 UTC (rev 1167)
+++ trunk/code/qcommon/q_shared.h	2007-09-06 18:21:10 UTC (rev 1168)
@@ -26,11 +26,13 @@
 // q_shared.h -- included first by ALL program modules.
 // A user mod should never modify this file
 
-#define Q3_VERSION_BASE         "ioq3 1.35"
+#define PRODUCT_NAME            "ioq3"
+#define PRODUCT_VERSION         "1.35"
+
 #ifdef SVN_VERSION
-# define Q3_VERSION Q3_VERSION_BASE "_SVN" SVN_VERSION
+# define Q3_VERSION PRODUCT_NAME " " SVN_VERSION
 #else
-# define Q3_VERSION Q3_VERSION_BASE
+# define Q3_VERSION PRODUCT_NAME " " PRODUCT_VERSION
 #endif
 
 #define CLIENT_WINDOW_TITLE     "ioquake3"

Modified: trunk/code/sdl/sdl_glimp.c
===================================================================
--- trunk/code/sdl/sdl_glimp.c	2007-09-06 08:26:11 UTC (rev 1167)
+++ trunk/code/sdl/sdl_glimp.c	2007-09-06 18:21:10 UTC (rev 1168)
@@ -22,6 +22,13 @@
 
 #include "SDL.h"
 
+#if !SDL_VERSION_ATLEAST(1, 2, 10)
+#define SDL_GL_ACCELERATED_VISUAL 15
+#define SDL_GL_SWAP_CONTROL 16
+#elif MINSDL_PATCH >= 10
+#error Code block no longer necessary, please remove
+#endif
+
 #ifdef SMP
 #include "SDL_thread.h"
 #endif

Modified: trunk/code/sys/sys_main.c
===================================================================
--- trunk/code/sys/sys_main.c	2007-09-06 08:26:11 UTC (rev 1167)
+++ trunk/code/sys/sys_main.c	2007-09-06 18:21:10 UTC (rev 1168)
@@ -35,6 +35,7 @@
 
 #ifndef DEDICATED
 #include "SDL.h"
+#include "SDL_cpuinfo.h"
 #endif
 
 #include "sys_local.h"
@@ -604,6 +605,24 @@
 	int   i;
 	char  commandLine[ MAX_STRING_CHARS ] = { 0 };
 
+#ifndef DEDICATED
+  const SDL_version *ver = SDL_Linked_Version( );
+
+#define STRING(s) #s
+#define XSTRING(s) STRING(s)
+#define MINSDL_VERSION \
+  XSTRING(MINSDL_MAJOR) "." \
+  XSTRING(MINSDL_MINOR) "." \
+  XSTRING(MINSDL_PATCH)
+
+  if( SDL_VERSIONNUM( ver->major, ver->minor, ver->patch ) <
+      SDL_VERSIONNUM( MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH ) )
+  {
+    Sys_Print( "SDL version " MINSDL_VERSION " or greater required\n" );
+    Sys_Exit( 1 );
+  }
+#endif
+
 	Sys_ParseArgs( argc, argv );
 	Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) );
 	Sys_SetDefaultInstallPath( DEFAULT_BASEDIR );




More information about the quake3-commits mailing list