changeset 25098:5dce8aa80652 stable

configure: disable SUNDIALS if the IDADENSE API is not found (bug #52475) * acinclude.m4 (OCTAVE_CHECK_SUNDIALS_IDA_DENSE): New macro to test for the IDADENSE API, which has been removed in SUNDIALS version 3.0.0. * configure.ac: Use it. Do not set HAVE_SUNDIALS if it fails. * __ode15__.cc: Use HAVE_IDA_IDA_DENSE_H when including <ida/ida_dense.h>.
author Mike Miller <mtmiller@octave.org>
date Mon, 02 Apr 2018 17:39:58 -0700
parents cc21f66ecb1c
children daff5efe062f
files configure.ac libinterp/dldfcn/__ode15__.cc m4/acinclude.m4
diffstat 3 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Mon Apr 02 20:32:35 2018 -0400
+++ b/configure.ac	Mon Apr 02 17:39:58 2018 -0700
@@ -2574,6 +2574,7 @@
   [], [don't use SUNDIALS IDA library, solvers ode15i and ode15s will be disabled],
   [warn_sundials_ida=
    OCTAVE_CHECK_SUNDIALS_SIZEOF_REALTYPE
+   OCTAVE_CHECK_SUNDIALS_IDA_DENSE
    OCTAVE_CHECK_SUNDIALS_IDAKLU])
 LIBS="$save_LIBS"
 
@@ -2581,6 +2582,7 @@
 dnl the build features script will get the correct value.
 if test -n "$SUNDIALS_IDA_LIBS" \
     && test -n "$SUNDIALS_NVECSERIAL_LIBS" \
+    && test $octave_cv_sundials_ida_dense = yes \
     && test $octave_cv_sundials_realtype_is_double = yes; then
   AC_DEFINE(HAVE_SUNDIALS, 1, [Define to 1 if SUNDIALS is available.])
 fi
--- a/libinterp/dldfcn/__ode15__.cc	Mon Apr 02 20:32:35 2018 -0400
+++ b/libinterp/dldfcn/__ode15__.cc	Mon Apr 02 17:39:58 2018 -0700
@@ -41,6 +41,9 @@
 
 #  if defined (HAVE_IDA_IDA_H)
 #    include <ida/ida.h>
+#  endif
+
+#  if defined (HAVE_IDA_IDA_DENSE_H)
 #    include <ida/ida_dense.h>
 #  endif
 
--- a/m4/acinclude.m4	Mon Apr 02 20:32:35 2018 -0400
+++ b/m4/acinclude.m4	Mon Apr 02 17:39:58 2018 -0700
@@ -2235,6 +2235,36 @@
   fi
 ])
 dnl
+dnl Check whether SUNDIALS IDA library has the IDADENSE linear solver.
+dnl The IDADENSE API was removed in SUNDIALS version 3.0.0.
+dnl
+AC_DEFUN([OCTAVE_CHECK_SUNDIALS_IDA_DENSE], [
+  AC_CHECK_HEADERS([ida/ida_dense.h ida_dense.h])
+  AC_CACHE_CHECK([whether SUNDIALS IDA includes the IDADENSE linear solver],
+    [octave_cv_sundials_ida_dense],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+         #if defined (HAVE_IDA_IDA_DENSE_H)
+         #include <ida/ida_dense.h>
+         #else
+         #include <ida_dense.h>
+         #endif
+         ]], [[
+         void *mem = 0;
+         long int num = 0;
+         IDADense (mem, num);
+      ]])],
+      octave_cv_sundials_ida_dense=yes,
+      octave_cv_sundials_ida_dense=no)
+    ])
+  if test $octave_cv_sundials_ida_dense = yes; then
+    AC_DEFINE(HAVE_SUNDIALS_IDADENSE, 1,
+      [Define to 1 if SUNDIALS IDA includes the IDADENSE linear solver.])
+  else
+    warn_sundials_ida_dense="SUNDIALS IDA library does not include the IDADENSE linear solver, ode15i and ode15s will be disabled"
+    OCTAVE_CONFIGURE_WARNING([warn_sundials_ida_dense])
+  fi
+])
+dnl
 dnl Add warning to final summary.
 dnl
 AC_DEFUN([OCTAVE_CONFIGURE_WARNING], [