diff --git a/daemon/gamemode-dbus.c b/daemon/gamemode-dbus.c index f3ba4e2..839961b 100644 --- a/daemon/gamemode-dbus.c +++ b/daemon/gamemode-dbus.c @@ -36,8 +36,13 @@ POSSIBILITY OF SUCH DAMAGE. #include "common-logging.h" #include "common-pidfds.h" +#ifdef USE_ELOGIND +#include +#include +#else #include #include +#endif #include #include diff --git a/daemon/meson.build b/daemon/meson.build index d6f1a72..d328122 100644 --- a/daemon/meson.build +++ b/daemon/meson.build @@ -17,6 +17,7 @@ gamemoded_includes += config_h_dir gamemoded = executable( 'gamemoded', sources: daemon_sources, + c_args: elogind_args, dependencies: [ link_daemon_common, dep_threads, diff --git a/meson.build b/meson.build index 370c4d9..5334f28 100644 --- a/meson.build +++ b/meson.build @@ -79,9 +79,22 @@ path_libdir = join_paths(path_prefix, get_option('libdir')) path_libexecdir = join_paths(path_prefix, get_option('libexecdir')) path_sysconfdir = join_paths(path_prefix, get_option('sysconfdir')) -# Find systemd via pkgconfig +# Find systemd / elogind via pkgconfig with_systemd = get_option('with-systemd') -dep_systemd = dependency('libsystemd') +with_elogind = get_option('with-elogind') +elogind_args = [] +dep_systemd = [] +if with_systemd == true + if with_elogind == true + error('you can\'t use systemd and elogind at the same time') + endif + dep_systemd = dependency('libsystemd') +elif with_elogind == true + elogind_args += ['-DUSE_ELOGIND'] + dep_systemd = dependency('libelogind') +else + error('you need to use either sd-bus.h from systemd or elogind') +endif # For the client, libdbus is used dep_dbus = dependency('dbus-1') diff --git a/meson_options.txt b/meson_options.txt index 609036b..1c4b85c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,12 +1,12 @@ -option('with-systemd', type: 'boolean', description: 'Use systemd support (unit, etc)', value: 'true') - # limits.d option('with-pam-group', type: 'string', description: 'Install the limits.d configuration file to allow renicing as an unpriviledged user being part of the specified group') # systemd specific +option('with-systemd', type: 'boolean', description: 'Use systemd support (unit, etc)', value: true) option('with-systemd-user-unit-dir', type: 'string', description: 'Explicitly set the systemd user unit directory') # Not using systemd +option('with-elogind', type: 'boolean', description: 'Use elogind\'s Dbus library', value: false) option('with-dbus-service-dir', type: 'string', description: 'Explicitly set the D-BUS session directory') # lib dir in gamemoderun