systemd: Discover and check systemd libraries with pkg-config during configure
authorMartin Willi <martin@revosec.ch>
Fri, 12 Sep 2014 08:29:29 +0000 (10:29 +0200)
committerMartin Willi <martin@revosec.ch>
Mon, 22 Sep 2014 12:19:38 +0000 (14:19 +0200)
configure.ac
src/charon-systemd/Makefile.am

index b4c4d85..9d9a993 100644 (file)
@@ -869,6 +869,16 @@ if test x$xml = xtrue; then
        AC_SUBST(xml_LIBS)
 fi
 
+if test x$systemd = xtrue; then
+       PKG_CHECK_MODULES(systemd_daemon, [libsystemd-daemon])
+       AC_SUBST(systemd_daemon_CFLAGS)
+       AC_SUBST(systemd_daemon_LIBS)
+
+       PKG_CHECK_MODULES(systemd_journal, [libsystemd-journal])
+       AC_SUBST(systemd_journal_CFLAGS)
+       AC_SUBST(systemd_journal_LIBS)
+fi
+
 if test x$tss = xtrousers; then
        AC_CHECK_LIB([tspi],[main],[LIBS="$LIBS"],[AC_MSG_ERROR([TrouSerS library libtspi not found])],[])
        AC_CHECK_HEADER([trousers/tss.h],,[AC_MSG_ERROR([TrouSerS header trousers/tss.h not found!])])
index b9a251f..1b9ac15 100644 (file)
@@ -9,10 +9,11 @@ charon_systemd_CPPFLAGS = \
        -I$(top_srcdir)/src/libstrongswan \
        -I$(top_srcdir)/src/libhydra \
        -I$(top_srcdir)/src/libcharon \
+       $(systemd_daemon_CFLAGS) $(systemd_journal_CFLAGS) \
        -DPLUGINS=\""${charon_plugins}\""
 
 charon_systemd_LDADD = \
        $(top_builddir)/src/libstrongswan/libstrongswan.la \
        $(top_builddir)/src/libhydra/libhydra.la \
        $(top_builddir)/src/libcharon/libcharon.la \
-       -lsystemd-daemon -lsystemd-journal -lm $(PTHREADLIB) $(DLLIB)
+       $(systemd_daemon_LIBS) $(systemd_journal_LIBS) -lm $(PTHREADLIB) $(DLLIB)