--- a/configure.ac	2017-10-07 16:41:08.632709458 +0200
+++ b/configure.ac	2017-10-07 16:47:33.480721012 +0200
@@ -312,6 +312,27 @@
 
 AM_CONDITIONAL(USE_LIBSYSTEMD_LOGIN, [test "$msg_libsystemd_login" = "yes"])
 
+dnl **********************************
+dnl *** Check for libelogind       ***
+dnl **********************************
+
+AC_ARG_ENABLE([libelogind], [AS_HELP_STRING([--enable-libsystemd-login],[Use libelogind instead of libsystemd-login])])
+msg_libelogind=no
+LIBELOGIND_REQUIRED=218
+
+if test "x$enable_libelogind" != "xno"; then
+  PKG_CHECK_EXISTS([libelogind], [msg_libelogind=yes],
+                   [PKG_CHECK_EXISTS([libelogind >= $LIBELOGIND_REQUIRED], [msg_libelogind=yes])])
+
+  if test "x$msg_libelogind" = "xyes"; then
+    PKG_CHECK_MODULES([LIBELOGIND],[libelogind],,
+                      [PKG_CHECK_MODULES([LIBELOGIND],[libelogind >= $LIBELOGIND_REQUIRED])])
+    AC_DEFINE([HAVE_LIBELOGIND], 1, [Define to 1 if libelogind is available])
+  fi
+fi
+
+AM_CONDITIONAL(USE_LIBELOGIND, [test "$msg_libelogind" = "yes"])
+
 dnl **************************************************
 dnl *** Check if we should build with CDDA backend ***
 dnl **************************************************
@@ -937,6 +958,7 @@
 	Build GOA volume monitor:     $msg_goa
         Use systemd user units:       $msg_systemd_user_units
         Use libsystemd-login:         $msg_libsystemd_login
+        Use libelogind:               $msg_libelogind
         Use GCR:                      $msg_gcr
 	GNOME Keyring support:        $msg_keyring
 	GTK+ support:                 $msg_gtk
--- a/monitor/udisks2/Makefile.am	2017-10-07 16:41:26.107709982 +0200
+++ b/monitor/udisks2/Makefile.am	2017-10-07 16:48:20.538722424 +0200
@@ -20,6 +20,7 @@
 	$(UDISKS2_CFLAGS)                       \
 	$(GUDEV_CFLAGS)                         \
 	$(LIBSYSTEMD_LOGIN_CFLAGS)		\
+	$(LIBELOGIND_CFLAGS)			\
 	$(KEYRING_CFLAGS)			\
 	-DGIO_MODULE_DIR=\"$(GIO_MODULE_DIR)\"	\
 	-DGVFS_LOCALEDIR=\""$(localedir)"\"	\
@@ -35,6 +36,7 @@
 	$(UDISKS2_LIBS)                                  			\
 	$(GUDEV_LIBS)                                  			      	\
 	$(LIBSYSTEMD_LOGIN_LIBS)						\
+	$(LIBELOGIND_LIBS)							\
 	$(KEYRING_LIBS)								\
 	$(top_builddir)/common/libgvfscommon.la 			      	\
 	$(top_builddir)/common/libgvfscommon-monitor.la			      	\
--- a/monitor/udisks2/gvfsudisks2utils.c	2017-10-07 16:41:41.402710441 +0200
+++ b/monitor/udisks2/gvfsudisks2utils.c	2017-10-07 16:48:52.320723379 +0200
@@ -530,7 +530,7 @@
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-#if defined(HAVE_LIBSYSTEMD_LOGIN)
+#if defined(HAVE_LIBSYSTEMD_LOGIN) || defined(HAVE_LIBELOGIND)
 #include <systemd/sd-login.h>
 
 static const gchar *
