Blame SOURCES/0006-Make-the-dependency-on-systemd-optional.patch

50b851
From e078503fcd9f74ccdd7e6c50c45e5e715f2dcda8 Mon Sep 17 00:00:00 2001
50b851
From: Jakub Filak <jfilak@redhat.com>
50b851
Date: Wed, 4 Feb 2015 06:30:25 +0100
50b851
Subject: [PATCH] Make the dependency on systemd optional
50b851
50b851
Closes #44
50b851
50b851
Signed-off-by: Jakub Filak <jfilak@redhat.com>
50b851
---
50b851
 src/CMakeLists.txt | 16 +++++++++++++---
50b851
 src/abrt-checker.c |  7 ++++++-
50b851
 2 files changed, 19 insertions(+), 4 deletions(-)
50b851
50b851
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
50b851
index a178dcd..1d31602 100644
50b851
--- a/src/CMakeLists.txt
50b851
+++ b/src/CMakeLists.txt
50b851
@@ -1,10 +1,17 @@
50b851
 find_package(JNI REQUIRED)
50b851
 include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
50b851
 
50b851
-pkg_check_modules(PC_JOURNALD REQUIRED libsystemd-journal)
50b851
 include_directories(${PC_LIBREPORT_INCLUDE_DIRS})
50b851
 include_directories(${PC_ABRT_INCLUDE_DIRS})
50b851
-include_directories(${PC_JOURNALD_INCLUDE_DIRS})
50b851
+
50b851
+pkg_check_modules(PC_JOURNALD libsystemd-journal)
50b851
+
50b851
+if (PC_JOURNALD_FOUND)
50b851
+    include_directories(${PC_JOURNALD_INCLUDE_DIRS})
50b851
+    add_definitions(-DHAVE_SYSTEMD=1)
50b851
+else()
50b851
+    add_definitions(-DHAVE_SYSTEMD=0)
50b851
+endif (PC_JOURNALD_FOUND)
50b851
 
50b851
 set(AbrtChecker_SRCS configuration.c abrt-checker.c
50b851
         jthrowable_circular_buf.c jthread_map.c)
50b851
@@ -19,6 +26,9 @@ set_target_properties(
50b851
 
50b851
 target_link_libraries(AbrtChecker ${PC_LIBREPORT_LIBRARIES})
50b851
 target_link_libraries(AbrtChecker ${PC_ABRT_LIBRARIES})
50b851
-target_link_libraries(AbrtChecker ${PC_JOURNALD_LIBRARIES})
50b851
+
50b851
+if (PC_JOURNALD_FOUND)
50b851
+    target_link_libraries(AbrtChecker ${PC_JOURNALD_LIBRARIES})
50b851
+endif (PC_JOURNALD_FOUND)
50b851
 
50b851
 install(TARGETS AbrtChecker DESTINATION ${JNIAGENTLIB_INSTALL_DIR})
50b851
diff --git a/src/abrt-checker.c b/src/abrt-checker.c
50b851
index 930e485..56f2fa4 100644
50b851
--- a/src/abrt-checker.c
50b851
+++ b/src/abrt-checker.c
50b851
@@ -39,9 +39,12 @@
50b851
 #include <linux/limits.h>
50b851
 #include <sys/stat.h>
50b851
 #include <errno.h>
50b851
-#include <systemd/sd-journal.h>
50b851
 #include <syslog.h>
50b851
 
50b851
+#if HAVE_SYSTEMD_JOURNAL
50b851
+#include <systemd/sd-journal.h>
50b851
+#endif
50b851
+
50b851
 /* Shared macros and so on */
50b851
 #include "abrt-checker.h"
50b851
 
50b851
@@ -689,6 +692,7 @@ static void report_stacktrace(
50b851
         syslog(LOG_ERR, "%s\n%s", message, stacktrace);
50b851
     }
50b851
 
50b851
+#if HAVE_SYSTEMD_JOURNAL
50b851
     if (globalConfig.reportErrosTo & ED_JOURNALD)
50b851
     {
50b851
         VERBOSE_PRINT("Reporting stack trace to JournalD\n");
50b851
@@ -698,6 +702,7 @@ static void report_stacktrace(
50b851
                         NULL);
50b851
 
50b851
     }
50b851
+#endif
50b851
 
50b851
     log_print("%s\n", message);
50b851
 
50b851
-- 
50b851
2.4.6
50b851