I tried working with this some time ago. I managed to eventually get a
glide2x.so that compiled, but all my newly compiled glide-based apps would crash
suddenly. There are some patches available (I am including what I have found),
that are supposed to fix this. Perhaps we should create a code branch of glide2x
to work on for FreeBSD until we get something stable? I have been working on and
off on these sorts of projects, as I am a full-time student at the Univ. of
Cincinnati as well. Anyway, try the patches and tell me what you come up with.

Rafael Barrero had the audacity to say:

> Has anyone here had any luck compiling Glide2x (from the SourceForge project pages - 
>http://www.sourceforge.net/project/?form_grp=369) under FreeBSD? Glide2x, not Glide3x.
> 
> Essentially I'm looking to build a native glide2x.so for testing under FreeBSD, but 
>I'm not having much luck with the (latest) CVS snapshot. It seems to me (I could be 
>utterly wrong here) that the makefiles and organization of the distribution are 
>mangled to some extent. The webpage does indicate FreeBSD, unfortunately I've had 
>little luck building this thing. I noticed there are some existing FreeBSD ports 
>available... but those only lead me to dead links.
> 
> If I could get someone to fix this or help me out, that would be fantastic.
> 
> Much appreciated,
> 
> Rafael Barrero
> Loki Software, Inc.
> 
> "You know ... you take the killing for granted. And then it's gone, and you're like, 
>'I wish I'd appreciated it more.' Stopped and smelled the corpses, you know?"
>                 -Spike (BtVS)
> 
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message
> 
diff -ur Glide-orig/cvg/glide/oem/oeminit.c Glide/cvg/glide/oem/oeminit.c
--- Glide-orig/cvg/glide/oem/oeminit.c  Mon Nov 29 19:37:43 1999
+++ Glide/cvg/glide/oem/oeminit.c       Tue Dec  7 14:45:03 1999
@@ -20,8 +20,9 @@
 */
 #include <stdarg.h>
 #include <stdio.h>
+#include <stdlib.h>
 
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <windows.h>
 #endif
 
diff -ur Glide-orig/cvg/glide/src/fxgasm.c Glide/cvg/glide/src/fxgasm.c
--- Glide-orig/cvg/glide/src/fxgasm.c   Mon Nov 29 19:37:43 1999
+++ Glide/cvg/glide/src/fxgasm.c        Tue Dec  7 14:55:23 1999
@@ -37,7 +37,7 @@
  * macros for creating assembler offset files
  *----------------------------------------------------------------------*/
 
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #define NEWLINE printf("\n")
 #define COMMENT 
printf(";----------------------------------------------------------------------\n")
 
diff -ur Glide-orig/cvg/glide/src/g3df.c Glide/cvg/glide/src/g3df.c
--- Glide-orig/cvg/glide/src/g3df.c     Mon Nov 29 19:37:43 1999
+++ Glide/cvg/glide/src/g3df.c  Tue Dec  7 14:55:37 1999
@@ -62,7 +62,7 @@
 #include <fxdll.h>
 #include <glide.h>
 #include "fxglide.h"
-#ifdef __linux__
+#if defined(__linux__) || defined(__FreeBSD__)
 #include <ctype.h>
 #endif
 
diff -ur Glide-orig/cvg/glide/src/gdraw.c Glide/cvg/glide/src/gdraw.c
--- Glide-orig/cvg/glide/src/gdraw.c    Mon Nov 29 19:37:43 1999
+++ Glide/cvg/glide/src/gdraw.c Tue Dec  7 14:54:40 1999
@@ -680,7 +680,7 @@
     }
   }
 #endif
-#if defined( __linux__ )
+#if defined(__GNUC__) && defined(__i386__)
 #if !defined(BIG_OPT)
   asm( "popl %%ebp" : /* no outputs*/ : /* no inputs */ : "ebp");
 #endif
diff -ur Glide-orig/cvg/glide/src/glidesys.h Glide/cvg/glide/src/glidesys.h
--- Glide-orig/cvg/glide/src/glidesys.h Mon Nov 29 19:37:43 1999
+++ Glide/cvg/glide/src/glidesys.h      Tue Dec  7 14:41:19 1999
@@ -88,7 +88,7 @@
 #endif
 
 /* Check for OS */
-#if defined(__IRIX__) || defined(__sparc__) || defined(__linux__)
+#if defined(__IRIX__) || defined(__sparc__) || defined(__linux__) || 
+defined(__FreeBSD__)
 #  define GLIDE_OS        GLIDE_OS_UNIX
 #elif defined(__DOS__)
 #  define GLIDE_OS        GLIDE_OS_DOS32
