Math, BLAS/LAPACK m4 checks
Just FYI, here's something which may be useful to authors of
autoconf-using math software, with a particular bent to the way
BLAS/LAPACK is done on Debian, and attention to Alpha issues such as
-mieee and the Q (er, HPaq?) math libs, etc. It's a rough draft of a
very small thing, feel free to use and modify, share and enjoy, comment
or criticize, etc., and if you have something better, I'd love to hear
BTW, I'd like to have my cxml package provide blas2 and/or lapack2, but
can't quite figure how to do that. If I make symlinks from
/usr/lib/libblas2.so etc. then that's not a problem at build-time, but
what about runtime? Do I need to symlink /usr/lib/libblas.so.2 to
libcxml.so? In that case, will it conflict with blas and lapack?
GPG fingerprint: D54D 1AEE B11C CE9B A02B C5DD 526F 01E8 564E E4B6
Welcome to the best software in the world today cafe!
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 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.
dnl ffm is free fast math by Joachim Wesner and Kazushige Goto for
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
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_CHECK_LIB(blas2, dgemm_, [
HAVE_BLAS="yes" LIBS="-lblas2 $aLIBS $FLIBS"
BLASLAPACK_LIBS="-lblas2 -llapack2 $FLIBS",
BLASLAPACK_LIBS="-lblas2 $FLIBS")], [
AC_CHECK_LIB(blas, dgemm_, [
HAVE_BLAS="yes" LIBS="$aLIBS -lblas $FLIBS"
BLASLAPACK_LIBS="-lblas -llapack $FLIBS",
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.
MATH_LIBS="$MATH_LIBS -lots -lcpml" MATH_INCLUDES=""
LIBS="$aLIBS -lots -lcpml" [
MATH_LIBS="$MATH_LIBS -lm" MATH_INCLUDES="")])