diff --git a/meson.build b/meson.build index deecd3f1e68b615d7a699ad8f0a29d60daffd1de..e07fa841b750cf6551ff510d03e87322d7f4cb26 100644 --- a/meson.build +++ b/meson.build @@ -111,13 +111,20 @@ x11_dep = dependency('x11') xfixes_dep = dependency('xfixes', version: '>= 6.0') enable_systemd = get_option('systemd') -systemd_dep = dependency('systemd', version: '>= 243', required: enable_systemd) -if systemd_dep.found() - systemd_userunitdir = systemd_dep.get_variable(pkgconfig: 'systemduserunitdir', - pkgconfig_define: ['prefix', gsd_prefix]) +enable_elogind = get_option('elogind') + +if enable_systemd and enable_elogind + error('Only systemd or elogind support should be activated') +elif enable_systemd + systemd_dep = dependency('systemd', version: '>= 243', required: true) + libsystemd_dep = dependency('libsystemd', version: '>= 243', required: true) + systemd_userunitdir = systemd_dep.get_pkgconfig_variable('systemduserunitdir', + define_variable: ['prefix', gsd_prefix]) +elif enable_elogind + elogind_dep = dependency('libelogind', version: '>= 209', required: true) endif -libsystemd_dep = dependency('libsystemd', version: '>= 243', required: enable_systemd) +config_h.set10('HAVE_SYSTEMD_LIB', enable_systemd or enable_elogind) m_dep = cc.find_library('m') diff --git a/meson_options.txt b/meson_options.txt index 1d913b4d29d7e4af54b3381c4dbed71366175ec3..5e2cccab651ee873fd34dcdd0a7b826d7316291d 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,6 +1,6 @@ option('udev_dir', type: 'string', value: '', description: 'Absolute path of the udev base directory') option('systemd', type: 'boolean', value: true, description: 'Enable systemd integration') - +option('elogind', type: 'boolean', value: false, description: 'Use elogind') option('alsa', type: 'boolean', value: true, description: 'build with ALSA support (not optional on Linux platforms)') option('gudev', type: 'boolean', value: true, description: 'build with gudev device support (not optional on Linux platforms)') option('cups', type: 'boolean', value: true, description: 'build with CUPS support') diff --git a/plugins/sharing/gsd-sharing-manager.c b/plugins/sharing/gsd-sharing-manager.c index 2ab2cb054f8dbbaa2d2198b0c90e62c0f1e975c2..c669e7bdebb651ed3ffa2cb78a2eb84907c2ae7c 100644 --- a/plugins/sharing/gsd-sharing-manager.c +++ b/plugins/sharing/gsd-sharing-manager.c @@ -20,12 +20,15 @@ #include "config.h" #include -#include #include #include #include #include +#if HAVE_SYSTEMD_LIB +#include +#endif + #if HAVE_NETWORK_MANAGER #include #endif /* HAVE_NETWORK_MANAGER */ diff --git a/plugins/sharing/meson.build b/plugins/sharing/meson.build index bda21608a589385e3436e60b999f55e778065d53..c65c4f9a5c41d5c6eb3168d4624083d8ab2c4bc1 100644 --- a/plugins/sharing/meson.build +++ b/plugins/sharing/meson.build @@ -6,9 +6,14 @@ sources = files( deps = plugins_deps + [ gio_unix_dep, libnotify_dep, - libsystemd_dep ] +if enable_systemd + deps += libsystemd_dep +elif enable_elogind + deps += elogind_dep +endif + if enable_network_manager deps += libnm_dep endif