diff -ruN ../xracer-0.94.old/config.log ./config.log
--- ../xracer-0.94.old/config.log	Thu Jan  1 00:00:00 1970
+++ ./config.log	Sat Nov  6 16:27:49 1999
@@ -0,0 +1,55 @@
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+configure:604: checking for a BSD compatible install
+configure:657: checking whether build environment is sane
+configure:714: checking whether make sets ${MAKE}
+configure:760: checking for working aclocal
+configure:773: checking for working autoconf
+configure:786: checking for working automake
+configure:799: checking for working autoheader
+configure:812: checking for working makeinfo
+configure:829: checking for gcc
+configure:906: checking whether the C compiler (gcc  ) works
+configure:920: gcc -o conftest    conftest.c  1>&5
+configure:940: checking whether the C compiler (gcc  ) is a cross-compiler
+configure:945: checking whether we are using GNU C
+configure:954: gcc -E conftest.c
+configure:969: checking whether gcc accepts -g
+configure:999: checking for gcc
+configure:1076: checking whether the C compiler (gcc -g -O2 ) works
+configure:1090: gcc -o conftest -g -O2   conftest.c  1>&5
+configure:1110: checking whether the C compiler (gcc -g -O2 ) is a cross-compiler
+configure:1115: checking whether we are using GNU C
+configure:1139: checking whether gcc accepts -g
+configure:1177: checking for a BSD compatible install
+configure:1227: checking whether make sets ${MAKE}
+configure:1324: checking for getopt_long
+configure:1352: gcc -o conftest -g -O2   conftest.c  1>&5
+/tmp/ccP13028.o: In function `main':
+/usr/home/adams/port/xracer/xracer-0.94/configure(.text+0x4): undefined reference to `getopt_long'
+configure: failed program was:
+#line 1329 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char getopt_long(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getopt_long();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_getopt_long) || defined (__stub___getopt_long)
+choke me
+#else
+getopt_long();
+#endif
+
+; return 0; }
+configure:1324: checking for getopt
+configure:1352: gcc -o conftest -g -O2   conftest.c  1>&5
diff -ruN ../xracer-0.94.old/configure ./configure
--- ../xracer-0.94.old/configure	Sat Nov  6 16:27:49 1999
+++ ./configure	Sat Nov  6 16:27:49 1999
@@ -2792,7 +2792,7 @@
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-ljpeg $jpeg_LIBS $LIBS"
+LIBS="-L/usr/local/lib -ljpeg $jpeg_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
 #line 2798 "configure"
 #include "confdefs.h"
diff -ruN ../xracer-0.94.old/freebsd.patch ./freebsd.patch
--- ../xracer-0.94.old/freebsd.patch	Thu Jan  1 00:00:00 1970
+++ ./freebsd.patch	Sat Nov  6 16:27:49 1999
@@ -0,0 +1,71 @@
+diff -ruN ../xracer-0.94.old/config.log ./config.log
+--- ../xracer-0.94.old/config.log	Thu Jan  1 00:00:00 1970
++++ ./config.log	Sat Nov  6 16:27:49 1999
+@@ -0,0 +1,55 @@
++This file contains any messages produced by compilers while
++running configure, to aid debugging if configure makes a mistake.
++
++configure:604: checking for a BSD compatible install
++configure:657: checking whether build environment is sane
++configure:714: checking whether make sets ${MAKE}
++configure:760: checking for working aclocal
++configure:773: checking for working autoconf
++configure:786: checking for working automake
++configure:799: checking for working autoheader
++configure:812: checking for working makeinfo
++configure:829: checking for gcc
++configure:906: checking whether the C compiler (gcc  ) works
++configure:920: gcc -o conftest    conftest.c  1>&5
++configure:940: checking whether the C compiler (gcc  ) is a cross-compiler
++configure:945: checking whether we are using GNU C
++configure:954: gcc -E conftest.c
++configure:969: checking whether gcc accepts -g
++configure:999: checking for gcc
++configure:1076: checking whether the C compiler (gcc -g -O2 ) works
++configure:1090: gcc -o conftest -g -O2   conftest.c  1>&5
++configure:1110: checking whether the C compiler (gcc -g -O2 ) is a cross-compiler
++configure:1115: checking whether we are using GNU C
++configure:1139: checking whether gcc accepts -g
++configure:1177: checking for a BSD compatible install
++configure:1227: checking whether make sets ${MAKE}
++configure:1324: checking for getopt_long
++configure:1352: gcc -o conftest -g -O2   conftest.c  1>&5
++/tmp/ccP13028.o: In function `main':
++/usr/home/adams/port/xracer/xracer-0.94/configure(.text+0x4): undefined reference to `getopt_long'
++configure: failed program was:
++#line 1329 "configure"
++#include "confdefs.h"
++/* System header to define __stub macros and hopefully few prototypes,
++    which can conflict with char getopt_long(); below.  */
++#include <assert.h>
++/* Override any gcc2 internal prototype to avoid an error.  */
++/* We use char because int might match the return type of a gcc2
++    builtin and then its argument prototype would still apply.  */
++char getopt_long();
++
++int main() {
++
++/* The GNU C library defines this for functions which it implements
++    to always fail with ENOSYS.  Some functions are actually named
++    something starting with __ and the normal name is an alias.  */
++#if defined (__stub_getopt_long) || defined (__stub___getopt_long)
++choke me
++#else
++getopt_long();
++#endif
++
++; return 0; }
++configure:1324: checking for getopt
++configure:1352: gcc -o conftest -g -O2   conftest.c  1>&5
+diff -ruN ../xracer-0.94.old/configure ./configure
+--- ../xracer-0.94.old/configure	Sat Nov  6 16:27:49 1999
++++ ./configure	Sat Nov  6 16:27:49 1999
+@@ -2792,7 +2792,7 @@
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   ac_save_LIBS="$LIBS"
+-LIBS="-ljpeg $jpeg_LIBS $LIBS"
++LIBS="-L/usr/local/lib -ljpeg $jpeg_LIBS $LIBS"
+ cat > conftest.$ac_ext <<EOF
+ #line 2798 "configure"
+ #include "confdefs.h"
diff -ruN ../xracer-0.94.old/src/Makefile.in ./src/Makefile.in
--- ../xracer-0.94.old/src/Makefile.in	Sat Nov  6 16:27:49 1999
+++ ./src/Makefile.in	Sat Nov  6 16:27:49 1999
@@ -142,7 +142,7 @@
 
 DEFS = @DEFS@ -I. -I$(srcdir) -I..
 CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
