aboutsummaryrefslogtreecommitdiff
path: root/swayidle
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-11-18 08:22:25 -0500
committerGitHub <noreply@github.com>2018-11-18 08:22:25 -0500
commitb87250425fe13149e41b346f15c5cf808f376438 (patch)
tree145fcb048cc3df3d04a8b6afb90de68dd2dd80a9 /swayidle
parenteda3bfeed5097c71634332bfe998188b028abf02 (diff)
parentcad851805bea6b4777685df1c6adf8cb9fa71835 (diff)
Merge pull request #3147 from emersion/set10
Use #if instead of #ifdef
Diffstat (limited to 'swayidle')
-rw-r--r--swayidle/main.c8
-rw-r--r--swayidle/meson.build24
2 files changed, 20 insertions, 12 deletions
diff --git a/swayidle/main.c b/swayidle/main.c
index 7d0f23f4..2b185949 100644
--- a/swayidle/main.c
+++ b/swayidle/main.c
@@ -18,10 +18,10 @@
#include "config.h"
#include "idle-client-protocol.h"
#include "list.h"
-#ifdef SWAY_IDLE_HAS_SYSTEMD
+#if HAVE_SYSTEMD
#include <systemd/sd-bus.h>
#include <systemd/sd-login.h>
-#elif defined(SWAY_IDLE_HAS_ELOGIND)
+#elif HAVE_ELOGIND
#include <elogind/sd-bus.h>
#include <elogind/sd-login.h>
#endif
@@ -66,7 +66,7 @@ static void cmd_exec(char *param) {
}
}
-#if defined(SWAY_IDLE_HAS_SYSTEMD) || defined(SWAY_IDLE_HAS_ELOGIND)
+#if HAVE_SYSTEMD || HAVE_ELOGIND
static int lock_fd = -1;
static int ongoing_fd = -1;
static struct sd_bus *bus = NULL;
@@ -414,7 +414,7 @@ int main(int argc, char *argv[]) {
}
bool should_run = state.timeout_cmds->length > 0;
-#if defined(SWAY_IDLE_HAS_SYSTEMD) || defined(SWAY_IDLE_HAS_ELOGIND)
+#if HAVE_SYSTEMD || HAVE_ELOGIND
if (state.lock_cmd) {
should_run = true;
setup_sleep_listener();
diff --git a/swayidle/meson.build b/swayidle/meson.build
index 6c3ac119..79d2c5c4 100644
--- a/swayidle/meson.build
+++ b/swayidle/meson.build
@@ -1,18 +1,26 @@
threads = dependency('threads')
+swayidle_deps = [
+ client_protos,
+ pixman,
+ wayland_client,
+ wayland_server,
+ wlroots,
+]
+
+if systemd.found()
+ swayidle_deps += systemd
+endif
+if elogind.found()
+ swayidle_deps += elogind
+endif
+
executable(
'swayidle', [
'main.c',
],
include_directories: [sway_inc],
- dependencies: [
- client_protos,
- pixman,
- wayland_client,
- wayland_server,
- wlroots,
- swayidle_deps,
- ],
+ dependencies: swayidle_deps,
link_with: [lib_sway_common, lib_sway_client],
install_rpath : rpathdir,
install: true