build: make '--with-suspend-resume' auto by default

If systemd is found, enable suspend resume support.
This commit is contained in:
Aleksander Morgado
2016-04-01 13:06:55 +02:00
parent ae2988da93
commit 1f13909d9b

View File

@@ -186,10 +186,19 @@ dnl-----------------------------------------------------------------------------
dnl Suspend/resume support dnl Suspend/resume support
dnl dnl
AC_ARG_WITH(suspend-resume, AS_HELP_STRING([--with-suspend-resume=no|systemd], [Build ModemManager with specific suspend/resume support])) 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])
AC_ARG_WITH(suspend-resume,
AS_HELP_STRING([--with-suspend-resume=no|systemd],
[Enable suspend/resume support [[default=auto]]]),,
[with_suspend_resume=auto])
if test "x$with_suspend_resume" = "x"; then if test "x$with_suspend_resume" = "xauto"; then
with_suspend_resume="no" if test "x$have_libsystemd" = "xyes" || test "x$have_libsystemd_login" = "xyes"; then
with_suspend_resume=systemd
else
with_suspend_resume=no
fi
fi fi
case $with_suspend_resume in case $with_suspend_resume in
@@ -197,12 +206,13 @@ case $with_suspend_resume in
AC_DEFINE(WITH_SUSPEND_RESUME, 0, [Define if you have suspend-resume support]) AC_DEFINE(WITH_SUSPEND_RESUME, 0, [Define if you have suspend-resume support])
;; ;;
systemd) systemd)
PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd >= 209],, if test "x$have_libsystemd" = "xno" && test "x$have_libsystemd_login" = "xno"; then
[PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd-login >= 183])]) AC_MSG_ERROR(libsystemd or libsystemd-login development headers are required)
fi
AC_DEFINE(WITH_SUSPEND_RESUME, 1, [Define if you have suspend-resume support]) AC_DEFINE(WITH_SUSPEND_RESUME, 1, [Define if you have suspend-resume support])
;; ;;
*) *)
AC_MSG_ERROR(--with-suspend-resume must be one of [no, systemd]) AC_MSG_ERROR([Wrong value for --with-suspend-resume: $with_suspend_resume])
;; ;;
esac esac