]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
configure.ac: add check for systemd library and header files
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Mon, 31 Jul 2023 10:27:37 +0000 (15:57 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 4 Aug 2023 17:33:22 +0000 (11:33 -0600)
systemd support is now enabled by default, unless explicitly disabled
during the ./configure by passing --enable-systemd=no. The make may
fail with:
systemd.c:9:10: fatal error: systemd/sd-bus.h: No such file or directory
    9 | #include <systemd/sd-bus.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.

if the host system is missing the systemd library and development files,
due to missing checks for their existence in ./configure.ac. This patch
add them.

Fixes: https://github.com/libcgroup/libcgroup/issues/387
Reported-by: Tomasz Kłoczko <kloczek@github.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
configure.ac

index 442f1b7b9d958c7d41c60271b622592328acba17..91efade8b9c21959f76bd5fff243d2e0a8fdf354 100644 (file)
@@ -236,6 +236,20 @@ if test x$with_pam = xtrue; then
                header files!])])
 fi
 
+if test x$with_systemd = xtrue; then
+       AC_CHECK_LIB([systemd],
+                    [sd_bus_message_new_method_call],
+                    [],
+                    [AC_MSG_ERROR([Cannot compile systemd support without
+                   libsystemd!])])
+
+       AC_CHECK_HEADERS(
+               [systemd/sd-bus.h],
+               [],
+               [AC_MSG_ERROR([Cannot compile systemd support - missing
+              systemd header files!])])
+fi
+
 AX_CODE_COVERAGE
 
 AC_CONFIG_FILES([Makefile