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

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