[syslog-ng] [PATCH] afsocket: Compile against libsystemd-daemon, if present.

Gergely Nagy algernon at balabit.hu
Tue Aug 30 20:31:31 CEST 2011


systemd v31+ comes with a libsystemd-daemon shared library. If systemd
is enabled, try to detect this library, and use it if present.

Signed-off-by: Gergely Nagy <algernon at balabit.hu>
---
 configure.in                 |    2 ++
 modules/afsocket/Makefile.am |   12 ++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/configure.in b/configure.in
index 2685568..b6c95cf 100644
--- a/configure.in
+++ b/configure.in
@@ -895,6 +895,7 @@ if test "x$enable_systemd" = "xauto"; then
 fi
 
 if test "x$enable_systemd" = "xyes"; then
+	PKG_CHECK_MODULES(libsystemd_daemon, libsystemd-daemon >= 31,with_libsystemd="yes",with_libsystemd="no")
 	if test "x$with_systemdsystemunitdir" = "xyes"; then
 		# no arguments, just --with-systemdsystemunitdir
 		systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd);
@@ -1064,6 +1065,7 @@ AM_CONDITIONAL(ENABLE_SUN_STREAMS, [test "$enable_sun_streams" = "yes"])
 AM_CONDITIONAL(ENABLE_PACCT, [test "$enable_pacct" = "yes"])
 AM_CONDITIONAL(ENABLE_MONGODB, [test "$enable_mongodb" = "yes"])
 AM_CONDITIONAL(ENABLE_JSON, [test "$enable_json" = "yes"])
+AM_CONDITIONAL(WITH_LIBSYSTEMD, [test "$with_libsystemd" = "yes"])
 
 # substitution into manual pages
 expanded_sysconfdir=[`patheval $sysconfdir | sed -e 's/-/\\\\-/g'`]
diff --git a/modules/afsocket/Makefile.am b/modules/afsocket/Makefile.am
index 08ffc19..79f9c99 100644
--- a/modules/afsocket/Makefile.am
+++ b/modules/afsocket/Makefile.am
@@ -3,7 +3,11 @@ AM_CPPFLAGS = -I$(top_srcdir)/lib -I../../lib
 export top_srcdir
 
 if ENABLE_SYSTEMD
+if WITH_LIBSYSTEMD
+SYSTEMD_SOURCES =
+else
 SYSTEMD_SOURCES = sd-daemon.c sd-daemon.h
+endif
 else
 SYSTEMD_SOURCES =
 endif
@@ -14,8 +18,8 @@ libafsocket_notls_la_SOURCES = \
 	afsocket.c afsocket.h afunix.c afunix.h afinet.c afinet.h \
 	afsocket-grammar.y afsocket-parser.c afsocket-parser.h afsocket-plugin.c \
 	$(SYSTEMD_SOURCES)
-libafsocket_notls_la_CPPFLAGS = $(AM_CPPFLAGS)
-libafsocket_notls_la_LIBADD = $(MODULE_DEPS_LIBS) $(LIBNET_LIBS) $(LIBWRAP_LIBS)
+libafsocket_notls_la_CPPFLAGS = $(AM_CPPFLAGS) $(libsystemd_daemon_CFLAGS)
+libafsocket_notls_la_LIBADD = $(MODULE_DEPS_LIBS) $(LIBNET_LIBS) $(LIBWRAP_LIBS) $(libsystemd_daemon_LIBS)
 libafsocket_notls_la_LDFLAGS = $(MODULE_LDFLAGS)
 
 if ENABLE_SSL
@@ -24,8 +28,8 @@ libafsocket_tls_la_SOURCES = \
 	afsocket.c afsocket.h afunix.c afunix.h afinet.c afinet.h \
 	afsocket-grammar.y afsocket-parser.c afsocket-parser.h afsocket-plugin.c \
 	$(SYSTEMD_SOURCES)
-libafsocket_tls_la_CPPFLAGS = $(AM_CPPFLAGS) -DENABLE_SSL=1
-libafsocket_tls_la_LIBADD = $(MODULE_DEPS_LIBS) ../../lib/libsyslog-ng-crypto.la $(OPENSSL_LIBS) $(ZLIB_LIBS) $(LIBNET_LIBS) $(LIBWRAP_LIBS)
+libafsocket_tls_la_CPPFLAGS = $(AM_CPPFLAGS) $(libsystemd_daemon_CFLAGS) -DENABLE_SSL=1
+libafsocket_tls_la_LIBADD = $(MODULE_DEPS_LIBS) ../../lib/libsyslog-ng-crypto.la $(OPENSSL_LIBS) $(ZLIB_LIBS) $(LIBNET_LIBS) $(LIBWRAP_LIBS) $(libsystemd_daemon_LIBS)
 libafsocket_tls_la_LDFLAGS = $(MODULE_LDFLAGS)
 endif
 
-- 
1.7.5.4




More information about the syslog-ng mailing list