diff mbox series

[ndctl] ndctl, build: Define HAVE_UUID

Message ID 154344133285.1069420.11463868512402749463.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit 9dd5adcb49c17edd29a55afd4994bd0ddf2eb345
Headers show
Series [ndctl] ndctl, build: Define HAVE_UUID | expand

Commit Message

Dan Williams Nov. 28, 2018, 9:42 p.m. UTC
Attempts to build ndctl in an epel-6 environment fail with the following
messages:

    In file included from util/filter.c:24:
    ./daxctl/libdaxctl.h:22: error: redefinition of typedef 'uuid_t'
    ./ndctl/libndctl.h:26: note: previous declaration of 'uuid_t' was here

Newer compilers discard the error since it sees the types are
compatible, but the definition should be coming from uuid.h when built
with libuuid. Arrange for an AC_DEFINE for the HAVE_UUID symbol when
libuuid is detected by PKG_CHECK_MODULES.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 configure.ac       |    3 ++-
 daxctl/libdaxctl.h |    2 +-
 ndctl/libndctl.h   |    2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index bb6b03324ea8..de5b84cec670 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,7 +112,8 @@  AM_CONDITIONAL([ENABLE_POISON],
 
 PKG_CHECK_MODULES([KMOD], [libkmod])
 PKG_CHECK_MODULES([UDEV], [libudev])
-PKG_CHECK_MODULES([UUID], [uuid])
+PKG_CHECK_MODULES([UUID], [uuid],
+	[AC_DEFINE([HAVE_UUID], [1], [Define to 1 if using libuuid])])
 PKG_CHECK_MODULES([JSON], [json-c])
 
 AC_ARG_WITH([bash],
diff --git a/daxctl/libdaxctl.h b/daxctl/libdaxctl.h
index 21bc376ce629..1d13ea291f6f 100644
--- a/daxctl/libdaxctl.h
+++ b/daxctl/libdaxctl.h
@@ -16,7 +16,7 @@ 
 #include <stdarg.h>
 #include <unistd.h>
 
-#ifdef HAVE_LIBUUID
+#ifdef HAVE_UUID
 #include <uuid/uuid.h>
 #else
 typedef unsigned char uuid_t[16];
diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h
index 62cef9e82da3..c81cc032ebae 100644
--- a/ndctl/libndctl.h
+++ b/ndctl/libndctl.h
@@ -20,7 +20,7 @@ 
 #include <errno.h>
 #include <limits.h>
 
-#ifdef HAVE_LIBUUID
+#ifdef HAVE_UUID
 #include <uuid/uuid.h>
 #else
 typedef unsigned char uuid_t[16];