[gnome-desktop-testing] Make libsystemd optional again



commit 802cfd283372a1ae3a5d91afe84afb2cbf89912e
Author: Simon McVittie <smcv debian org>
Date:   Thu Dec 21 17:30:32 2017 +0000

    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>

 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 b0d29d3..62bbe58 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)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]