diff -ur Glide-orig/cvg/glide/src/gpci.c Glide/cvg/glide/src/gpci.c
--- Glide-orig/cvg/glide/src/gpci.c     Mon Nov 29 19:37:43 1999
+++ Glide/cvg/glide/src/gpci.c  Tue Dec  7 14:55:56 1999
@@ -603,7 +603,7 @@
       const char* errStr = s;
       
       if (pciGetErrorCode() == PCI_ERR_NOERR) {
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
         sprintf(s, "%s: glide2x.dll expected %s, none detected\n",
                 FN_NAME, GLIDE_DRIVER_NAME);
 #else
diff -ur Glide-orig/cvg/glide/tests/display.c Glide/cvg/glide/tests/display.c
--- Glide-orig/cvg/glide/tests/display.c        Mon Nov 29 19:38:10 1999
+++ Glide/cvg/glide/tests/display.c     Tue Dec  7 14:46:40 1999
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/h3dtst01.c Glide/cvg/glide/tests/h3dtst01.c
--- Glide-orig/cvg/glide/tests/h3dtst01.c       Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/h3dtst01.c    Tue Dec  7 15:30:20 1999
@@ -16,14 +16,14 @@
 **
 */
 
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <windows.h>
 #endif
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/h3dtst02.c Glide/cvg/glide/tests/h3dtst02.c
--- Glide-orig/cvg/glide/tests/h3dtst02.c       Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/h3dtst02.c    Tue Dec  7 15:30:23 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/plib.c Glide/cvg/glide/tests/plib.c
--- Glide-orig/cvg/glide/tests/plib.c   Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/plib.c        Tue Dec  7 14:48:08 1999
@@ -22,7 +22,7 @@
 
 #include <stdlib.h>
 #include <stdarg.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <stdio.h>
diff -ur Glide-orig/cvg/glide/tests/qatest00.c Glide/cvg/glide/tests/qatest00.c
--- Glide-orig/cvg/glide/tests/qatest00.c       Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/qatest00.c    Tue Dec  7 15:31:43 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <math.h>
diff -ur Glide-orig/cvg/glide/tests/qatest01.c Glide/cvg/glide/tests/qatest01.c
--- Glide-orig/cvg/glide/tests/qatest01.c       Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/qatest01.c    Tue Dec  7 15:31:42 1999
@@ -22,7 +22,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test00.c Glide/cvg/glide/tests/test00.c
--- Glide-orig/cvg/glide/tests/test00.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test00.c      Tue Dec  7 15:31:42 1999
@@ -22,7 +22,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test01.c Glide/cvg/glide/tests/test01.c
--- Glide-orig/cvg/glide/tests/test01.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test01.c      Tue Dec  7 15:31:41 1999
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test02.c Glide/cvg/glide/tests/test02.c
--- Glide-orig/cvg/glide/tests/test02.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test02.c      Tue Dec  7 15:31:41 1999
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test03.c Glide/cvg/glide/tests/test03.c
--- Glide-orig/cvg/glide/tests/test03.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test03.c      Tue Dec  7 15:31:40 1999
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test04.c Glide/cvg/glide/tests/test04.c
--- Glide-orig/cvg/glide/tests/test04.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test04.c      Tue Dec  7 15:31:40 1999
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test05.c Glide/cvg/glide/tests/test05.c
--- Glide-orig/cvg/glide/tests/test05.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test05.c      Tue Dec  7 15:31:39 1999
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test06.c Glide/cvg/glide/tests/test06.c
--- Glide-orig/cvg/glide/tests/test06.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test06.c      Tue Dec  7 15:31:39 1999
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test07.c Glide/cvg/glide/tests/test07.c
--- Glide-orig/cvg/glide/tests/test07.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test07.c      Tue Dec  7 15:31:39 1999
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test08.c Glide/cvg/glide/tests/test08.c
--- Glide-orig/cvg/glide/tests/test08.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test08.c      Tue Dec  7 15:31:38 1999
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test09.c Glide/cvg/glide/tests/test09.c
--- Glide-orig/cvg/glide/tests/test09.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test09.c      Tue Dec  7 15:31:38 1999
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test10.c Glide/cvg/glide/tests/test10.c
--- Glide-orig/cvg/glide/tests/test10.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test10.c      Tue Dec  7 15:31:38 1999
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test11.c Glide/cvg/glide/tests/test11.c
--- Glide-orig/cvg/glide/tests/test11.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test11.c      Tue Dec  7 15:31:37 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test12.c Glide/cvg/glide/tests/test12.c
--- Glide-orig/cvg/glide/tests/test12.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test12.c      Tue Dec  7 15:31:37 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test13.c Glide/cvg/glide/tests/test13.c
--- Glide-orig/cvg/glide/tests/test13.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test13.c      Tue Dec  7 15:31:36 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test14.c Glide/cvg/glide/tests/test14.c
--- Glide-orig/cvg/glide/tests/test14.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test14.c      Tue Dec  7 15:31:36 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test15.c Glide/cvg/glide/tests/test15.c
--- Glide-orig/cvg/glide/tests/test15.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test15.c      Tue Dec  7 15:31:36 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test16.c Glide/cvg/glide/tests/test16.c
--- Glide-orig/cvg/glide/tests/test16.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test16.c      Tue Dec  7 15:31:35 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test17.c Glide/cvg/glide/tests/test17.c
--- Glide-orig/cvg/glide/tests/test17.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test17.c      Tue Dec  7 15:31:35 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test18.c Glide/cvg/glide/tests/test18.c
--- Glide-orig/cvg/glide/tests/test18.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test18.c      Tue Dec  7 15:31:35 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test19.c Glide/cvg/glide/tests/test19.c
--- Glide-orig/cvg/glide/tests/test19.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test19.c      Tue Dec  7 15:31:34 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test20.c Glide/cvg/glide/tests/test20.c
--- Glide-orig/cvg/glide/tests/test20.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test20.c      Tue Dec  7 15:31:34 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test21.c Glide/cvg/glide/tests/test21.c
--- Glide-orig/cvg/glide/tests/test21.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test21.c      Tue Dec  7 15:31:34 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test22.c Glide/cvg/glide/tests/test22.c
--- Glide-orig/cvg/glide/tests/test22.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test22.c      Tue Dec  7 15:31:33 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test23.c Glide/cvg/glide/tests/test23.c
--- Glide-orig/cvg/glide/tests/test23.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test23.c      Tue Dec  7 15:31:33 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test24.c Glide/cvg/glide/tests/test24.c
--- Glide-orig/cvg/glide/tests/test24.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test24.c      Tue Dec  7 15:31:32 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test25.c Glide/cvg/glide/tests/test25.c
--- Glide-orig/cvg/glide/tests/test25.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test25.c      Tue Dec  7 15:31:32 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test26.c Glide/cvg/glide/tests/test26.c
--- Glide-orig/cvg/glide/tests/test26.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test26.c      Tue Dec  7 15:31:32 1999
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test27.c Glide/cvg/glide/tests/test27.c
--- Glide-orig/cvg/glide/tests/test27.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test27.c      Tue Dec  7 15:31:31 1999
@@ -22,7 +22,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test28.c Glide/cvg/glide/tests/test28.c
--- Glide-orig/cvg/glide/tests/test28.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test28.c      Tue Dec  7 15:31:31 1999
@@ -18,7 +18,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/test29.c Glide/cvg/glide/tests/test29.c
--- Glide-orig/cvg/glide/tests/test29.c Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/test29.c      Tue Dec  7 15:31:31 1999
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #endif
 #include <assert.h>
diff -ur Glide-orig/cvg/glide/tests/tlib.c Glide/cvg/glide/tests/tlib.c
--- Glide-orig/cvg/glide/tests/tlib.c   Mon Nov 29 19:38:11 1999
+++ Glide/cvg/glide/tests/tlib.c        Tue Dec  7 14:56:53 1999
@@ -23,7 +23,7 @@
 
 #include <stdlib.h>
 #include <stdarg.h>
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__FreeBSD__)
 #include <conio.h>
 #else
 #include <ctype.h>
