[syslog-ng] [PATCH] afsocket: Fix compilation with libsystemd-daemon

Gergely Nagy algernon at balabit.hu
Mon Oct 17 00:07:38 CEST 2011


When the libsystemd-daemon library is used, we need to use the header
provided by the library, otherwise linking will likely fail. To do
that, configure sets WITH_LIBSYSTEMD as appropriate, and depending on
that value, we either include <systemd/sd-daemon.h> or "sd-daemon.h".

Signed-off-by: Gergely Nagy <algernon at balabit.hu>
---
 configure.in              |    1 +
 modules/afsocket/afunix.c |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/configure.in b/configure.in
index 13bc874..1e3a09a 100644
--- a/configure.in
+++ b/configure.in
@@ -1059,6 +1059,7 @@ AC_DEFINE_UNQUOTED(ENABLE_LINUX_CAPS, `enable_value $enable_linux_caps`, [Enable
 AC_DEFINE_UNQUOTED(ENABLE_PCRE, `enable_value $enable_pcre`, [Enable PCRE support])
 AC_DEFINE_UNQUOTED(ENABLE_ENV_WRAPPER, `enable_value $enable_env_wrapper`, [Enable environment wrapper support])
 AC_DEFINE_UNQUOTED(ENABLE_SYSTEMD, `enable_value $enable_systemd`, [Enable systemd support])
+AC_DEFINE_UNQUOTED(WITH_LIBSYSTEMD, `enable_value $with_libsystemd`, [Compile with libsystemd-daemon])
 
 AM_CONDITIONAL(ENABLE_ENV_WRAPPER, [test "$enable_env_wrapper" = "yes"])
 AM_CONDITIONAL(ENABLE_SYSTEMD, [test "$enable_systemd" = "yes"])
diff --git a/modules/afsocket/afunix.c b/modules/afsocket/afunix.c
index 57ae213..2d57078 100644
--- a/modules/afsocket/afunix.c
+++ b/modules/afsocket/afunix.c
@@ -25,7 +25,12 @@
 #include "misc.h"
 #include "messages.h"
 #include "gprocess.h"
+
+#if WITH_LIBSYSTEMD
+#include <systemd/sd-daemon.h>
+#else
 #include "sd-daemon.h"
+#endif
 
 #include <string.h>
 #include <sys/types.h>
-- 
1.7.7




More information about the syslog-ng mailing list