build: rename --with-suspend-resume to --with-systemd-suspend-resume

And only define WITH_SYSTEMD_SUSPEND_RESUME when enabled.

We already have other systemd specific features under the
--with-systemd-* name scheme, so consolidate that, given that we don't
have any other method to support suspend/resume notifications.
This commit is contained in:
Aleksander Morgado
2017-06-22 10:51:40 +02:00
parent b2a859a782
commit 4d6896f0d9
3 changed files with 22 additions and 25 deletions

View File

@@ -212,35 +212,32 @@ dnl
PKG_CHECK_MODULES(LIBSYSTEMD, [libsystemd >= 209],[have_libsystemd=yes],[have_libsystemd=no]) PKG_CHECK_MODULES(LIBSYSTEMD, [libsystemd >= 209],[have_libsystemd=yes],[have_libsystemd=no])
PKG_CHECK_MODULES(LIBSYSTEMD_LOGIN, [libsystemd-login >= 183],[have_libsystemd_login=yes],[have_libsystemd_login=no]) PKG_CHECK_MODULES(LIBSYSTEMD_LOGIN, [libsystemd-login >= 183],[have_libsystemd_login=yes],[have_libsystemd_login=no])
AC_ARG_WITH(suspend-resume, AC_ARG_WITH(systemd-suspend-resume,
AS_HELP_STRING([--with-suspend-resume=no|systemd], AS_HELP_STRING([--with-systemd-suspend-resume=no|yes],
[Enable suspend/resume support [[default=auto]]]),, [Enable systemd suspend/resume support [[default=auto]]]),,
[with_suspend_resume=auto]) [with_systemd_suspend_resume=auto])
if test "x$with_suspend_resume" = "xauto"; then if test "x$with_systemd_suspend_resume" = "xauto"; then
if test "x$have_libsystemd" = "xyes" || test "x$have_libsystemd_login" = "xyes"; then if test "x$have_libsystemd" = "xyes" || test "x$have_libsystemd_login" = "xyes"; then
with_suspend_resume=systemd with_systemd_suspend_resume=yes
else else
with_suspend_resume=no with_systemd_suspend_resume=no
fi fi
fi fi
case $with_suspend_resume in case $with_systemd_suspend_resume in
no) yes)
AC_DEFINE(WITH_SUSPEND_RESUME, 0, [Define if you have suspend-resume support])
;;
systemd)
if test "x$have_libsystemd" = "xno" && test "x$have_libsystemd_login" = "xno"; then if test "x$have_libsystemd" = "xno" && test "x$have_libsystemd_login" = "xno"; then
AC_MSG_ERROR(libsystemd or libsystemd-login development headers are required) AC_MSG_ERROR(libsystemd or libsystemd-login development headers are required)
fi fi
AC_DEFINE(WITH_SUSPEND_RESUME, 1, [Define if you have suspend-resume support]) AC_DEFINE(WITH_SYSTEMD_SUSPEND_RESUME, 1, [Define if you have systemd suspend-resume support])
;; ;;
*) *)
AC_MSG_ERROR([Wrong value for --with-suspend-resume: $with_suspend_resume]) with_systemd_suspend_resume=no
;; ;;
esac esac
AM_CONDITIONAL(SUSPEND_RESUME_SYSTEMD, test "x$with_suspend_resume" = "xsystemd") AM_CONDITIONAL(WITH_SYSTEMD_SUSPEND_RESUME, test "x$with_systemd_suspend_resume" = "xyes")
dnl----------------------------------------------------------------------------- dnl-----------------------------------------------------------------------------
dnl systemd journal support dnl systemd journal support
@@ -449,12 +446,12 @@ echo "
systemd unit directory: ${with_systemdsystemunitdir} systemd unit directory: ${with_systemdsystemunitdir}
Features: Features:
udev support: ${with_udev} udev: ${with_udev}
policykit support: ${with_polkit} policykit: ${with_polkit}
mbim support: ${with_mbim} mbim: ${with_mbim}
qmi support: ${with_qmi} qmi: ${with_qmi}
suspend/resume support: ${with_suspend_resume} systemd suspend/resume: ${with_systemd_suspend_resume}
systemd journal support: ${with_systemd_journal} systemd journal: ${with_systemd_journal}
Miscellaneous: Miscellaneous:
gobject introspection: ${found_introspection} gobject introspection: ${found_introspection}

View File

@@ -354,7 +354,7 @@ ModemManager_SOURCES += mm-auth-provider-polkit.h mm-auth-provider-polkit.c
endif endif
# Additional suspend/resume support via systemd # Additional suspend/resume support via systemd
if SUSPEND_RESUME_SYSTEMD if WITH_SYSTEMD_SUSPEND_RESUME
ModemManager_SOURCES += mm-sleep-monitor.h mm-sleep-monitor.c ModemManager_SOURCES += mm-sleep-monitor.h mm-sleep-monitor.c
endif endif

View File

@@ -30,7 +30,7 @@
#include "mm-log.h" #include "mm-log.h"
#include "mm-context.h" #include "mm-context.h"
#if WITH_SUSPEND_RESUME #if defined WITH_SYSTEMD_SUSPEND_RESUME
# include "mm-sleep-monitor.h" # include "mm-sleep-monitor.h"
#endif #endif
@@ -55,7 +55,7 @@ quit_cb (gpointer user_data)
return FALSE; return FALSE;
} }
#if WITH_SUSPEND_RESUME #if defined WITH_SYSTEMD_SUSPEND_RESUME
static void static void
sleeping_cb (MMSleepMonitor *sleep_monitor) sleeping_cb (MMSleepMonitor *sleep_monitor)
@@ -165,7 +165,7 @@ main (int argc, char *argv[])
name_lost_cb, name_lost_cb,
NULL, NULL,
NULL); NULL);
#if WITH_SUSPEND_RESUME #if defined WITH_SYSTEMD_SUSPEND_RESUME
{ {
MMSleepMonitor *sleep_monitor; MMSleepMonitor *sleep_monitor;