r199 - in trunk/code: qcommon renderer tools/asm tools/lcc tools/lcc/etc unix

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Oct 29 18:05:21 EDT 2005


Author: tma
Date: 2005-10-29 18:05:20 -0400 (Sat, 29 Oct 2005)
New Revision: 199

Modified:
   trunk/code/qcommon/common.c
   trunk/code/qcommon/q_shared.h
   trunk/code/renderer/qgl.h
   trunk/code/tools/asm/Makefile
   trunk/code/tools/lcc/etc/gcc-solaris.c
   trunk/code/tools/lcc/etc/lcc.c
   trunk/code/tools/lcc/makefile
   trunk/code/unix/Makefile
   trunk/code/unix/linux_glimp.c
   trunk/code/unix/linux_joystick.c
   trunk/code/unix/linux_snd.c
   trunk/code/unix/sdl_glimp.c
   trunk/code/unix/sdl_snd.c
   trunk/code/unix/unix_glw.h
   trunk/code/unix/unix_main.c
   trunk/code/unix/unix_net.c
   trunk/code/unix/unix_shared.c
Log:
* Beginnings of Solaris support from Vincent S. Cojot
* Note this patch also splits USE_SDL into USE_SDL_VIDEO and USE_SDL_AUDIO


Modified: trunk/code/qcommon/common.c
===================================================================
--- trunk/code/qcommon/common.c	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/qcommon/common.c	2005-10-29 22:05:20 UTC (rev 199)
@@ -24,7 +24,7 @@
 #include "q_shared.h"
 #include "qcommon.h"
 #include <setjmp.h>
-#if defined __linux__ || defined MACOS_X || defined __FreeBSD__
+#if defined __linux__ || defined MACOS_X || defined __FreeBSD__ || defined __sun
 #include <netinet/in.h>
 #else
 #include <winsock.h>

Modified: trunk/code/qcommon/q_shared.h
===================================================================
--- trunk/code/qcommon/q_shared.h	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/qcommon/q_shared.h	2005-10-29 22:05:20 UTC (rev 199)
@@ -105,7 +105,7 @@
 
 
 // this is the define for determining if we have an asm version of a C function
-#if (defined _M_IX86 || defined __i386__) && !defined __sun__  && !defined __LCC__
+#if (defined _M_IX86 || defined __i386__) && !defined __sun  && !defined __LCC__
 #define id386	1
 #else
 #define id386	0
@@ -355,6 +355,52 @@
 
 #endif
 
+//======================= SUNOS DEFINES =================================
+
+#ifdef __sun
+
+#include <sys/isa_defs.h>
+
+// bk001205 - from Makefile
+#define stricmp strcasecmp
+
+#define MAC_STATIC
+#define ID_INLINE inline 
+
+#ifdef __i386__
+#define	CPUSTRING	"Solaris-i386"
+#elif defined __sparc
+#define	CPUSTRING	"Solaris-sparc"
+#endif
+
+#define	PATH_SEP '/'
+
+// bk001205 - try
+#ifdef Q3_STATIC
+#define	GAME_HARD_LINKED
+#define	CGAME_HARD_LINKED
+#define	UI_HARD_LINKED
+#define	BOTLIB_HARD_LINKED
+#endif
+
+#if defined(_LITTLE_ENDIAN)
+inline static short BigShort( short l) { return ShortSwap(l); }
+#define LittleShort
+inline static int BigLong(int l) { return LongSwap(l); }
+#define LittleLong
+inline static float BigFloat(const float l) { return FloatSwap(&l); }
+#define LittleFloat
+#else /* Must be _BIG_ENDIAN */
+#define BigShort
+inline static short LittleShort(short l) { return ShortSwap(l); }
+#define BigLong
+inline static int LittleLong (int l) { return LongSwap(l); }
+#define BigFloat
+inline static float LittleFloat (const float l) { return FloatSwap(&l); }
+#endif
+
+#endif
+
 //=============================================================
 
 typedef unsigned char 		byte;

Modified: trunk/code/renderer/qgl.h
===================================================================
--- trunk/code/renderer/qgl.h	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/renderer/qgl.h	2005-10-29 22:05:20 UTC (rev 199)
@@ -57,6 +57,10 @@
 #include <GL/fxmesa.h>
 #endif
 
