Commit 37954c91 authored by Beniamino Galvani's avatar Beniamino Galvani

build: meson: check vapi prerequisites and allow autodetection

Turn the vapi option into a combo that allows autodetection and check
whether all prerequisites are satisfied (including introspection
support) when vapi is explicitly enabled.

#28
parent 98b4a19a
......@@ -711,11 +711,27 @@ auto_support_src = 'int main() { int a = 0; __auto_type b = a; return b + a; };'
config_h.set10('_NM_CC_SUPPORT_AUTO_TYPE', cc.compiles(auto_support_src))
# Vala bindings
enable_vapi = get_option('vapi')
if enable_vapi
vapi_opt = get_option('vapi')
if vapi_opt == 'false'
enable_vapi = false
else
vala_req_version = '>= 0.17.1.24'
assert(add_languages('vala', required: false), 'vala is required to build. Use -Dvapi=false to disable it')
assert(meson.get_compiler('vala').version().version_compare(vala_req_version), 'vala ' + vala_req_version + ' is required to build. Use -Dvapi=false to disable it')
enable_vapi = true
if not enable_introspection
assert(vapi_opt != 'true', 'vala api require GObject introspection. Use -Dvapi=false to disable it')
enable_vapi = false
endif
if enable_vapi and not add_languages('vala', required: false)
assert(vapi_opt != 'true', 'vala is required to build. Use -Dvapi=false to disable it')
enable_vapi = false
endif
if enable_vapi and not meson.get_compiler('vala').version().version_compare(vala_req_version)
assert(vapi_opt != 'true', 'vala ' + vala_req_version + ' is required to build. Use -Dvapi=false to disable it')
enable_vapi = false
endif
endif
# Tests, utilities and documentation
......@@ -978,4 +994,5 @@ output += ' JSON validation for libnm: ' + enable_json_validation.to_string() +
output += ' crypto: ' + crypto + ' (have-gnutls: ' + crypto_gnutls_dep.found().to_string() + ', have-nss: ' + crypto_nss_dep.found().to_string() + ')\n'
output += ' sanitizers: ' + get_option('b_sanitize') + '\n'
output += ' Mozilla Public Suffix List: ' + enable_libpsl.to_string() + '\n'
output += ' vapi: ' + enable_vapi.to_string() + '\n'
message(output)
......@@ -62,7 +62,7 @@ option('config_dhcp_default', type: 'combo', choices: ['dhcpcanon', 'dhclient',
# miscellaneous
option('introspection', type: 'boolean', value: true, description: 'Enable introspection for this build')
option('vapi', type: 'boolean', value: true, description: 'build Vala bindings')
option('vapi', type : 'combo', choices : ['auto', 'true', 'false'], description: 'build Vala bindings')
option('docs', type: 'boolean', value: false, description: 'use to build documentation')
option('tests', type: 'combo', choices: ['yes', 'no', 'root'], value: 'yes', description: 'Build NetworkManager tests')
option('more_asserts', type: 'string', value: 'all', description: 'Enable more assertions for debugging (0 = none, 100 = all, default: all)')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment