Mercurial > octave
changeset 21160:b5b531ba93ce
build: Use configure-time test to check CXSparse version.
* configure.ac: Call OCTAVE_CHECK_CXSPARSE_VERSION_OK macro and error out of
configure if version is < 2.2.
* acinclude.m4 (OCTAVE_CHECK_CXSPARSE_VERSION_OK) : New macro.
* oct-sparse.h: Remove compie-time test for CXSparse version.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 30 Jan 2016 20:48:21 -0800 |
parents | 4aa8e4b868c9 |
children | 4c54a269ad44 |
files | configure.ac liboctave/util/oct-sparse.h m4/acinclude.m4 |
diffstat | 3 files changed, 49 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Tue Jan 19 12:31:06 2016 +1100 +++ b/configure.ac Sat Jan 30 20:48:21 2016 -0800 @@ -1586,6 +1586,14 @@ [cs${CXSPARSE_TAG}sqr], [C++], [don't use CXSparse library, disable some sparse matrix functionality]) +## Additional check for CXSparse version >= 2.2 +if test $octave_cv_lib_cxsparse = yes; then + OCTAVE_CHECK_CXSPARSE_VERSION_OK + if test $octave_cv_cxsparse_version_ok = no; then + AC_MSG_ERROR([CXSparse library is too old (< version 2.2). Upgrade CXSparse (SuiteSparse) or configure Octave with --disable-cxsparse"]) + fi +fi + ### Check for UMFPACK library. save_LIBS="$LIBS"
--- a/liboctave/util/oct-sparse.h Tue Jan 19 12:31:06 2016 +1100 +++ b/liboctave/util/oct-sparse.h Sat Jan 30 20:48:21 2016 -0800 @@ -83,18 +83,6 @@ #include <cs.h> #endif -// Yes, it would be better to use a configure script check for -// required CXSparse features, but that seems more trouble than it is -// worth in this case. - -#if (defined (HAVE_CXSPARSE) \ - && (! defined (CS_VER) \ - || CS_VER < 2 \ - || (CS_VER == 2 && CS_SUBVER < 2))) -#error "Octave requires CXSparse version 2.2 or later" -#error "Upgrade CXSparse (SuiteSparse) or configure Octave with --disable-cxsparse" -#endif - #if (defined (HAVE_SUITESPARSE_CHOLMOD_H) \ || defined (HAVE_UFSPARSE_CHOLMOD_H) \ || defined (HAVE_CHOLMOD_CHOLMOD_H) \ @@ -106,8 +94,8 @@ #endif #endif -// Cope with new suitesparse versions -// +// Cope with new SuiteSparse versions + #if defined (SUITESPARSE_VERSION) # if SUITESPARSE_VERSION >= SUITESPARSE_VER_CODE (4, 3) # define SUITESPARSE_NAME(name) SuiteSparse_ ## name
--- a/m4/acinclude.m4 Tue Jan 19 12:31:06 2016 +1100 +++ b/m4/acinclude.m4 Sat Jan 30 20:48:21 2016 -0800 @@ -180,6 +180,45 @@ fi ]) dnl +dnl Check whether CXSparse is version 2.2 or later +dnl FIXME: This test uses a version number. It potentially could +dnl be re-written to actually call a function, but is it worth it? +dnl +AC_DEFUN([OCTAVE_CHECK_CXSPARSE_VERSION_OK], [ + AC_CACHE_CHECK([whether CXSparse is version 2.2 or later], + [octave_cv_cxsparse_version_ok], + [AC_LANG_PUSH(C++) + ac_octave_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS" + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ + #if defined (HAVE_SUITESPARSE_CS_H) + #include <suitesparse/cs.h> + #elif defined (HAVE_UFSPARSE_CS_H) + #include <ufsparse/cs.h> + #elif defined (HAVE_CXSPARSE_CS_H) + #include <cxsparse/cs.h> + #elif defined (HAVE_CS_H) + #include <cs.h> + #endif + ]], [[ + #if (defined (HAVE_CXSPARSE) \ + && (! defined (CS_VER) \ + || CS_VER < 2 \ + || (CS_VER == 2 && CS_SUBVER < 2))) + #error "Octave requires CXSparse version 2.2 or later" + #endif + ]])], + octave_cv_cxsparse_version_ok=yes, + octave_cv_cxsparse_version_ok=no) + CPPFLAGS="$ac_octave_save_CPPFLAGS" + AC_LANG_POP(C++) + ]) + if test $octave_cv_cxsparse_version_ok = yes; then + AC_DEFINE(HAVE_CXSPARSE_VERSION_OK, 1, + [Define to 1 if CXSparse is version 2.2 or later.]) + fi +]) +dnl dnl Check whether the FFTW library supports multi-threading. This macro dnl should be called once per FFTW precision passing in the library dnl variant (e.g. "fftw3") and a function in the thread support API