+#elif defined( __sun )
+#include <GL/gl.h>
+#include <GL/glx.h>
+
 #else
 
 #include <gl.h>
@@ -76,6 +80,7 @@
 /*
 ** multitexture extension definitions
 */
+#if !defined(__sun)
 #define GL_ACTIVE_TEXTURE_ARB               0x84E0
 #define GL_CLIENT_ACTIVE_TEXTURE_ARB        0x84E1
 #define GL_MAX_ACTIVE_TEXTURES_ARB          0x84E2
@@ -84,9 +89,12 @@
 #define GL_TEXTURE1_ARB                     0x84C1
 #define GL_TEXTURE2_ARB                     0x84C2
 #define GL_TEXTURE3_ARB                     0x84C3
+#else
+#define GL_MAX_ACTIVE_TEXTURES_ARB          0x84E2
+#endif /* defined(__sun) */
 
 // NOTE: some Linux platforms would need those prototypes
-#if defined(MACOS_X)
+#if defined(MACOS_X) || defined(__sun)
 typedef void (APIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
 typedef void (APIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
 typedef void (APIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
@@ -152,7 +160,7 @@
 //===========================================================================
 
 // non-windows systems will just redefine qgl* to gl*
-#if !defined( _WIN32 ) && !defined(MACOS_X) && !defined( __linux__ ) && !defined( __FreeBSD__ ) // rb010123
+#if !defined( _WIN32 ) && !defined(MACOS_X) && !defined( __linux__ ) && !defined( __FreeBSD__ ) && !defined(__sun) // rb010123
 
 #include "qgl_linked.h"
 
@@ -539,7 +547,7 @@
 
 #endif	// _WIN32
 
-#if ( (defined __linux__ )  || (defined __FreeBSD__ ) ) // rb010123
+#if ( (defined __linux__ )  || (defined __FreeBSD__ ) || (defined __sun) ) // rb010123
 
 //FX Mesa Functions
 // bk001129 - from cvs1.17 (mkv)
@@ -560,7 +568,7 @@
 extern void (*qglXCopyContext)( Display *dpy, GLXContext src, GLXContext dst, GLuint mask );
 extern void (*qglXSwapBuffers)( Display *dpy, GLXDrawable drawable );
 
-#endif // __linux__ || __FreeBSD__ // rb010123
+#endif // __linux__ || __FreeBSD__ || __sun // rb010123
 
 #endif	// _WIN32 && __linux__
 

Modified: trunk/code/tools/asm/Makefile
===================================================================
--- trunk/code/tools/asm/Makefile	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/tools/asm/Makefile	2005-10-29 22:05:20 UTC (rev 199)
@@ -7,6 +7,12 @@
   BINEXT=
 endif
 
+ifeq ($(PLATFORM),SunOS)
+  INSTALL=ginstall
+else
+  INSTALL=install
+endif
+
 CC=gcc
 Q3ASM_CFLAGS=-O2 -Wall -Werror -fno-strict-aliasing
 
@@ -19,7 +25,7 @@
 	rm -f q3asm *~ *.o
 
 install: default
-	install -s -m 0755 q3asm$(BINEXT) ../
+	$(INSTALL) -s -m 0755 q3asm$(BINEXT) ../
 
 uninstall:
 	rm -f ../q3asm$(BINEXT)

Modified: trunk/code/tools/lcc/etc/gcc-solaris.c
===================================================================
--- trunk/code/tools/lcc/etc/gcc-solaris.c	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/tools/lcc/etc/gcc-solaris.c	2005-10-29 22:05:20 UTC (rev 199)
@@ -1,48 +1,55 @@
-/* SPARCs running Solaris 2.5.1 w/GCC tools
-   at CS Dept., Princeton University */
+/* Solaris 10 sparc */
 
 #include <string.h>
 
+/*
+TTimo - 10-18-2001
+our binaries are named q3lcc q3rcc and q3cpp
+removed hardcoded paths
+removed __linux__ preprocessor define (confuses the preprocessor, we are doing bytecode!)
+*/
 
+
 #ifndef LCCDIR
-#define LCCDIR "/usr/local/lib/lcc/"
+#define LCCDIR ""
 #endif
 #ifndef GCCDIR
-#define GCCDIR "/usr/local/gnu/bin/"
+#define GCCDIR "/usr/sfw/bin/"
 #endif
 #ifndef GCCLIB
-#define GCCLIB "/usr/local/gnu/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/"
+#define GCCLIB "/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/"
 #endif
+#define BINEXT ""
 
-char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
+char *suffixes[] = { ".c", ".i", ".asm", ".s", ".o", ".out", 0 };
 char inputs[256] = "";
-char *cpp[] = { LCCDIR "cpp",
-	"-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix",
+char *cpp[] = { LCCDIR "q3cpp" BINEXT,
+	"-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix", "-D__sun",
 	"$1", "$2", "$3", 0 };
-char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
-	"-I" GCCLIB "include", "-I/usr/include", 0 };
-char *com[] = { LCCDIR "rcc", "-target=sparc/solaris",
-	"$1", "$2", "$3", 0 };
-char *as[] = { GCCDIR "as", "-f", "-o", "$3", "$1", "$2", 0 };
-char *ld[] = { GCCDIR "ld", "-o", "$3", "$1",
-	GCCLIB "crti.o", GCCLIB "crt1.o",
-	GCCLIB "crtbegin.o", "$2", "", "", "-L" LCCDIR, "-llcc",
-	"-L" GCCLIB, "-lgcc", "-lm", "-lc", "",
-	GCCLIB "crtend.o", GCCLIB "crtn.o", 0 };
+char *include[] = { "-I" LCCDIR "include", "-I" LCCDIR "gcc/include",
+	"-I" SYSTEM "include", "-I/usr/include", 0 };
+/* char *com[] = { LCCDIR "q3rcc", "-target=bytecode", "$1", "$2", "$3", 0 }; */
+char *com[] = { LCCDIR "q3rcc", "-target=sparc/solaris", "$1", "$2", "$3", 0 };
+char *as[] = { "/usr/ccs/bin/as", "-o", "$3", "$1", "$2", 0 };
+char *ld[] = { "/usr/ccs/bin/ld", "-o", "$3", "$1",
+        GCCLIB "crti.o", GCCLIB "crt1.o",
+        GCCLIB "crtbegin.o", "$2", "", "", "-L" LCCDIR, "-llcc",
+        "-L" GCCLIB, "-lgcc", "-lm", "-lc", "",
+        GCCLIB "crtend.o", GCCLIB "crtn.o", 0 };
 
 extern char *concat(char *, char *);
 
 int option(char *arg) {
 	if (strncmp(arg, "-lccdir=", 8) == 0) {
-		cpp[0] = concat(&arg[8], "/cpp");
+		cpp[0] = concat(&arg[8], "/gcc/cpp");
 		include[0] = concat("-I", concat(&arg[8], "/include"));
 		ld[10] = concat("-L", &arg[8]);
 		com[0] = concat(&arg[8], "/rcc");
+	} else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) {
+		ld[8] = "-lgmon";
 	} else if (strcmp(arg, "-g") == 0)
 		;
-	else if (strcmp(arg, "-pg") == 0) {
-		ld[8] = GCCLIB "gmon.o";
-	} else if (strcmp(arg, "-b") == 0)
+	else if (strcmp(arg, "-b") == 0)
 		;
 	else
 		return 0;

Modified: trunk/code/tools/lcc/etc/lcc.c
===================================================================
--- trunk/code/tools/lcc/etc/lcc.c	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/tools/lcc/etc/lcc.c	2005-10-29 22:05:20 UTC (rev 199)
@@ -48,7 +48,9 @@
 extern int suffix(char *, char *[], int);
 extern char *tempname(char *);
 
+#ifndef __sun
 extern int getpid(void);
+#endif
 
 extern char *cpp[], *include[], *com[], *as[],*ld[], inputs[], *suffixes[];
 extern int option(char *);
@@ -95,15 +97,14 @@
 	if( p )
 	{
 		*p = '\0';
+#ifdef _WIN32
 		strncpy( path, "PATH=", 4096 );
-		strncat( path, getenv( "PATH" ), 4096 );
-#ifdef _WIN32
 		strncat( path, ";", 4096 );
 		strncat( path, basepath, 4096 );
 		_putenv( path );
 #else
-		strncat( path, ":", 4096 );
-		strncat( path, basepath, 4096 );
+/* Ugly workaround against execvp problem/limitation on Solaris 10 */
+		snprintf( path, 4096, "PATH=%s:%s", basepath, getenv( "PATH" ) );
 		putenv( path );
 #endif
 	}
@@ -252,7 +253,9 @@
 #include <process.h>
 #else
 #define _P_WAIT 0
+#ifndef __sun
 extern int fork(void);
+#endif
 extern int wait(int *);
 
 static int _spawnvp(int mode, const char *cmdname, char *argv[]) {

Modified: trunk/code/tools/lcc/makefile
===================================================================
--- trunk/code/tools/lcc/makefile	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/tools/lcc/makefile	2005-10-29 22:05:20 UTC (rev 199)
@@ -25,6 +25,12 @@
 TSTDIR=$(BUILDDIR)/$(TARGET)/tst
 BD=$(BUILDDIR)/
 T=$(TSTDIR)/
+ifeq ($(PLATFORM),SunOS)
+  INSTALL=ginstall
+HOSTFILE=etc/gcc-solaris.c
+else
+  INSTALL=install
+endif
 
 # $Id: makefile 145 2001-10-17 21:53:10Z timo $
 
@@ -237,9 +243,9 @@
 	$(RM) $(T)yacc$(E) $(T)yacc.s $(T)yacc.2 $(T)yacc.1
 
 install::	all
-	install -s -m 0755 $(BD)q3lcc$(E) ../
-	install -s -m 0755 $(BD)q3cpp$(E) ../
-	install -s -m 0755 $(BD)q3rcc$(E) ../
+	$(INSTALL) -s -m 0755 $(BD)q3lcc$(E) ../
+	$(INSTALL) -s -m 0755 $(BD)q3cpp$(E) ../
+	$(INSTALL) -s -m 0755 $(BD)q3rcc$(E) ../
 
 uninstall::
 	-$(RM) ../q3lcc$(E)

Modified: trunk/code/unix/Makefile
===================================================================
--- trunk/code/unix/Makefile	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/unix/Makefile	2005-10-29 22:05:20 UTC (rev 199)
@@ -49,6 +49,10 @@
 DXSDK_DIR=C:/DXSDK
 endif
 
+ifndef USE_SDL
+USE_SDL=true
+endif
+
 #############################################################################
 
 BD=debug$(ARCH)$(GLIBC)
@@ -78,12 +82,8 @@
 #############################################################################
 
 ## Defaults
-USE_SDL=true
 VM_PPC=
 
-# bk010215 - TODO - add all defaults / kill Ryan
-
-
 LIB=lib
 ifeq ($(PLATFORM),linux)
 
@@ -110,7 +110,7 @@
   BASE_CFLAGS =  -pipe -Wall -Wimplicit -Wstrict-prototypes
 
   ifeq ($(strip $(USE_SDL)),true)
-    BASE_CFLAGS += -DUSE_SDL=1 $(shell sdl-config --cflags)
+    BASE_CFLAGS += -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags)
     GL_CFLAGS =
   else
     GL_CFLAGS = -I/usr/X11R6/include
@@ -352,6 +352,117 @@
 else # ifeq IRIX
 
 #############################################################################
+# SETUP AND BUILD -- SunOS
+#############################################################################
+
+ifeq ($(PLATFORM),SunOS)
+
+  GLIBC= #libc is irrelevant
+  CC=gcc
+  CXX=g++
+  COPYDIR="/usr/local/share/games/quake3"
+
+  ifneq (,$(findstring i86pc,$(shell uname -m)))
+    ARCH=i386
+  else #default to sparc
+    ARCH=sparc
+  endif
+
+  ifneq ($(ARCH),i386)
+    ifneq ($(ARCH),sparc)
+      $(error arch $(ARCH) is currently not supported)
+    endif
+  endif
+
+
+  BASE_CFLAGS =  -pipe -Wall -Wimplicit -Wstrict-prototypes
+
+  ifeq ($(strip $(USE_SDL)),true)
+    BASE_CFLAGS += -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags)
+    GL_CFLAGS =
+  else
+    GL_CFLAGS = -I/usr/openwin/include
+  endif
+
+  OPTIMIZE = -O3 -ffast-math -funroll-loops -fomit-frame-pointer \
+    -fno-strict-aliasing
+  BASE_CFLAGS += -DNO_VM_COMPILED
+
+  ifeq ($(ARCH),sparc)
+    OPTIMIZE = -O3 -fomit-frame-pointer -ffast-math -falign-loops=2 \
+      -falign-jumps=2 -falign-functions=2 -fstrength-reduce \
+      -fno-strict-aliasing
+  else
+  ifeq ($(ARCH),i386)
+    OPTIMIZE = -O3 -march=i686 -fomit-frame-pointer -ffast-math \
+      -falign-loops=2 -falign-jumps=2 -falign-functions=2 \
+      -fno-strict-aliasing -fstrength-reduce
+  endif
+  endif
+
+  DEBUG_CFLAGS = $(BASE_CFLAGS) -g -O0
+
+  RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
+
+  SHLIBEXT=so
+  SHLIBCFLAGS=-fPIC
+  SHLIBLDFLAGS=-shared $(LDFLAGS)
+
+  THREAD_LDFLAGS=-lpthread
+  LDFLAGS=-lsocket -lnsl -ldl -lm
+
+  ifeq ($(strip $(USE_SDL)),true)
+    GLLDFLAGS=$(shell sdl-config --libs) -lGLU -lX11 -lXext
+  else
+    GLLDFLAGS=-L/usr/openwin/$(LIB) -lGLU -lX11 -lXext
+  endif
+
+  ifeq ($(ARCH),i386)
+    # linux32 make ...
+    BASE_CFLAGS += -m32
+    LDFLAGS+=-m32
+  endif
+
+  ifeq ($(ARCH),sparc)
+    TARGETS=\
+      $(B)/$(PLATFORM)quake3 \
+      $(B)/$(PLATFORM)q3ded \
+      $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) \
+      $(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) \
+      $(B)/baseq3/ui$(ARCH).$(SHLIBEXT)     \
+      $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
+      $(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
+      $(B)/missionpack/ui$(ARCH).$(SHLIBEXT) \
+      $(B)/baseq3/vm/cgame.qvm \
+      $(B)/baseq3/vm/qagame.qvm \
+      $(B)/baseq3/vm/ui.qvm \
+      $(B)/missionpack/vm/qagame.qvm \
+      $(B)/missionpack/vm/cgame.qvm \
+      $(B)/missionpack/vm/ui.qvm
+#      $(B)/$(PLATFORM)quake3-smp
+  else
+    TARGETS=\
+      $(B)/$(PLATFORM)quake3 \
+      $(B)/$(PLATFORM)q3ded \
+      $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) \
+      $(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) \
+      $(B)/baseq3/ui$(ARCH).$(SHLIBEXT)     \
+      $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
+      $(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
+      $(B)/missionpack/ui$(ARCH).$(SHLIBEXT) \
+      $(B)/baseq3/vm/cgame.qvm \
+      $(B)/baseq3/vm/qagame.qvm \
+      $(B)/baseq3/vm/ui.qvm \
+      $(B)/missionpack/vm/qagame.qvm \
+      $(B)/missionpack/vm/cgame.qvm \
+      $(B)/missionpack/vm/ui.qvm
+#      $(B)/$(PLATFORM)quake3-smp
+
+  endif
+
+else # ifeq SunOS
+
+#############################################################################
 # SETUP AND BUILD -- GENERIC
 #############################################################################
 
@@ -371,6 +482,7 @@
 endif #mingw32
 endif #FreeBSD
 endif #IRIX
+endif #SunOS
 
 ifdef DEFAULT_BASEDIR
   BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\"
@@ -699,8 +811,41 @@
     Q3POBJ += $(B)/client/ftola.o $(B)/client/snapvectora.o
     Q3POBJ_SMP += $(B)/client/ftola.o $(B)/client/snapvectora.o
   endif
+endif #Linux-axp
+else
+ifeq ($(PLATFORM),SunOS)
+  Q3POBJ=\
+    $(B)/client/unix_main.o \
+    $(B)/client/unix_net.o \
+    $(B)/client/unix_shared.o \
+    $(B)/client/linux_signals.o \
+    $(B)/client/linux_common.o \
+    $(B)/client/linux_qgl.o \
+    $(B)/client/linux_glimp.o \
+    $(B)/client/linux_snd.o \
+    $(B)/client/sdl_snd.o \
+    $(B)/client/snd_mixa.o \
+    $(B)/client/matha.o \
 
-endif #Linux-axp
+  Q3POBJ_SMP=\
+    $(B)/client/unix_main.o \
+    $(B)/client/unix_net.o \
+    $(B)/client/unix_shared.o \
+    $(B)/client/linux_signals.o \
+    $(B)/client/linux_common.o \
+    $(B)/client/linux_qgl.o \
+    $(B)/client/linux_glimp_smp.o \
+    $(B)/client/linux_snd.o \
+    $(B)/client/sdl_snd.o \
+    $(B)/client/snd_mixa.o \
+    $(B)/client/matha.o
+
+  ifeq ($(ARCH),i386)
+    Q3POBJ += $(B)/client/ftola.o $(B)/client/snapvectora.o
+    Q3POBJ_SMP += $(B)/client/ftola.o $(B)/client/snapvectora.o
+  endif
+
+endif #SunOS
 endif #Linux
 endif #mingw32
 endif #IRIX

Modified: trunk/code/unix/linux_glimp.c
===================================================================
--- trunk/code/unix/linux_glimp.c	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/unix/linux_glimp.c	2005-10-29 22:05:20 UTC (rev 199)
@@ -34,7 +34,7 @@
 **
 */
 
-#if !USE_SDL
+#if !USE_SDL_VIDEO
 
 #include <termios.h>
 #include <sys/ioctl.h>
@@ -68,9 +68,19 @@
 #include <X11/keysym.h>
 #include <X11/cursorfont.h>
 
+#if !defined(__sun)
 #include <X11/extensions/xf86dga.h>
 #include <X11/extensions/xf86vmode.h>
+#endif
 
+#if defined(__sun)
+#include <X11/Sunkeysym.h>
+#endif
+
+#ifdef _XF86DGA_H_
+#define HAVE_XF86DGA
+#endif
+
 #define	WINDOW_CLASS_NAME	"Quake III: Arena"
 
 typedef enum
@@ -121,14 +131,18 @@
 cvar_t  *r_previousglDriver;
 
 qboolean vidmode_ext = qfalse;
+#ifdef HAVE_XF86DGA
 static int vidmode_MajorVersion = 0, vidmode_MinorVersion = 0; // major and minor of XF86VidExtensions
 
 // gamma value of the X display before we start playing with it
 static XF86VidModeGamma vidmode_InitialGamma;
+#endif /* HAVE_XF86DGA */
 
 static int win_x, win_y;
 
+#ifdef HAVE_XF86DGA
 static XF86VidModeModeInfo **vidmodes;
+#endif /* HAVE_XF86DGA */
 //static int default_dotclock_vidmode; // bk001204 - unused
 static int num_vidmodes;
 static qboolean vidmode_active = qfalse;
@@ -398,6 +412,7 @@
 
   if (in_dgamouse->value)
   {
+#ifdef HAVE_XF86DGA
     int MajorVersion, MinorVersion;
 
     if (!XF86DGAQueryVersion(dpy, &MajorVersion, &MinorVersion))
@@ -410,6 +425,7 @@
       XF86DGADirectVideo(dpy, DefaultScreen(dpy), XF86DGADirectMouse);
       XWarpPointer(dpy, None, win, 0, 0, 0, 0, 0, 0);
     }
+#endif /* HAVE_XF86DGA */
   } else
   {
     mwx = glConfig.vidWidth / 2;
@@ -431,7 +447,9 @@
   {
 		if (com_developer->value)
 			ri.Printf( PRINT_ALL, "DGA Mouse - Disabling DGA DirectVideo\n" );
+#ifdef HAVE_XF86DGA
     XF86DGADirectVideo(dpy, DefaultScreen(dpy), 0);
+#endif /* HAVE_XF86DGA */
   }
 
   XChangePointerControl(dpy, qtrue, qtrue, mouse_accel_numerator, 
@@ -741,6 +759,7 @@
 {
   // NOTE TTimo we get the gamma value from cvar, because we can't work with the s_gammatable
   //   the API wasn't changed to avoid breaking other OSes
+#ifdef HAVE_XF86DGA
   float g = Cvar_Get("r_gamma", "1.0", 0)->value;
   XF86VidModeGamma gamma;
   assert(glConfig.deviceSupportsGamma);
@@ -748,6 +767,7 @@
   gamma.green = g;
   gamma.blue = g;
   XF86VidModeSetGamma(dpy, scrnum, &gamma);
+#endif /* HAVE_XF86DGA */
 }
 
 /*
@@ -773,12 +793,14 @@
       qglXDestroyContext(dpy, ctx);
     if (win)
       XDestroyWindow(dpy, win);
+#ifdef HAVE_XF86DGA
     if (vidmode_active)
       XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[0]);
     if (glConfig.deviceSupportsGamma)
     {
       XF86VidModeSetGamma(dpy, scrnum, &vidmode_InitialGamma);
     }
+#endif /* HAVE_XF86DGA */
     // NOTE TTimo opening/closing the display should be necessary only once per run
     //   but it seems QGL_Shutdown gets called in a lot of occasion
     //   in some cases, this XCloseDisplay is known to raise some X errors
@@ -909,18 +931,23 @@
   actualHeight = glConfig.vidHeight;
 
   // Get video mode list
+#ifdef HAVE_XF86DGA
   if (!XF86VidModeQueryVersion(dpy, &vidmode_MajorVersion, &vidmode_MinorVersion))
   {
+#endif /* HAVE_XF86DGA */
     vidmode_ext = qfalse;
+#ifdef HAVE_XF86DGA
   } else
   {
     ri.Printf(PRINT_ALL, "Using XFree86-VidModeExtension Version %d.%d\n",
               vidmode_MajorVersion, vidmode_MinorVersion);
     vidmode_ext = qtrue;
   }
+#endif /* HAVE_XF86DGA */
 
   // Check for DGA	
   dga_MajorVersion = 0, dga_MinorVersion = 0;
+#ifdef HAVE_XF86DGA
   if (in_dgamouse->value)
   {
     if (!XF86DGAQueryVersion(dpy, &dga_MajorVersion, &dga_MinorVersion))
@@ -934,7 +961,9 @@
                  dga_MajorVersion, dga_MinorVersion);
     }
   }
+#endif /* HAVE_XF86DGA */      
 
+#ifdef HAVE_XF86DGA
   if (vidmode_ext)
   {
     int best_fit, best_dist, dist, x, y;
@@ -988,6 +1017,7 @@
       ri.Printf(PRINT_ALL, "XFree86-VidModeExtension:  Ignored on non-fullscreen/Voodoo\n");
     }
   }
