newlib: add AC_CACHE_CHECK sugar around preprocessor checks

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, and it lets the build cache
its own results when rerunning config.status.
This commit is contained in:
Mike Frysinger 2022-01-28 05:17:46 -05:00
parent 38755463e5
commit 041dd7ff26
6 changed files with 78 additions and 39 deletions

48
newlib/libc/configure vendored
View File

@ -12467,7 +12467,12 @@ fi
if test "${machine_dir}" = "nds32"; then if test "${machine_dir}" = "nds32"; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nds32 V3M ISA" >&5
$as_echo_n "checking for nds32 V3M ISA... " >&6; }
if ${newlib_cv_nds32_isa_v3m+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#ifdef __NDS32_ISA_V3M__ #ifdef __NDS32_ISA_V3M__
# error "This is nds32_isa_v3m." # error "This is nds32_isa_v3m."
@ -12482,14 +12487,17 @@ main ()
} }
_ACEOF _ACEOF
if ac_fn_c_try_cpp "$LINENO"; then : if ac_fn_c_try_cpp "$LINENO"; then :
is_nds32_isa_v3m="no" newlib_cv_nds32_isa_v3m="no"
else else
is_nds32_isa_v3m="yes" newlib_cv_nds32_isa_v3m="yes"
fi fi
rm -f conftest.err conftest.i conftest.$ac_ext rm -f conftest.err conftest.i conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $newlib_cv_nds32_isa_v3m" >&5
$as_echo "$newlib_cv_nds32_isa_v3m" >&6; }
fi fi
if test "$is_nds32_isa_v3m" = "yes"; then if test "$newlib_cv_nds32_isa_v3m" = "yes"; then
IS_NDS32_ISA_V3M_TRUE= IS_NDS32_ISA_V3M_TRUE=
IS_NDS32_ISA_V3M_FALSE='#' IS_NDS32_ISA_V3M_FALSE='#'
else else
@ -12524,7 +12532,12 @@ fi
if test "${machine_dir}" = "sh"; then if test "${machine_dir}" = "sh"; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SH5 (64-bit)" >&5
$as_echo_n "checking for SH5 (64-bit)... " >&6; }
if ${newlib_cv_sh64+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#if !defined(__SH5__) #if !defined(__SH5__)
# error "not SH5" # error "not SH5"
@ -12539,14 +12552,17 @@ main ()
} }
_ACEOF _ACEOF
if ac_fn_c_try_cpp "$LINENO"; then : if ac_fn_c_try_cpp "$LINENO"; then :
have_sh64=yes newlib_cv_sh64=yes
else else
have_sh64=no newlib_cv_sh64=no
fi fi
rm -f conftest.err conftest.i conftest.$ac_ext rm -f conftest.err conftest.i conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $newlib_cv_sh64" >&5
$as_echo "$newlib_cv_sh64" >&6; }
fi fi
if test "$have_sh64" = yes; then if test "$newlib_cv_sh64" = yes; then
SH64_TRUE= SH64_TRUE=
SH64_FALSE='#' SH64_FALSE='#'
else else
@ -12558,7 +12574,10 @@ fi
if test "${machine_dir}" = "spu"; then if test "${machine_dir}" = "spu"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports __ea" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports __ea" >&5
$as_echo_n "checking whether the compiler supports __ea... " >&6; } $as_echo_n "checking whether the compiler supports __ea... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext if ${newlib_cv_spu_compiler_has_ea+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#if !defined (__EA32__) && !defined (__EA64__) #if !defined (__EA32__) && !defined (__EA64__)
# error "__ea not supported" # error "__ea not supported"
@ -12573,15 +12592,16 @@ main ()
} }
_ACEOF _ACEOF
if ac_fn_c_try_cpp "$LINENO"; then : if ac_fn_c_try_cpp "$LINENO"; then :
spu_compiler_has_ea=yes newlib_cv_spu_compiler_has_ea=yes
else else
spu_compiler_has_ea=no newlib_cv_spu_compiler_has_ea=no
fi fi
rm -f conftest.err conftest.i conftest.$ac_ext rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $spu_compiler_has_ea" >&5
$as_echo "$spu_compiler_has_ea" >&6; }
fi fi
if test x${spu_compiler_has_ea} != xno; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $newlib_cv_spu_compiler_has_ea" >&5
$as_echo "$newlib_cv_spu_compiler_has_ea" >&6; }
fi
if test "$newlib_cv_spu_compiler_has_ea" = yes; then
HAVE_SPU_EA_TRUE= HAVE_SPU_EA_TRUE=
HAVE_SPU_EA_FALSE='#' HAVE_SPU_EA_FALSE='#'
else else

View File

@ -1,10 +1,11 @@
if test "${machine_dir}" = "nds32"; then if test "${machine_dir}" = "nds32"; then
dnl Use builtin macro to detect if this is for "AndeStar ISA V3m". 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__ [[#ifdef __NDS32_ISA_V3M__
# error "This is nds32_isa_v3m." # error "This is nds32_isa_v3m."
#endif #endif
]])], [is_nds32_isa_v3m="no"], [is_nds32_isa_v3m="yes"]) ]])], [newlib_cv_nds32_isa_v3m="no"], [newlib_cv_nds32_isa_v3m="yes"])])
fi 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")

View File

@ -1,9 +1,10 @@
if test "${machine_dir}" = "sh"; then 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__) [[#if !defined(__SH5__)
# error "not SH5" # error "not SH5"
#endif #endif
]])], [have_sh64=yes], [have_sh64=no]) ]])], [newlib_cv_sh64=yes], [newlib_cv_sh64=no])])
fi fi
AM_CONDITIONAL(SH64, [test "$have_sh64" = yes]) AM_CONDITIONAL(SH64, [test "$newlib_cv_sh64" = yes])

