From 91f732794b92868dd48505e715e88450ec90df58 Mon Sep 17 00:00:00 2001
From: XMRig <support@xmrig.com>
Date: Tue, 23 Jul 2019 08:06:04 +0700
Subject: [PATCH] HWLOC_VERSION not always defined.

---
 src/base/kernel/Entry.cpp             |  8 ++++++++
 src/base/kernel/config/BaseConfig.cpp | 10 +++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/base/kernel/Entry.cpp b/src/base/kernel/Entry.cpp
index 1e12b24d2..da225e40c 100644
--- a/src/base/kernel/Entry.cpp
+++ b/src/base/kernel/Entry.cpp
@@ -78,7 +78,15 @@ static int showVersion()
     }
 #   endif
 
+#   if defined(XMRIG_FEATURE_HWLOC)
+#   if defined(HWLOC_VERSION)
     printf("hwloc/%s\n", HWLOC_VERSION);
+#   elif HWLOC_API_VERSION >= 0x20000
+    printf("hwloc/2\n");
+#   else
+    printf("hwloc/1\n");
+#   endif
+#   endif
 
     return 0;
 }
diff --git a/src/base/kernel/config/BaseConfig.cpp b/src/base/kernel/config/BaseConfig.cpp
index 2fcbad702..c89b032a0 100644
--- a/src/base/kernel/config/BaseConfig.cpp
+++ b/src/base/kernel/config/BaseConfig.cpp
@@ -110,8 +110,16 @@ void xmrig::BaseConfig::printVersions()
     }
 #   endif
 
-#   ifdef XMRIG_FEATURE_HWLOC
+
+#   if defined(XMRIG_FEATURE_HWLOC)
+#   if defined(HWLOC_VERSION)
     snprintf(buf, sizeof buf, "hwloc/%s ", HWLOC_VERSION);
+#   elif HWLOC_API_VERSION >= 0x20000
+    snprintf(buf, sizeof buf, "hwloc/2 ");
+#   else
+    snprintf(buf, sizeof buf, "hwloc/1 ");
+#   endif
+
     libs += buf;
 #   endif