Submitted by:            DJ Lucas (dj_AT_linuxfromscratch_DOT_org)
Date:                    2018-12-18
Initial Package Version: 1.8.2
Upstream Status:         Not submitted
Origin:                  Self
Description:             Allows detection and use of elogind

diff -Naurp ModemManager-1.8.2-orig/configure.ac ModemManager-1.8.2/configure.ac
--- ModemManager-1.8.2-orig/configure.ac	2018-09-22 04:01:11.000000000 -0500
+++ ModemManager-1.8.2/configure.ac	2018-12-13 22:30:59.307184516 -0600
@@ -237,6 +237,34 @@ esac
 
 AM_CONDITIONAL(WITH_SYSTEMD_SUSPEND_RESUME, test "x$with_systemd_suspend_resume" = "xyes")
 
+PKG_CHECK_MODULES(LIBELOGIND, [libelogind >= 209],[have_libelogind=yes],[have_libelogind=no])
+AC_ARG_WITH(elogind-suspend-resume,
+            AS_HELP_STRING([--with-elogind-suspend-resume=no|yes],
+                           [Enable elogind suspend/resume support [[default=auto]]]),,
+            [with_elogind_suspend_resume=auto])
+
+if test "x$with_elogind_suspend_resume" = "xauto"; then
+    if test "x$have_libelogindd" = "xyes"; then
+        with_elogind_suspend_resume=yes
+    else
+        with_elogind_suspend_resume=no
+    fi
+fi
+
+case $with_elogind_suspend_resume in
+    yes)
+        if test "x$have_libelogind" = "xno"; then
+                    AC_MSG_ERROR(libelogind development headers are required)
+            fi
+        AC_DEFINE(WITH_ELOGIND_SUSPEND_RESUME, 1, [Define if you have elogind suspend-resume support])
+        ;;
+    *)
+        with_elogind_suspend_resume=no
+        ;;
+esac
+
+AM_CONDITIONAL(WITH_ELOGIND_SUSPEND_RESUME, test "x$with_elogind_suspend_resume" = "xyes")
+
 dnl-----------------------------------------------------------------------------
 dnl systemd journal support
 dnl
@@ -448,6 +476,7 @@ echo "
       mbim:                    ${with_mbim}
       qmi:                     ${with_qmi}
       systemd suspend/resume:  ${with_systemd_suspend_resume}
+      elogind suspend/resume:  ${with_elogind_suspend_resume}
       systemd journal:         ${with_systemd_journal}
 
     Miscellaneous:
diff -Naurp ModemManager-1.8.2-orig/Makefile.in ModemManager-1.8.2/Makefile.in
--- ModemManager-1.8.2-orig/Makefile.in	2018-09-22 04:01:49.000000000 -0500
+++ ModemManager-1.8.2/Makefile.in	2018-12-13 22:30:59.307184516 -0600
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -144,7 +144,7 @@ am__recursive_targets = \
   $(RECURSIVE_CLEAN_TARGETS) \
   $(am__extra_recursive_targets)
 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-	cscope distdir dist dist-all distcheck
+	cscope distdir distdir-am dist dist-all distcheck
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
 	$(LISP)config.h.in
 # Read a list of newline-separated strings from the standard input,
@@ -278,6 +278,8 @@ INTROSPECTION_TYPELIBDIR = @INTROSPECTIO
 LCOV = @LCOV@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
+LIBELOGIND_CFLAGS = @LIBELOGIND_CFLAGS@
+LIBELOGIND_LIBS = @LIBELOGIND_LIBS@
 LIBICONV = @LIBICONV@
 LIBINTL = @LIBINTL@
 LIBMM_GLIB_CFLAGS = @LIBMM_GLIB_CFLAGS@
@@ -463,8 +465,8 @@ Makefile: $(srcdir)/Makefile.in $(top_bu
 	    echo ' $(SHELL) ./config.status'; \
 	    $(SHELL) ./config.status;; \
 	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
 	esac;
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -606,7 +608,10 @@ distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
 
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
 	$(am__remove_distdir)
 	test -d "$(distdir)" || mkdir "$(distdir)"
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
diff -Naurp ModemManager-1.8.2-orig/src/Makefile.am ModemManager-1.8.2/src/Makefile.am
--- ModemManager-1.8.2-orig/src/Makefile.am	2018-09-22 02:25:43.000000000 -0500
+++ ModemManager-1.8.2/src/Makefile.am	2018-12-13 22:32:24.251757477 -0600
@@ -363,6 +363,12 @@ if WITH_SYSTEMD_SUSPEND_RESUME
 ModemManager_SOURCES += mm-sleep-monitor.h mm-sleep-monitor.c
 endif
 
+# Additional suspend/resume support via elogind
+if WITH_ELOGIND_SUSPEND_RESUME
+ModemManager_SOURCES += mm-sleep-monitor.h mm-sleep-monitor.c
+endif
+
+
 # Additional QMI support in ModemManager
 if WITH_QMI
 ModemManager_SOURCES += \
