Mercurial > hg > octave-nkf
comparison m4/ax_blas_f77_func.m4 @ 10956:cab8365e476d
update ax_blas_f77_func.m4
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 10 Sep 2010 07:07:37 +0200 |
parents | 97b8d462ef11 |
children | ba431d1106e3 |
comparison
equal
deleted
inserted
replaced
10955:2786e3b7072e | 10956:cab8365e476d |
---|---|
61 | 61 |
62 # F77 call-compatibility checks | 62 # F77 call-compatibility checks |
63 if test "$cross_compiling" = yes ; then | 63 if test "$cross_compiling" = yes ; then |
64 ifelse($3, ,$1,$3) | 64 ifelse($3, ,$1,$3) |
65 elif test x"$ax_blas_ok" = xyes; then | 65 elif test x"$ax_blas_ok" = xyes; then |
66 save_ax_blas_f77_func_LIBS="$LIBS" | |
66 LIBS="$BLAS_LIBS $LIBS" | 67 LIBS="$BLAS_LIBS $LIBS" |
67 AC_LANG_PUSH(Fortran 77) | 68 AC_LANG_PUSH(Fortran 77) |
68 # LSAME check (LOGICAL return values) | 69 # LSAME check (LOGICAL return values) |
69 AC_MSG_CHECKING([whether LSAME is called correctly from Fortran]) | 70 AC_MSG_CHECKING([whether LSAME is called correctly from Fortran]) |
70 AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[ | 71 AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[ |
92 if (i.ne.2) stop 1 | 93 if (i.ne.2) stop 1 |
93 ]]),[ax_blas_isamax_fcall_ok=yes], | 94 ]]),[ax_blas_isamax_fcall_ok=yes], |
94 [ax_blas_isamax_fcall_ok=no]) | 95 [ax_blas_isamax_fcall_ok=no]) |
95 AC_MSG_RESULT([$ax_blas_isamax_fcall_ok]) | 96 AC_MSG_RESULT([$ax_blas_isamax_fcall_ok]) |
96 # SDOT check (REAL return values) | 97 # SDOT check (REAL return values) |
97 AC_MSG_CHECKING([whether DDOT is called correctly from Fortran]) | 98 AC_MSG_CHECKING([whether SDOT is called correctly from Fortran]) |
98 AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[ | 99 AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[ |
99 real sdot,a(1),b(1),w | 100 real sdot,a(1),b(1),w |
100 external sdot | 101 external sdot |
101 a(1) = 1e0 | 102 a(1) = 1e0 |
102 b(1) = 2e0 | 103 b(1) = 2e0 |
139 w = zdotu(1,a,1,b,1) | 140 w = zdotu(1,a,1,b,1) |
140 if (w .ne. a(1)*b(1)) stop 1 | 141 if (w .ne. a(1)*b(1)) stop 1 |
141 ]]),[ax_blas_zdotu_fcall_ok=yes], | 142 ]]),[ax_blas_zdotu_fcall_ok=yes], |
142 [ax_blas_zdotu_fcall_ok=no]) | 143 [ax_blas_zdotu_fcall_ok=no]) |
143 AC_MSG_RESULT([$ax_blas_zdotu_fcall_ok]) | 144 AC_MSG_RESULT([$ax_blas_zdotu_fcall_ok]) |
145 # Check for correct integer size | |
146 # FIXME: this may fail with things like -ftrapping-math. | |
147 AC_MSG_CHECKING([whether the integer size is correct]) | |
148 AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[ | |
149 integer n,nn(3) | |
150 real s,a(1),b(1),sdot | |
151 a(1) = 1.0 | |
152 b(1) = 1.0 | |
153 c Generate -2**33 + 1, if possible | |
154 n = 2 | |
155 n = -4 * (n ** 30) | |
156 n = n + 1 | |
157 if (n >= 0) goto 1 | |
158 c This means we're on 64-bit integers. Check whether the BLAS is, too. | |
159 s = sdot(n,a,1,b,1) | |
160 if (s .ne. 0.0) stop 1 | |
161 1 continue | |
162 c We may be on 32-bit integers, and the BLAS on 64 bits. This is almost bound | |
163 c to have already failed, but just in case, we'll check. | |
164 nn(1) = -1 | |
165 nn(2) = 1 | |
166 nn(3) = -1 | |
167 s = sdot(nn(2),a,1,b,1) | |
168 if (s .ne. 1.0) stop 1 | |
169 ]]),[ax_blas_integer_size_ok=yes], | |
170 [ax_blas_integer_size_ok=no]) | |
171 AC_MSG_RESULT([$ax_blas_integer_size_ok]) | |
144 | 172 |
145 AC_LANG_POP(Fortran 77) | 173 AC_LANG_POP(Fortran 77) |
146 | 174 |
147 # if any of the tests failed, reject the BLAS library | 175 # if any of the tests failed, reject the BLAS library |
148 if test $ax_blas_lsame_fcall_ok = yes \ | 176 if test $ax_blas_lsame_fcall_ok = yes \ |
149 -a $ax_blas_sdot_fcall_ok = yes \ | 177 -a $ax_blas_sdot_fcall_ok = yes \ |
150 -a $ax_blas_ddot_fcall_ok = yes \ | 178 -a $ax_blas_ddot_fcall_ok = yes \ |
151 -a $ax_blas_cdotu_fcall_ok = yes \ | 179 -a $ax_blas_cdotu_fcall_ok = yes \ |
152 -a $ax_blas_zdotu_fcall_ok = yes ; then | 180 -a $ax_blas_zdotu_fcall_ok = yes \ |
181 -a $ax_blas_integer_size_ok = yes; then | |
153 ax_blas_f77_func_ok=yes; | 182 ax_blas_f77_func_ok=yes; |
154 $1 | 183 $1 |
155 else | 184 else |
156 ax_blas_f77_func_ok=no; | 185 ax_blas_f77_func_ok=no; |
157 $2 | 186 $2 |
158 fi | 187 fi |
188 LIBS="$save_ax_blas_f77_func_LIBS" | |
159 fi | 189 fi |
160 | 190 |
161 ])dnl AX_BLAS_F77_FUNC | 191 ])dnl AX_BLAS_F77_FUNC |
162 | 192 |
163 AC_DEFUN([AX_BLAS_WITH_F77_FUNC], [ | 193 AC_DEFUN([AX_BLAS_WITH_F77_FUNC], [ |