<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.26.0">
</HEAD>
<BODY>
On Tue, 2011-01-04 at 16:15 +0100, Wolfram Sang wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Similar to 97a4e747bfac14f34646c55ddf639e8fe22f2f55 in xf86-video-ati.

Signed-off-by: Wolfram Sang &lt;<A HREF="mailto:w.sang@pengutronix.de">w.sang@pengutronix.de</A>&gt;
---
 configure.ac |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0116265..7884b28 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,12 +78,19 @@ sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
 # Checks for libraries.
 
 if test &quot;x$DRI&quot; = xauto; then
-        AC_CHECK_FILE([${sdkdir}/dri.h],
-                      [have_dri_h=&quot;yes&quot;], [have_dri_h=&quot;no&quot;])
-        AC_CHECK_FILE([${sdkdir}/sarea.h],
-                      [have_sarea_h=&quot;yes&quot;], [have_sarea_h=&quot;no&quot;])
-        AC_CHECK_FILE([${sdkdir}/dristruct.h],
-                      [have_dristruct_h=&quot;yes&quot;], [have_dristruct_h=&quot;no&quot;])
+        PKG_CHECK_MODULES(DRI, [libdrm &gt;= 2.0 xf86driproto glproto])
</PRE>
</BLOCKQUOTE>
With this line, the configuration will always fail on a system where libdrm is not installed or at a version less than 2.0.<BR>
The current code is probably not correct either. It checks if headers are in the server and will fail if libdrm is not installed. <BR>
<BR>
You can use something similar to:
<PRE>
PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
</PRE>
The macro will not abort if the required package is missing, it will just set the variables.<BR>
I did notice some drivers are not buildable with a server configured without mesa.<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
+        save_CPPFLAGS=&quot;$CPPFLAGS&quot;
+        CPPFLAGS=&quot;$XORG_CFLAGS $DRI_CFLAGS&quot;
+        AC_CHECK_HEADER([dri.h],
+                      [have_dri_h=&quot;yes&quot;], [have_dri_h=&quot;no&quot;],[-])
+        AC_CHECK_HEADER([sarea.h],
+                      [have_sarea_h=&quot;yes&quot;], [have_sarea_h=&quot;no&quot;],[-])
+        AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#include &lt;xorg-server.h&gt;
+#include &lt;dristruct.h&gt;
+                      ]])],
+                      [have_dristruct_h=&quot;yes&quot;], [have_dristruct_h=&quot;no&quot;],[-])
+        CPPFLAGS=&quot;$save_CPPFLAGS&quot;
 fi
 
 AC_MSG_CHECKING([whether to include DRI support])
@@ -100,7 +107,6 @@ AC_MSG_RESULT([$DRI])
 
 AM_CONDITIONAL(DRI, test &quot;x$DRI&quot; = xyes)
 if test &quot;x$DRI&quot; = xyes; then
-        PKG_CHECK_MODULES(DRI, [libdrm &gt;= 2.0 xf86driproto glproto])
         AC_DEFINE(XF86DRI,1,[Enable DRI driver support])
         AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
 fi
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>