From 161ae2fcb41e1a5e8fbc56a375b332ec63c47bf2 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Sat, 10 Feb 2018 10:46:27 +0100 Subject: [PATCH] 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 --- meson.build | 12 ++++++------ meson_options.txt | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build index a2f08446..43af94a8 100644 --- a/meson.build +++ b/meson.build @@ -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 diff --git a/meson_options.txt b/meson_options.txt index b1e64bd9..6434b43d 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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')