dnl Math and linear algebra checks by Adam Powell last modified 2002-08-07. dnl Copyright 2000 Adam Powell, redistributable under the terms of the GNU dnl General Public License version 2 or later. dnl dnl Then again, since none of this is "incorporated" in any software generated dnl except perhaps a configure script, its application to non-GPL-compatible dnl software packages is not clear at this point... in that regard, use at your dnl own risk. AC_DEFUN([MATH_BLASLAPACK_CHECKS],[ dnl ffm is free fast math by Joachim Wesner and Kazushige Goto for dnl Linux/Alpha. AC_CHECK_HEADERS(libffm.h) AC_CHECK_LIB(ffm, dsqrtiv, MATH_LIBS="$MATH_LIBS -lffm" MATH_INCLUDES="-DFFM") dnl Alphas need this sometimes AC_CHECKING([whether -mieee is needed to avoid SIGFPE on divide by zero]) case $build/$CC in alpha*/gcc* ) MIEEE_CFLAGS="-mieee" AC_MSG_RESULT([yes]) ;; * ) MIEEE_CFLAGS="" AC_MSG_RESULT([not needed]) ;; esac AC_SUBST(MIEEE_CFLAGS) dnl Used to check for IRIX multi-processor BLAS, but result was dnl EXTREMELY slow (here just for historical purposes) dnl AC_CHECK_LIB(blas_mp, dgemm_, BLAS_LIBS="-mp -lblas_mp", [ dnl AC_CHECK_LIB(f77blas, dgemm_, BLAS_LIBS="-lf77blas -latlas", [ dnl LIBS="$aLIBS $MATH_LIBS $FLIBS"])]) dnl For some reason, the Debian BLAS/LAPACK maintainer decided blas2 dnl and lapack2 are good names for the alternatives symlinks; I'm dnl prefering those over blas and lapack. For now, I don't see a need dnl for mixed blas/lapack2 or blas2/lapack, only blas2/lapack2 and dnl blas/lapack are checked. AC_F77_LIBRARY_LDFLAGS aLIBS="$LIBS" LIBS="$aLIBS $FLIBS" AC_CHECK_LIB(blas2, dgemm_, [ HAVE_BLAS="yes" LIBS="-lblas2 $aLIBS $FLIBS" AC_CHECK_LIB(lapack2, dgetrf_, HAVE_LAPACK="yes" BLASLAPACK_LIBS="-lblas2 -llapack2 $FLIBS", BLASLAPACK_LIBS="-lblas2 $FLIBS")], [ AC_CHECK_LIB(blas, dgemm_, [ HAVE_BLAS="yes" LIBS="$aLIBS -lblas $FLIBS" AC_CHECK_LIB(lapack, dgetrf_, HAVE_LAPACK="yes" BLASLAPACK_LIBS="-lblas -llapack $FLIBS", BLASLAPACK_LIBS="-lblas $FLIBS")])]) LIBS="$aLIBS" dnl cpml is the Compaq Portable Math Library for Linux/Alpha, and often dnl comes with cxml which has superfast blas/lapack included, so this dnl overrides the above BLAS and LAPACK checks. aLIBS="$LIBS" LIBS="$aLIBS -lots" AC_CHECK_LIB(cpml, sqrt, MATH_LIBS="$MATH_LIBS -lots -lcpml" MATH_INCLUDES="" LIBS="$aLIBS -lots -lcpml" [ AC_CHECK_LIB(cxml, dgemm_, BLASLAPACK_LIBS="$MATH_LIBS -lcxml" HAVE_BLAS="yes" HAVE_LAPACK="yes", MATH_LIBS="$MATH_LIBS -lm" MATH_INCLUDES="")]) LIBS="$aLIBS" AC_SUBST(MATH_LIBS) AC_SUBST(MATH_INCLUDES) AC_SUBST(BLASLAPACK_LIBS) AC_SUBST(HAVE_BLAS) AC_SUBST(HAVE_LAPACK) ])