Mesa (master): Make XF86VIDMODE extension optional

Kristian Høgsberg krh at kemper.freedesktop.org
Tue Sep 7 17:32:39 UTC 2010


Module: Mesa
Branch: master
Commit: 2b9dac397bd97909876bbda8532e2cbce9d8a77f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b9dac397bd97909876bbda8532e2cbce9d8a77f

Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Wed Apr 21 12:58:54 2010 +0100

Make XF86VIDMODE extension optional

Code in glx/glxcmds.c which uses the XF86VIDMODE extension is already guarded.  Also use
that guard to control inclusion of the xf86vmode.h header, and only enable that guard if the
XF86VIDMODE extension is found by pkgconfig.

This changes the behaviour on platforms which XF86VIDMODE exists, in that XF86VIDMODE used to
be mandatory, but is now optional.

Presumably other build systems are already arranging for -DXF86VIDMODE to be supplied to the
complier when glxcmds.c is compiled, so are not affected by this change

Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

---

 configs/autoconf.in |    2 ++
 configure.ac        |   11 ++++++++++-
 src/glx/Makefile    |    6 +++++-
 src/glx/glxcmds.c   |    2 ++
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index 10d311f..9bdbefe 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -195,3 +195,5 @@ ifneq ($(LLVM_VERSION),)
   HAVE_LLVM := 0x0$(subst .,0,$(LLVM_VERSION:svn=))
   DEFINES += -DHAVE_LLVM=$(HAVE_LLVM)
 endif
+
+HAVE_XF86VIDMODE = @HAVE_XF86VIDMODE@
diff --git a/configure.ac b/configure.ac
index d3d74ac..a7ee0f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -626,8 +626,15 @@ dri)
 
     # find the DRI deps for libGL
     if test "$x11_pkgconfig" = yes; then
+        dri_modules="x11 xext xdamage xfixes"
+
+        # add xf86vidmode if available
+        PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
+        if test "$HAVE_XF86VIDMODE" = yes ; then
+            dri_modules="$dri_modules xxf86vm"
+        fi
+
         # add xcb modules if necessary
-        dri_modules="x11 xext xxf86vm xdamage xfixes"
         if test "$enable_xcb" = yes; then
             dri_modules="$dri_modules x11-xcb xcb-glx"
         fi
@@ -676,6 +683,8 @@ AC_SUBST([GLESv2_LIB_DEPS])
 AC_SUBST([GLESv2_PC_LIB_PRIV])
 
 
+AC_SUBST([HAVE_XF86VIDMODE])
+
 dnl
 dnl More X11 setup
 dnl
diff --git a/src/glx/Makefile b/src/glx/Makefile
index ba5708f..2c94ef1 100644
--- a/src/glx/Makefile
+++ b/src/glx/Makefile
@@ -1,7 +1,11 @@
 TOP = ../..
 include $(TOP)/configs/current
 
-EXTRA_DEFINES = -DXF86VIDMODE -D_REENTRANT \
+ifeq ($(HAVE_XF86VIDMODE),yes)
+EXTRA_DEFINES_XF86VIDMODE = -DXF86VIDMODE
+endif
+
+EXTRA_DEFINES = $(EXTRA_DEFINES_XF86VIDMODE) -D_REENTRANT \
                 -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\"
 
 SOURCES = \
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 5cd9287..7016fdf 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -44,7 +44,9 @@
 #include "glx_error.h"
 #else
 #include <sys/time.h>
+#ifdef XF86VIDMODE
 #include <X11/extensions/xf86vmode.h>
+#endif
 #include "xf86dri.h"
 #endif
 #else




More information about the mesa-commit mailing list