[PATCH v1 7/7] meson: Detect XDR only when needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If remote driver was disabled there is no need to check whether
host has a XDR library installed.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/196
Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 meson.build | 37 ++++++++++++++++---------------------
 1 file changed, 16 insertions(+), 21 deletions(-)

diff --git a/meson.build b/meson.build
index c5f0ee7287..624f37819f 100644
--- a/meson.build
+++ b/meson.build
@@ -883,32 +883,27 @@ endforeach
 
 # early checks where lot of other packages depend on the result
 
-# On MinGW portablexdr provides XDR functions, on linux they are
-# provided by libtirpc and on FreeBSD/macOS there is no need to
-# use extra library as it's provided by libc directly.
-if host_machine.system() == 'windows'
-  xdr_dep = cc.find_library('portablexdr', required: false)
-elif host_machine.system() == 'linux'
-  xdr_dep = dependency('libtirpc', required: false)
-elif host_machine.system() in [ 'freebsd', 'darwin' ]
-  xdr_dep = cc.find_library('c', required: false)
-else
-  xdr_dep = dependency('', required: false)
-endif
-
 if not get_option('driver_remote').disabled()
-  use_remote = true
-
-  if not xdr_dep.found()
-    use_remote = false
-    if get_option('driver_remote').enabled()
-      error('XDR is required for remote driver')
-    endif
+  # On MinGW portablexdr provides XDR functions, on linux they are
+  # provided by libtirpc and on FreeBSD/macOS there is no need to
+  # use extra library as it's provided by libc directly.
+  if host_machine.system() == 'windows'
+    xdr_dep = cc.find_library('portablexdr', required: get_option('driver_remote'))
+  elif host_machine.system() == 'linux'
+    xdr_dep = dependency('libtirpc', required: get_option('driver_remote'))
+  elif host_machine.system() in [ 'freebsd', 'darwin' ]
+    xdr_dep = cc.find_library('c', required: get_option('driver_remote'))
+  else
+    xdr_dep = dependency('', required: false)
   endif
 
-  if use_remote
+  if xdr_dep.found()
     conf.set('WITH_REMOTE', 1)
+  elif get_option('driver_remote').enabled()
+    error('XDR is required for remote driver')
   endif
+else
+  xdr_dep = dependency('', required: false)
 endif
 
 
-- 
2.32.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux