[gnome-session] gsm-system: allow disabling ConsoleKit backend
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] gsm-system: allow disabling ConsoleKit backend
- Date: Fri, 12 Dec 2014 15:16:37 +0000 (UTC)
commit d638df1f2f049655bc71cbbf351bcd06686ed953
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sat Oct 25 20:48:44 2014 -0700
gsm-system: allow disabling ConsoleKit backend
This allows a dbus-glib-free compilation of gnome-session when the
ConsoleKit backend is not in use.
https://bugzilla.gnome.org/show_bug.cgi?id=622924
configure.ac | 43 ++++++++++++++++++++++++++++++++++++++++---
gnome-session/Makefile.am | 9 ++++++++-
gnome-session/gsm-system.c | 8 +++++++-
3 files changed, 55 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 35e3c29..1ce43c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,9 +139,6 @@ if test x$enable_systemd = xyes; then
AC_MSG_ERROR([Systemd support explicitly required, but systemd not found])
fi
AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is used for session tracking])
- session_tracking="systemd (with fallback to ConsoleKit)"
-else
- session_tracking=ConsoleKit
fi
AC_SUBST(SYSTEMD_CFLAGS)
@@ -150,6 +147,46 @@ AC_SUBST(SYSTEMD_LIBS)
AM_CONDITIONAL(HAVE_SYSTEMD, [test "$enable_systemd" = "yes"], [Using systemd])
dnl ====================================================================
+dnl Check for ConsoleKit
+dnl ====================================================================
+
+AC_ARG_ENABLE([consolekit],
+ AS_HELP_STRING([--enable-consolekit], [Use consolekit]),
+ [enable_consolekit=$enableval],
+ [enable_consolekit=no])
+
+AC_MSG_CHECKING([whether to use consolekit])
+AC_MSG_RESULT($enable_consolekit)
+
+if test x$enable_consolekit = xyes; then
+ PKG_CHECK_MODULES(CONSOLEKIT, [dbus-glib-1 >= $DBUS_GLIB_REQUIRED],
+ [have_consolekit=yes], [have_consolekit=no])
+ if test x$have_consolekit = xno; then
+ AC_MSG_ERROR([ConsoleKit support explicitly required, but dbus-glib not found])
+ fi
+ AC_DEFINE(HAVE_CONSOLEKIT, 1, [Define if ConsoleKit is used for session tracking])
+fi
+
+AC_SUBST(CONSOLEKIT_CFLAGS)
+AC_SUBST(CONSOLEKIT_LIBS)
+
+AM_CONDITIONAL(HAVE_CONSOLEKIT, [test "$enable_consolekit" = "yes"], [Using ConsoleKit])
+
+if test x$enable_systemd = xyes; then
+ if test x$enable_consolekit = xyes; then
+ session_tracking="systemd (with fallback to ConsoleKit)"
+ else
+ session_tracking="systemd"
+ fi
+else
+ if test x$enable_consolekit = xyes; then
+ session_tracking="ConsoleKit"
+ else
+ session_tracking="null backend"
+ fi
+fi
+
+dnl ====================================================================
dnl Check for XSync extension
dnl ====================================================================
diff --git a/gnome-session/Makefile.am b/gnome-session/Makefile.am
index 4f6e40d..64342bc 100644
--- a/gnome-session/Makefile.am
+++ b/gnome-session/Makefile.am
@@ -1,3 +1,4 @@
+EXTRA_DIST =
NULL =
bin_PROGRAMS = gnome-session
libexec_PROGRAMS = gnome-session-failed
@@ -60,7 +61,11 @@ gnome_session_SOURCES = \
gsm-xsmp-server.c \
gsm-xsmp-server.h
+if HAVE_CONSOLEKIT
gnome_session_SOURCES += gsm-consolekit.c gsm-consolekit.h
+else
+EXTRA_DIST += gsm-consolekit.c gsm-consolekit.h
+endif
gnome_session_CPPFLAGS = \
$(AM_CPPFLAGS) \
@@ -69,6 +74,7 @@ gnome_session_CPPFLAGS = \
$(ICE_CFLAGS) \
$(XEXT_CFLAGS) \
$(GCONF_CFLAGS) \
+ $(CONSOLEKIT_CFLAGS) \
$(SYSTEMD_CFLAGS) \
$(GIOUNIX_CFLAGS) \
-DLOCALE_DIR=\""$(datadir)/locale"\" \
@@ -89,6 +95,7 @@ gnome_session_LDADD = \
$(GNOME_SESSION_LIBS) \
$(UPOWER_LIBS) \
$(GCONF_LIBS) \
+ $(CONSOLEKIT_LIBS) \
$(SYSTEMD_LIBS) \
$(GIOUNIX_LIBS) \
$(EXECINFO_LIBS)
@@ -194,7 +201,7 @@ BUILT_SOURCES = \
org.gnome.SessionManager.Presence.h \
org.gnome.SessionManager.Presence.c
-EXTRA_DIST = \
+EXTRA_DIST += \
README \
org.gnome.SessionManager.xml \
org.gnome.SessionManager.App.xml \
diff --git a/gnome-session/gsm-system.c b/gnome-session/gsm-system.c
index 6a4bc3d..c24a955 100644
--- a/gnome-session/gsm-system.c
+++ b/gnome-session/gsm-system.c
@@ -22,9 +22,13 @@
#include <glib/gi18n.h>
#include "gsm-system.h"
-#include "gsm-consolekit.h"
+
#include "gsm-systemd.h"
+#ifdef HAVE_CONSOLEKIT
+#include "gsm-consolekit.h"
+#endif
+
enum {
REQUEST_COMPLETED,
SHUTDOWN_PREPARED,
@@ -253,12 +257,14 @@ gsm_get_system (void)
}
}
+#ifdef HAVE_CONSOLEKIT
if (system == NULL) {
system = GSM_SYSTEM (gsm_consolekit_new ());
if (system != NULL) {
g_debug ("Using ConsoleKit for session tracking");
}
}
+#endif
if (system == NULL) {
system = g_object_new (gsm_system_null_get_type (), NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]