@@ -427,7 +427,7 @@
     return; 
 };
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__FreeBSD__)
 static void strupr(char *str) {
   while (*str) {
     if (islower(*str)) *str=toupper(*str);
@@ -1396,7 +1396,7 @@
   return FXTRUE;
 }
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__FreeBSD__)
 #include <linutil.h>
 
 /*-------------------------------------------------------------------
diff -ur Glide-orig/swlibs/fxmisc/fxos.c Glide/swlibs/fxmisc/fxos.c
--- Glide-orig/swlibs/fxmisc/fxos.c     Mon Nov 29 19:37:43 1999
+++ Glide/swlibs/fxmisc/fxos.c  Tue Dec  7 14:40:31 1999
@@ -59,7 +59,7 @@
     return (tb.time - once) + tb.millitm * .001;
     
 #else
-#if defined ( WIN32 ) || ( __DOS__ )
+#if defined ( WIN32 ) || ( __DOS__ ) || defined(__FreeBSD__)
 #   include <time.h>
 #   define times(a) clock()
 #   define HZ   CLOCKS_PER_SEC
diff -ur Glide-orig/swlibs/include/make/3dfx.mak Glide/swlibs/include/make/3dfx.mak
--- Glide-orig/swlibs/include/make/3dfx.mak     Mon Nov 29 19:37:43 1999
+++ Glide/swlibs/include/make/3dfx.mak  Tue Dec  7 14:38:31 1999
@@ -89,7 +89,24 @@
 #CDEBUG               = -pg -g -O
 #GCDEFS               =
 endif
-  
+
+ifeq "$(OS)" "FreeBSD"
+GCINCS        = -I. -I$(BUILD_ROOT_SWLIBS)/include -I$(BUILD_ROOT_HW)/include
+GCOPTS        = -Wall
+# 
+# BIG_OPT Indicates O3(?) or better is being used. It changes the
+# assembly language in grDrawTriangle. Larger optimization removes
+# an extra push in the calling sequence.
+#
+CNODEBUG       = -O6 -m486 -fomit-frame-pointer -funroll-loops \
+       -fexpensive-optimizations -ffast-math -DBIG_OPT
+
+CDEBUG        = -g -O
+# Profiling
+#CDEBUG               = -pg -g -O
+#GCDEFS               =
+endif
+
 # if we are not debugging then replace debug flags with nodebug flags
 
 # DEBUG = xx
@@ -142,6 +159,11 @@
 AR      = /usr/bin/ar crsl
 ECHO   = /bin/echo
 INSTALL = /usr/bin/install
+endif
+ifeq "$(OS)" "FreeBSD"
+AR      = /usr/bin/ar crsl
+ECHO   = /bin/echo
+INSTALL = /usr/bin/install -c
 endif
 
 DATE   = date
diff -ur Glide-orig/swlibs/newpci/pcilib/fxlinux.c Glide/swlibs/newpci/pcilib/fxlinux.c
--- Glide-orig/swlibs/newpci/pcilib/fxlinux.c   Mon Nov 29 19:37:43 1999
+++ Glide/swlibs/newpci/pcilib/fxlinux.c        Tue Dec  7 16:40:15 1999
@@ -33,11 +33,16 @@
  *        iopl() and asm/io.h has the declarations of inb, inw, inl and such.
  * glibc2: sys/io.h has the declaration of iopl() and includes
  *         asm/io.h for us */
