From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 12B9C385DC35 for ; Fri, 28 Jan 2022 10:23:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 12B9C385DC35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id A2FD3342CF4; Fri, 28 Jan 2022 10:23:54 +0000 (UTC) From: Mike Frysinger To: newlib@sourceware.org Subject: [PATCH 2/2] newlib: add AC_CACHE_CHECK sugar around preprocessor checks Date: Fri, 28 Jan 2022 05:23:55 -0500 Message-Id: <20220128102355.10213-2-vapier@gentoo.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220128102355.10213-1-vapier@gentoo.org> References: <171dc9cb-6b2c-ead3-1c55-27fadb33220f@gmail.com> <20220128102355.10213-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jan 2022 10:23:56 -0000 This isn't strictly necessary, but it makes for much clearer logs as to what the target is doing, and provides cache vars for anyone who wants to force the test a different way. --- newlib/libc/configure | 48 ++++++++++++++++++-------- newlib/libc/machine/nds32/acinclude.m4 | 7 ++-- newlib/libc/machine/sh/acinclude.m4 | 7 ++-- newlib/libc/machine/spu/acinclude.m4 | 9 +++-- newlib/libm/configure | 32 ++++++++++++----- newlib/libm/machine/nds32/acinclude.m4 | 14 ++++---- 6 files changed, 78 insertions(+), 39 deletions(-) diff --git a/newlib/libc/machine/nds32/acinclude.m4 b/newlib/libc/machine/nds32/acinclude.m4 index 35c2afe992bf..ae8ea5d91ecf 100644 --- a/newlib/libc/machine/nds32/acinclude.m4 +++ b/newlib/libc/machine/nds32/acinclude.m4 @@ -1,10 +1,11 @@ if test "${machine_dir}" = "nds32"; then dnl Use builtin macro to detect if this is for "AndeStar ISA V3m". - AC_PREPROC_IFELSE([AC_LANG_PROGRAM( + AC_CACHE_CHECK([for nds32 V3M ISA], newlib_cv_nds32_isa_v3m, [dnl + AC_PREPROC_IFELSE([AC_LANG_PROGRAM( [[#ifdef __NDS32_ISA_V3M__ # error "This is nds32_isa_v3m." #endif -]])], [is_nds32_isa_v3m="no"], [is_nds32_isa_v3m="yes"]) +]])], [newlib_cv_nds32_isa_v3m="no"], [newlib_cv_nds32_isa_v3m="yes"])]) fi -AM_CONDITIONAL(IS_NDS32_ISA_V3M, test "$is_nds32_isa_v3m" = "yes") +AM_CONDITIONAL(IS_NDS32_ISA_V3M, test "$newlib_cv_nds32_isa_v3m" = "yes") diff --git a/newlib/libc/machine/sh/acinclude.m4 b/newlib/libc/machine/sh/acinclude.m4 index 60af7b1f1135..66ec3b4e15ff 100644 --- a/newlib/libc/machine/sh/acinclude.m4 +++ b/newlib/libc/machine/sh/acinclude.m4 @@ -1,9 +1,10 @@ if test "${machine_dir}" = "sh"; then - AC_PREPROC_IFELSE([AC_LANG_PROGRAM( + AC_CACHE_CHECK([for SH5 (64-bit)], newlib_cv_sh64, [dnl + AC_PREPROC_IFELSE([AC_LANG_PROGRAM( [[#if !defined(__SH5__) # error "not SH5" #endif -]])], [have_sh64=yes], [have_sh64=no]) +]])], [newlib_cv_sh64=yes], [newlib_cv_sh64=no])]) fi -AM_CONDITIONAL(SH64, [test "$have_sh64" = yes]) +AM_CONDITIONAL(SH64, [test "$newlib_cv_sh64" = yes]) diff --git a/newlib/libc/machine/spu/acinclude.m4 b/newlib/libc/machine/spu/acinclude.m4 index 4e5fb363ce13..bca70e309d1f 100644 --- a/newlib/libc/machine/spu/acinclude.m4 +++ b/newlib/libc/machine/spu/acinclude.m4 @@ -1,10 +1,9 @@ if test "${machine_dir}" = "spu"; then - AC_MSG_CHECKING([whether the compiler supports __ea]) - AC_PREPROC_IFELSE([AC_LANG_PROGRAM( + AC_CACHE_CHECK([whether the compiler supports __ea], newlib_cv_spu_compiler_has_ea, [dnl + AC_PREPROC_IFELSE([AC_LANG_PROGRAM( [[#if !defined (__EA32__) && !defined (__EA64__) # error "__ea not supported" #endif -]])], [spu_compiler_has_ea=yes], [spu_compiler_has_ea=no]) - AC_MSG_RESULT($spu_compiler_has_ea) +]])], [newlib_cv_spu_compiler_has_ea=yes], [newlib_cv_spu_compiler_has_ea=no])]) fi -AM_CONDITIONAL(HAVE_SPU_EA, test x${spu_compiler_has_ea} != xno) +AM_CONDITIONAL(HAVE_SPU_EA, test "$newlib_cv_spu_compiler_has_ea" = yes) diff --git a/newlib/libm/machine/nds32/acinclude.m4 b/newlib/libm/machine/nds32/acinclude.m4 index 6363df8a3c76..781fa914556d 100644 --- a/newlib/libm/machine/nds32/acinclude.m4 +++ b/newlib/libm/machine/nds32/acinclude.m4 @@ -1,17 +1,19 @@ if test "${libm_machine_dir}" = "nds32"; then dnl Use builtin macro to detect if FPU extension support is on. - AC_PREPROC_IFELSE([AC_LANG_PROGRAM( + AC_CACHE_CHECK([for nds32 FPU SP extension], newlib_cv_nds32_fpu_sp, [dnl + AC_PREPROC_IFELSE([AC_LANG_PROGRAM( [[#if (__NDS32_EXT_FPU_SP__) # error "Has nds32 FPU SP extension support" #endif -]])], [has_nds32_fpu_sp="no"], [has_nds32_fpu_sp="yes"]) +]])], [newlib_cv_nds32_fpu_sp="no"], [newlib_cv_nds32_fpu_sp="yes"])]) - AC_PREPROC_IFELSE([AC_LANG_PROGRAM( + AC_CACHE_CHECK([for nds32 FPU DP extension], newlib_cv_nds32_fpu_dp, [dnl + AC_PREPROC_IFELSE([AC_LANG_PROGRAM( [[#if (__NDS32_EXT_FPU_DP__) # error "Has nds32 FPU DP extension support" #endif -]])], [has_nds32_fpu_dp="no"], [has_nds32_fpu_dp="yes"]) +]])], [newlib_cv_nds32_fpu_dp="no"], [newlib_cv_nds32_fpu_dp="yes"])]) fi -AM_CONDITIONAL(HAS_NDS32_FPU_SP, test "$has_nds32_fpu_sp" = "yes") -AM_CONDITIONAL(HAS_NDS32_FPU_DP, test "$has_nds32_fpu_dp" = "yes") +AM_CONDITIONAL(HAS_NDS32_FPU_SP, test "$newlib_cv_nds32_fpu_sp" = "yes") +AM_CONDITIONAL(HAS_NDS32_FPU_DP, test "$newlib_cv_nds32_fpu_dp" = "yes") -- 2.34.1