From 4e3f3f2db61229e297130994a2d76c4211b994bd Mon Sep 17 00:00:00 2001
From: "Peter W. Draper" <p.w.draper@durham.ac.uk>
Date: Thu, 13 Dec 2018 13:30:44 +0000
Subject: [PATCH] Check if the -isystem includes really fix the NUMA prototypes
 problem, if not bail out

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

diff --git a/configure.ac b/configure.ac
index a3dd823511..7e5af3bcc2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1145,6 +1145,18 @@ if test "$have_numa" != "no"; then
         case "$CFLAGS" in
             *strict-prototypes*)
                 NUMA_INCS="-isystem$with_numa/include"
+                # This may still fail if CPATH is used, so we check if the
+                # headers are usable.
+                AS_UNSET(ac_cv_header_numa_h)
+                old_CPPFLAGS="$CPPFLAGS"
+                CPPFLAGS="$CPPFLAGS $NUMA_INCS"
+                numa_failed="no"
+                AC_CHECK_HEADER([numa.h],[numa_failed="no"],
+                                [numa_failed="yes"])
+                if test "$numa_failed" = "yes"; then
+                    AC_MSG_ERROR([Failed to compile the numa.h header file: you may need to set --enable-compiler-warnings to yes or no])
+                fi
+                CPPFLAGS="$old_CPPFLAGS"
             ;;
             *)
                 NUMA_INCS="-I$with_numa/include"
-- 
GitLab