[PATCH:intel-gpu-tools v2] Make testdisplay build optional and disable on systems without requirements

Alan Coopersmith alan.coopersmith at oracle.com
Mon Jan 23 20:25:40 PST 2012


Allows building on non-Linux systems which don't have libudev to query
the Linux kernel specific udev interfaces.

Fails configure if --enable-testdisplay is passed and a dependency is missing.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---

Oops, next time, test first, then mail.

v2: Fixes the --enable-testdisplay case to actually error out when missing
a dependency.

 configure.ac      |   42 +++++++++++++++++++++++++++++++++++-------
 tests/Makefile.am |    2 ++
 2 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 19744e0..647c3a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,20 +55,48 @@ XORG_DEFAULT_OPTIONS
 PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.30 libdrm])
 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
 
-# for testdisplay
-PKG_CHECK_MODULES(CAIRO, cairo)
-PKG_CHECK_MODULES(LIBUDEV, libudev)
-PKG_CHECK_MODULES(GLIB, glib-2.0)
-
 # -----------------------------------------------------------------------------
 #			Configuration options
 # -----------------------------------------------------------------------------
-# Define a configure option for the shadder debugger
+
+# Define a configure option for testdisplay
+AC_ARG_ENABLE(testdisplay, AS_HELP_STRING([--enable-testdisplay],
+    [Enable display testing support [autodetected]]),
+    [BUILD_TESTDISPLAY="$enableval"], [BUILD_TESTDISPLAY=auto])
+
+# testdisplay depends on cairo, glib, and libudev
+if test "x$BUILD_TESTDISPLAY" != xno ; then
+    PKG_CHECK_MODULES(CAIRO, cairo, [cairo_found=yes], [cairo_found=no])
+    PKG_CHECK_MODULES(LIBUDEV, libudev, [udev_found=yes], [udev_found=no])
+    PKG_CHECK_MODULES(GLIB, glib-2.0, [glib_found=yes], [glib_found=no])
+
+    if test "x$BUILD_TESTDISPLAY" = xyes ; then
+        if test $cairo_found = no ; then
+	    AC_MSG_ERROR([displaytest requested, cairo not found.])
+	fi
+        if test $udev_found = no ; then
+	    AC_MSG_ERROR([displaytest requested, libudev not found.])
+	fi
+        if test $glib_found = no ; then
+	    AC_MSG_ERROR([displaytest requested, glib-2.0 not found.])
+	fi
+    else
+	if test $cairo_found = yes && test $udev_found = yes && test $glib_found = yes ; then
+	    BUILD_TESTDISPLAY=yes
+	else
+	    BUILD_TESTDISPLAY=no
+	fi
+    fi
+fi
+
+AM_CONDITIONAL(BUILD_TESTDISPLAY, [test "x$BUILD_TESTDISPLAY" != xno])
+
+# Define a configure option for the shader debugger
 AC_ARG_ENABLE(shader-debugger, AS_HELP_STRING([--enable-shader-debugger],
     [Enable shader debugging support [autodetected]]),
     [BUILD_SHADER_DEBUGGER="$enableval"], [BUILD_SHADER_DEBUGGER=auto])
 
-# Shadder debugger depends on python3, intel-genasm and objcopy
+# Shader debugger depends on python3, intel-genasm and objcopy
 if test "x$BUILD_SHADER_DEBUGGER" != xno; then
     # Check Python 3 is installed
     if test "$PYTHON" = ":" ; then
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6e169de..80139ee 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -92,9 +92,11 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) \
 	-I$(srcdir)/../lib
 LDADD = ../lib/libintel_tools.la $(PCIACCESS_LIBS) $(DRM_LIBS) 
 
+if BUILD_TESTDISPLAY
 TESTS_progs += testdisplay
 LDADD += $(CAIRO_LIBS) $(LIBUDEV_LIBS) $(GLIB_LIBS)
 AM_CFLAGS += $(CAIRO_CFLAGS) $(LIBUDEV_CFLAGS) $(GLIB_CFLAGS)
+endif BUILD_TESTDISPLAY
 
 gem_fence_thrash_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 gem_fence_thrash_LDADD = $(LDADD) -lpthread
-- 
1.7.3.2



More information about the xorg-devel mailing list