Mercurial > octave
changeset 26991:c188513f5496
configure: disable building with SUNDIALS when the API is too old (bug #55937)
* acinclude.m4 (OCTAVE_CHECK_SUNDIALS_COMPATIBLE_API): New macro to test for
sets of required SUNDIALS functions.
* configure.ac: Use it to determine whether to disable SUNDIALS.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Wed, 27 Mar 2019 13:48:50 -0700 |
parents | 4612f8a71e47 |
children | 05f389459461 |
files | configure.ac m4/acinclude.m4 |
diffstat | 2 files changed, 41 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Wed Mar 27 12:31:27 2019 -0700 +++ b/configure.ac Wed Mar 27 13:48:50 2019 -0700 @@ -2207,7 +2207,8 @@ [warn_sundials_ida= OCTAVE_CHECK_SUNDIALS_SIZEOF_REALTYPE OCTAVE_CHECK_SUNDIALS_SUNLINSOL_DENSE - OCTAVE_CHECK_SUNDIALS_SUNLINSOL_KLU]) + OCTAVE_CHECK_SUNDIALS_SUNLINSOL_KLU + OCTAVE_CHECK_SUNDIALS_COMPATIBLE_API]) LIBS="$save_LIBS" dnl Define this way instead of with an #if in oct-conf-post.h so that @@ -2220,7 +2221,8 @@ if test -n "$SUNDIALS_IDA_LIBS" \ && test -n "$SUNDIALS_NVECSERIAL_LIBS" \ && test $octave_cv_sundials_sunlinsol_dense = yes \ - && test $octave_cv_sundials_realtype_is_double = yes; then + && test $octave_cv_sundials_realtype_is_double = yes \ + && test $octave_have_sundials_compatible_api = yes; then AC_DEFINE(HAVE_SUNDIALS, 1, [Define to 1 if SUNDIALS is available.]) ## Collections of options needed to build with SUNDIALS and its dependencies. @@ -2233,7 +2235,7 @@ SUNDIALS_IDA_LIBS= SUNDIALS_SUNLINSOLKLU_CPPFLAGS= SUNDIALS_SUNLINSOLKLU_LDFLAGS= - SUNDIALS_SUNLINSOLKLU_LIBS + SUNDIALS_SUNLINSOLKLU_LIBS= SUNDIALS_NVECSERIAL_CPPFLAGS= SUNDIALS_NVECSERIAL_LDFLAGS= SUNDIALS_NVECSERIAL_LIBS= @@ -2248,15 +2250,6 @@ AC_SUBST(SUNDIALS_XLDFLAGS) AC_SUBST(SUNDIALS_XLIBS) -save_LIBS="$LIBS" -LIBS="$SUNDIALS_XLIBS $LIBS" -## Current interface: -AC_CHECK_FUNCS([IDASetJacFn IDASetLinearSolver SUNLinSol_Dense SUNLinSol_KLU]) -## Deprecated interface: -AC_CHECK_HEADERS([ida/ida_direct.h ida_direct.h]) -AC_CHECK_FUNCS([IDADlsSetJacFn IDADlsSetLinearSolver SUNDenseLinearSolver SUNKLU]) -LIBS="$save_LIBS" - ### Check for ARPACK library. save_LIBS="$LIBS"
--- a/m4/acinclude.m4 Wed Mar 27 12:31:27 2019 -0700 +++ b/m4/acinclude.m4 Wed Mar 27 13:48:50 2019 -0700 @@ -2211,6 +2211,42 @@ ]) ]) dnl +dnl Check whether SUNDIALS libraries provide a compatible interface. +dnl The current recommended interface was introduced in SUNDIALS version 4. +dnl The deprecated interface that Octave currently works to be compatible with +dnl was introduced in SUNDIALS version 3. +dnl +AC_DEFUN([OCTAVE_CHECK_SUNDIALS_COMPATIBLE_API], [ + ac_octave_save_LIBS=$LIBS + LIBS="$SUNDIALS_IDA_LIBS $SUNDIALS_SUNLINSOLKLU_LIBS $SUNDIALS_NVECSERIAL_LIBS $KLU_LIBS $LIBS" + dnl Current API functions present in SUNDIALS version 4 + AC_CHECK_FUNCS([IDASetJacFn IDASetLinearSolver SUNLinSol_Dense SUNLinSol_KLU]) + dnl FIXME: The purpose of the following tests is to detect the deprecated + dnl API from SUNDIALS version 3, which should only be used if the current + dnl API tests above failed. For now, always test for ida_direct.h. + AC_CHECK_HEADERS([ida/ida_direct.h ida_direct.h]) + dnl Each of these is a deprecated analog to the functions listed above. + AC_CHECK_FUNCS([IDADlsSetJacFn IDADlsSetLinearSolver SUNDenseLinearSolver SUNKLU]) + LIBS=$ac_octave_save_LIBS + AC_MSG_CHECKING([whether SUNDIALS API provides the necessary functions]) + if test "x$ac_cv_func_IDASetJacFn" = xyes \ + && test "x$ac_cv_func_IDASetLinearSolver" = xyes \ + && test "x$ac_cv_func_SUNLinSol_Dense" = xyes; then + octave_have_sundials_compatible_api=yes + elif test "x$ac_cv_func_IDADlsSetJacFn" = xyes \ + && test "x$ac_cv_func_IDADlsSetLinearSolver" = xyes \ + && test "x$ac_cv_func_SUNDenseLinearSolver" = xyes; then + octave_have_sundials_compatible_api=yes + else + octave_have_sundials_compatible_api=no + fi + AC_MSG_RESULT([$octave_have_sundials_compatible_api]) + if test $octave_have_sundials_compatible_api = no; then + warn_sundials_api="SUNDIALS libraries do not provide an API that is compatible with Octave, ode15i and ode15s will be disabled" + OCTAVE_CONFIGURE_WARNING([warn_sundials_api]) + fi +]) +dnl dnl Check whether SUNDIALS IDA library is configured with double dnl precision realtype. dnl