[PATCH 2/4] multipath-tools: autodiscover libdevmapper.h headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 devmapper
    /nix/store/c30fr0ahpa285sjkjgiinc2rr68ysmid-lvm2-2.03.14-dev/include

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

CC: Martin Wilck <mwilck@xxxxxxxx>
CC: Benjamin Marzinski <bmarzins@xxxxxxxxxx>
Signed-off-by: Sergei Trofimovich <slyich@xxxxxxxxx>
---
 Makefile.inc          |  8 ++++++++
 kpartx/Makefile       |  2 +-
 libmultipath/Makefile | 10 +++++-----
 multipathd/Makefile   |  2 +-
 4 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/Makefile.inc b/Makefile.inc
index 59856f24..3b50395f 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -52,6 +52,14 @@ ifndef SYSTEMDPATH
 	SYSTEMDPATH=usr/lib
 endif
 
+ifndef DEVMAPPER_INCDIR
+	ifeq ($(shell $(PKGCONFIG) --modversion devmapper >/dev/null 2>&1 && echo 1), 1)
+		DEVMAPPER_INCDIR = $(shell $(PKGCONFIG) --variable=includedir devmapper)
+	else
+		DEVMAPPER_INCDIR = /usr/include
+	endif
+endif
+
 prefix		=
 exec_prefix	= $(prefix)
 usr_prefix	= $(prefix)
diff --git a/kpartx/Makefile b/kpartx/Makefile
index 9be115d6..d2943a99 100644
--- a/kpartx/Makefile
+++ b/kpartx/Makefile
@@ -8,7 +8,7 @@ LDFLAGS += $(BIN_LDFLAGS)
 
 LIBDEPS += -ldevmapper
 
-ifneq ($(call check_func,dm_task_set_cookie,/usr/include/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_set_cookie,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
 	CFLAGS += -DLIBDM_API_COOKIE
 endif
 
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index d4af1a54..be48775d 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -21,15 +21,15 @@ ifdef SYSTEMD
 	endif
 endif
 
-ifneq ($(call check_func,dm_task_no_flush,/usr/include/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_no_flush,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
 	CFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE
 endif
 
-ifneq ($(call check_func,dm_task_get_errno,/usr/include/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_get_errno,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
 	CFLAGS += -DLIBDM_API_GET_ERRNO
 endif
 
-ifneq ($(call check_func,dm_task_set_cookie,/usr/include/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_set_cookie,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
 	CFLAGS += -DLIBDM_API_COOKIE
 endif
 
@@ -37,11 +37,11 @@ ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,/usr/include/libud
 	CFLAGS += -DLIBUDEV_API_RECVBUF
 endif
 
-ifneq ($(call check_func,dm_task_deferred_remove,/usr/include/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_deferred_remove,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
 	CFLAGS += -DLIBDM_API_DEFERRED
 endif
 
-ifneq ($(call check_func,dm_hold_control_dev,/usr/include/libdevmapper.h),0)
+ifneq ($(call check_func,dm_hold_control_dev,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
 	CFLAGS += -DLIBDM_API_HOLD_CONTROL
 endif
 
diff --git a/multipathd/Makefile b/multipathd/Makefile
index 64df2214..5f4ef6c2 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -1,6 +1,6 @@
 include ../Makefile.inc
 
-ifneq ($(call check_func,dm_task_get_errno,/usr/include/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_get_errno,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
 	CFLAGS += -DLIBDM_API_GET_ERRNO
 endif
 
-- 
2.34.1

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux