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>
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)\"