Added the autoconf driver option --with-driver=glcore for building
libGLcore for xorg-server. When building glcore through autoconf, it
will check that xorg-server is new enough (1.5.99.1 corresponds to
current master). It will then check if XF86DRI is defined and enable
the DRI functionality in GLcore accordingly.

Changes have also been made so plain `make' and `make install' work
when --with-driver=glcore is used. This does require the overloaded
--with-dri-driverdir setting to specify the installation directory.
---
Dan

 I'm not attached to the name glcore at all. Do people prefer that it
 be called xorg or something? Also, if George's drixorg goes in, I'll
 happily fix things up to work with that.

 configure.ac      |  102 +++++++++++++++++++++++++++++++++++++++++-----------
 src/mesa/Makefile |   11 ++++++
 2 files changed, 91 insertions(+), 22 deletions(-)

diff --git a/configure.ac b/configure.ac
index cccf7bd..ad7bc8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,7 @@ AC_CANONICAL_HOST
 dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.3.1
 DRI2PROTO_REQUIRED=1.1
+XORG_REQUIRED=1.5.99.1
 
 dnl Check for progs
 AC_PROG_CPP
@@ -251,12 +252,13 @@ esac
 
 AC_ARG_WITH([driver],
     [AS_HELP_STRING([--with-driver=DRIVER],
-        [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or 
xlib@:>@])],
+        [driver for Mesa: xlib,dri,osmesa,glcore
+        @<:@default=dri when available, or xlib@:>@])],
     [mesa_driver="$withval"],
     [mesa_driver="$default_driver"])
 dnl Check for valid option
 case "x$mesa_driver" in
-xxlib|xdri|xosmesa)
+xxlib|xdri|xosmesa|xglcore)
     ;;
 *)
     AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
@@ -281,6 +283,9 @@ dri)
 osmesa)
     DRIVER_DIRS="osmesa"
     ;;
+glcore)
+    DRIVER_DIRS="glcore"
+    ;;
 esac
 AC_SUBST([SRC_DIRS])
 AC_SUBST([GLU_DIRS])
@@ -310,10 +315,14 @@ PROGRAM_DIRS=""
 case "$with_demos" in
 no) ;;
 yes)
-    # If the driver isn't osmesa, we have libGL and can build xdemos
-    if test "$mesa_driver" != osmesa; then
+    # If the driver isn't osmesa or glcore, we have libGL and can build xdemos
+    case "$mesa_driver" in
+    osmesa|glcore)
+        ;;
+    *)
         PROGRAM_DIRS="xdemos"
-    fi
+        ;;
+    esac
     ;;
 *)
     # verify the requested demos directories exist
@@ -418,8 +427,8 @@ dri)
     # need DRM libs, -lpthread, etc.
     GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
     ;;
-osmesa)
-    # No libGL for osmesa
+osmesa|glcore)
+    # No libGL for osmesa or glcore
     GL_LIB_DEPS=""
     ;;
 esac
