meson: Detect XDR only when needed

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>
This commit is contained in:
Michal Privoznik 2021-12-08 09:32:55 +01:00
parent a642cc648c
commit be592a6ebb

View 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
# 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 not xdr_dep.found()
use_remote = false
if get_option('driver_remote').enabled()
if xdr_dep.found()
conf.set('WITH_REMOTE', 1)
elif get_option('driver_remote').enabled()
error('XDR is required for remote driver')
endif
endif
if use_remote
conf.set('WITH_REMOTE', 1)
endif
else
xdr_dep = dependency('', required: false)
endif