[pulseaudio-discuss] [PATCH 2/8] build-sys: Clarify some systemd sub-component variable/define names.

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


In newer versions of systemd some libraries were combined for the sake of
general simplicity.

This change checks against the newer name first and avoids separate pkgconfig
checks if it's found. We probably want to keep support for the older library
names for some time. systemd does allow for the shipping of compatibility
pkgconfig files to not break downstream code like ourselves which is why this
likely hasn't been "fixed" until now.

With this change we no longer rely on systemd having been built with those
compatibility pkgconfig files.
---
 configure.ac         | 32 ++++++++++++++++----------------
 src/Makefile.am      | 10 +++++-----
 src/daemon/cmdline.c |  2 +-
 src/daemon/main.c    |  2 +-
 src/pulsecore/log.c  | 12 ++++++------
 src/pulsecore/log.h  |  2 +-
 6 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/configure.ac b/configure.ac
index 74bea71..177494a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1174,29 +1174,29 @@ AM_CONDITIONAL([HAVE_GCOV], [test "x$HAVE_GCOV" = x1])
 
 ORC_CHECK([0.4.11])
 
-#### systemd support (optional) ####
+#### systemd login support (optional) ####
 
-AC_ARG_ENABLE([systemd],
-    AS_HELP_STRING([--disable-systemd],[Disable optional systemd support]))
+AC_ARG_ENABLE([systemd-login],
+    AS_HELP_STRING([--disable-systemd-login],[Disable optional systemd login support]))
 
-AS_IF([test "x$enable_systemd" != "xno"],
-    [PKG_CHECK_MODULES(SYSTEMD, [ libsystemd-login ], HAVE_SYSTEMD=1, HAVE_SYSTEMD=0)],
-    HAVE_SYSTEMD=0)
+AS_IF([test "x$enable_systemd_login" != "xno"],
+    [PKG_CHECK_MODULES(SYSTEMDLOGIN, [ libsystemd-login ], HAVE_SYSTEMD_LOGIN=1, HAVE_SYSTEMD_LOGIN=0)],
+    HAVE_SYSTEMD_LOGIN=0)
 
-AS_IF([test "x$enable_systemd" = "xyes" && test "x$HAVE_SYSTEMD" = "x0"],
-    [AC_MSG_ERROR([*** Needed systemd support not found])])
+AS_IF([test "x$enable_systemd_login" = "xyes" && test "x$HAVE_SYSTEMD_LOGIN" = "x0"],
+    [AC_MSG_ERROR([*** Needed systemd login support not found])])
 
-AC_SUBST(HAVE_SYSTEMD)
-AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$HAVE_SYSTEMD" = x1])
-AS_IF([test "x$HAVE_SYSTEMD" = "x1"], AC_DEFINE([HAVE_SYSTEMD], 1, [Have SYSTEMD?]))
+AC_SUBST(HAVE_SYSTEMD_LOGIN)
+AM_CONDITIONAL([HAVE_SYSTEMD_LOGIN], [test "x$HAVE_SYSTEMD_LOGIN" = x1])
+AS_IF([test "x$HAVE_SYSTEMD_LOGIN" = "x1"], AC_DEFINE([HAVE_SYSTEMD_LOGIN], 1, [Have SYSTEMDLOGIN?]))
 
