meson build: make enable options work as auto/true/false

This makes meson fail if -Denable_systemd=true was set but not found
The default is now auto which is the old behaviour
This commit is contained in:
Dominique Martinet 2018-02-10 10:46:27 +01:00
parent 19d7edb430
commit 161ae2fcb4
2 changed files with 9 additions and 9 deletions

View File

@ -65,24 +65,24 @@ xcb_image = dependency('xcb-image')
xcb_render = dependency('xcb-render')
xcb_icccm = dependency('xcb-icccm', required: false)
x11_xcb = dependency('x11-xcb')
libcap = dependency('libcap', required: false)
systemd = dependency('libsystemd', required: false)
elogind = dependency('libelogind', required: false)
libcap = dependency('libcap', required: get_option('enable_libcap') == 'true')
systemd = dependency('libsystemd', required: get_option('enable_systemd') == 'true')
elogind = dependency('libelogind', required: get_option('enable_elogind') == 'true')
math = cc.find_library('m', required: false)
if xcb_icccm.found()
conf_data.set('WLR_HAS_XCB_ICCCM', true)
endif
if libcap.found() and get_option('enable_libcap')
if libcap.found() and get_option('enable_libcap') != 'false'
conf_data.set('WLR_HAS_LIBCAP', true)
endif
if systemd.found() and get_option('enable_systemd')
if systemd.found() and get_option('enable_systemd') != 'false'
conf_data.set('WLR_HAS_SYSTEMD', true)
endif
if elogind.found() and get_option('enable_elogind')
if elogind.found() and get_option('enable_elogind') != 'false'
conf_data.set('WLR_HAS_ELOGIND', true)
endif

View File

@ -1,4 +1,4 @@
option('enable_libcap', type: 'boolean', value: true, description: 'Enable support for capabilities')
option('enable_systemd', type: 'boolean', value: true, description: 'Enable support for logind')
option('enable_elogind', type: 'boolean', value: true, description: 'Enable support for logind')
option('enable_libcap', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Enable support for capabilities')
option('enable_systemd', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Enable support for logind')
option('enable_elogind', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Enable support for logind')
option('enable_xwayland', type: 'boolean', value: true, description: 'Enable support X11 applications')