]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: Detect XDR only when needed
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 8 Dec 2021 08:32:55 +0000 (09:32 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 15 Dec 2021 11:12:44 +0000 (12:12 +0100)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
meson.build

index c5f0ee728755b335d5bd551f3a1f8ec6645067e1..624f37819f99a4f48dad8e2dd55caa33821f2223 100644 (file)
@@ -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