Commit 1dd63580 authored by Thomas Haller's avatar Thomas Haller

build/meson: fix build options for suspend-resume

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.
parent 1a9bc224
......@@ -210,6 +210,8 @@ if jansson_dep.found()
endif
libsystemd_dep = dependency('libsystemd', version: '>= 209', required: false)
libsystemd_login_dep = 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_dep.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_dep.found()
system_inhibit_dep = libsystemd_login_dep
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
......
......@@ -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')
......
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