meson: check for XDR and driver_remote early

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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Pavel Hrdina 2021-07-07 13:00:12 +02:00
parent 094671b1e7
commit 988beaf1d0

View File

@ -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')