+#endif /* HAVE_XF86DGA */
 
 
   if (!r_colorbits->value)
@@ -1286,6 +1316,7 @@
   
   glConfig.deviceSupportsGamma = qfalse;
 
+#ifdef HAVE_XF86DGA
   if (vidmode_ext)
   {
     if (vidmode_MajorVersion < GAMMA_MINMAJOR || 
@@ -1297,6 +1328,7 @@
     ri.Printf( PRINT_ALL, "XF86 Gamma extension initialized\n");
     glConfig.deviceSupportsGamma = qtrue;
   }
+#endif /* HAVE_XF86DGA */
 }
 
 /*
@@ -1768,10 +1800,10 @@
 // bk010216 - added stubs for non-Linux UNIXes here
 // FIXME - use NO_JOYSTICK or something else generic
 
-#if defined( __FreeBSD__ ) // rb010123
+#if (defined( __FreeBSD__ ) || defined( __sun)) // rb010123
 void IN_StartupJoystick( void ) {}
 void IN_JoyMove( void ) {}
 #endif
 
-#endif  // !USE_SDL
+#endif  // !USE_SDL_VIDEO
 

Modified: trunk/code/unix/linux_joystick.c
===================================================================
--- trunk/code/unix/linux_joystick.c	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/unix/linux_joystick.c	2005-10-29 22:05:20 UTC (rev 199)
@@ -30,7 +30,7 @@
 **
 */
 
