From 10cf2f4ee82c89f1a0d52a0758cf3a881d4b0cff Mon Sep 17 00:00:00 2001
From: Utz-Uwe Haus <uhaus@cray.com>
Date: Thu, 28 Oct 2021 14:12:12 +0200
Subject: [PATCH] Distinguish between local and system libfabric builds in
 drc.c

Bulding against external libfabric on GNI system did not work due to path mixup for fi_ext_gni.h
---
 configure.ac  | 1 +
 maestro/drc.c | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index bebf2b86..220dd6e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -456,6 +456,7 @@ AS_IF([test "x$enable_ofi_pool_manager" = "xyes"], [
    dnl Whether doing so creates a performance problem or not is still to be determined
    AX_SUBDIRS_CONFIGURE([deps/libfabric],[[--enable-embedded],[--disable-rxd],[--disable-shm],[--disable-tcp],[--with-kdreg=no],[--enable-debug]],[],[],[])
    AC_MSG_NOTICE([================== done preconfiguring private libfabric library build])
+   AC_DEFINE([LOCAL_LIBFABRIC],[1],[Define if using our own libfabric build])
   ])
 
 
diff --git a/maestro/drc.c b/maestro/drc.c
index 9eed8005..b7ee5c02 100644
--- a/maestro/drc.c
+++ b/maestro/drc.c
@@ -55,8 +55,13 @@
 
 #ifdef HAVE_DRC
 #include <rdmacred.h>
-/* #include <rdma/fi_ext_gni.h> */
-#include <fi_ext_gni.h> /* use uninstalled one */
+
+#ifndef LOCAL_LIBFABRIC
+# include <rdma/fi_ext_gni.h>
+#else
+# include <fi_ext_gni.h> /* use uninstalled one */
+#endif
+
 #else
 
 /* define some placeholders; we want to compile code with dummy
-- 
GitLab