summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2016-04-01 13:06:55 +0200
committerAleksander Morgado <aleksander@aleksander.es>2016-04-03 21:54:19 +0200
commit1f13909d9b59176afd9cec32cfbd623b44ec8d80 (patch)
treed72de23665066b8932cf5258ad0242b9f8024166
parentae2988da933f39d8983c94aaeef3c1b6f98f3e4e (diff)
downloadModemManager-1f13909d9b59176afd9cec32cfbd623b44ec8d80.tar.gz
build: make '--with-suspend-resume' auto by default
If systemd is found, enable suspend resume support.
-rw-r--r--configure.ac24
1 files changed, 17 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index c0bf86c3c..db41f7957 100644
--- a/configure.ac
+++ b/configure.ac
@@ -186,10 +186,19 @@ dnl-----------------------------------------------------------------------------
dnl Suspend/resume support
dnl
-AC_ARG_WITH(suspend-resume, AS_HELP_STRING([--with-suspend-resume=no|systemd], [Build ModemManager with specific suspend/resume support]))
-
-if test "x$with_suspend_resume" = "x"; then
- with_suspend_resume="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])
+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" = "xauto"; then
+ if test "x$have_libsystemd" = "xyes" || test "x$have_libsystemd_login" = "xyes"; then
+ with_suspend_resume=systemd
+ else
+ with_suspend_resume=no
+ fi
fi
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])
;;
systemd)
- PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd >= 209],,
- [PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd-login >= 183])])
+ if test "x$have_libsystemd" = "xno" && test "x$have_libsystemd_login" = "xno"; then
+ 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_MSG_ERROR(--with-suspend-resume must be one of [no, systemd])
+ AC_MSG_ERROR([Wrong value for --with-suspend-resume: $with_suspend_resume])
;;
esac