-#### journal support (optional) ####
+#### 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(JOURNAL, [ libsystemd-journal ], HAVE_SYSTEMD_JOURNAL=1, HAVE_SYSTEMD_JOURNAL=0)],
+    [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"],
@@ -1204,7 +1204,7 @@ AS_IF([test "x$enable_systemd_journal" = "xyes" && test "x$HAVE_SYSTEMD_JOURNAL"
 
 AC_SUBST(HAVE_SYSTEMD_JOURNAL)
 AM_CONDITIONAL([HAVE_SYSTEMD_JOURNAL], [test "x$HAVE_SYSTEMD_JOURNAL" = x1])
-AS_IF([test "x$HAVE_SYSTEMD_JOURNAL" = "x1"], AC_DEFINE([HAVE_JOURNAL], 1, [Have JOURNAL?]))
+AS_IF([test "x$HAVE_SYSTEMD_JOURNAL" = "x1"], AC_DEFINE([HAVE_SYSTEMD_JOURNAL], 1, [Have SYSTEMDJOURNAL?]))
 
 #### Build and Install man pages ####
 
@@ -1455,7 +1455,7 @@ AS_IF([test "x$HAVE_LIRC" = "x1"], ENABLE_LIRC=yes, ENABLE_LIRC=no)
 AS_IF([test "x$HAVE_XEN" = "x1"], ENABLE_XEN=yes, ENABLE_XEN=no)
 AS_IF([test "x$HAVE_DBUS" = "x1"], ENABLE_DBUS=yes, ENABLE_DBUS=no)
 AS_IF([test "x$HAVE_UDEV" = "x1"], ENABLE_UDEV=yes, ENABLE_UDEV=no)
-AS_IF([test "x$HAVE_SYSTEMD" = "x1"], ENABLE_SYSTEMD=yes, ENABLE_SYSTEMD=no)
+AS_IF([test "x$HAVE_SYSTEMD_LOGIN" = "x1"], ENABLE_SYSTEMD_LOGIN=yes, ENABLE_SYSTEMD_LOGIN=no)
 AS_IF([test "x$HAVE_SYSTEMD_JOURNAL" = "x1"], ENABLE_SYSTEMD_JOURNAL=yes, ENABLE_SYSTEMD_JOURNAL=no)
 AS_IF([test "x$HAVE_BLUEZ_4" = "x1"], ENABLE_BLUEZ_4=yes, ENABLE_BLUEZ_4=no)
 AS_IF([test "x$HAVE_BLUEZ_5" = "x1"], ENABLE_BLUEZ_5=yes, ENABLE_BLUEZ_5=no)
@@ -1516,7 +1516,7 @@ echo "
         headset backend:           ${BLUETOOTH_HEADSET_BACKEND}
     Enable udev:                   ${ENABLE_UDEV}
       Enable HAL->udev compat:     ${ENABLE_HAL_COMPAT}
-    Enable systemd login:          ${ENABLE_SYSTEMD}
+    Enable systemd login:          ${ENABLE_SYSTEMD_LOGIN}
     Enable systemd journal:        ${ENABLE_SYSTEMD_JOURNAL}
     Enable TCP Wrappers:           ${ENABLE_TCPWRAP}
     Enable libsamplerate:          ${ENABLE_LIBSAMPLERATE}
diff --git a/src/Makefile.am b/src/Makefile.am
index 8d49af3..0391fa4 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 += $(JOURNAL_FLAGS)
-libpulsecommon_ at PA_MAJORMINOR@_la_LDFLAGS += $(JOURNAL_LIBS)
+libpulsecommon_ at PA_MAJORMINOR@_la_CFLAGS += $(SYSTEMDJOURNAL_FLAGS)
+libpulsecommon_ at PA_MAJORMINOR@_la_LDFLAGS += $(SYSTEMDJOURNAL_LIBS)
 endif
 
 # proplist-util.h uses these header files, but not the library itself!
@@ -1354,7 +1354,7 @@ modlibexec_LTLIBRARIES += \
 		module-udev-detect.la
 endif
 
-if HAVE_SYSTEMD
+if HAVE_SYSTEMD_LOGIN
 modlibexec_LTLIBRARIES += \
 		module-systemd-login.la
 endif
@@ -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) $(SYSTEMD_LIBS)
-module_systemd_login_la_CFLAGS = $(AM_CFLAGS) $(SYSTEMD_CFLAGS)
+module_systemd_login_la_LIBADD = $(MODULE_LIBADD) $(SYSTEMDLOGIN_LIBS)
+module_systemd_login_la_CFLAGS = $(AM_CFLAGS) $(SYSTEMDLOGIN_CFLAGS)
 
 # GConf support
 module_gconf_la_SOURCES = modules/gconf/module-gconf.c
diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c
index 68579c5..2ffc61f 100644
--- a/src/daemon/cmdline.c
+++ b/src/daemon/cmdline.c
@@ -323,7 +323,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d
 
             case ARG_LOG_TARGET:
                 if (pa_daemon_conf_set_log_target(conf, optarg) < 0) {
-#ifdef HAVE_JOURNAL
+#ifdef HAVE_SYSTEMD_JOURNAL
                     pa_log(_("Invalid log target: use either 'syslog', 'journal','stderr' or 'auto' or a valid file name 'file:<path>', 'newfile:<path>'."));
 #else
                     pa_log(_("Invalid log target: use either 'syslog', 'stderr' or 'auto' or a valid file name 'file:<path>', 'newfile:<path>'."));
diff --git a/src/daemon/main.c b/src/daemon/main.c
index 4fd245a..642e04d 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -788,7 +788,7 @@ int main(int argc, char *argv[]) {
 #endif
 
         if (!conf->log_target) {
-#ifdef HAVE_JOURNAL
+#ifdef HAVE_SYSTEMD_JOURNAL
             pa_log_target target = { .type = PA_LOG_JOURNAL, .file = NULL };
 #else
             pa_log_target target = { .type = PA_LOG_SYSLOG, .file = NULL };
diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c
index cf96dce..9e29c78 100644
--- a/src/pulsecore/log.c
+++ b/src/pulsecore/log.c
@@ -40,7 +40,7 @@
 #include <syslog.h>
 #endif
 
-#ifdef HAVE_JOURNAL
+#ifdef HAVE_SYSTEMD_JOURNAL
 #include <systemd/sd-journal.h>
 #endif
 
@@ -96,7 +96,7 @@ static const int level_to_syslog[] = {
 
 /* These are actually equivalent to the syslog ones
  * but we don't want to depend on syslog.h */
-#ifdef HAVE_JOURNAL
+#ifdef HAVE_SYSTEMD_JOURNAL
 static const int level_to_journal[] = {
     [PA_LOG_ERROR]  = 3,
     [PA_LOG_WARN]   = 4,
@@ -145,7 +145,7 @@ int pa_log_set_target(pa_log_target *t) {
     switch (t->type) {
         case PA_LOG_STDERR:
         case PA_LOG_SYSLOG:
-#ifdef HAVE_JOURNAL
+#ifdef HAVE_SYSTEMD_JOURNAL
         case PA_LOG_JOURNAL:
 #endif
         case PA_LOG_NULL:
@@ -488,7 +488,7 @@ void pa_log_levelv_meta(
                 break;
 #endif
 
-#ifdef HAVE_JOURNAL
+#ifdef HAVE_SYSTEMD_JOURNAL
             case PA_LOG_JOURNAL:
                 if (sd_journal_send("MESSAGE=%s", t,
                                 "PRIORITY=%i", level_to_journal[level],
@@ -619,7 +619,7 @@ pa_log_target *pa_log_parse_target(const char *string) {
         t = pa_log_target_new(PA_LOG_STDERR, NULL);
     else if (pa_streq(string, "syslog"))
         t = pa_log_target_new(PA_LOG_SYSLOG, NULL);
-#ifdef HAVE_JOURNAL
+#ifdef HAVE_SYSTEMD_JOURNAL
     else if (pa_streq(string, "journal"))
         t = pa_log_target_new(PA_LOG_JOURNAL, NULL);
 #endif
@@ -647,7 +647,7 @@ char *pa_log_target_to_string(const pa_log_target *t) {
         case PA_LOG_SYSLOG:
             string = pa_xstrdup("syslog");
             break;
-#ifdef HAVE_JOURNAL
+#ifdef HAVE_SYSTEMD_JOURNAL
         case PA_LOG_JOURNAL:
             string = pa_xstrdup("journal");
             break;
diff --git a/src/pulsecore/log.h b/src/pulsecore/log.h
index 5e9611d..14ae857 100644
--- a/src/pulsecore/log.h
+++ b/src/pulsecore/log.h
@@ -35,7 +35,7 @@
 typedef enum pa_log_target_type {
     PA_LOG_STDERR,      /* default */
     PA_LOG_SYSLOG,
-#ifdef HAVE_JOURNAL
+#ifdef HAVE_SYSTEMD_JOURNAL
     PA_LOG_JOURNAL,     /* systemd journal */
 #endif
     PA_LOG_NULL,        /* to /dev/null */
-- 
2.1.2



More information about the pulseaudio-discuss mailing list