48
48
endif
49
49
50
50
51
+ # This is currently injected directly into CFLAGS/CXXFLAGS for wheel builds
52
+ # (see cibuildwheel settings in pyproject.toml)
53
+ blas_symbol_suffix = get_option (' blas-symbol-suffix' )
54
+
55
+
51
56
# TODO: 64-bit BLAS and LAPACK
52
57
#
53
58
# Note that this works as long as BLAS and LAPACK are detected properly via
69
74
have_blas = blas.found()
70
75
cblas = []
71
76
if have_blas
77
+ # As noted above, at this point the BLAS_SYMBOL_SUFFIX may be injected into
78
+ # the CFLAGS directly, so this requires care to use that when it happens:
79
+ if blas_symbol_suffix != ''
80
+ probe_args = [' -DBLAS_SYMBOL_SUFFIX=' + blas_symbol_suffix]
81
+ else
82
+ probe_args = []
83
+ endif
84
+
72
85
# Netlib BLAS has a separate `libcblas.so` which we use directly in the g77
73
86
# ABI wrappers, so detect it and error out if we cannot find it. OpenBLAS can
74
87
# be built without CBLAS too (see gh-23909, done by Arch Linux until
@@ -78,15 +91,22 @@ if have_blas
78
91
# see https://github.com/mesonbuild/meson/pull/10921.
79
92
have_cblas = false
80
93
if cc.links('''
94
+ #ifndef BLAS_SYMBOL_SUFFIX
95
+ # define BLAS_SYMBOL_SUFFIX
96
+ #endif
97
+ #define EXPAND(suffix) cblas_ddot ## suffix
98
+ #define DDOT(suffix) EXPAND(suffix)
99
+
81
100
#include <cblas.h>
82
101
int main(int argc, const char *argv[])
83
102
{
84
103
double a[4] = {1,2,3,4};
85
104
double b[4] = {5,6,7,8};
86
- return cblas_ddot (4, a, 1, b, 1) > 10;
105
+ return DDOT(BLAS_SYMBOL_SUFFIX) (4, a, 1, b, 1) > 10;
87
106
}
88
107
''' ,
89
108
dependencies : blas,
109
+ args : probe_args,
90
110
name : ' CBLAS' ,
91
111
)
92
112
have_cblas = true
@@ -133,9 +153,6 @@ if have_blas
133
153
if use_ilp64
134
154
c_args_blas += [' -DHAVE_BLAS_ILP64' ]
135
155
endif
136
- # This is currently injected directly into CFLAGS/CXXFLAGS for wheel builds
137
- # (see cibuildwheel settings in pyproject.toml)
138
- blas_symbol_suffix = get_option (' blas-symbol-suffix' )
139
156
if blas_symbol_suffix != ''
140
157
c_args_blas += [' -DBLAS_SYMBOL_SUFFIX=' + blas_symbol_suffix]
141
158
endif
0 commit comments