[libvirt PATCH] meson: check for `XDR` and `driver_remote` early

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

 



We have several other options that depend on result of `driver_remote`
option check so we need to do it early to have the result available.

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/185
Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 meson.build | 65 ++++++++++++++++++++++++++++-------------------------
 1 file changed, 34 insertions(+), 31 deletions(-)

diff --git a/meson.build b/meson.build
index c95c7f7444..ca4291e37a 100644
--- a/meson.build
+++ b/meson.build
@@ -848,6 +848,37 @@ foreach name : optional_programs
 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
+  endif
+
+  if use_remote
+    conf.set('WITH_REMOTE', 1)
+  endif
+endif
+
+
 # generic build dependencies
 
 # FIXME rewrite to use dependency()
@@ -1005,7 +1036,7 @@ else
 endif
 
 libssh_version = '0.7'
-if not get_option('driver_remote').disabled()
+if conf.has('WITH_REMOTE')
   libssh_dep = dependency('libssh', version: '>=' + libssh_version, required: get_option('libssh'))
   if libssh_dep.found()
     conf.set('WITH_LIBSSH', 1)
@@ -1028,7 +1059,7 @@ else
 endif
 
 libssh2_version = '1.3'
-if not get_option('driver_remote').disabled()
+if conf.has('WITH_REMOTE')
   libssh2_dep = dependency('libssh2', version: '>=' + libssh2_version, required: get_option('libssh2'))
   if libssh2_dep.found()
     conf.set('WITH_SSH2', 1)
@@ -1172,7 +1203,7 @@ if not get_option('sanlock').disabled()
 endif
 
 sasl_version = '2.1.26'
-if get_option('driver_remote').enabled()
+if conf.has('WITH_REMOTE')
   sasl_dep = dependency('libsasl2', version: '>=' + sasl_version, required: get_option('sasl'))
   if sasl_dep.found()
     conf.set('WITH_SASL', 1)
@@ -1280,19 +1311,6 @@ if wireshark_dep.found()
   endif
 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: 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
-
 yajl_version = '2.0.3'
 yajl_dep = dependency('yajl', version: '>=' + yajl_version, required: get_option('yajl'))
 if yajl_dep.found()
@@ -1406,21 +1424,6 @@ endif
 
 # build driver options
 
-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
-  endif
-
-  if use_remote
-    conf.set('WITH_REMOTE', 1)
-  endif
-endif
-
 remote_default_mode = get_option('remote_default_mode')
 if remote_default_mode == 'direct'
   conf.set('REMOTE_DRIVER_AUTOSTART_DIRECT', '1')
-- 
2.31.1




[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