From 44189f8129edff56668cad6846579adc0e64f8f3 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 11 Jul 2012 15:06:04 +0100 Subject: Use systemd for suspend and hibernate When running under systemd, call into systemd for suspend and hibernate instead of pm-utils. To capture resume events, install a small script that gets executed by systemd after resume and sends a dbus signal back to upower. To make this work, the upower backends gain a new signal, ::resuming, that they can optionally emit to signal that a resume happened. Backends opt in to this by returning TRUE from up_backend_emits_resuming(). In this case, upower doesn't assume the sleep command to block until resume, but instead waits for the ::resuming signal from the backend. The only backend that uses this mechanism is the linux backend when built with systemd support. Signed-off-by: Richard Hughes --- configure.ac | 57 +++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 8 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 311c6f2..8d8710c 100644 --- a/configure.ac +++ b/configure.ac @@ -176,6 +176,55 @@ fi PKG_CHECK_MODULES(GIO, [gio-2.0 >= 2.16.1]) +dnl ==================================================================== +dnl Check for systemd +dnl ==================================================================== +AC_ARG_ENABLE([systemd], + AS_HELP_STRING([--enable-systemd], [Use systemd]), + [enable_systemd=$enableval], + [enable_systemd=auto]) + +PKG_CHECK_MODULES(SYSTEMD, + [libsystemd-daemon], + [have_systemd=yes], [have_systemd=no]) + +AC_MSG_CHECKING([whether to use systemd]) + +if test x$enable_systemd = xauto ; then + if test x$have_systemd = xno ; then + enable_systemd=no + else + enable_systemd=yes + fi +fi +AC_MSG_RESULT($enable_systemd) + +if test x$enable_systemd = xyes; then + if test x$have_systemd = xno; 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]) +fi + +AC_SUBST(SYSTEMD_CFLAGS) +AC_SUBST(SYSTEMD_LIBS) + +AM_CONDITIONAL(HAVE_SYSTEMD, [test "$with_systemd" = "yes"], [Using systemd]) + +AC_ARG_WITH([systemdutildir], + AS_HELP_STRING([--with-systemdutildir=DIR], [Directory for systemd utilities]), + [], + [with_systemdutildir=$($PKG_CONFIG --variable=systemdutildir systemd)]) +AC_SUBST([systemdutildir], [$with_systemdutildir]) +AM_CONDITIONAL(HAVE_SYSTEMDUTILDIR, [test -n "$with_systemdutildir"]) + +AC_ARG_WITH([systemdsystemunitdir], + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), + [], + [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) +AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) +AM_CONDITIONAL(HAVE_SYSTEMDSYSTEMUNITDIR, [test -n "$with_systemdsystemunitdir"]) + dnl --------------------------------------------------------------------------- dnl - Compile time default choice of backend dnl --------------------------------------------------------------------------- @@ -210,14 +259,6 @@ fi AM_CONDITIONAL(HAVE_IDEVICE, [test x$have_idevice = xyes]) -# systemd -AC_ARG_WITH([systemdsystemunitdir], - AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), - [], - [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) -AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) -AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"]) - # export to Makefile.am AM_CONDITIONAL(BACKEND_TYPE_DUMMY, [test x$with_backend = xdummy]) AM_CONDITIONAL(BACKEND_TYPE_LINUX, [test x$with_backend = xlinux]) -- cgit v1.2.1