1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
From: Simon McVittie <smcv@debian.org>
Date: Thu, 21 Dec 2017 17:30:32 +0000
Subject: Make libsystemd optional again
As much as I'd like to stop supporting non-systemd Linux systems, some
people get very upset by the suggestion that systemd is mandatory on
Linux, and it isn't portable to non-Linux in any case.
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=788470
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>
Applied-upstream: 2018.2, commit:802cfd283372a1ae3a5d91afe84afb2cbf89912e
---
Makefile-tests.am | 4 ++--
configure.ac | 4 +++-
src/gnome-desktop-testing-runner.c | 9 +++++++++
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/Makefile-tests.am b/Makefile-tests.am
index 02585f1..f91c13d 100644
--- a/Makefile-tests.am
+++ b/Makefile-tests.am
@@ -18,5 +18,5 @@
bin_PROGRAMS += gnome-desktop-testing-runner
gnome_desktop_testing_runner_SOURCES = src/gnome-desktop-testing-runner.c
gnome_desktop_testing_runner_CPPFLAGS = $(AM_CPPFLAGS)
-gnome_desktop_testing_runner_CFLAGS = $(BUILDDEP_GDT_CFLAGS)
-gnome_desktop_testing_runner_LDADD = $(BUILDDEP_GDT_LIBS)
+gnome_desktop_testing_runner_CFLAGS = $(BUILDDEP_GDT_CFLAGS) $(SYSTEMD_CFLAGS)
+gnome_desktop_testing_runner_LDADD = $(BUILDDEP_GDT_LIBS) $(SYSTEMD_LIBS)
diff --git a/configure.ac b/configure.ac
index 7718329..82dc535 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,7 +27,9 @@ AC_SUBST(WARN_CFLAGS)
LT_PREREQ([2.2.4])
LT_INIT([disable-static])
-PKG_CHECK_MODULES(BUILDDEP_GDT, [gio-unix-2.0 >= 2.34.0 libsystemd])
+PKG_CHECK_MODULES(BUILDDEP_GDT, [gio-unix-2.0 >= 2.34.0])
+PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [have_systemd=yes], [have_systemd=no])
+AS_IF([test "x$have_systemd" = xyes], [AC_DEFINE([HAVE_SYSTEMD], [1], [Define if you have libsystemd])])
GIO_UNIX_CFLAGS="$GIO_UNIX_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_36 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36"
AC_CONFIG_FILES([
diff --git a/src/gnome-desktop-testing-runner.c b/src/gnome-desktop-testing-runner.c
index 62e5d5e..5e53511 100644
--- a/src/gnome-desktop-testing-runner.c
+++ b/src/gnome-desktop-testing-runner.c
@@ -27,7 +27,10 @@
#include <errno.h>
#include <sys/time.h>
#include <sys/resource.h>
+
+#ifdef HAVE_SYSTEMD
#include <systemd/sd-journal.h>
+#endif
#define TEST_SKIP_ECODE 77
@@ -86,6 +89,7 @@ test_log (TestLog what,
message = g_strdup_vprintf (format, ap);
va_end (ap);
+#ifdef HAVE_SYSTEMD
if (test_name)
sd_journal_send ("MESSAGE_ID=%s", msgid,
"GDTR_TEST=%s", test_name,
@@ -95,6 +99,11 @@ test_log (TestLog what,
sd_journal_send ("MESSAGE_ID=%s", msgid,
"MESSAGE=%s", message,
NULL);
+#else
+ /* we can't log this to the Journal, so do *something* with it */
+ if (what == TEST_LOG_ARBITRARY)
+ g_printerr ("%s: %s\n", msgid, message);
+#endif
if (!opt_quiet)
{
|