--- a/config.h.in 2017-06-01 13:38:32.406980179 +0200 +++ b/config.h.in 2017-06-01 13:38:46.546980454 +0200 @@ -144,6 +144,9 @@ /* Version number of package */ #undef VERSION +/* Define to enable elogind support */ +#undef WITH_ELOGIND + /* Define to enable systemd support */ #undef WITH_SYSTEMD --- a/configure.ac 2017-06-01 13:06:23.669942591 +0200 +++ b/configure.ac 2017-06-01 13:20:51.570959505 +0200 @@ -264,6 +264,39 @@ dnl --------------------------------------------------------------------------- AC_PATH_PROG([XSLTPROC], [xsltproc]) +# elogind + +have_elogind=no + +AC_MSG_CHECKING([whether to use elogind]) + +AC_ARG_ENABLE([elogind], + AS_HELP_STRING([--enable-elogind], [Use elogind]), + [enable_elogind=$enableval]) + +AC_MSG_RESULT($enable_elogind) + +if test "x$enable_elogind" != "xno"; then + PKG_CHECK_MODULES(ELOGIND, [libelogind >= 219], + [have_elogind=yes], + [have_elogind=no]) +fi + +if test "x$enable_elogind" != "xno"; then + if test "x$have_elogind" != "xyes"; then + AC_MSG_ERROR([elogind support explicitly required, but libelogind not found]) + else + AC_SUBST(ELOGIND_CFLAGS) + AC_SUBST(ELOGIND_LIBS) + + LIBACCOUNTSSERVICE_LIBS="$LIBACCOUNTSSERVICE_LIBS $ELOGIND_LIBS" + LIBACCOUNTSSERVICE_CFLAGS="$LIBACCOUNTSSERVICE_CFLAGS $ELOGIND_CFLAGS" + + AC_DEFINE(WITH_ELOGIND, 1, [Define to enable elogind support]) + fi +fi + + # systemd AC_ARG_ENABLE([systemd], @@ -272,8 +305,15 @@ [enable_systemd=auto]) if test x$enable_systemd != xno; then - PKG_CHECK_MODULES(SYSTEMD, [libsystemd >= 186], - [have_systemd=yes], [have_systemd=no]) + if test "x$enable_elogind" != "xno"; then + AC_MSG_NOTICE([Systemd support requested, but elogind found]) + have_systemd=no + enable_systemd=no + else + PKG_CHECK_MODULES(SYSTEMD, [libsystemd >= 186], + [have_systemd=yes], + [have_systemd=no]) + fi else have_systemd=no fi --- a/src/libaccountsservice/act-user-manager.c 2017-06-01 13:06:17.869942478 +0200 +++ b/src/libaccountsservice/act-user-manager.c 2017-06-01 13:19:09.037957507 +0200 @@ -43,8 +43,16 @@ #ifdef WITH_SYSTEMD #include +#endif + +#ifdef WITH_ELOGIND +#include +/* Re-Use WITH_SYSTEMD as elogind substitutes systemd-login */ +#define WITH_SYSTEMD 1 +#endif /* check if logind is running */ +#ifdef WITH_SYSTEMD #define LOGIND_RUNNING() (access("/run/systemd/seats/", F_OK) >= 0) #endif