summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2015-03-31 08:38:52 +0100
committerColin Walters <walters@verbum.org>2015-03-31 08:53:52 -0400
commit2291767a014f5a04a92ca6f0eb472794f212ca67 (patch)
treedf95c18bd0b6e4a65f12108f3d5b984a0f0a0aeb
parentf4d71e0de885010494b8b0b8d62ca910011d7544 (diff)
downloadpolkit-2291767a014f5a04a92ca6f0eb472794f212ca67.tar.gz
Use libsystemd instead of older libsystemd-login if possible
The command-line option is still --enable-libsystemd-login for now. Bug-Debian: https://bugs.debian.org/779756
-rw-r--r--configure.ac42
-rw-r--r--src/polkit/Makefile.am6
-rw-r--r--src/polkitbackend/Makefile.am6
-rw-r--r--src/polkitbackend/polkitbackendjsauthority.c8
4 files changed, 35 insertions, 27 deletions
diff --git a/configure.ac b/configure.ac
index e783ea5..d9a97bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -187,39 +187,47 @@ dnl ---------------------------------------------------------------------------
dnl - Select wether to use libsystemd-login or ConsoleKit for session tracking
dnl ---------------------------------------------------------------------------
-have_libsystemd_login=no
+have_libsystemd=no
SESSION_TRACKING=ConsoleKit
AC_ARG_ENABLE([libsystemd-login],
- AS_HELP_STRING([--enable-libsystemd-login[=@<:@auto/yes/no@:>@]], [Use libsystemd-login (auto/yes/no)]),
+ [AS_HELP_STRING([--enable-libsystemd-login[=@<:@auto/yes/no@:>@]], [Use libsystemd (auto/yes/no)])],
[enable_libsystemd_login=$enableval],
[enable_libsystemd_login=auto])
if test "$enable_libsystemd_login" != "no"; then
- PKG_CHECK_MODULES(LIBSYSTEMD_LOGIN,
- [libsystemd-login],
- have_libsystemd_login=yes,
- have_libsystemd_login=no)
- if test "$have_libsystemd_login" = "yes"; then
+ PKG_CHECK_MODULES([LIBSYSTEMD],
+ [libsystemd],
+ [have_libsystemd=yes],
+ dnl if libsystemd is not available, fall back to the older libsystemd-login
+ [PKG_CHECK_MODULES([LIBSYSTEMD_LOGIN],
+ [libsystemd-login],
+ [
+ have_libsystemd=yes
+ LIBSYSTEMD_CFLAGS="$LIBSYSTEMD_LOGIN_CFLAGS"
+ LIBSYSTEMD_LIBS="$LIBSYSTEMD_LOGIN_LIBS"
+ ],
+ [have_libsystemd=no])])
+ if test "$have_libsystemd" = "yes"; then
SESSION_TRACKING=libsystemd-login
- AC_DEFINE([HAVE_LIBSYSTEMD_LOGIN], 1, [Define to 1 if libsystemd-login is available])
+ AC_DEFINE([HAVE_LIBSYSTEMD], 1, [Define to 1 if libsystemd is available])
save_LIBS=$LIBS
- LIBS=$LIBSYSTEMD_LOGIN_LIBS
+ LIBS=$LIBSYSTEMD_LIBS
AC_CHECK_FUNCS(sd_uid_get_display)
LIBS=$save_LIBS
else
if test "$enable_libsystemd_login" = "yes"; then
- AC_MSG_ERROR([libsystemd-login support requested but libsystemd-login library not found])
+ AC_MSG_ERROR([libsystemd support requested but libsystemd or libsystemd-login library not found])
fi
fi
fi
AS_IF([test "x$cross_compiling" != "xyes" ], [
- AS_IF([test "$have_libsystemd_login" = "yes"], [
+ AS_IF([test "$have_libsystemd" = "yes"], [
AS_IF([test ! -d /sys/fs/cgroup/systemd/ ], [
AS_IF([test "$enable_libsystemd_login" = "yes"], [
- AC_MSG_WARN([libsystemd-login requested but system does not appear to be using systemd])
+ AC_MSG_WARN([libsystemd requested but system does not appear to be using systemd])
], [
- AC_MSG_ERROR([libsystemd-login autoconfigured, but system does not appear to use systemd])
+ AC_MSG_ERROR([libsystemd autoconfigured, but system does not appear to use systemd])
])
])
], [
@@ -227,15 +235,15 @@ AS_IF([test "x$cross_compiling" != "xyes" ], [
AS_IF([test "$enable_libsystemd_login" = "no" ], [
AC_MSG_WARN([ConsoleKit requested but system appears to use systemd])
], [
- AC_MSG_ERROR([ConsoleKit autoconfigured, but systemd is in use (missing libsystemd-login pkg-config?)])
+ AC_MSG_ERROR([ConsoleKit autoconfigured, but systemd is in use (missing libsystemd or libsystemd-login pkg-config?)])
])
])
])
])
-AC_SUBST(LIBSYSTEMD_LOGIN_CFLAGS)
-AC_SUBST(LIBSYSTEMD_LOGIN_LIBS)
-AM_CONDITIONAL(HAVE_LIBSYSTEMD_LOGIN, [test "$have_libsystemd_login" = "yes"], [Using libsystemd-login])
+AC_SUBST(LIBSYSTEMD_CFLAGS)
+AC_SUBST(LIBSYSTEMD_LIBS)
+AM_CONDITIONAL(HAVE_LIBSYSTEMD, [test "$have_libsystemd" = "yes"], [Using libsystemd])
dnl ---------------------------------------------------------------------------
dnl - systemd unit / service files
diff --git a/src/polkit/Makefile.am b/src/polkit/Makefile.am
index d648d29..5f08bb2 100644
--- a/src/polkit/Makefile.am
+++ b/src/polkit/Makefile.am
@@ -81,7 +81,7 @@ libpolkit_gobject_1_la_SOURCES = \
polkitpermission.c polkitpermission.h \
$(NULL)
-if HAVE_LIBSYSTEMD_LOGIN
+if HAVE_LIBSYSTEMD
libpolkit_gobject_1_la_SOURCES += \
polkitunixsession-systemd.c polkitunixsession.h
else
@@ -92,12 +92,12 @@ endif
libpolkit_gobject_1_la_CFLAGS = \
-D_POLKIT_COMPILATION \
$(GLIB_CFLAGS) \
- $(LIBSYSTEMD_LOGIN_CFLAGS) \
+ $(LIBSYSTEMD_CFLAGS) \
$(NULL)
libpolkit_gobject_1_la_LIBADD = \
$(GLIB_LIBS) \
- $(LIBSYSTEMD_LOGIN_LIBS) \
+ $(LIBSYSTEMD_LIBS) \
$(NULL)
libpolkit_gobject_1_la_LDFLAGS = -export-symbols-regex '(^polkit_.*)'
diff --git a/src/polkitbackend/Makefile.am b/src/polkitbackend/Makefile.am
index 9f430d0..5120e82 100644
--- a/src/polkitbackend/Makefile.am
+++ b/src/polkitbackend/Makefile.am
@@ -38,7 +38,7 @@ libpolkit_backend_1_la_SOURCES = \
polkitbackendactionlookup.h polkitbackendactionlookup.c \
$(NULL)
-if HAVE_LIBSYSTEMD_LOGIN
+if HAVE_LIBSYSTEMD
libpolkit_backend_1_la_SOURCES += \
polkitbackendsessionmonitor.h polkitbackendsessionmonitor-systemd.c
else
@@ -50,13 +50,13 @@ libpolkit_backend_1_la_CFLAGS = \
-D_POLKIT_COMPILATION \
-D_POLKIT_BACKEND_COMPILATION \
$(GLIB_CFLAGS) \
- $(LIBSYSTEMD_LOGIN_CFLAGS) \
+ $(LIBSYSTEMD_CFLAGS) \
$(LIBJS_CFLAGS) \
$(NULL)
libpolkit_backend_1_la_LIBADD = \
$(GLIB_LIBS) \
- $(LIBSYSTEMD_LOGIN_LIBS) \
+ $(LIBSYSTEMD_LIBS) \
$(top_builddir)/src/polkit/libpolkit-gobject-1.la \
$(EXPAT_LIBS) \
$(LIBJS_LIBS) \
diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c
index c507595..d18b5b1 100644
--- a/src/polkitbackend/polkitbackendjsauthority.c
+++ b/src/polkitbackend/polkitbackendjsauthority.c
@@ -35,9 +35,9 @@
#include <polkit/polkitprivate.h>
-#ifdef HAVE_LIBSYSTEMD_LOGIN
+#ifdef HAVE_LIBSYSTEMD
#include <systemd/sd-login.h>
-#endif /* HAVE_LIBSYSTEMD_LOGIN */
+#endif /* HAVE_LIBSYSTEMD */
#include <jsapi.h>
@@ -764,7 +764,7 @@ subject_to_jsval (PolkitBackendJsAuthority *authority,
g_assert_not_reached ();
}
-#ifdef HAVE_LIBSYSTEMD_LOGIN
+#ifdef HAVE_LIBSYSTEMD
if (sd_pid_get_session (pid, &session_str) == 0)
{
if (sd_session_get_seat (session_str, &seat_str) == 0)
@@ -772,7 +772,7 @@ subject_to_jsval (PolkitBackendJsAuthority *authority,
/* do nothing */
}
}
-#endif /* HAVE_LIBSYSTEMD_LOGIN */
+#endif /* HAVE_LIBSYSTEMD */
g_assert (POLKIT_IS_UNIX_USER (user_for_subject));
uid = polkit_unix_user_get_uid (POLKIT_UNIX_USER (user_for_subject));