Commit d638df1f authored by Cosimo Cecchi's avatar Cosimo Cecchi Committed by Ray Strode

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
parent 083a4a46
......@@ -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)
......@@ -149,6 +146,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 ====================================================================
......
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 \
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment