From c7f422940a3d12cd338e3a13d5adc9dbbf45e145 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?=
Date: Wed, 13 Mar 2024 12:31:32 +0000
Subject: [PATCH] build: add caching for involved configure checks
* configure.ac: Wrap the following with AC_CACHE_VAL,
so that they can be cached / overridden. We use
the "utils_cv_" prefix as they're coreutils specific overrides.
utils_cv_avx2_intrinsic_exists,
utils_cv_brain_16_bit_supported,
utils_cv_ieee_16_bit_supported,
utils_cv_pclmul_intrinsic_exists,
utils_cv_stdbuf_supported.
---
configure.ac | 57 +++++++++++++++++++++++++++++++--------------------------
1 file changed, 31 insertions(+), 26 deletions(-)
diff --git a/configure.ac b/configure.ac
index 21bee28d1..898ccf5d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -544,7 +544,8 @@ gl_WARN_ADD([-errwarn], [CFLAGS])
AC_MSG_CHECKING([whether this system supports stdbuf])
CFLAGS="-fPIC $CFLAGS"
LDFLAGS="-shared $LDFLAGS"
-stdbuf_supported=no
+AC_CACHE_VAL([utils_cv_stdbuf_supported],[
+utils_cv_stdbuf_supported=no
# Note we only LINK here rather than RUN to support cross compilation
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
@@ -558,9 +559,9 @@ AC_LINK_IFELSE(
if (stdbuf != 1)
return 1;]])
],
- [stdbuf_supported=yes])
-AC_MSG_RESULT([$stdbuf_supported])
-if test "$stdbuf_supported" = "yes" && test -z "$EXEEXT"; then
+ [utils_cv_stdbuf_supported=yes])])
+AC_MSG_RESULT([$utils_cv_stdbuf_supported])
+if test "$utils_cv_stdbuf_supported" = "yes" && test -z "$EXEEXT"; then
gl_ADD_PROG([optional_bin_progs], [stdbuf])
fi
CFLAGS=$ac_save_CFLAGS
@@ -569,6 +570,7 @@ ac_c_werror_flag=$cu_save_c_werror_flag
# Test compiler support for half precision floating point types (for od)
AC_MSG_CHECKING([IEEE 16 bit floating point])
+AC_CACHE_VAL([utils_cv_ieee_16_bit_supported],[
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
int
@@ -580,16 +582,17 @@ AC_MSG_CHECKING([IEEE 16 bit floating point])
}
]])
],[
- ieee_16_bit_supported=yes
+ utils_cv_ieee_16_bit_supported=yes
],[
- ieee_16_bit_supported=no
- ])
-AC_MSG_RESULT([$ieee_16_bit_supported])
-if test $ieee_16_bit_supported = yes; then
+ utils_cv_ieee_16_bit_supported=no
+ ])])
+AC_MSG_RESULT([$utils_cv_ieee_16_bit_supported])
+if test $utils_cv_ieee_16_bit_supported = yes; then
AC_DEFINE([FLOAT16_SUPPORTED], [1], [IEEE 16 bit float supported])
fi
AC_MSG_CHECKING([Brain 16 bit floating point])
+AC_CACHE_VAL([utils_cv_brain_16_bit_supported],[
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
int
@@ -601,18 +604,19 @@ AC_MSG_CHECKING([Brain 16 bit floating point])
}
]])
],[
- brain_16_bit_supported=yes
+ utils_cv_brain_16_bit_supported=yes
],[
- brain_16_bit_supported=no
- ])
-AC_MSG_RESULT([$brain_16_bit_supported])
-if test $brain_16_bit_supported = yes; then
+ utils_cv_brain_16_bit_supported=no
+ ])])
+AC_MSG_RESULT([$utils_cv_brain_16_bit_supported])
+if test $utils_cv_brain_16_bit_supported = yes; then
AC_DEFINE([BF16_SUPPORTED], [1], [Brain 16 bit float supported])
fi
ac_save_CFLAGS=$CFLAGS
CFLAGS="-mavx -mpclmul $CFLAGS"
AC_MSG_CHECKING([if pclmul intrinsic exists])
+AC_CACHE_VAL([utils_cv_pclmul_intrinsic_exists],[
AC_LINK_IFELSE(
[AC_LANG_SOURCE([[
#include