Skip to content

Commit fa7f062

Browse files
author
Release Manager
committed
Trac #29361: openblas spkg-configure.m4: Fix the check for lapack/cblas functions
This line (introduced in #29071): {{{ AC_FC_FREEFORM([AC_FC_FUNC([dgeqrf])]) }}} is not executed at all because `AC_FC_FREEFORM` is `AC_DEFUN_ONCE` and is called already in `gfortran/spkg-configure.m4` As a result: {{{ Checking whether SageMath should install SPKG openblas... checking BLAS library... openblas checking whether any of gfortran is installed or will be installed as SPKG... no checking for openblas >= 0.2.20... yes checking for cblas_dgemm... yes checking for ... no checking for lapack... no configure: no suitable system package found for SPKG openblas }}} In this ticket, we fix the check by avoiding `AC_FC_FUNC` altogether, which is not suitable to be used in a configure that must work if no Fortran compiler is available. (Factored out from #29104.) URL: https://trac.sagemath.org/29361 Reported by: mkoeppe Ticket author(s): Matthias Koeppe Reviewer(s): Dima Pasechnik
2 parents d26d2ae + 71ac6a5 commit fa7f062

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

build/pkgs/openblas/spkg-configure.m4

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
11
SAGE_SPKG_CONFIGURE([openblas], [
22
SAGE_SPKG_DEPCHECK([gfortran], [
33
PKG_CHECK_MODULES([OPENBLAS], [openblas >= 0.2.20], [
4+
SAVE_LIBS="$LIBS"
5+
LIBS="$OPENBLAS_LIBS $LIBS"
6+
SAVE_CFLAGS="$CFLAGS"
7+
CFLAGS="$OPENBLAS_CFLAGS $CFLAGS"
48
PKG_CHECK_VAR([OPENBLASPCDIR], [openblas], [pcfiledir], [
59
sage_install_blas_pc=yes
6-
AC_SEARCH_LIBS([cblas_dgemm], [openblas], [dnl openblas works as cblas
10+
AC_CHECK_FUNC([cblas_dgemm], [dnl openblas works as cblas
711
sage_install_cblas_pc=yes
812
], [
9-
dnl openblas does not work as cblas; try to use system's cblas as is
13+
dnl openblas does not work as cblas; try to use system cblas as is
1014
PKG_CHECK_MODULES([CBLAS], [cblas], [], [sage_spkg_install_openblas=yes])
1115
])
12-
AC_FC_FREEFORM([AC_FC_FUNC([dgeqrf])])
13-
AC_SEARCH_LIBS([$dgeqrf], [openblas], [dnl openblas works as lapack
16+
dnl Check all name manglings that AC_FC_FUNC could check based on the
17+
dnl characteristics of the Fortran compiler
18+
m4_foreach([dgeqrf_mangled], [dgeqrf, dgeqrf_, DGEQRF, DGEQRF_], [
19+
AC_CHECK_FUNC(dgeqrf_mangled, [
20+
AS_VAR_SET([HAVE_DGEQRF], [yes])
21+
])
22+
])
23+
AS_IF([test x$HAVE_DGEQRF = xyes], [dnl openblas works as lapack
1424
sage_install_lapack_pc=yes
1525
], [
16-
dnl openblas does not work as lapack; try to use system's lapack as is
26+
dnl openblas does not work as lapack; try to use system lapack as is
1727
PKG_CHECK_MODULES([LAPACK], [lapack], [], [sage_spkg_install_openblas=yes])
1828
])
1929
], [
2030
AC_MSG_WARN([Unable to locate the directory of openblas.pc. This should not happen!])
2131
sage_spkg_install_openblas=yes
2232
])
33+
LIBS="$SAVE_LIBS"
34+
CFLAGS="$SAVE_CFLAGS"
2335
], [sage_spkg_install_openblas=yes])
2436
AS_IF([test x$sage_spkg_install_openblas != xyes], [
2537
m4_foreach([blaslibnam], [blas, cblas, lapack], [

0 commit comments

Comments
 (0)