#include <stdlib.h>
#include <sys/types.h>
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-login.h>
+#include <systemd/sd-daemon.h>
+#endif
+
#include <pulse/xmalloc.h>
#include <pulsecore/module.h>
dbus_error_init(&error);
+#ifdef HAVE_SYSTEMD
+ /* If systemd support is enabled and we boot on systemd we
+ shouldn't watch ConsoleKit but systemd's logind service. */
+ if (sd_booted() > 0)
+ return 0;
+#endif
+
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
goto fail;