Mercurial > hg > octave-lyh
changeset 15329:719ffb2f35a6
Fix Octave builds with SuiteSparse >=4.0 (bug #37031)
* configure.ac: Call OCTAVE_UMFPACK_NEED_SUITESPARSE_TIME to check if
UMFPACK needs SuiteSparse_time function. If it does, use AC_SEARCH_LIBS
to find a possible library.
* m4/acinclude.m4: Add new macro OCTAVE_UMFPACK_NEED_SUITESPARSE_TIME.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 07 Sep 2012 17:05:12 -0700 |
parents | efbc896c1ecc |
children | 81cc4e5733b1 |
files | configure.ac m4/acinclude.m4 |
diffstat | 2 files changed, 61 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac +++ b/configure.ac @@ -1320,11 +1320,41 @@ LIBS="$save_LIBS" fi +## Test features of the installed UMFPACK library + if test -n "$UMFPACK_LIBS"; then + ## SuiteSparse >= 4.0 needs additional link library for SuiteSparse_time() save_LIBS="$LIBS"; - LIBS="$UMFPACK_LIBS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS" - OCTAVE_UMFPACK_SEPARATE_SPLIT + LIBS="$UMFPACK_LIBS $FLIBS $LIBS" + xtra_libs= + OCTAVE_UMFPACK_NEED_SUITESPARSE_TIME + if test "$octave_cv_umfpack_need_suitesparse_time" = yes; then + AC_CHECK_LIB([rt], [clock_gettime], [xtra_libs="-lrt"], [xtra_libs=]) + ## FIXME: This library list is only accurate for Linux, Mac OS X. + ## Possibly need other library names for MinGW, Cygwin. + AC_SEARCH_LIBS([SuiteSparse_time], + [suitesparseconfig SuiteSparse], + [], [], [$xtra_libs]) + case "$ac_cv_search_SuiteSparse_time" in + -l*) + UMFPACK_LIBS="$UMFPACK_LIBS $ac_cv_search_SuiteSparse_time" + ;; + no) + UMFPACK_LIBS= + AC_MSG_WARN([UMFPACK library found but is missing SuiteSparse_time functionality.]) + AC_MSG_WARN([UMFPACK library will be disabled.]) + ;; + esac + fi LIBS="$save_LIBS" + + ## Check for UMFPACK separately split complex matrix and RHS. + if test -n "$UMFPACK_LIBS"; then + save_LIBS="$LIBS"; + LIBS="$UMFPACK_LIBS $CHOLMOD_LIBS $AMD_LIBS $COLAMD_LIBS $LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS $xtra_libs" + OCTAVE_UMFPACK_SEPARATE_SPLIT + LIBS="$save_LIBS" + fi fi ### Check for ARPACK library.
--- a/m4/acinclude.m4 +++ b/m4/acinclude.m4 @@ -1624,6 +1624,35 @@ AC_SUBST($1) ]) dnl +dnl Check whether SuiteSparse_time is required by UMFPACK. +dnl UMFPACK >= 4 requires linking in another library for SuiteSparse_time. +dnl +dnl Macro assumes that the check for umfpack has already been performed. +dnl +AC_DEFUN([OCTAVE_UMFPACK_NEED_SUITESPARSE_TIME], [ + AC_CACHE_CHECK([whether UMFPACK needs SuiteSparse_time function], + [octave_cv_umfpack_need_suitesparse_time], + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #if defined (HAVE_SUITESPARSE_UMFPACK_H) + # include <suitesparse/umfpack.h> + #elif defined (HAVE_UFSPARSE_UMFPACK_H) + # include <ufsparse/umfpack.h> + #elif defined (HAVE_UMFPACK_UMFPACK_H) + # include <umfpack/umfpack.h> + #elif defined (HAVE_UMFPACK_H) + # include <umfpack.h> + #endif + ]], [[ + double stats [2]; + umfpack_tic (stats); + ]])], + octave_cv_umfpack_need_suitesparse_time=no, + octave_cv_umfpack_need_suitesparse_time=yes) + AC_LANG_POP(C) + ]) +]) +dnl dnl Check for UMFPACK separately split complex matrix and RHS. dnl dnl Macro assumes that the check for umfpack has already been performed.