From 325b006503afd3fbffcd5373a86bd650287e5cf5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <gruenich@dune-project.org>
Date: Tue, 17 Jul 2012 10:15:41 +0000
Subject: [PATCH] [FindSuperLU] Add test for HAVE_MEM_USAGE_T_EXPANSIONS needed
 for SuperLU 3.0. This fixes CMake Bug #133.

[[Imported from SVN: r1655]]
---
 cmake/modules/FindSuperLU.cmake | 14 +++++++++++++-
 config.h.cmake                  |  3 +++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/cmake/modules/FindSuperLU.cmake b/cmake/modules/FindSuperLU.cmake
index 77d72cf6..a8038bde 100644
--- a/cmake/modules/FindSuperLU.cmake
+++ b/cmake/modules/FindSuperLU.cmake
@@ -30,10 +30,22 @@ find_library(SUPERLU_LIBRARY
   PATH_SUFFIXES "lib" "lib64"
 )
 
-# check if version is 4.3
+# check version specific macros
 include(CheckCSourceCompiles)
 set(CMAKE_REQUIRED_INCLUDES ${SUPERLU_INCLUDE_DIR})
 set(CMAKE_REQUIRED_LIBRARIES ${SUPERLU_LIBRARY})
+
+# check whether "mem_usage_t.expansions" was found in "slu_ddefs.h"
+CHECK_C_SOURCE_COMPILES("
+#include <slu_ddefs.h>
+int main(void)
+{
+  mem_usage_t mem;
+  return mem.expansions;
+}"
+HAVE_MEM_USAGE_T_EXPANSIONS)
+
+# check whether version is at least 4.3
 CHECK_C_SOURCE_COMPILES("
 #include <slu_ddefs.h>
 int main(void)
diff --git a/config.h.cmake b/config.h.cmake
index 8ea26e8a..990c1181 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -45,6 +45,9 @@
 /* define to 1 because older versions of SuperLU are no longer supported*/
 #define SUPERLU_POST_2005_VERSION 1
 
+/* Define to 1 if 'expansions' is a member of 'mem_usage_t'. */
+#cmakedefine HAVE_MEM_USAGE_T_EXPANSIONS @HAVE_MEM_USAGE_T_EXPANSIONS@
+
 /* define to 1 if SuperLU header slu_ddefs.h contains SLU_DOUBLE */
 #cmakedefine SUPERLU_MIN_VERSION_4_3 @SUPERLU_MIN_VERSION_4_3@
 
-- 
GitLab