From c8a52177bf135d219df7ba75a498a8ac0cfad36c Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Sun, 14 Oct 2012 12:14:15 +0200 Subject: [PATCH 1/2] Honor explicit specification of BLAS/LAPACK libraries Only probe for libraries on system if no library is specified. If there is an error with the library that is specified as an argument, then raise an error instead of continuing to look for other libraries with a simple warning buried deep in the configuration log. --- m4/ax_blas.m4 | 8 ++++++++ m4/ax_lapack.m4 | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/m4/ax_blas.m4 b/m4/ax_blas.m4 index e4f96cbe..7e6fd549 100644 --- a/m4/ax_blas.m4 +++ b/m4/ax_blas.m4 @@ -98,6 +98,11 @@ if test "x$BLAS_LIBS" != x; then fi fi +# don't probe if explicitly defined; by bailing out here if the +# argument is set, we guard against typo, incompatible libs. etc. +# being inadvertedly overrided by another (random) implementation +if test "x$with_blas" == x; then + # BLAS linked to by default? (happens on some supercomputers) if test $ax_blas_ok = no; then save_LIBS="$LIBS"; LIBS="$LIBS" @@ -186,6 +191,9 @@ if test $ax_blas_ok = no; then AC_CHECK_LIB(blas, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lblas"]) fi +# end of guard against automatic overriding explicit definitions +fi + AC_SUBST(BLAS_LIBS) LIBS="$ax_blas_save_LIBS" diff --git a/m4/ax_lapack.m4 b/m4/ax_lapack.m4 index 6aa16aaf..ad188f9e 100644 --- a/m4/ax_lapack.m4 +++ b/m4/ax_lapack.m4 @@ -101,6 +101,11 @@ if test "x$LAPACK_LIBS" != x; then fi fi +# don't probe if explicitly defined; by bailing out here if the +# argument is set, we guard against typo, incompatible libs. etc. +# being inadvertedly overrided by another (random) implementation +if test "x$with_lapack" == x; then + # LAPACK linked to by default? (is sometimes included in BLAS lib) if test $ax_lapack_ok = no; then save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS" @@ -118,6 +123,9 @@ for lapack in lapack lapack_rs6k; do fi done +# end of guard against automatic overriding explicit definitions +fi + AC_SUBST(LAPACK_LIBS) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: From 1689074d4fd94acb364727078903e31ca431b193 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Sun, 14 Oct 2012 21:43:11 +0200 Subject: [PATCH 2/2] Abort build process if BLAS or LAPACK not found --- m4/opm_lapack.m4 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/m4/opm_lapack.m4 b/m4/opm_lapack.m4 index b5fa5ca5..083ecf0b 100644 --- a/m4/opm_lapack.m4 +++ b/m4/opm_lapack.m4 @@ -1,4 +1,7 @@ AC_DEFUN([OPM_LAPACK], [AC_REQUIRE([AC_F77_WRAPPERS])dnl AC_REQUIRE([AX_LAPACK])dnl + if test x"$ax_lapack_ok" != xyes; then + AC_MSG_ERROR([BLAS/LAPACK required, but not found.]) + fi ])[]dnl