-#if !USE_SDL
+#if !USE_SDL_VIDEO
 
 #include <linux/joystick.h>
 #include <sys/types.h>
@@ -206,6 +206,6 @@
   old_axes = axes;
 }
 
-#endif // !USE_SDL
+#endif // !USE_SDL_VIDEO
 
 

Modified: trunk/code/unix/linux_snd.c
===================================================================
--- trunk/code/unix/linux_snd.c	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/unix/linux_snd.c	2005-10-29 22:05:20 UTC (rev 199)
@@ -20,7 +20,7 @@
 ===========================================================================
 */
 
-#if !USE_SDL
+#if !USE_SDL_SOUND
 
 #include <unistd.h>
 #include <fcntl.h>
@@ -290,5 +290,5 @@
 {
 }
 
-#endif // !USE_SDL
+#endif // !USE_SDL_SOUND
 

Modified: trunk/code/unix/sdl_glimp.c
===================================================================
--- trunk/code/unix/sdl_glimp.c	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/unix/sdl_glimp.c	2005-10-29 22:05:20 UTC (rev 199)
@@ -1,5 +1,5 @@
 
-#if USE_SDL
+#if USE_SDL_VIDEO
 
 /*
  * SDL implementation for Quake 3: Arena's GPL source release.
@@ -1406,7 +1406,7 @@
     stick_state.oldaxes = axes;
 }
 
-#endif  // USE_SDL
+#endif  // USE_SDL_VIDEO
 
 // end of linux_glimp_sdl.c ...
 

Modified: trunk/code/unix/sdl_snd.c
===================================================================
--- trunk/code/unix/sdl_snd.c	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/unix/sdl_snd.c	2005-10-29 22:05:20 UTC (rev 199)
@@ -1,4 +1,4 @@
-#if USE_SDL
+#if USE_SDL_SOUND
 
 /*
  * SDL implementation for Quake 3: Arena's GPL source release.
@@ -298,7 +298,7 @@
     SDL_LockAudio();
 }
 
-#endif  // USE_SDL
+#endif  // USE_SDL_SOUND
 
 // end of linux_snd_sdl.c ...
 

Modified: trunk/code/unix/unix_glw.h
===================================================================
--- trunk/code/unix/unix_glw.h	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/unix/unix_glw.h	2005-10-29 22:05:20 UTC (rev 199)
@@ -19,8 +19,8 @@
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 ===========================================================================
 */
