From deaa5b8eabe16586028948ceeb0d3ab318ca5992 Mon Sep 17 00:00:00 2001
From: Sven Willner <sven.willner@mpimet.mpg.de>
Date: Tue, 2 May 2023 21:44:29 +0200
Subject: [PATCH] Fix Borges inclusion

---
 configure.ac    | 2 +-
 src/Makefile.am | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 68bd4a2c3..adb835bac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -605,7 +605,7 @@ AM_CONDITIONAL([HAVE_PARALLEL_NC4], [test "x$have_parallel_nc4" = xyes])
 AS_VAR_IF([enable_borges], [yes],
   [ACX_C_PACKAGE([BORGES], [borges/borges.h],,,
      [AC_MSG_FAILURE([required header borges/borges.h not found or not compilable])],
-     [borges_context_create],[borges], [rt], [],
+     [borges_context_create],[borges], [$LIBRT], [],
      [AC_MSG_FAILURE([cannot link C BORGES programs])])
    AC_DEFINE([HAVE_BORGES], [1],
      [supporting output to BORGES data system])])
diff --git a/src/Makefile.am b/src/Makefile.am
index d2c0d0916..e4cd52f3b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -62,7 +62,7 @@ else !with_on_demand_check_programs
 noinst_LTLIBRARIES += libcdiresunpack.la
 endif !with_on_demand_check_programs
 
-AM_CPPFLAGS = $(PPM_CORE_C_INCLUDE) $(YAXT_C_INCLUDE) $(MPI_C_INCLUDE)
+AM_CPPFLAGS = $(BORGES_C_INCLUDE) $(PPM_CORE_C_INCLUDE) $(YAXT_C_INCLUDE) $(MPI_C_INCLUDE)
 if ENABLE_MPI
 # TODO: this needs a refactoring but for now we set this macro here and not in
 # config.h because the macro is used in several files that do not include the
@@ -233,6 +233,8 @@ libcdi_la_SOURCES += \
   stream_gribapi.c
 endif HAVE_LIBGRIB_API
 
+libcdi_la_LIBADD = $(BORGES_C_LIB) $(LIBRT)
+
 libcdi_f2003_la_SOURCES = mo_cdi.f90
 libcdi_f2003_la_LIBADD = libcdi.la
 
-- 
GitLab