diff --git a/cmake/modules/FindSuperLU.cmake b/cmake/modules/FindSuperLU.cmake
index cd0007cbe795e62b3c0efa4492a66153d628cc37..8eb6bd3fd73a7e11e76bf182f5169629a033f426 100644
--- a/cmake/modules/FindSuperLU.cmake
+++ b/cmake/modules/FindSuperLU.cmake
@@ -125,8 +125,20 @@ int main(void)
 }"
 SUPERLU_MIN_VERSION_5)
 
+if(SUPERLU_MIN_VERSION_4_3)
+  include(CheckIncludeFiles)
+  set(HAVE_SLU_DDEFS_H 1)
+  check_include_files(slu_sdefs.h HAVE_SLU_SDEFS_H)
+  check_include_files(slu_cdefs.h HAVE_SLU_CDEFS_H)
+  check_include_files(slu_zdefs.h HAVE_SLU_ZDEFS_H)
+endif(SUPERLU_MIN_VERSION_4_3)
+
 cmake_pop_check_state()
 
+set(SUPERLU_INT_TYPE "int" CACHE STRING
+  "The integer version that SuperLU was compiled for (Default is int.
+  Should be the same as int_t define in e.g. slu_sdefs.h")
+
 if(NOT SUPERLU_MIN_VERSION_4)
   set(SUPERLU_WITH_VERSION "SuperLU < 4.0" CACHE STRING
     "Human readable string containing SuperLU version information.")
diff --git a/config.h.cmake b/config.h.cmake
index 29df279aef014766ec7c054c86890174a025f50a..3c488a94a6cbd314529bf8a4df9b6dd062d2db08 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -31,6 +31,22 @@
 /* Define to ENABLE_SUPERLU if the SuperLU library is available */
 #cmakedefine HAVE_SUPERLU ENABLE_SUPERLU
 
+/* Define to the integer type that SuperLU was compiled for
+   See e.g. what int_t is defined to in slu_sdefs.h */
+#cmakedefine SUPERLU_INT_TYPE @SUPERLU_INT_TYPE@
+
+/* Define to 1 if header slu_sdefs.h is there. */
+#cmakedefine01 HAVE_SLU_SDEFS_H
+
+/* Define to 1 if header slu_ddefs.h is there. */
+#cmakedefine01 HAVE_SLU_DDEFS_H
+
+/* Define to 1 if header slu_cdefs.h is there. */
+#cmakedefine01 HAVE_SLU_CDEFS_H
+
+/* Define to 1 if header slu_zdefs.h is there. */
+#cmakedefine01 HAVE_SLU_ZDEFS_H
+
 /* Define to ENABLE_ARPACKPP if the ARPACK++ library is available */
 #cmakedefine HAVE_ARPACKPP ENABLE_ARPACKPP
 
diff --git a/dune/istl/superlu.hh b/dune/istl/superlu.hh
index 94e06729102801b6462e449752ef5bcc664330ac..f18c35aeb88e0ac64ec165aacc3d7f846532f8fe 100644
--- a/dune/istl/superlu.hh
+++ b/dune/istl/superlu.hh
@@ -4,32 +4,8 @@
 #define DUNE_ISTL_SUPERLU_HH
 
 #if HAVE_SUPERLU
-#ifdef TRUE
-#undef TRUE
-#endif
-#ifdef FALSE
-#undef FALSE
-#endif
-#ifndef SUPERLU_NTYPE
-#define  SUPERLU_NTYPE 1
-#endif
-
-#if SUPERLU_NTYPE==0
-#include "slu_sdefs.h"
-#endif
-
-#if SUPERLU_NTYPE==1
-#include "slu_ddefs.h"
-#endif
-
-#if SUPERLU_NTYPE==2
-#include "slu_cdefs.h"
-#endif
-
-#if SUPERLU_NTYPE>=3
-#include "slu_zdefs.h"
-#endif
 
+#include "superlufunctions.hh"
 #include "solvers.hh"
 #include "supermatrix.hh"
 #include <algorithm>
@@ -81,7 +57,7 @@ namespace Dune
   struct QuerySpaceChooser
   {};
 
-#if SUPERLU_NTYPE==0
+#if HAVE_SLU_SDEFS_H
   template<>
   struct SuperLUDenseMatChooser<float>
   {
@@ -129,7 +105,7 @@ namespace Dune
 
 #endif
 
-#if SUPERLU_NTYPE==1
+#if HAVE_SLU_DDEFS_H
 
   template<>
   struct SuperLUDenseMatChooser<double>
@@ -176,7 +152,7 @@ namespace Dune
   };
 #endif
 
-#if SUPERLU_NTYPE>=3
+#if HAVE_SLU_ZDEFS_H
   template<>
   struct SuperLUDenseMatChooser<std::complex<double> >
   {
@@ -223,7 +199,7 @@ namespace Dune
   };
 #endif
 
-#if SUPERLU_NTYPE==2
+#if HAVE_SLU_CDEFS_H
   template<>
   struct SuperLUDenseMatChooser<std::complex<float> >
   {
diff --git a/dune/istl/superlufunctions.hh b/dune/istl/superlufunctions.hh
new file mode 100644
index 0000000000000000000000000000000000000000..bf4940f187463b79f080afeb57fdf036845f963d
--- /dev/null
+++ b/dune/istl/superlufunctions.hh
@@ -0,0 +1,123 @@
+// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+// vi: set et ts=4 sw=2 sts=2:
+#ifndef DUNE_ISTL_SUPERLUFUNCTIONS_HH
+#define DUNE_ISTL_SUPERLUFUNCTIONS_HH
+#if HAVE_SUPERLU
+
+
+#define int_t SUPERLU_INT_TYPE
+#include "supermatrix.h"
+#include "slu_util.h"
+#undef int_t
+
+#if HAVE_SLU_SDEFS_H
+extern "C" {
+  extern void
+  sgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
+         char *, float *, float *, SuperMatrix *, SuperMatrix *,
+         void *, int, SuperMatrix *, SuperMatrix *,
+         float *, float *, float *, float *,
+#if SUPERLU_MIN_VERSION_5
+         GlobalLU_t*,
+#endif
+         mem_usage_t *, SuperLUStat_t *, int *);
+
+  extern void
+  sCreate_Dense_Matrix(SuperMatrix *, int, int, float *, int,
+                       Stype_t, Dtype_t, Mtype_t);
+  extern void
+  sCreate_CompCol_Matrix(SuperMatrix *, int, int, int, float *,
+                         int *, int *, Stype_t, Dtype_t, Mtype_t);
+  extern int     sQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
+
+  extern void    sPrint_CompCol_Matrix(char *, SuperMatrix *);
+}
+#endif
+
+#if HAVE_SLU_DDEFS_H
+extern "C" {
+  extern void
+  dgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
+         char *, double *, double *, SuperMatrix *, SuperMatrix *,
+         void *, int, SuperMatrix *, SuperMatrix *,
+         double *, double *, double *, double *,
+#if SUPERLU_MIN_VERSION_5
+         GlobalLU_t*,
+#endif
+         mem_usage_t *, SuperLUStat_t *, int *);
+
+  extern void
+  dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *,
+                         int *, int *, Stype_t, Dtype_t, Mtype_t);
+
+  extern void
+  dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int,
+                       Stype_t, Dtype_t, Mtype_t);
+
+  extern int     dQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
+
+  extern void    dPrint_CompCol_Matrix(char *, SuperMatrix *);
+}
+#endif
+
+#if HAVE_SLU_CDEFS_H
+#include "slu_scomplex.h"
+
+extern "C" {
+  extern void
+  cgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
+         char *, float *, float *, SuperMatrix *, SuperMatrix *,
+         void *, int, SuperMatrix *, SuperMatrix *,
+         float *, float *, float *, float *,
+#if SUPERLU_MIN_VERSION_5
+         GlobalLU_t*,
+#endif
+         mem_usage_t *, SuperLUStat_t *, int *);
+
+
+  extern void
+  cCreate_Dense_Matrix(SuperMatrix *, int, int, ::complex *, int,
+                       Stype_t, Dtype_t, Mtype_t);
+
+
+  extern void
+  cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, ::complex *,
+                         int *, int *, Stype_t, Dtype_t, Mtype_t);
+
+  extern int     cQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
+
+  extern void    cPrint_CompCol_Matrix(char *, SuperMatrix *);
+}
+#endif
+
+#if HAVE_SLU_ZDEFS_H
+#include "slu_dcomplex.h"
+extern "C" {
+  extern void
+  zgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
+         char *, double *, double *, SuperMatrix *, SuperMatrix *,
+         void *, int, SuperMatrix *, SuperMatrix *,
+         double *, double *, double *, double *,
+#if SUPERLU_MIN_VERSION_5
+         GlobalLU_t*,
+#endif
+         mem_usage_t *, SuperLUStat_t *, int *);
+
+
+  extern void
+  zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, doublecomplex *,
+                         int *, int *, Stype_t, Dtype_t, Mtype_t);
+
+  extern void
+  zCreate_Dense_Matrix(SuperMatrix *, int, int, doublecomplex *, int,
+                       Stype_t, Dtype_t, Mtype_t);
+
+  extern int     zQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
+
+  extern void    zPrint_CompCol_Matrix(char *, SuperMatrix *);
+}
+#endif
+
+
+#endif
+#endif
diff --git a/dune/istl/supermatrix.hh b/dune/istl/supermatrix.hh
index e5fb16a6939cd955e8a255d9c2967b69c3867f9a..ef8e51080e196689f93a18326840ddda7b39ccc9 100644
--- a/dune/istl/supermatrix.hh
+++ b/dune/istl/supermatrix.hh
@@ -5,26 +5,6 @@
 
 #if HAVE_SUPERLU
 
