[Xorg-driver-geode] Patch for compilation under FreeBSD

Arrigo Marchiori ardovm at yahoo.it
Tue Aug 5 06:56:13 PDT 2008


Dear list,

today I found some time to make up a patch. It should make the
./configure script detect the operating system and:

 - avoid compiling the file src/z4l.c

 - enable #ifdef's inside src/geode_msr.c.

This patch is probably far from perfect: 

 - as Martin-Éric Racine pointed out, there may be simpler ways to do
   the #ifdef's trick and the z4l.c should be adapted instead of just
   blindly removed;

 - this patch treats any OS that is not FreeBSD as "Linux";

 - moreover, this is the first time that I play with GNU autotools, so
   it may be not done in the best or most elegant way.

But this seems to be working for me. :-) So I'm posting it, hoping
that it can be useful as a starting point. I would like the Linux
users to test it, because I could only check it under FreeBSD.
-- 
rigo

http://rigo.altervista.org
-------------- next part --------------
diff -u -r xf86-video-geode-2.10.0/configure.ac xf86-video-geode-2.10.0-patched/configure.ac
--- xf86-video-geode-2.10.0/configure.ac	2008-06-13 23:49:21.000000000 +0200
+++ xf86-video-geode-2.10.0-patched/configure.ac	2008-08-05 15:13:54.000000000 +0200
@@ -34,6 +34,27 @@
 
 AM_MAINTAINER_MODE
 
+# Determine the operating system
+AC_MSG_CHECKING([uname -s for detecting host operating system])
+OSNAME=`uname -s`
+case "$OSNAME" in
+	FreeBSD*)
+		AC_MSG_RESULT(FreeBSD)
+		FREEBSD=yes
+                CFLAGS="-DFreeBSD $CFLAGS"
+	;;
+	Linux*)
+		AC_MSG_RESULT(Linux)
+		LINUX=yes
+	;;
+	*)
+		AC_MSG_RESULT(unknown! Assuming Linux)
+                LINUX=yes
+	;;
+esac
+AM_CONDITIONAL(ON_FREEBSD, test x$FREEBSD = xyes)
+AM_CONDITIONAL(ON_LINUX, test x$LINUX = xyes)
+
 # Checks for programs.
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL
diff -u -r xf86-video-geode-2.10.0/src/Makefile.am xf86-video-geode-2.10.0-patched/src/Makefile.am
--- xf86-video-geode-2.10.0/src/Makefile.am	2008-05-12 18:15:11.000000000 +0200
+++ xf86-video-geode-2.10.0-patched/src/Makefile.am	2008-08-05 15:41:46.000000000 +0200
@@ -145,6 +145,10 @@
 ztv_drv_la_LDFLAGS = -module -avoid-version
 ztv_drv_ladir = @moduledir@/drivers
 
+if ON_LINUX
 ztv_drv_la_SOURCES = \
         z4l.c
-
+else
+# It seems that we can't build this on FreeBSD
+ztv_drv_la_SOURCES =
+endif
diff -u -r xf86-video-geode-2.10.0/src/geode_msr.c xf86-video-geode-2.10.0-patched/src/geode_msr.c
--- xf86-video-geode-2.10.0/src/geode_msr.c	2008-04-01 21:27:38.000000000 +0200
+++ xf86-video-geode-2.10.0-patched/src/geode_msr.c	2008-08-05 15:18:03.000000000 +0200
@@ -7,6 +7,12 @@
 #include "os.h"
 #include "geode.h"
 
+// #define hacks to allow compilation under FreeBSD
+#ifdef FreeBSD
+#define lseek64 lseek
+#define off64_t off_t
+#endif
+
 static int
 _msr_open(void)
 {


More information about the Xorg-driver-geode mailing list