diff mbox

[03/11] ndctl: use PKG_CHECK_MODULES for external dependencies

Message ID 20150905013132.28464.38371.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit 6237eec302cc
Headers show

Commit Message

Dan Williams Sept. 5, 2015, 1:31 a.m. UTC
Some distros place devel material in non-standard locations.  Use
pkgconfig to find it.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 Makefile.am  |   17 ++++++++++-------
 configure.ac |   11 +++--------
 2 files changed, 13 insertions(+), 15 deletions(-)
diff mbox

Patch

diff --git a/Makefile.am b/Makefile.am
index 070192f2f2bc..d22e55708474 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,7 +9,10 @@  AM_CPPFLAGS = \
 	-DLIBEXECDIR=\""$(libexecdir)"\" \
 	-I${top_srcdir}/lib/ndctl \
 	-I${top_srcdir}/lib \
-	-I${top_srcdir}/
+	-I${top_srcdir}/ \
+	$(KMOD_CFLAGS) \
+	$(UDEV_CFLAGS) \
+	$(UUID_CFLAGS)
 
 AM_CFLAGS = ${my_CFLAGS} \
 	-fvisibility=hidden \
@@ -42,7 +45,7 @@  lib_LTLIBRARIES = lib/libndctl.la
 lib_libndctl_la_SOURCES =\
 	lib/libndctl-private.h \
 	lib/libndctl.c
-lib_libndctl_la_LIBADD = -ludev -luuid -lkmod
+lib_libndctl_la_LIBADD = $(UDEV_LIBS) $(UUID_LIBS) $(KMOD_LIBS)
 
 bin_PROGRAMS = ndctl
 
@@ -69,7 +72,7 @@  ndctl_SOURCES += lib/blk_namespaces.c \
 ndctl_SOURCES += builtin-bat.c
 endif
 
-ndctl_LDADD = lib/libndctl.la -luuid -lkmod
+ndctl_LDADD = lib/libndctl.la $(UUID_LIBS) $(KMOD_LIBS)
 
 noinst_LIBRARIES = libccan.a
 libccan_a_SOURCES = \
@@ -108,13 +111,13 @@  check_PROGRAMS += lib/test-blk-ns lib/test-pmem-ns
 endif
 
 lib_test_libndctl_SOURCES = lib/test-libndctl.c
-lib_test_libndctl_LDADD = lib/libndctl.la -luuid -lkmod
+lib_test_libndctl_LDADD = lib/libndctl.la $(UUID_LIBS) $(KMOD_LIBS)
 
 lib_test_blk_ns_SOURCES = lib/blk_namespaces.c
-lib_test_blk_ns_LDADD = lib/libndctl.la -lkmod
+lib_test_blk_ns_LDADD = lib/libndctl.la $(KMOD_LIBS)
 
 lib_test_pmem_ns_SOURCES = lib/pmem_namespaces.c
-lib_test_pmem_ns_LDADD = lib/libndctl.la -lkmod
+lib_test_pmem_ns_LDADD = lib/libndctl.la $(KMOD_LIBS)
 
 lib_test_dpa_alloc_SOURCES = lib/test-dpa-alloc.c
-lib_test_dpa_alloc_LDADD = lib/libndctl.la -luuid -lkmod
+lib_test_dpa_alloc_LDADD = lib/libndctl.la $(UUID_LIBS) $(KMOD_LIBS)
diff --git a/configure.ac b/configure.ac
index daa6b3227c8e..8162b723ecab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,14 +68,9 @@  AS_IF([test "x$enable_destructive" = "xyes"],
 	[AC_DEFINE([ENABLE_DESTRUCTIVE], [1], [destructive functional tests support])])
 AM_CONDITIONAL([ENABLE_DESTRUCTIVE], [test "x$enable_destructive" = "xyes"])
 
-AC_CHECK_LIB([udev], [main], [],
-	[AC_MSG_FAILURE([missing systemd-devel])], [])
-
-AC_CHECK_LIB([kmod], [main], [],
-	[AC_MSG_FAILURE([missing kmod-devel])], [])
-
-AC_CHECK_LIB([uuid], [main], [],
-	[AC_MSG_FAILURE([missing libuuid-devel])], [])
+PKG_CHECK_MODULES([KMOD], [libkmod])
+PKG_CHECK_MODULES([UDEV], [libudev])
+PKG_CHECK_MODULES([UUID], [uuid])
 
 AC_CHECK_HEADER([linux/ndctl.h],
 		[AC_DEFINE([HAVE_NDCTL_H], [1],