changeset 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 bb63f6bf9b51
children 1d819b308578
files configure.ac m4/octave_blas_f77_func.m4
diffstat 2 files changed, 60 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Wed Jul 06 14:15:02 2022 -0700
+++ b/configure.ac	Wed Jul 06 22:03:13 2022 -0700
@@ -781,7 +781,7 @@
   AC_MSG_ERROR([BLAS and LAPACK libraries are required])
 fi
 
-case $ax_blas_integer_size in
+case $ax_cv_blas_integer_size in
   4)
     HAVE_64_BIT_BLAS=no
   ;;
@@ -794,8 +794,8 @@
 esac
 
 OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER
-if test $octave_cv_sizeof_fortran_integer -ne $ax_blas_integer_size; then
-  if test $ax_blas_integer_size -eq 8; then
+if test $octave_cv_sizeof_fortran_integer -ne $ax_cv_blas_integer_size; then
+  if test $ax_cv_blas_integer_size -eq 8; then
     case $F77 in
       *gfortran*)
         case $F77_INTEGER_8_FLAG in
@@ -825,8 +825,8 @@
   fi
   ## We intentionally don't attempt to fix things up if the default
   ## Fortran integer size is 8 but BLAS appears to use 4-byte integers.
-  if test $octave_cv_sizeof_fortran_integer -ne $ax_blas_integer_size; then
-    AC_MSG_ERROR([your Fortran compiler must have an option for setting the default integer size to be the same size as your BLAS library uses ($ax_blas_integer_size bytes).  See the file INSTALL for more information.])
+  if test $octave_cv_sizeof_fortran_integer -ne $ax_cv_blas_integer_size; then
+    AC_MSG_ERROR([your Fortran compiler must have an option for setting the default integer size to be the same size as your BLAS library uses ($ax_cv_blas_integer_size bytes).  See the file INSTALL for more information.])
   fi
 fi
 AC_SUBST(F77_INTEGER_8_FLAG)
--- a/m4/octave_blas_f77_func.m4	Wed Jul 06 14:15:02 2022 -0700
+++ b/m4/octave_blas_f77_func.m4	Wed Jul 06 22:03:13 2022 -0700
@@ -74,8 +74,9 @@
         LIBS="$BLAS_LIBS $LIBS"
         AC_LANG_PUSH(Fortran 77)
 # LSAME check (LOGICAL return values)
-        AC_MSG_CHECKING([whether LSAME is called correctly from Fortran])
-        AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[
+        AC_CACHE_CHECK([whether LSAME is called correctly from Fortran],
+          [ax_cv_blas_lsame_fcall_ok],
+          [AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
       logical lsame,w
       external lsame
       character c1,c2
@@ -85,12 +86,15 @@
       if (w) stop 1
       w = lsame(c1,c1)
       if (.not. w) stop 1
-      ]]),[ax_blas_lsame_fcall_ok=yes],
-        [ax_blas_lsame_fcall_ok=no])
-        AC_MSG_RESULT([$ax_blas_lsame_fcall_ok])
+            ]])],
+            ax_cv_blas_lsame_fcall_ok=yes,
+            ax_cv_blas_lsame_fcall_ok=no)
+        ])
 # ISAMAX check (INTEGER return values)
-        AC_MSG_CHECKING([whether ISAMAX is called correctly from Fortran])
-        AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[
+# FIXME: This value is never used, so why do we calculate it?
+        AC_CACHE_CHECK([whether ISAMAX is called correctly from Fortran],
+          [ax_cv_blas_isamax_fcall_ok],
+          [AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
       integer isamax,i
       external isamax
       real a(2)
@@ -98,62 +102,72 @@
       a(2) = -2e0
       i = isamax(2,a,1)
       if (i.ne.2) stop 1
-      ]]),[ax_blas_isamax_fcall_ok=yes],
-        [ax_blas_isamax_fcall_ok=no])
-        AC_MSG_RESULT([$ax_blas_isamax_fcall_ok])
+            ]])],
+            ax_cv_blas_isamax_fcall_ok=yes,
+            ax_cv_blas_isamax_fcall_ok=no)
+        ])
 # SDOT check (REAL return values)
-        AC_MSG_CHECKING([whether SDOT is called correctly from Fortran])
-        AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[
+        AC_CACHE_CHECK([whether SDOT is called correctly from Fortran],
+          [ax_cv_blas_sdot_fcall_ok],
+          [AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
       real sdot,a(1),b(1),w
       external sdot
       a(1) = 1e0
       b(1) = 2e0
       w = sdot(1,a,1,b,1)
       if (w .ne. a(1)*b(1)) stop 1
-      ]]),[ax_blas_sdot_fcall_ok=yes],
-        [ax_blas_sdot_fcall_ok=no])
-        AC_MSG_RESULT([$ax_blas_sdot_fcall_ok])
+            ]])],
+            ax_cv_blas_sdot_fcall_ok=yes,
+            ax_cv_blas_sdot_fcall_ok=no)
+        ])
 # DDOT check (DOUBLE return values)
