annotate m4/octave_blas_f77_func.m4 @ 31122:1077a1c277fb

build: Use caching for Fortran values in configure. * configure.ac: Rename ax_blas_integer_size to ax_cv_blas_integer_size. * octave_blas_f77_func.m4: Use AC_CACHE_CHECK macro for Fortran values. Rename values from "ax_blas_..." to "ax_cv_blas_..." to comply with requirement for "_cv_" in configure cache naming.
author Rik <rik@octave.org>
date Wed, 06 Jul 2022 22:03:13 -0700
parents f19e621d7f2d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22986
21707d6a02c7 make --enable-64 the default
John W. Eaton <jwe@octave.org>
parents: 19300
diff changeset
1 # OCTAVE_BLAS_F77_FUNC
21707d6a02c7 make --enable-64 the default
John W. Eaton <jwe@octave.org>
parents: 19300
diff changeset
2 #
21707d6a02c7 make --enable-64 the default
John W. Eaton <jwe@octave.org>
parents: 19300
diff changeset
3 # The same as AX_BLAS_F77_FUNC (described below) except attempt to
21707d6a02c7 make --enable-64 the default
John W. Eaton <jwe@octave.org>
parents: 19300
diff changeset
4 # determine whether the BLAS library uses 32- or 64-bit integers instead
21707d6a02c7 make --enable-64 the default
John W. Eaton <jwe@octave.org>
parents: 19300
diff changeset
5 # of failing if the default size of Fortran integers does not appear to
21707d6a02c7 make --enable-64 the default
John W. Eaton <jwe@octave.org>
parents: 19300
diff changeset
6 # match the size of integers used by the BLAS library.
21707d6a02c7 make --enable-64 the default
John W. Eaton <jwe@octave.org>
parents: 19300
diff changeset
7
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
8 # ===========================================================================
24893
a3eb0d746042 doc: use canonical https URLs for all external gnu.org references
Mike Miller <mtmiller@octave.org>
parents: 24534
diff changeset
9 # https://www.gnu.org/software/autoconf-archive/ax_blas_f77_func.html
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
10 # ===========================================================================
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
11 #
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
12 # SYNOPSIS
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
13 #
10951
97b8d462ef11 Update m4 macros.
Ben Abbott <bpabbott@mac.com>
parents: 9645
diff changeset
14 # AX_BLAS_F77_FUNC([ACTION-IF-PASS[, ACTION-IF-FAIL[, ACTION-IF-CROSS-COMPILING]])
97b8d462ef11 Update m4 macros.
Ben Abbott <bpabbott@mac.com>
parents: 9645
diff changeset
15 # AX_BLAS_WITH_F77_FUNC([ACTION-IF-FOUND-AND-PASS[, ACTION-IF-NOT-FOUND-OR-FAIL]])
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
16 #
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
17 # DESCRIPTION
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
18 #
10951
97b8d462ef11 Update m4 macros.
Ben Abbott <bpabbott@mac.com>
parents: 9645
diff changeset
19 # These macros are intended as a supplement to the AX_BLAS macro, to
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
20 # verify that BLAS functions are properly callable from Fortran. This is
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
21 # necessary, for example, if you want to build the LAPACK library on top
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
22 # of the BLAS.
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
23 #
10951
97b8d462ef11 Update m4 macros.
Ben Abbott <bpabbott@mac.com>
parents: 9645
diff changeset
24 # AX_BLAS_F77_FUNC uses the defined BLAS_LIBS and Fortran environment to
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
25 # check for compatibility, and takes a specific action in case of success,
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
26 # resp. failure, resp. cross-compilation.
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
27 #
10951
97b8d462ef11 Update m4 macros.
Ben Abbott <bpabbott@mac.com>
parents: 9645
diff changeset
28 # AX_BLAS_WITH_F77_FUNC is a drop-in replacement wrapper for AX_BLAS that
97b8d462ef11 Update m4 macros.
Ben Abbott <bpabbott@mac.com>
parents: 9645
diff changeset
29 # calls AX_BLAS_F77_FUNC after detecting a BLAS library and rejects it on
97b8d462ef11 Update m4 macros.
Ben Abbott <bpabbott@mac.com>
parents: 9645
diff changeset
30 # failure (i.e. pretends that no library was found).
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
31 #
10951
97b8d462ef11 Update m4 macros.
Ben Abbott <bpabbott@mac.com>
parents: 9645
diff changeset
32 # LICENSE
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
33 #
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
34 # Copyright (c) 2008 Jaroslav Hajek <highegg@gmail.com>
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
35 #
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
36 # This program is free software: you can redistribute it and/or modify it
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
37 # under the terms of the GNU General Public License as published by the
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
38 # Free Software Foundation, either version 3 of the License, or (at your
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
39 # option) any later version.
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
40 #
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
41 # This program is distributed in the hope that it will be useful, but
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
42 # WITHOUT ANY WARRANTY; without even the implied warranty of
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
43 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
44 # Public License for more details.
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
45 #
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
46 # You should have received a copy of the GNU General Public License along
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23876
diff changeset
47 # with this program. If not, see <https://www.gnu.org/licenses/>.
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
48 #
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
49 # As a special exception, the respective Autoconf Macro's copyright owner
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
50 # gives unlimited permission to copy, distribute and modify the configure
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
51 # scripts that are the output of Autoconf when processing the Macro. You
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
52 # need not follow the terms of the GNU General Public License when using
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
53 # or distributing such scripts, even though portions of the text of the
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
54 # Macro appear in them. The GNU General Public License (GPL) does govern
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
55 # all other use of the material that constitutes the Autoconf Macro.
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
56 #
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
57 # This special exception to the GPL applies to versions of the Autoconf
10951
97b8d462ef11 Update m4 macros.
Ben Abbott <bpabbott@mac.com>
parents: 9645
diff changeset
58 # Macro released by the Autoconf Archive. When you make and distribute a
97b8d462ef11 Update m4 macros.
Ben Abbott <bpabbott@mac.com>
parents: 9645
diff changeset
59 # modified version of the Autoconf Macro, you may extend this special
97b8d462ef11 Update m4 macros.
Ben Abbott <bpabbott@mac.com>
parents: 9645
diff changeset
60 # exception to the GPL to apply to your modified version as well.
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
61
15153
ba431d1106e3 build: Update ax_XXX macros in m4 directory to newest versions.
Rik <rik@octave.org>
parents: 10956
diff changeset
62 #serial 8
10951
97b8d462ef11 Update m4 macros.
Ben Abbott <bpabbott@mac.com>
parents: 9645
diff changeset
63
23085
dffa2b8c9482 maint: strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 22986
diff changeset
64 ## Derived from
22986
21707d6a02c7 make --enable-64 the default
John W. Eaton <jwe@octave.org>
parents: 19300
diff changeset
65 AC_DEFUN([OCTAVE_BLAS_F77_FUNC], [
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
66 AC_PREREQ(2.50)
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
67 AC_REQUIRE([AX_BLAS])
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
68
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
69 # F77 call-compatibility checks
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
70 if test "$cross_compiling" = yes ; then
23876
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
71 ifelse($3, ,$1,$3)
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
72 elif test x"$ax_blas_ok" = xyes; then
23876
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
73 save_ax_blas_f77_func_LIBS="$LIBS"
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
74 LIBS="$BLAS_LIBS $LIBS"
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
75 AC_LANG_PUSH(Fortran 77)
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
76 # LSAME check (LOGICAL return values)
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
77 AC_CACHE_CHECK([whether LSAME is called correctly from Fortran],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
78 [ax_cv_blas_lsame_fcall_ok],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
79 [AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
80 logical lsame,w
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
81 external lsame
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
82 character c1,c2
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
83 c1 = 'A'
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
84 c2 = 'B'
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
85 w = lsame(c1,c2)
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
86 if (w) stop 1
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
87 w = lsame(c1,c1)
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
88 if (.not. w) stop 1
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
89 ]])],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
90 ax_cv_blas_lsame_fcall_ok=yes,
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
91 ax_cv_blas_lsame_fcall_ok=no)
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
92 ])
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
93 # ISAMAX check (INTEGER return values)
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
94 # FIXME: This value is never used, so why do we calculate it?
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
95 AC_CACHE_CHECK([whether ISAMAX is called correctly from Fortran],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
96 [ax_cv_blas_isamax_fcall_ok],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
97 [AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
98 integer isamax,i
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
99 external isamax
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
100 real a(2)
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
101 a(1) = 1e0
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
102 a(2) = -2e0
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
103 i = isamax(2,a,1)
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
104 if (i.ne.2) stop 1
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
105 ]])],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
106 ax_cv_blas_isamax_fcall_ok=yes,
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
107 ax_cv_blas_isamax_fcall_ok=no)
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
108 ])
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
109 # SDOT check (REAL return values)
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
110 AC_CACHE_CHECK([whether SDOT is called correctly from Fortran],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
111 [ax_cv_blas_sdot_fcall_ok],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
112 [AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
113 real sdot,a(1),b(1),w
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
114 external sdot
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
115 a(1) = 1e0
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
116 b(1) = 2e0
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
117 w = sdot(1,a,1,b,1)
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
118 if (w .ne. a(1)*b(1)) stop 1
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
119 ]])],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
120 ax_cv_blas_sdot_fcall_ok=yes,
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
121 ax_cv_blas_sdot_fcall_ok=no)
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
122 ])
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
123 # DDOT check (DOUBLE return values)
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
124 AC_CACHE_CHECK([whether DDOT is called correctly from Fortran],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
125 [ax_cv_blas_ddot_fcall_ok],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
126 [AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
127 double precision ddot,a(1),b(1),w
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
128 external ddot
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
129 a(1) = 1d0
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 7683
diff changeset
130 b(1) = 2d0
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
131 w = ddot(1,a,1,b,1)
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
132 if (w .ne. a(1)*b(1)) stop 1
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
133 ]])],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
134 ax_cv_blas_ddot_fcall_ok=yes,
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
135 ax_cv_blas_ddot_fcall_ok=no)
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
136 ])
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
137 # CDOTU check (COMPLEX return values)
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
138 AC_CACHE_CHECK([whether CDOTU is called correctly from Fortran],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
139 [ax_cv_blas_cdotu_fcall_ok],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
140 [AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
141 complex cdotu,a(1),b(1),w
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
142 external cdotu
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
143 a(1) = cmplx(1e0,1e0)
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
144 b(1) = cmplx(1e0,2e0)
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
145 w = cdotu(1,a,1,b,1)
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
146 if (w .ne. a(1)*b(1)) stop 1
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
147 ]])],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
148 ax_cv_blas_cdotu_fcall_ok=yes,
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
149 ax_cv_blas_cdotu_fcall_ok=no)
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
150 ])
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
151 # ZDOTU check (DOUBLE COMPLEX return values)
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
152 AC_CACHE_CHECK([whether ZDOTU is called correctly from Fortran],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
153 [ax_cv_blas_zdotu_fcall_ok],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
154 [AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
155 double complex zdotu,a(1),b(1),w
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
156 external zdotu
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
157 a(1) = dcmplx(1d0,1d0)
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
158 b(1) = dcmplx(1d0,2d0)
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
159 w = zdotu(1,a,1,b,1)
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
160 if (w .ne. a(1)*b(1)) stop 1
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
161 ]])],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
162 ax_cv_blas_zdotu_fcall_ok=yes,
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
163 ax_cv_blas_zdotu_fcall_ok=no)
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
164 ])
22986
21707d6a02c7 make --enable-64 the default
John W. Eaton <jwe@octave.org>
parents: 19300
diff changeset
165 # Check BLAS library integer size. If it does not appear to be
21707d6a02c7 make --enable-64 the default
John W. Eaton <jwe@octave.org>
parents: 19300
diff changeset
166 # 8 bytes, we assume it is 4 bytes.
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
167 # FIXME: this may fail with things like -ftrapping-math.
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
168 AC_CACHE_CHECK([BLAS library integer size],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
169 [ax_cv_blas_integer_size],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
170 [AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
25632
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
171 integer*8 two, n
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
172 integer*4 n2(2)
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
173 double precision d, a(1), b(1), ddot
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
174 equivalence (n, n2)
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
175
10956
cab8365e476d update ax_blas_f77_func.m4
Jaroslav Hajek <highegg@gmail.com>
parents: 10951
diff changeset
176 a(1) = 1.0
cab8365e476d update ax_blas_f77_func.m4
Jaroslav Hajek <highegg@gmail.com>
parents: 10951
diff changeset
177 b(1) = 1.0
25632
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
178
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
179 c Generate 2**32 + 1 in an 8-byte integer. Whether we have a big
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
180 c endian or little endian system, both 4-byte words of this value
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
181 c should be 1.
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
182
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
183 two = 2
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
184 n = (two ** 32) + 1
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
185
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
186 c Check that our expectation about the type conversions are correct.
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
187
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
188 if (n2(1) .ne. 1 .or. n2(2) .ne. 1) then
22986
21707d6a02c7 make --enable-64 the default
John W. Eaton <jwe@octave.org>
parents: 19300
diff changeset
189 print *, 'invalid assumption about integer type conversion'
21707d6a02c7 make --enable-64 the default
John W. Eaton <jwe@octave.org>
parents: 19300
diff changeset
190 stop 2
21707d6a02c7 make --enable-64 the default
John W. Eaton <jwe@octave.org>
parents: 19300
diff changeset
191 endif
25632
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
192
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
193 * print *, n, n2(1), n2(2)
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
194 * print *, a(1), b(1)
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
195
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
196 c DDOT will either see 1 or a large value for N. Since INCX and INCY
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
197 c are both 0, we will never increment the index, so A and B only need to
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
198 c have a single element. If N is interpreted as 1 (BLAS compiled with 4
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
199 c byte integers) then the result will be 1. If N is interpreted as a
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
200 c large value (BLAS compiled with 8 byte integers) then the result will
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
201 c be the summation a(1)*b(1) 2^32+1 times. This will also take some
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
202 c time to compute, but at least for now it is the unusual case so we are
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
203 c much more likely to exit quickly after detecting that the BLAS library
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
204 c was compiled with 4-byte integers.
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
205
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
206 d = ddot (n, a, 0, b, 0)
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
207
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
208 * print *, a(1), b(1), d
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
209
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
210 c Success (0 exit status) means we detected BLAS compiled with
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
211 c 8-byte integers.
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
212
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
213 if (d .eq. 1.0) then
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
214 stop 1
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
215 endif
171d90967f16 fix test for 8-byte integer BLAS lib on big-endian systems (bug #53853)
John W. Eaton <jwe@octave.org>
parents: 24893
diff changeset
216
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
217 ]])],
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
218 ax_cv_blas_integer_size=8,
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
219 ax_cv_blas_integer_size=4)
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
220 ])
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
221
23876
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
222 AC_LANG_POP(Fortran 77)
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
223
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
224 # if any of the tests failed, reject the BLAS library
31122
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
225 if test $ax_cv_blas_lsame_fcall_ok = yes \
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
226 -a $ax_cv_blas_sdot_fcall_ok = yes \
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
227 -a $ax_cv_blas_ddot_fcall_ok = yes \
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
228 -a $ax_cv_blas_cdotu_fcall_ok = yes \
1077a1c277fb build: Use caching for Fortran values in configure.
Rik <rik@octave.org>
parents: 27487
diff changeset
229 -a $ax_cv_blas_zdotu_fcall_ok = yes ; then
23876
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
230 ax_blas_f77_func_ok=yes;
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
231 $1
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
232 else
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
233 ax_blas_f77_func_ok=no;
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
234 $2
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
235 fi
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
236 LIBS="$save_ax_blas_f77_func_LIBS"
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
237 fi
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
238
10951
97b8d462ef11 Update m4 macros.
Ben Abbott <bpabbott@mac.com>
parents: 9645
diff changeset
239 ])dnl AX_BLAS_F77_FUNC
7683
8136cb19fb7a implement BLAS-F77 call compatibility check
Jaroslav Hajek <highegg@gmail.com>
parents:
diff changeset
240
22986
21707d6a02c7 make --enable-64 the default
John W. Eaton <jwe@octave.org>
parents: 19300
diff changeset
241 AC_DEFUN([OCTAVE_BLAS_WITH_F77_FUNC], [
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
242 AC_PREREQ(2.50)
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
243 AX_BLAS([# disable special action], [])
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
244 if test x$ax_blas_ok = xyes ; then
23876
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
245 OCTAVE_BLAS_F77_FUNC(
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
246 [ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1])],
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
247 [ax_blas_ok=no; BLAS_LIBS=])
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
248 fi
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
249 if test x$ax_blas_ok = xno ; then
27487
f19e621d7f2d avoid error if second arg for OCTAVE_BLAS_F77_FUNC is empty (bug #57042)
John W. Eaton <jwe@octave.org>
parents: 25765
diff changeset
250 :
23876
b6e756d8f485 maint: eliminate TAB characters from source files
John W. Eaton <jwe@octave.org>
parents: 23085
diff changeset
251 $2
19300
d6240c099a02 build: Update m4 macros to their latest versions (bug #43517).
Rik <rik@octave.org>
parents: 17977
diff changeset
252 fi
10951
97b8d462ef11 Update m4 macros.
Ben Abbott <bpabbott@mac.com>
parents: 9645
diff changeset
253 ])dnl AX_BLAS_WITH_F77_FUNC