diff options
author | Thomas Haller <thaller@redhat.com> | 2018-08-26 20:42:03 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-08-26 21:03:44 +0200 |
commit | bbe7cbb57f4f54f0385446c4323147f1393837de (patch) | |
tree | 1a0723619a457bd48de1528718f62435ab1cf5aa | |
parent | a92a4ff9666d35706a4bde4092209f7727ef4c6a (diff) | |
download | NetworkManager-th/build-ifdef-cleanup.tar.gz |
build/meson: fix build options for suspend-resumeth/build-ifdef-cleanup
suspend-resume must be selectable, out of for possible options.
We can do auto-detection based on present libraries, but it
shall be selectable. Like it is with autotools.
-rw-r--r-- | meson.build | 50 | ||||
-rw-r--r-- | meson_options.txt | 2 |
2 files changed, 31 insertions, 21 deletions
diff --git a/meson.build b/meson.build index cf0d8c9a30..8356b34323 100644 --- a/meson.build +++ b/meson.build @@ -210,6 +210,8 @@ if jansson_dep.found() endif libsystemd_dep = dependency('libsystemd', version: '>= 209', required: false) +libsystemd_login_deb = dependency('libsystemd-login', version: '>= 183', required: false) + config_h.set10('HAVE_LIBSYSTEMD', libsystemd_dep.found()) systemd_dep = dependency('systemd', required: false) @@ -378,31 +380,39 @@ config_h.set('HOSTNAME_PERSIST_SUSE', (hostname_persist == 'suse')) config_h.set('HOSTNAME_PERSIST_GENTOO', (hostname_persist == 'gentoo')) config_h.set('HOSTNAME_PERSIST_SLACKWARE', (hostname_persist == 'slackware')) -enable_suspend_resume = get_option('suspend_resume') -suspend_resume = '' +suspend_resume = get_option('suspend_resume') + +if suspend_resume == 'auto' + if libsystemd_dep.found() or libsystemd_login_deb.found() + suspend_resume = 'systemd' + elif libelogind_dep.found() + suspend_resume = 'elogind' + elif session_tracking_consolekit + suspend_resume = 'consolekit' + else + suspend_resume = 'upower' + endif +endif -if enable_suspend_resume +if suspend_resume == 'systemd' if libsystemd_dep.found() system_inhibit_dep = libsystemd_dep - suspend_resume = 'systemd' - config_h.set('SUSPEND_RESUME_SYSTEMD', true) + elif libsystemd_login_deb.found() + system_inhibit_dep = libsystemd_login_deb else - system_inhibit_dep = dependency('libsystemd-login', version: '>= 183', required: false) - if system_inhibit_dep.found() - suspend_resume = 'systemd' - config_h.set('SUSPEND_RESUME_SYSTEMD', true) - elif libelogind_dep.found() - system_inhibit_dep = libelogind_dep - suspend_resume = 'elogind' - config_h.set('SUSPEND_RESUME_ELOGIND', true) - elif session_tracking_consolekit - suspend_resume = 'consolekit' - config_h.set('SUSPEND_RESUME_CONSOLEKIT', true) - else - suspend_resume = 'upower' - config_h.set('SUSPEND_RESUME_UPOWER', true) - endif + error('Need libsystemd for suspend_resume=systemd') endif + config_h.set('SUSPEND_RESUME_SYSTEMD', true) +elif suspend_resume == 'elogind' + assert(libelogind_dep.found(), 'Need libelogind for suspend_resume=elogind') + system_inhibit_dep = libelogind_dep + config_h.set('SUSPEND_RESUME_ELOGIND', true) +elif suspend_resume == 'consolekit' + config_h.set('SUSPEND_RESUME_CONSOLEKIT', true) +elif suspend_resume == 'upower' + config_h.set('SUSPEND_RESUME_UPOWER', true) +else + error('bug') endif # SELinux support diff --git a/meson_options.txt b/meson_options.txt index 61304fcc04..25ec7ae4e9 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -15,7 +15,7 @@ option('dnssec_trigger', type: 'array', value: ['dnssec-trigger-script', '/usr/l option('dist_version', type: 'string', value: '', description: 'Define the NM\'s distribution version string') option('session_tracking_consolekit', type: 'boolean', value: true, description: 'Support consolekit session tracking') option('session_tracking', type: 'combo', choices: ['systemd', 'elogind', 'no'], value: 'systemd', description: 'Compatibility option to choose one session tracking module') -option('suspend_resume', type: 'boolean', value: true, description: 'Build NetworkManager with specific suspend/resume support') +option('suspend_resume', type: 'combo', choices: ['upower', 'systemd', 'elogind', 'consolekit', 'auto'], value: 'auto', description: 'Build NetworkManager with specific suspend/resume support') option('polkit', type: 'combo', choices: ['yes', 'no', 'disabled'], value: 'yes', description: 'set default value for auth-polkit configuration option. This value can be overwritten by NM configuration. \'disabled\' compiles NM without any support') option('modify_system', type: 'boolean', value: false, description: 'Allow users to modify system connections') option('polkit_agent', type: 'boolean', value: false, description: 'enable polkit agent for clients') |