+#ifdef linux
 #if __GNU_LIBRARY__ <= 5
 #include <asm/io.h>
 #else
 #include <sys/io.h>
 #endif
+#endif
+#ifdef __FreeBSD__
+#include <machine/cpufunc.h>
+#endif
 
 #include <fcntl.h>
 #include "fxpci.h"
@@ -94,6 +99,9 @@
 static const FxU32 SST1_PCI_BUS_SNOOP1_LINUX = 0x48;
 
 static int linuxDevFd=-1;
+#ifdef __FreeBSD__
+static int freebsdIoFd=-1;
+#endif
 
 struct pioData {
   short port;
@@ -195,10 +203,19 @@
 {
   if (!getenv("SST_NO_DEV3DFX")) linuxDevFd=open("/dev/3dfx", O_RDWR, 0);
   if (linuxDevFd==-1) {
+#ifdef linux
     if (iopl(3)<0) {
       pciErrorCode = PCI_ERR_NO_IO_PERM;
       return FXFALSE;
     }
+#endif
+#ifdef __FreeBSD__
+    freebsdIoFd = open("/dev/io", O_RDWR, 0);
+    if (freebsdIoFd < 0) {
+      pciErrorCode = PCI_ERR_NO_IO_PERM;
+      return FXFALSE;
+    }
+#endif
   }
   return FXTRUE;
 }
@@ -208,9 +225,17 @@
 {
   if (linuxDevFd>=0) {
     close(linuxDevFd);
-  } else {
+  }
+#ifdef linux
+  else {
     iopl(0);
   }
+#endif
+#ifdef __FreeBSD__
+  else if (freebsdIoFd>=0) {
+    close(freebsdIoFd);
+  }
+#endif
   return FXTRUE;
 }
 
@@ -317,7 +342,11 @@
   /* fprintf(stderr, "write byte=%d desc at %x data at %x\n", data,
       &desc, &data); */
   if (linuxDevFd==-1) {
+#ifdef linux
     outb(data, port);
+#else
+    outb(port, data);
+#endif
     return FXTRUE;
   }
   desc.port=port;
@@ -333,7 +362,11 @@
   /* fprintf(stderr, "write word=%x to port=%x desc at %x data at %x\n", 
          data, port, &desc, &data); */
   if (linuxDevFd==-1) {
+#ifdef linux
     outw(data, port);
+#else
+    outw(port, data);
+#endif
     return FXTRUE;
   }
   desc.port=port;
@@ -347,9 +380,13 @@
 {
   struct pioData desc;
   /* fprintf(stderr, "write long=%x to port=%x desc at %x data at %x\n", 
-         data, port, &desc, &data); */
+     data, port, &desc, &data); */
   if (linuxDevFd==-1) {
+#ifdef linux
     outl(data, port);
+#else
+    outl(port, data);
+#endif
     return FXTRUE;
   }
   desc.port=port;

Reply via email to