meson: Try finding libxvmcw via pkg-config before using find_library
authorDylan Baker <dylan@pnwbakers.com>
Thu, 26 Sep 2019 22:19:54 +0000 (15:19 -0700)
committerDylan Baker <dylan@pnwbakers.com>
Fri, 27 Sep 2019 16:39:01 +0000 (16:39 +0000)
This fixes cross compiling issues, because pkg-config is less likely to
get the wrong libs.

v2: - Fix typo in comment

Fixes: 22a817af8a89eb3c762fc3e07b443a3ce37d7416
       ("meson: build gallium xvmc state tracker")
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/939
Reviewed-by: Adam Jackson <ajax@redhat.com>
src/gallium/state_trackers/xvmc/meson.build

index d120d533eef6372fdfeef75a42e34b44a164152a..f66b4f2a337580a5f5140199655d78423413463a 100644 (file)
@@ -26,10 +26,15 @@ libxvmc_st = static_library(
   dependencies : [dep_xvmc, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3],
 )
 
-# These tests will not work without a working xvmc configuration. 
+# These tests will not work without a working xvmc configuration.
 if with_tools.contains('xvmc')
-  dep_xvmcw = cc.find_library('XvMCW')
+  # pkg-config was added in 1.0.12, so allow fallback
+  dep_xvmcw = dependency('xvmc-wrapper', required : false)
+  if not dep_xvmcw.found()
+    dep_xvmcw = cc.find_library('XvMCW')
+  endif
   dep_real_xvmc = dependency('xvmc')
+
   foreach x : ['context', 'surface', 'subpicture', 'blocks', 'rendering']
     _name = 'xvmc_@0@'.format(x)
     executable(