-#ifndef SUPERLU_NTYPE
-#define SUPERLU_NTYPE 1
-#endif
-
-#if SUPERLU_NTYPE==0
-#include "slu_sdefs.h"
-#endif
-
-#if SUPERLU_NTYPE==1
-#include "slu_ddefs.h"
-#endif
-
-#if SUPERLU_NTYPE==2
-#include "slu_cdefs.h"
-#endif
-
-#if SUPERLU_NTYPE>=3
-#include "slu_zdefs.h"
-#endif
-
 #include "bcrsmatrix.hh"
 #include "bvector.hh"
 #include <dune/common/fmatrix.hh>
@@ -34,6 +14,8 @@
 
 #include"colcompmatrix.hh"
 
+#include "superlufunctions.hh"
+
 namespace Dune
 {
 
@@ -45,7 +27,7 @@ namespace Dune
   struct SuperMatrixPrinter
   {};
 
-#if SUPERLU_NTYPE==0
+#if HAVE_SLU_SDEFS_H
   template<>
   struct SuperMatrixCreateSparseChooser<float>
   {
@@ -68,7 +50,7 @@ namespace Dune
   };
 #endif
 
-#if SUPERLU_NTYPE==1
+#if HAVE_SLU_DDEFS_H
   template<>
   struct SuperMatrixCreateSparseChooser<double>
   {
@@ -91,7 +73,7 @@ namespace Dune
   };
 #endif
 
-#if SUPERLU_NTYPE==2
+#if HAVE_SLU_CDEFS_H
   template<>
   struct SuperMatrixCreateSparseChooser<std::complex<float> >
   {
@@ -114,7 +96,7 @@ namespace Dune
   };
 #endif
 
-#if SUPERLU_NTYPE>=3
+#if HAVE_SLU_ZDEFS_H
   template<>
   struct SuperMatrixCreateSparseChooser<std::complex<double> >
   {
diff --git a/dune/istl/test/superlutest.cc b/dune/istl/test/superlutest.cc
index 5688f98caf9cd096269bf9a316f9ee3b7539c8a9..270c6fdd807e0588f1899ea272be1ce7152f49df 100644
--- a/dune/istl/test/superlutest.cc
+++ b/dune/istl/test/superlutest.cc
@@ -14,36 +14,11 @@
 
 #include "laplacian.hh"
 
-#ifndef SUPERLU_NTYPE
-#define SUPERLU_NTYPE 1
-#endif
-
-#if SUPERLU_NTYPE==1
-typedef double FIELD_TYPE;
-#endif
-
-#if SUPERLU_NTYPE==0
-typedef float FIELD_TYPE;
-#endif
-
-#if SUPERLU_NTYPE==2
-typedef std::complex<float> FIELD_TYPE;
-#endif
-
-#if SUPERLU_NTYPE>=3
-typedef std::complex<double> FIELD_TYPE;
-#endif
-
-int main(int argc, char** argv)
-try
-{
 #if HAVE_SUPERLU
+template<typename FIELD_TYPE>
+void runSuperLU(std::size_t N)
+{
   const int BS=1;
-  std::size_t N=100;
-
-  if(argc>1)
-    N = atoi(argv[1]);
-  std::cout<<"testing for N="<<N<<" BS="<<1<<std::endl;
 
 
   typedef Dune::FieldMatrix<FIELD_TYPE,BS,BS> MatrixBlock;
@@ -83,8 +58,34 @@ try
 
   solver1.apply(x1,b1, res);
   solver1.apply(reinterpret_cast<FIELD_TYPE*>(&x1[0]), reinterpret_cast<FIELD_TYPE*>(&b1[0]));
+}
+#endif
+
+int main(int argc, char** argv)
+try
+{
+
+  std::size_t N=100;
+
+  if(argc>1)
+    N = atoi(argv[1]);
+  std::cout<<"testing for N="<<N<<" BS="<<1<<std::endl;
+#if HAVE_SUPERLU
+#if HAVE_SLU_SDEFS_H
+  runSuperLU<float>(N);
+#endif
+#if HAVE_SLU_DDEFS_H
+  runSuperLU<double>(N);
+#endif
+#if HAVE_SLU_CDEFS_H
+  runSuperLU<std::complex<float> >(N);
+#endif
+#if HAVE_SLU_ZDEFS_H
+  runSuperLU<std::complex<double> >(N);
+#endif
 
   return 0;
+
 #else // HAVE_SUPERLU
   std::cerr << "You need SuperLU to run this test." << std::endl;
   return 77;