-        AC_MSG_CHECKING([whether DDOT is called correctly from Fortran])
-        AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[
+        AC_CACHE_CHECK([whether DDOT is called correctly from Fortran],
+          [ax_cv_blas_ddot_fcall_ok],
+          [AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
       double precision ddot,a(1),b(1),w
       external ddot
       a(1) = 1d0
       b(1) = 2d0
       w = ddot(1,a,1,b,1)
       if (w .ne. a(1)*b(1)) stop 1
-      ]]),[ax_blas_ddot_fcall_ok=yes],
-        [ax_blas_ddot_fcall_ok=no])
-        AC_MSG_RESULT([$ax_blas_ddot_fcall_ok])
+            ]])],
+            ax_cv_blas_ddot_fcall_ok=yes,
+            ax_cv_blas_ddot_fcall_ok=no)
+        ])
 # CDOTU check (COMPLEX return values)
-        AC_MSG_CHECKING([whether CDOTU is called correctly from Fortran])
-        AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[
+        AC_CACHE_CHECK([whether CDOTU is called correctly from Fortran],
+          [ax_cv_blas_cdotu_fcall_ok],
+          [AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
       complex cdotu,a(1),b(1),w
       external cdotu
       a(1) = cmplx(1e0,1e0)
       b(1) = cmplx(1e0,2e0)
       w = cdotu(1,a,1,b,1)
       if (w .ne. a(1)*b(1)) stop 1
-      ]]),[ax_blas_cdotu_fcall_ok=yes],
-        [ax_blas_cdotu_fcall_ok=no])
-        AC_MSG_RESULT([$ax_blas_cdotu_fcall_ok])
+            ]])],
+            ax_cv_blas_cdotu_fcall_ok=yes,
+            ax_cv_blas_cdotu_fcall_ok=no)
+        ])
 # ZDOTU check (DOUBLE COMPLEX return values)
-        AC_MSG_CHECKING([whether ZDOTU is called correctly from Fortran])
-        AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[
+        AC_CACHE_CHECK([whether ZDOTU is called correctly from Fortran],
+          [ax_cv_blas_zdotu_fcall_ok],
+          [AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
       double complex zdotu,a(1),b(1),w
       external zdotu
       a(1) = dcmplx(1d0,1d0)
       b(1) = dcmplx(1d0,2d0)
       w = zdotu(1,a,1,b,1)
       if (w .ne. a(1)*b(1)) stop 1
-      ]]),[ax_blas_zdotu_fcall_ok=yes],
-        [ax_blas_zdotu_fcall_ok=no])
-        AC_MSG_RESULT([$ax_blas_zdotu_fcall_ok])
+            ]])],
+            ax_cv_blas_zdotu_fcall_ok=yes,
+            ax_cv_blas_zdotu_fcall_ok=no)
+        ])
 # Check BLAS library integer size.  If it does not appear to be
 # 8 bytes, we assume it is 4 bytes.
 # FIXME: this may fail with things like -ftrapping-math.
-        AC_MSG_CHECKING([BLAS library integer size])
-        AC_RUN_IFELSE(AC_LANG_PROGRAM(,[[
+        AC_CACHE_CHECK([BLAS library integer size],
+          [ax_cv_blas_integer_size],
+          [AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
       integer*8 two, n
       integer*4 n2(2)
       double precision d, a(1), b(1), ddot
@@ -200,18 +214,19 @@
         stop 1
       endif
 
-       ]]),[ax_blas_integer_size=8],
-        [ax_blas_integer_size=4])
-        AC_MSG_RESULT([$ax_blas_integer_size])
+            ]])],
+            ax_cv_blas_integer_size=8,
+            ax_cv_blas_integer_size=4)
+        ])
 
         AC_LANG_POP(Fortran 77)
 
 # if any of the tests failed, reject the BLAS library
-        if test $ax_blas_lsame_fcall_ok = yes \
-                -a $ax_blas_sdot_fcall_ok = yes \
-                -a $ax_blas_ddot_fcall_ok = yes \
-                -a $ax_blas_cdotu_fcall_ok = yes \
-                -a $ax_blas_zdotu_fcall_ok = yes ; then
+        if test $ax_cv_blas_lsame_fcall_ok = yes \
+                -a $ax_cv_blas_sdot_fcall_ok = yes \
+                -a $ax_cv_blas_ddot_fcall_ok = yes \
+                -a $ax_cv_blas_cdotu_fcall_ok = yes \
+                -a $ax_cv_blas_zdotu_fcall_ok = yes ; then
                 ax_blas_f77_func_ok=yes;
                 $1
         else