-#if !( defined __linux__ || defined __FreeBSD__ )
-#error You should include this file only on Linux/FreeBSD platforms
+#if !( defined __linux__ || defined __FreeBSD__ || defined __sun)
+#error You should include this file only on Linux/FreeBSD/Solaris platforms
 #endif
 
 #ifndef __GLW_LINUX_H__

Modified: trunk/code/unix/unix_main.c
===================================================================
--- trunk/code/unix/unix_main.c	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/unix/unix_main.c	2005-10-29 22:05:20 UTC (rev 199)
@@ -47,6 +47,10 @@
   #include <fpu_control.h> // bk001213 - force dumps on divide by zero
 #endif
 
+#if defined(__sun)
+  #include <sys/file.h>
+#endif
+
 // FIXME TTimo should we gard this? most *nix system should comply?
 #include <termios.h>
 
@@ -391,7 +395,7 @@
 #else
   Cvar_Set( "arch", "freebsd unknown" );
 #endif
-#elif defined __sun__
+#elif defined(__sun)
 #if defined __i386__
   Cvar_Set( "arch", "solaris x86" );
 #elif defined __sparc__
@@ -801,6 +805,8 @@
   snprintf (fname, sizeof(fname), "%shppa.so", name);
 #elif defined __sh__
   snprintf (fname, sizeof(fname), "%ssh.so", name);
