[RFC PATCH 1/6] Find and link libsystemd

Victor Westerhuis victor@westerhu.is
Sun Mar 7 12:49:53 GMT 2021


Signed-off-by: Victor Westerhuis <victor@westerhu.is>
---
 configure.ac           | 12 ++++++++++++
 debuginfod/Makefile.am |  7 +++++++
 2 files changed, 19 insertions(+)

diff --git a/configure.ac b/configure.ac
index aa8439e8..8d52b666 100644
--- a/configure.ac
+++ b/configure.ac
@@ -773,6 +773,17 @@ AS_IF([test "x$enable_debuginfod" != "xno"], [
     if test "x$enable_debuginfod" = "xno"; then
       AC_MSG_ERROR([dependencies not found, use --disable-debuginfod to disable.])
     fi
+
+    AC_ARG_ENABLE([systemd],AC_HELP_STRING([--enable-systemd], [Enable systemd support in debuginfod]))
+    AS_IF([test "x$enable_systemd" != "xno"], [
+        PKG_CHECK_MODULES([libsystemd],[libsystemd],[enable_systemd=yes],[
+            AS_IF([test "x$enable_systemd" = "xyes"], [
+                AC_MSG_ERROR([need libsystemd, use --disable-systemd to disable.])
+            ], [enable_systemd=no])
+        ])
+    ])
+    AS_IF([test "x$enable_systemd" = "xyes"],AC_DEFINE([ENABLE_SYSTEMD],[1],[Enable systemd support]))
+    AM_CONDITIONAL([SYSTEMD],[test "x$enable_systemd" = "xyes"])
 ])
 
 AS_IF([test "x$enable_debuginfod" != "xno"],AC_DEFINE([ENABLE_DEBUGINFOD],[1],[Build debuginfod]))
@@ -823,6 +834,7 @@ AC_MSG_NOTICE([
     Extra Valgrind annotations         : ${use_vg_annotations}
     libdebuginfod client support       : ${enable_libdebuginfod}
     Debuginfod server support          : ${enable_debuginfod}
+    Debuginfod systemd support         : ${enable_systemd}
     Default DEBUGINFOD_URLS            : ${default_debuginfod_urls}
 
   EXTRA TEST FEATURES (used with make check)
diff --git a/debuginfod/Makefile.am b/debuginfod/Makefile.am
index 3adb2755..e7528c3a 100644
--- a/debuginfod/Makefile.am
+++ b/debuginfod/Makefile.am
@@ -35,6 +35,10 @@ AM_CPPFLAGS += -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
 	   $(libmicrohttpd_CFLAGS) $(libcurl_CFLAGS) $(sqlite3_CFLAGS) \
 	   $(libarchive_CFLAGS)
 
+if SYSTEMD
+AM_CPPFLAGS += $(libsystemd_CFLAGS)
+endif
+
 # Disable eu- prefixing for artifacts (binaries & man pages) in this
 # directory, since they do not conflict with binutils tools.
 program_prefix=
@@ -71,6 +75,9 @@ endif
 
 debuginfod_SOURCES = debuginfod.cxx
 debuginfod_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(argp_LDADD) $(fts_LIBS) $(libmicrohttpd_LIBS) $(sqlite3_LIBS) $(libarchive_LIBS) -lpthread -ldl
+if SYSTEMD
+debuginfod_LDADD += $(libsystemd_LIBS)
+endif
 
 debuginfod_find_SOURCES = debuginfod-find.c
 debuginfod_find_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(argp_LDADD) $(fts_LIBS)
-- 
2.30.1


More information about the Elfutils-devel mailing list