From: Pádraig Brady Date: Wed, 13 Mar 2024 12:31:32 +0000 (+0000) Subject: build: add caching for involved configure checks X-Git-Tag: v9.5~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7f422940a3d12cd338e3a13d5adc9dbbf45e145;p=thirdparty%2Fcoreutils.git 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. --- diff --git a/configure.ac b/configure.ac index 21bee28d10..898ccf5d5f 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 @@ -627,21 +631,22 @@ AC_LINK_IFELSE( } ]]) ],[ - pclmul_intrinsic_exists=yes + utils_cv_pclmul_intrinsic_exists=yes ],[ - pclmul_intrinsic_exists=no - ]) -AC_MSG_RESULT([$pclmul_intrinsic_exists]) -if test $pclmul_intrinsic_exists = yes; then + utils_cv_pclmul_intrinsic_exists=no + ])]) +AC_MSG_RESULT([$utils_cv_pclmul_intrinsic_exists]) +if test $utils_cv_pclmul_intrinsic_exists = yes; then AC_DEFINE([USE_PCLMUL_CRC32], [1], [CRC32 calculation by pclmul hardware instruction enabled]) fi AM_CONDITIONAL([USE_PCLMUL_CRC32], - [test $pclmul_intrinsic_exists = yes]) + [test $utils_cv_pclmul_intrinsic_exists = yes]) CFLAGS=$ac_save_CFLAGS CFLAGS="-mavx2 $CFLAGS" AC_MSG_CHECKING([for avx2 intrinsics]) +AC_CACHE_VAL([utils_cv_avx2_intrinsic_exists],[ AC_LINK_IFELSE( [AC_LANG_SOURCE([[ #include @@ -655,16 +660,16 @@ AC_LINK_IFELSE( } ]]) ],[ - avx2_intrinsic_exists=yes + utils_cv_avx2_intrinsic_exists=yes ],[ - avx2_intrinsic_exists=no - ]) -AC_MSG_RESULT([$avx2_intrinsic_exists]) -if test $avx2_intrinsic_exists = yes; then + utils_cv_avx2_intrinsic_exists=no + ])]) +AC_MSG_RESULT([$utils_cv_avx2_intrinsic_exists]) +if test $utils_cv_avx2_intrinsic_exists = yes; then AC_DEFINE([USE_AVX2_WC_LINECOUNT], [1], [Counting lines with AVX2 enabled]) fi AM_CONDITIONAL([USE_AVX2_WC_LINECOUNT], - [test $avx2_intrinsic_exists = yes]) + [test $utils_cv_avx2_intrinsic_exists = yes]) CFLAGS=$ac_save_CFLAGS