+LDFLAGS = -L/usr/local/lib -ljpeg @LDFLAGS@
 LIBS = @LIBS@
 X_CFLAGS = @X_CFLAGS@
 X_LIBS = @X_LIBS@
diff -ruN ../xracer-0.94.old/src/sound/generic.c ./src/sound/generic.c
--- ../xracer-0.94.old/src/sound/generic.c	Sat Nov  6 16:27:49 1999
+++ ./src/sound/generic.c	Sat Nov  6 16:27:49 1999
@@ -37,11 +37,11 @@
 int
 os_sound_enable ()
 {
-  return fd;
+  return -1;
 }
 
 int
 os_sound_disable ()
 {
-  return fd;
+  return -1;
 }
diff -ruN ../xracer-0.94.old/src/ws/win32.c ./src/ws/win32.c
--- ../xracer-0.94.old/src/ws/win32.c	Sat Nov  6 16:27:49 1999
+++ ./src/ws/win32.c	Sat Nov  6 16:27:49 1999
@@ -1,26 +1,74 @@
 /* XRacer (C) 1999 Richard W.M. Jones.
- * $Id: win32.c,v 1.1 1999/07/21 07:39:43 rich Exp $
+ * $Id: x11.c,v 1.1 1999/07/21 07:39:43 rich Exp $
  */
 
+#include <sys/time.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
 #include "xracer.h"
+#include "os.h"
 
 double ws_get_time()
 {
-  return (double)GetTickCount() * 1e-3;
+  struct timeval tv;
+
+  gettimeofday(&tv,0);
+
+  return (double)tv.tv_sec + (double)tv.tv_usec * 1e-6;
 }
 
+/* X11- and GLUT-specific hack to warp and grab the pointer into the window. */
+
+struct GLUTwindow
+{
+  int num;
+  Window win;
+};
+
+extern Display *__glutDisplay;
+
+extern Window __glutRoot;
+extern struct GLUTwindow *__glutCurrentWindow;
+
 void ws_warp_pointer()
 {
+  Window window = __glutCurrentWindow->win;
+
+  XWarpPointer(__glutDisplay, 0, window, 0, 0, 0, 0, width/2, height/2);
 }
 
+/* Grab the pointer. */
+
 void ws_grab_pointer()
 {
+  Window window = __glutCurrentWindow->win;
+
+  if (XGrabPointer(__glutDisplay, window, True,
+        ButtonReleaseMask | ButtonPressMask,
+        GrabModeAsync, GrabModeAsync,
+        window, None, CurrentTime) != GrabSuccess)
+    log (LOG_ERROR, "pointer grab failed");
 }
 
 void ws_flush_events()
 {
+  XSync(__glutDisplay, False);
 }
 
+/* X11 hack to give window a class, so WindowManagers can interact with it
+   (e.g. start xracer without window borders/titlebar, start fullscreen,...)
+   Why isn't this implemented in glutCreateWindow? */
+
 void ws_fix_window()
 {
+   XClassHint classhint;
+   Window window = __glutCurrentWindow->win;
+
+   classhint.res_name="xracer";
+   classhint.res_class="XRacer";
+   XSetClassHint(__glutDisplay, window, &classhint);
 }
diff -ruN ../xracer-0.94.old/test/Makefile.in ./test/Makefile.in
--- ../xracer-0.94.old/test/Makefile.in	Sat Nov  6 16:27:49 1999
+++ ./test/Makefile.in	Sat Nov  6 16:27:49 1999
@@ -96,7 +96,7 @@
 DEFS = @DEFS@ -I. -I$(srcdir) -I..
 CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
+LIBS = -L/usr/local/lib @LIBS@
 X_CFLAGS = @X_CFLAGS@
 X_LIBS = @X_LIBS@
 X_EXTRA_LIBS = @X_EXTRA_LIBS@
diff -ruN ../xracer-0.94.old/tools/Makefile.in ./tools/Makefile.in
--- ../xracer-0.94.old/tools/Makefile.in	Sat Nov  6 16:27:49 1999
+++ ./tools/Makefile.in	Sat Nov  6 16:27:48 1999
@@ -104,7 +104,7 @@
 DEFS = @DEFS@ -I. -I$(srcdir) -I..
 CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
+LIBS = -L/usr/local/lib @LIBS@
 X_CFLAGS = @X_CFLAGS@
 X_LIBS = @X_LIBS@
 X_EXTRA_LIBS = @X_EXTRA_LIBS@
