[pulseaudio-discuss] [PATCH 3/8] build-sys: Add support for newer systemd without compatibility libs

Colin Guthrie colin at mageia.org
Sat Oct 18 11:43:26 PDT 2014


When systemd is built without compatibility libs, we only need to do one
pkgconfig check (libsystemd) rather than for libsystemd-login and
libsystemd-journal separately.

This change should allow building with both older and newer versions of
systemd.
---
 configure.ac    | 27 +++++++++++++++++++++------
 src/Makefile.am |  8 ++++----
 2 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index 177494a..dbe7c2f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1174,13 +1174,31 @@ AM_CONDITIONAL([HAVE_GCOV], [test "x$HAVE_GCOV" = x1])
 
 ORC_CHECK([0.4.11])
 
-#### systemd login support (optional) ####
+#### systemd support (optional) ####
 
 AC_ARG_ENABLE([systemd-login],
     AS_HELP_STRING([--disable-systemd-login],[Disable optional systemd login support]))
 
+AC_ARG_ENABLE([systemd-journal],
+    AS_HELP_STRING([--disable-systemd-journal],[Disable optional systemd journal support]))
+
+# Newer systemd's combine their subcomponent libraries into one
+# If it exists, we should use it for the further checks
+
+AS_IF([test "x$enable_systemd_login" != "xno" || test "x$enable_systemd_journal" != "xno"],
+    [PKG_CHECK_MODULES(SYSTEMD, [ libsystemd ], HAVE_SYSTEMD=1, HAVE_SYSTEMD=0)],
+    HAVE_SYSTEMD=0)
+
+AS_IF([test "x$HAVE_SYSTEMD" = "x1"],
+    [
+        HAVE_SYSTEMD_LOGIN=1
+        HAVE_SYSTEMD_JOURNAL=1
+    ])
+
+#### systemd login support (optional) ####
+
 AS_IF([test "x$enable_systemd_login" != "xno"],
-    [PKG_CHECK_MODULES(SYSTEMDLOGIN, [ libsystemd-login ], HAVE_SYSTEMD_LOGIN=1, HAVE_SYSTEMD_LOGIN=0)],
+    [AS_IF([test "x$HAVE_SYSTEMD_LOGIN" != "x1"], [PKG_CHECK_MODULES(SYSTEMDLOGIN, [ libsystemd-login ], HAVE_SYSTEMD_LOGIN=1, HAVE_SYSTEMD_LOGIN=0)])],
     HAVE_SYSTEMD_LOGIN=0)
 
 AS_IF([test "x$enable_systemd_login" = "xyes" && test "x$HAVE_SYSTEMD_LOGIN" = "x0"],
@@ -1192,11 +1210,8 @@ AS_IF([test "x$HAVE_SYSTEMD_LOGIN" = "x1"], AC_DEFINE([HAVE_SYSTEMD_LOGIN], 1, [
 
 #### systemd journal support (optional) ####
 
-AC_ARG_ENABLE([systemd-journal],
-    AS_HELP_STRING([--disable-systemd-journal],[Disable optional systemd journal support]))
-
 AS_IF([test "x$enable_systemd_journal" != "xno"],
-    [PKG_CHECK_MODULES(SYSTEMDJOURNAL, [ libsystemd-journal ], HAVE_SYSTEMD_JOURNAL=1, HAVE_SYSTEMD_JOURNAL=0)],
+    [AS_IF([test "x$HAVE_SYSTEMD_JOURNAL" != "x1"], [PKG_CHECK_MODULES(SYSTEMDJOURNAL, [ libsystemd-journal ], HAVE_SYSTEMD_JOURNAL=1, HAVE_SYSTEMD_JOURNAL=0)])],
     HAVE_SYSTEMD_JOURNAL=0)
 
 AS_IF([test "x$enable_systemd_journal" = "xyes" && test "x$HAVE_SYSTEMD_JOURNAL" = "x0"],
diff --git a/src/Makefile.am b/src/Makefile.am
index 0391fa4..248b2ab 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -707,8 +707,8 @@ libpulsecommon_ at PA_MAJORMINOR@_la_LDFLAGS += $(X11_LIBS)
 endif
 
 if HAVE_SYSTEMD_JOURNAL
-libpulsecommon_ at PA_MAJORMINOR@_la_CFLAGS += $(SYSTEMDJOURNAL_FLAGS)
-libpulsecommon_ at PA_MAJORMINOR@_la_LDFLAGS += $(SYSTEMDJOURNAL_LIBS)
+libpulsecommon_ at PA_MAJORMINOR@_la_CFLAGS += $(SYSTEMD_FLAGS) $(SYSTEMDJOURNAL_FLAGS)
+libpulsecommon_ at PA_MAJORMINOR@_la_LDFLAGS += $(SYSTEMD_LIBS) $(SYSTEMDJOURNAL_LIBS)
 endif
 
 # proplist-util.h uses these header files, but not the library itself!
@@ -2062,8 +2062,8 @@ module_console_kit_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
 
 module_systemd_login_la_SOURCES = modules/module-systemd-login.c
 module_systemd_login_la_LDFLAGS = $(MODULE_LDFLAGS)
-module_systemd_login_la_LIBADD = $(MODULE_LIBADD) $(SYSTEMDLOGIN_LIBS)
-module_systemd_login_la_CFLAGS = $(AM_CFLAGS) $(SYSTEMDLOGIN_CFLAGS)
+module_systemd_login_la_LIBADD = $(MODULE_LIBADD) $(SYSTEMD_LIBS) $(SYSTEMDLOGIN_LIBS)
+module_systemd_login_la_CFLAGS = $(AM_CFLAGS) $(SYSTEMD_CFLAGS) $(SYSTEMDLOGIN_CFLAGS)
 
 # GConf support
 module_gconf_la_SOURCES = modules/gconf/module-gconf.c
-- 
2.1.2



More information about the pulseaudio-discuss mailing list