build: decouple systemd session tracking from systemd suspend/resume

New option --with-suspend-resume=[upower|systemd] which defaults
to systemd if you have systemd >= 183 with the inhibit support,
otherwise upower.  Allows you to use systemd session tracking
simultaneously with upower for suspend/resume if you don't have
system >= 183.
This commit is contained in:
Dan Williams 2012-11-06 14:22:44 -06:00
parent 0180f461ef
commit 3f179d74e2
2 changed files with 32 additions and 3 deletions

View file

@ -303,6 +303,31 @@ AM_CONDITIONAL(SESSION_TRACKING_CK, test "x$with_session_tracking" = "xck")
AM_CONDITIONAL(SESSION_TRACKING_SYSTEMD, test "x$with_session_tracking" = "xsystemd")
AC_ARG_WITH(suspend-resume, AS_HELP_STRING([--with-suspend-resume=upower|systemd], [Build NetworkManager with specific suspend/resume support]))
if test "z$with_suspend_resume" = "z"; then
PKG_CHECK_EXISTS([systemd >= 183], [have_systemd_inhibit=yes], [have_systemd_inhibit=no])
if test "z${have_systemd_inhibit}" = "zyes"; then
# Use systemd if it's new enough
with_suspend_resume="systemd"
else
# Fall back to upower
with_suspend_resume="upower"
fi
fi
case $with_suspend_resume in
upower) ;;
systemd)
PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [systemd >= 183])
;;
*)
AC_MSG_ERROR(--with-suspend-resume must be one of [upower, systemd])
;;
esac
AM_CONDITIONAL(SUSPEND_RESUME_UPOWER, test "x$with_suspend_resume" = "xupower")
AM_CONDITIONAL(SUSPEND_RESUME_SYSTEMD, test "x$with_suspend_resume" = "xsystemd")
have_libnl="no"
PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [have_libnl3=yes], [have_libnl3=no])
PKG_CHECK_MODULES(LIBNL_ROUTE3, libnl-route-3.0, [have_libnl_route3=yes], [have_libnl_route3=no])
@ -796,6 +821,8 @@ fi
echo Session tracking: ${with_session_tracking}
echo Suspend/resume: ${with_session_tracking}
if test "${enable_wimax}" = "yes"; then
echo WiMAX support: yes
else

View file

@ -202,16 +202,18 @@ NetworkManager_SOURCES += nm-connectivity.c nm-connectivity.h
endif
if SESSION_TRACKING_SYSTEMD
NetworkManager_SOURCES += \
nm-session-monitor-systemd.c \
nm-sleep-monitor-systemd.c
NetworkManager_SOURCES += nm-session-monitor-systemd.c
else
if SESSION_TRACKING_CK
NetworkManager_SOURCES += nm-session-monitor-ck.c
else
NetworkManager_SOURCES += nm-session-monitor-null.c
endif
endif
if SUSPEND_RESUME_SYSTEMD
NetworkManager_SOURCES += nm-sleep-monitor-systemd.c
else
# UPower suspend/resume used whenever systemd is not enabled
NetworkManager_SOURCES += nm-sleep-monitor-upower.c
endif