summaryrefslogtreecommitdiff
blob: 609aa034438df16cf2b496b9685bb213b83721f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
From 8e350d3f47a1785eb4eea83dee43c596d6399459 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <michael@orlitzky.com>
Date: Sat, 10 Feb 2024 07:30:37 -0500
Subject: [PATCH] configure.ac,fflas-ffpack-config.in: use pkg-config to check
 for blas

Patching configure.ac for this is ugly, but in this case it is
actually the simplest way to get sane behavior out of the blas/lapack
check.
---
 configure.ac           | 29 ++++++++++++++++++-----------
 fflas-ffpack-config.in |  4 ++--
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5390bcf..2f5fc46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -133,17 +133,24 @@ FF_CHECK_GIVARO_USABILITY()
 
 AS_ECHO([---------------------------------------])
 
-BLAS_FOUND=false
-
-FF_CHECK_BLAS_CFLAGS
-FF_CHECK_BLAS_LIBS
-FF_CHECK_MKL
-FF_CHECK_USER_BLAS
-FF_CHECK_USER_LAPACK
-
-FF_OPENBLAS_NUM_THREADS
-
-# FF_CHECK_CUDA
+PKG_PROG_PKG_CONFIG
+
+PKG_CHECK_MODULES([BLAS], [cblas blas],[
+    AC_DEFINE(HAVE_BLAS,1,[Define if BLAS is installed])
+    AC_DEFINE(HAVE_CBLAS,1,[Define if C interface to BLAS is installed])
+    HAVE_BLAS=yes
+    BLAS_PATH=""
+    CBLAS_LIBS="${BLAS_LIBS}"
+    AC_SUBST(BLAS_LIBS)
+    AC_SUBST(CBLAS_LIBS)
+    AC_SUBST(BLAS_CFLAGS)
+    AC_SUBST(BLAS_PATH)])
+
+PKG_CHECK_MODULES([LAPACK], [lapack],[
+    AC_DEFINE(HAVE_LAPACK,1,[Define if LAPACK is installed])
+    AC_SUBST(LAPACK_LIBS)])
+
+AM_CONDITIONAL(FFLASFFPACK_HAVE_LAPACK,  test "x$HAVE_LAPACK" == "x1")
 
 AS_ECHO([---------------------------------------])
 
diff --git a/fflas-ffpack-config.in b/fflas-ffpack-config.in
index 3e2f53f..e227ce0 100644
--- a/fflas-ffpack-config.in
+++ b/fflas-ffpack-config.in
@@ -106,11 +106,11 @@ while test $# -gt 0; do
 			;;
 
 		--libs)
-			echo @PARLIBS@ @PRECOMPILE_LIBS@ @BLAS_LIBS@ @GIVARO_LIBS@
+			echo @PARLIBS@ @PRECOMPILE_LIBS@ @LAPACK_LIBS@ @BLAS_LIBS@ @GIVARO_LIBS@
 			;;
 
 		--blas-libs)
-			echo @BLAS_LIBS@
+			echo @LAPACK_LIBS@ @BLAS_LIBS@
 			;;
 
 		*)
-- 
2.43.0