From db805a5b2aaa545fb026e1ee62a0518ccd83eff8 Mon Sep 17 00:00:00 2001
From: Utz-Uwe Haus <uhaus@hpe.com>
Date: Thu, 11 Aug 2022 18:54:07 +0300
Subject: [PATCH] Add pkg-config check for libfabric (needed on Cray Shasta)

---
 configure.ac | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/configure.ac b/configure.ac
index f26ac2ed..736eb320 100644
--- a/configure.ac
+++ b/configure.ac
@@ -450,6 +450,17 @@ AS_IF([test "x$enable_ofi_pool_manager" = "xyes"], [
   SAVED_LDFLAGS="$LDFLAGS"
   SAVED_LIBS="$LIBS"
 
+  dnl If libfabric is installed in a nonstandard place but can be found by pkg-config, add whatever that tells us before trying to find it
+  dnl (notable example: Cray Shasta systems)
+  if pkg-config libfabric; then
+     AC_MSG_NOTICE([found libfabric via pkg-config])
+     CPPFLAGS="`pkg-config --cflags      libfabric` $CFLAGS"
+     LDFLAGS=" `pkg-config --libs-only-L libfabric` $LDFLAGS"
+     LIBS="    `pkg-config --libs-only-l libfabric` $LIBS"
+  else
+     AC_MSG_NOTICE([pkg-config does not know about a libfabric installation, fine])
+  fi
+
   AX_USE_LIBRARY([fabric])
 
   dnl Sanity check for libfabric library
-- 
GitLab