[dm-devel] [PATCH 3/4] multipath-tools: autodiscover libudev.h headers

Sergei Trofimovich slyich at gmail.com
Sun Jan 9 10:29:07 UTC 2022


On NixOS nothing is installed in /usr/include and instead lives
in it's own prefix. pkg-config variables are expected to be used
for installation discovery:

    $ pkg-config --variable=includedir libudev
    /nix/store/27mwkz5zhzw0gip8y7pvjyma5r0hzzaw-systemd-249.7-dev/include

The change switches libudev.h discovery to pkg-config provided path.

CC: Martin Wilck <mwilck at suse.com>
CC: Benjamin Marzinski <bmarzins at redhat.com>
Signed-off-by: Sergei Trofimovich <slyich at gmail.com>
---
 Makefile.inc          | 8 ++++++++
 libmultipath/Makefile | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Makefile.inc b/Makefile.inc
index 3b50395f..f5509db4 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -60,6 +60,14 @@ ifndef DEVMAPPER_INCDIR
 	endif
 endif
 
+ifndef LIBUDEV_INCDIR
+	ifeq ($(shell $(PKGCONFIG) --modversion libudev >/dev/null 2>&1 && echo 1), 1)
+		LIBUDEV_INCDIR = $(shell $(PKGCONFIG) --variable=includedir libudev)
+	else
+		LIBUDEV_INCDIR = /usr/include
+	endif
+endif
+
 prefix		=
 exec_prefix	= $(prefix)
 usr_prefix	= $(prefix)
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index be48775d..46972faf 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -33,7 +33,7 @@ ifneq ($(call check_func,dm_task_set_cookie,$(DEVMAPPER_INCDIR)/libdevmapper.h),
 	CFLAGS += -DLIBDM_API_COOKIE
 endif
 
-ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,/usr/include/libudev.h),0)
+ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,$(LIBUDEV_INCDIR)/libudev.h),0)
 	CFLAGS += -DLIBUDEV_API_RECVBUF
 endif
 
-- 
2.34.1




More information about the dm-devel mailing list