]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Makefile: detect corosync and libdlm via pkg-config
authorMaxin John <maxin.john@gmail.com>
Tue, 24 Feb 2026 22:26:42 +0000 (00:26 +0200)
committerMariusz Tkaczyk <mtkaczyk@kernel.org>
Tue, 3 Mar 2026 07:20:27 +0000 (08:20 +0100)
The Makefile currently checks for corosync and libdlm headers by probing
/usr/include directly. This breaks in cross-compilation environments
because the headers may be located in a sysroot rather than the host
filesystem.

Use pkg-config to detect the presence of corosync and libdlm instead.

Signed-off-by: Maxin John <maxin.john@gmail.com>
Makefile

index 8031ce24ff9ac6b778cfba9c1f3066909833029b..43b128e5c535f87dfe195bc99f0bbfbaaefa8d57 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -120,8 +120,8 @@ FAILED_SLOTS_DIR = $(RUN_DIR)/failed-slots
 SYSTEMD_DIR=/lib/systemd/system
 LIB_DIR=/usr/libexec/mdadm
 
-COROSYNC:=$(shell [ -d /usr/include/corosync ] || echo -DNO_COROSYNC)
-DLM:=$(shell [ -f /usr/include/libdlm.h ] || echo -DNO_DLM)
+COROSYNC:=$(shell $(PKG_CONFIG) --exists corosync || echo -DNO_COROSYNC)
+DLM:=$(shell $(PKG_CONFIG) --exists libdlm || echo -DNO_DLM)
 
 DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\"
 DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\"