View File

@ -1,10 +1,9 @@
if test "${machine_dir}" = "spu"; then if test "${machine_dir}" = "spu"; then
AC_MSG_CHECKING([whether the compiler supports __ea]) AC_CACHE_CHECK([whether the compiler supports __ea], newlib_cv_spu_compiler_has_ea, [dnl
AC_PREPROC_IFELSE([AC_LANG_PROGRAM( AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
[[#if !defined (__EA32__) && !defined (__EA64__) [[#if !defined (__EA32__) && !defined (__EA64__)
# error "__ea not supported" # error "__ea not supported"
#endif #endif
]])], [spu_compiler_has_ea=yes], [spu_compiler_has_ea=no]) ]])], [newlib_cv_spu_compiler_has_ea=yes], [newlib_cv_spu_compiler_has_ea=no])])
AC_MSG_RESULT($spu_compiler_has_ea)
fi 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)

32
newlib/libm/configure vendored
View File

@ -12120,7 +12120,12 @@ fi
if test "${libm_machine_dir}" = "nds32"; then if test "${libm_machine_dir}" = "nds32"; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nds32 FPU SP extension" >&5
$as_echo_n "checking for nds32 FPU SP extension... " >&6; }
if ${newlib_cv_nds32_fpu_sp+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#if (__NDS32_EXT_FPU_SP__) #if (__NDS32_EXT_FPU_SP__)
# error "Has nds32 FPU SP extension support" # error "Has nds32 FPU SP extension support"
@ -12135,13 +12140,21 @@ main ()
} }
_ACEOF _ACEOF
if ac_fn_c_try_cpp "$LINENO"; then : if ac_fn_c_try_cpp "$LINENO"; then :
has_nds32_fpu_sp="no" newlib_cv_nds32_fpu_sp="no"
else else
has_nds32_fpu_sp="yes" newlib_cv_nds32_fpu_sp="yes"
fi fi
rm -f conftest.err conftest.i conftest.$ac_ext rm -f conftest.err conftest.i conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $newlib_cv_nds32_fpu_sp" >&5
$as_echo "$newlib_cv_nds32_fpu_sp" >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nds32 FPU DP extension" >&5
$as_echo_n "checking for nds32 FPU DP extension... " >&6; }
if ${newlib_cv_nds32_fpu_dp+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#if (__NDS32_EXT_FPU_DP__) #if (__NDS32_EXT_FPU_DP__)
# error "Has nds32 FPU DP extension support" # error "Has nds32 FPU DP extension support"
@ -12156,14 +12169,17 @@ main ()
} }
_ACEOF _ACEOF
if ac_fn_c_try_cpp "$LINENO"; then : if ac_fn_c_try_cpp "$LINENO"; then :
has_nds32_fpu_dp="no" newlib_cv_nds32_fpu_dp="no"
else else
has_nds32_fpu_dp="yes" newlib_cv_nds32_fpu_dp="yes"
fi fi
rm -f conftest.err conftest.i conftest.$ac_ext rm -f conftest.err conftest.i conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $newlib_cv_nds32_fpu_dp" >&5
$as_echo "$newlib_cv_nds32_fpu_dp" >&6; }
fi fi
if test "$has_nds32_fpu_sp" = "yes"; then if test "$newlib_cv_nds32_fpu_sp" = "yes"; then
HAS_NDS32_FPU_SP_TRUE= HAS_NDS32_FPU_SP_TRUE=
HAS_NDS32_FPU_SP_FALSE='#' HAS_NDS32_FPU_SP_FALSE='#'
else else
@ -12171,7 +12187,7 @@ else
HAS_NDS32_FPU_SP_FALSE= HAS_NDS32_FPU_SP_FALSE=
fi fi
if test "$has_nds32_fpu_dp" = "yes"; then if test "$newlib_cv_nds32_fpu_dp" = "yes"; then
HAS_NDS32_FPU_DP_TRUE= HAS_NDS32_FPU_DP_TRUE=
HAS_NDS32_FPU_DP_FALSE='#' HAS_NDS32_FPU_DP_FALSE='#'
else else

View File

@ -1,17 +1,19 @@
if test "${libm_machine_dir}" = "nds32"; then if test "${libm_machine_dir}" = "nds32"; then
dnl Use builtin macro to detect if FPU extension support is on. 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__) [[#if (__NDS32_EXT_FPU_SP__)
# error "Has nds32 FPU SP extension support" # error "Has nds32 FPU SP extension support"
#endif #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__) [[#if (__NDS32_EXT_FPU_DP__)
# error "Has nds32 FPU DP extension support" # error "Has nds32 FPU DP extension support"
#endif #endif
]])], [has_nds32_fpu_dp="no"], [has_nds32_fpu_dp="yes"]) ]])], [newlib_cv_nds32_fpu_dp="no"], [newlib_cv_nds32_fpu_dp="yes"])])
fi fi
AM_CONDITIONAL(HAS_NDS32_FPU_SP, test "$has_nds32_fpu_sp" = "yes") AM_CONDITIONAL(HAS_NDS32_FPU_SP, test "$newlib_cv_nds32_fpu_sp" = "yes")
AM_CONDITIONAL(HAS_NDS32_FPU_DP, test "$has_nds32_fpu_dp" = "yes") AM_CONDITIONAL(HAS_NDS32_FPU_DP, test "$newlib_cv_nds32_fpu_dp" = "yes")