If dri1/2/3 are configured for auto-detection, libdrm is required, as well
as the corresponding proto.  (Practically we will always have the
corresponding protos now, as they are part of xorgproto).

Signed-off-by: Jon Turney <jon.tur...@dronecode.org.uk>
---
 meson.build | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/meson.build b/meson.build
index 3579d078a..32d72045b 100644
--- a/meson.build
+++ b/meson.build
@@ -279,20 +279,22 @@ endif
 
 build_glx = get_option('glx')
 
+libdrm_dep = dependency('libdrm', version: '>= 2.4.89', required: false)
+
 if get_option('dri1') == 'auto'
-    build_dri1 = xf86driproto_dep.found()
+    build_dri1 = xf86driproto_dep.found() and libdrm_dep.found()
 else
     build_dri1 = get_option('dri1') == 'true'
 endif
 
 if get_option('dri2') == 'auto'
-    build_dri2 = dri2proto_dep.found()
+    build_dri2 = dri2proto_dep.found() and libdrm_dep.found()
 else
     build_dri2 = get_option('dri2') == 'true'
 endif
 
 if get_option('dri3') == 'auto'
-    build_dri3 = dri3proto_dep.found() and xshmfence_dep.found()
+    build_dri3 = dri3proto_dep.found() and xshmfence_dep.found() and 
libdrm_dep.found()
 else
     build_dri3 = get_option('dri3') == 'true'
     if build_dri3
@@ -302,8 +304,11 @@ else
     endif
 endif
 
-libdrm_required = (get_option('dri1') == 'true') or (get_option('dri2') == 
'true') or (get_option('dri3') == 'true')
-libdrm_dep = dependency('libdrm', version: '>= 2.4.89', required: 
libdrm_required)
+libdrm_required = build_dri1 or build_dri2 or build_dri3
+if not libdrm_dep.found() and libdrm_required
+    error('DRI requested, but LIBDRM not found')
+endif
+
 build_modesetting = libdrm_dep.found()
 
 build_vbe = false
-- 
2.16.2

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to