@@ -443,7 +452,8 @@ AC_ARG_ENABLE([glx-tls],
 dnl Directory for DRI drivers
 AC_ARG_WITH([dri-driverdir],
     [AS_HELP_STRING([--with-dri-driverdir=DIR],
-        [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
+        [directory for the DRI and GLcore drivers
+        @<:@/usr/X11R6/lib/modules/dri@:>@])],
     [DRI_DRIVER_INSTALL_DIR="$withval"],
     [DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri'])
 AC_SUBST([DRI_DRIVER_INSTALL_DIR])
@@ -588,11 +598,14 @@ AC_ARG_ENABLE([gl-osmesa],
     [gl_osmesa="$enableval"],
     [gl_osmesa="$default_gl_osmesa"])
 if test "x$gl_osmesa" = xyes; then
-    if test "$mesa_driver" = osmesa; then
-        AC_MSG_ERROR([libGL is not available for OSMesa driver])
-    else
+    case "$mesa_driver" in
+    osmesa|glcore)
+        AC_MSG_ERROR([libGL is not available for $mesa_driver driver])
+        ;;
+    *)
         DRIVER_DIRS="$DRIVER_DIRS osmesa"
-    fi
+        ;;
+    esac
 fi
 
 dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
@@ -646,12 +659,48 @@ AC_SUBST([OSMESA_MESA_DEPS])
 dnl
 dnl GLcore configuration
 dnl
-# delay pkg-config checks until `make glcore' run
-XORG_CFLAGS='`pkg-config --cflags xorg-server`'
-GLCORE_LIB_DEPS='-lm -lpthread'
-if test "$mesa_driver" = dri; then
-    GLCORE_LIB_DEPS="$GLCORE_LIB_DEPS $DLOPEN_LIBS"
-fi
+case "$mesa_driver" in
+glcore)
+    # GLcore must be shared
+    if test "$enable_static" = yes; then
+        AC_MSG_ERROR([Can't use static libraries for glcore])
+    fi
+    PKG_CHECK_MODULES([XORG], [xorg-server >= $XORG_REQUIRED])
+    GLCORE_LIB_DEPS="-lm -lpthread"
+
+    # see if xorg-server.h defines XF86DRI
+    save_cppflags="$CPPFLAGS"
+    CPPFLAGS="$XORG_CFLAGS"
+    AC_CHECK_HEADER([xorg-server.h],
+        [AC_MSG_CHECKING([whether the XF86DRI extension is supported])
+        AC_PREPROC_IFELSE([#include <xorg-server.h>
+#ifndef XF86DRI
+# error "No DRI extension in xserver"
+#endif],
+            [xserver_dri=yes],
+            [xserver_dri=no])
+        AC_MSG_RESULT([$xserver_dri])],
+        [AC_MSG_ERROR([Can't build glcore without xorg-server.h])])
+    CPPFLAGS="$save_cppflags"
+
+    if test "$xserver_dri" = yes; then
+        # Hack so that DRI sources are built into GLcore
+        WINDOW_SYSTEM=dri
+        DEFINES="$DEFINES -DIN_DRI_DRIVER"
+        PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
+        GLCORE_LIB_DEPS="$GLCORE_LIB_DEPS $DLOPEN_LIBS"
+    fi
+    ;;
+*)
+    # Allow `make glcore' to be run from a prebuilt tree. Delay
+    # pkg-config checks until `make glcore' run.
+    XORG_CFLAGS='`pkg-config --cflags xorg-server`'
+    GLCORE_LIB_DEPS="-lm -lpthread"
+    if test "$mesa_driver" = dri; then
+        GLCORE_LIB_DEPS="$GLCORE_LIB_DEPS $DLOPEN_LIBS"
+    fi
+    ;;
+esac
 AC_SUBST([XORG_CFLAGS])
 AC_SUBST([GLCORE_LIB_DEPS])
 
@@ -663,6 +712,11 @@ AC_ARG_ENABLE([glu],
         [enable OpenGL Utility library @<:@default=enabled@:>@])],
     [enable_glu="$enableval"],
     [enable_glu=yes])
+dnl Don't build glu on glcore
+if test "x$enable_glu" = xyes && test "$mesa_driver" = glcore; then
+    AC_MSG_WARN([Disabling GLU since the driver is glcore])
+    enable_glu=no
+fi
 if test "x$enable_glu" = xyes; then
     SRC_DIRS="$SRC_DIRS glu"
 
@@ -706,10 +760,14 @@ AC_ARG_ENABLE([glw],
         [enable Xt/Motif widget library @<:@default=enabled@:>@])],
     [enable_glw="$enableval"],
     [enable_glw=yes])
-dnl Don't build GLw on osmesa
-if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
-    AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
-    enable_glw=no
+dnl Don't build GLw on osmesa or glcore
+if test "x$enable_glw" = xyes; then
+    case "$mesa_driver" in
+    osmesa|glcore)
+        AC_MSG_WARN([Disabling GLw since the driver is $mesa_driver])
+        enable_glw=no
+        ;;
+    esac
 fi
 if test "x$enable_glw" = xyes; then
     SRC_DIRS="$SRC_DIRS glw"
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index 08d7235..8da3b79 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -33,6 +33,7 @@ default: depend
            beos)     $(MAKE) beos || exit 1 ;; \
            directfb) $(MAKE) directfb || exit 1 ;; \
            fbdev)    $(MAKE) fbdev || exit 1 ;; \
+           glcore)   $(MAKE) glcore || exit 1 ;; \
            *) echo "$$driver is invalid in DRIVER_DIRS" >&2; exit 1;; \
          esac ; \
        done
@@ -45,6 +46,7 @@ install: default
                    else \
                      $(MAKE) install-osmesa || exit 1 ; \
                    fi ;; \
+           glcore) $(MAKE) install-glcore || exit 1 ;; \
            dri)    $(MAKE) install-libgl install-dri || exit 1 ;; \
            *)      $(MAKE) install-libgl || exit 1 ;; \
          esac ; \
@@ -72,6 +74,12 @@ linux-solo: depend subdirs libmesa.a
        cd drivers/dri && $(MAKE)
 
 
+######################################################################
+# Xorg GLcore module
+glcore: depend subdirs libmesa.a
+       cd drivers/xorg && $(MAKE)
+
+
 #####################################################################
 # Stand-alone Mesa libGL, no built-in drivers (DirectFB)
 
@@ -193,6 +201,9 @@ install-osmesa: default
 install-dri:
        cd drivers/dri && $(MAKE) install
 
+install-glcore:
+       cd drivers/xorg && $(MAKE) install
+
 ## NOT INSTALLED YET:
 ## $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GLES
 ## $(INSTALL) -m 644 include/GLES/*.h $(DESTDIR)$(INSTALL_DIR)/include/GLES
-- 
1.5.3.2


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to