+#elif defined __sparc__
+  snprintf (fname, sizeof(fname), "%ssparc.so", name);
 #else
 #error Unknown arch
 #endif

Modified: trunk/code/unix/unix_net.c
===================================================================
--- trunk/code/unix/unix_net.c	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/unix/unix_net.c	2005-10-29 22:05:20 UTC (rev 199)
@@ -45,6 +45,10 @@
 #import <net/if_dl.h>         // for 'struct sockaddr_dl'
 #endif
 
+#ifdef __sun
+#include <sys/filio.h>
+#endif
+
 static cvar_t	*noudp;
 
 netadr_t	net_local_adr;

Modified: trunk/code/unix/unix_shared.c
===================================================================
--- trunk/code/unix/unix_shared.c	2005-10-29 17:42:12 UTC (rev 198)
+++ trunk/code/unix/unix_shared.c	2005-10-29 22:05:20 UTC (rev 199)
@@ -76,7 +76,7 @@
 	return curtime;
 }
 
-#if (defined(__linux__) || defined(__FreeBSD__)) && !defined(DEDICATED)
+#if (defined(__linux__) || defined(__FreeBSD__) || defined(__sun)) && !defined(DEDICATED)
 /*
 ================
 Sys_XTimeToSysTime




More information about the quake3-commits mailing list