build: Stop detecting features automatically

Auto-detect options add some convenience for platforms where a
particular feature isn't available - systemd on non-Linux OS comes
to mind - but the downside is that it is easy to accidentally build
without a desired feature. We consider the latter much more serious
nowadays, so turn our auto-detect options into regular boolean
options.

https://bugzilla.gnome.org/show_bug.cgi?id=791007
This commit is contained in:
Florian Müllner 2017-11-25 07:15:39 +01:00
parent 10c602fe95
commit ca367e4e26
2 changed files with 11 additions and 33 deletions

View File

@ -102,39 +102,19 @@ if enable_recorder
endif endif
nm_deps = [] nm_deps = []
enable_networkmanager = get_option('networkmanager') if get_option('networkmanager')
if enable_networkmanager != 'no' nm_deps += dependency('libnm-glib', version: nm_req)
want_networkmanager = enable_networkmanager == 'yes' nm_deps += dependency('libnm-util', version: nm_req)
nm_deps += dependency('libnm-gtk', version: nm_req)
nm_deps += dependency('libnm-glib', nm_deps += dependency('libsecret-1', version: secret_req)
version: nm_req, required: want_networkmanager
)
nm_deps += dependency('libnm-util',
version: nm_req, required: want_networkmanager
)
nm_deps += dependency('libnm-gtk',
version: nm_req, required: want_networkmanager
)
nm_deps += dependency('libsecret-1',
version: secret_req, required: want_networkmanager
)
have_networkmanager = true have_networkmanager = true
foreach dep : nm_deps
have_networkmanager = have_networkmanager and dep.found()
endforeach
if not have_networkmanager
nm_deps = []
endif
else else
have_networkmanager = false have_networkmanager = false
endif endif
enable_systemd = get_option('systemd') if get_option('systemd')
if enable_systemd != 'no' systemd_dep = dependency('libsystemd')
want_systemd = enable_systemd == 'yes'
systemd_dep = dependency('libsystemd', required: want_systemd)
have_systemd = systemd_dep.found() have_systemd = systemd_dep.found()
else else
systemd_dep = [] systemd_dep = []

View File

@ -17,15 +17,13 @@ option('man',
) )
option('networkmanager', option('networkmanager',
type: 'combo', type: 'boolean',
choices: ['yes', 'no', 'auto'], value: true,
value: 'auto',
description: 'Enable NetworkManager support' description: 'Enable NetworkManager support'
) )
option('systemd', option('systemd',
type: 'combo', type: 'boolean',
choices: ['yes', 'no', 'auto'], value: true,
value: 'auto',
description: 'Enable systemd integration' description: 'Enable systemd integration'
) )