# gcc describes its behavior via the macro __FLT_EVAL_METHOD__ and glibc derives
# float_t from that, this behavior can be configured with
# --enable-s390-excess-float-precision. When given as enabled, that flag selects
-# the old model. When omitted, native builds will derive the flag from the
-# behavior of glibc. When glibc clamps float_t to double, gcc follows the old
-# model. In any other case, it defaults to the new model.
+# the old model. When omitted, native builds and cross compiles that have target
+# libc headers will detect whether libc clamps float_t to double and in that
+# case maintain the old model. Otherwise, they will default to the new model.
# Check whether --enable-s390-excess-float-precision was given.
if test "${enable_s390_excess_float_precision+set}" = set; then :
enableval=$enable_s390_excess_float_precision;
case $target in
s390*-linux*)
- if test "$target" = "$host" -a "$host" = "$build" -a \
- x"$enable_s390_excess_float_precision" = xauto; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glibc clamping float_t to double" >&5
+ if test x"$enable_s390_excess_float_precision" = xauto; then
+ # Can we autodetect the behavior of the target libc?
+ if test "$target" = "$host" -a "$host" = "$build"; then
+ enable_s390_excess_float_precision=autodetect
+ elif test "x$with_headers" != xno; then
+ # cross build. are target headers available?
+ # carefully coerce the build-system compiler to use target headers
+ saved_CXXFLAGS="$CXXFLAGS"
+ CROSS_TEST_CXXFLAGS="-nostdinc ${XGCC_FLAGS_FOR_TARGET//-B/-idirafter/}"
+ CXXFLAGS="$CROSS_TEST_CXXFLAGS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <math.h>
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ enable_s390_excess_float_precision=autodetect
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CXXFLAGS="$saved_CXXFLAGS"
+ fi
+
+ if test x"$enable_s390_excess_float_precision" = xautodetect; then
+ saved_CXXFLAGS="$CXXFLAGS"
+ if ! test "$target" = "$host" -a "$host" = "$build"; then
+ CXXFLAGS="$CROSS_TEST_CXXFLAGS"
+ unset CROSS_TEST_CXXFLAGS
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glibc clamping float_t to double" >&5
$as_echo_n "checking for glibc clamping float_t to double... " >&6; }
if ${gcc_cv_float_t_clamped_to_double+:} false; then :
$as_echo_n "(cached) " >&6
else
- if test "$cross_compiling" = yes; then :
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define __FLT_EVAL_METHOD__ 0
#include <math.h>
-int main() {
- return !(sizeof(float_t) == sizeof(double));
-}
+int dummy[sizeof(float_t) == sizeof(double) ? 1 : -1];
+
_ACEOF
-if ac_fn_cxx_try_run "$LINENO"; then :
+if ac_fn_cxx_try_compile "$LINENO"; then :
gcc_cv_float_t_clamped_to_double=yes
else
gcc_cv_float_t_clamped_to_double=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_float_t_clamped_to_double" >&5
$as_echo "$gcc_cv_float_t_clamped_to_double" >&6; }
- if test x"$gcc_cv_float_t_clamped_to_double" = xyes; then
- enable_s390_excess_float_precision=yes
+ CXXFLAGS="$saved_CXXFLAGS"
+ enable_s390_excess_float_precision="$gcc_cv_float_t_clamped_to_double"
+ else
+ # no way to detect behavior of target libc, default to new model
+ enable_s390_excess_float_precision=no
fi
fi
# gcc describes its behavior via the macro __FLT_EVAL_METHOD__ and glibc derives
# float_t from that, this behavior can be configured with
# --enable-s390-excess-float-precision. When given as enabled, that flag selects
-# the old model. When omitted, native builds will derive the flag from the
-# behavior of glibc. When glibc clamps float_t to double, gcc follows the old
-# model. In any other case, it defaults to the new model.
+# the old model. When omitted, native builds and cross compiles that have target
+# libc headers will detect whether libc clamps float_t to double and in that
+# case maintain the old model. Otherwise, they will default to the new model.
AC_ARG_ENABLE(s390-excess-float-precision,
[AS_HELP_STRING([--enable-s390-excess-float-precision],
[on s390 targets, evaluate float with double precision
case $target in
s390*-linux*)
- if test "$target" = "$host" -a "$host" = "$build" -a \
- x"$enable_s390_excess_float_precision" = xauto; then
- AC_CACHE_CHECK([for glibc clamping float_t to double],
- gcc_cv_float_t_clamped_to_double,
- [AC_RUN_IFELSE([AC_LANG_SOURCE([
+ if test x"$enable_s390_excess_float_precision" = xauto; then
+ # Can we autodetect the behavior of the target libc?
+ if test "$target" = "$host" -a "$host" = "$build"; then
+ enable_s390_excess_float_precision=autodetect
+ elif test "x$with_headers" != xno; then
+ # cross build. are target headers available?
+ # carefully coerce the build-system compiler to use target headers
+ saved_CXXFLAGS="$CXXFLAGS"
+ CROSS_TEST_CXXFLAGS="-nostdinc ${XGCC_FLAGS_FOR_TARGET//-B/-idirafter/}"
+ CXXFLAGS="$CROSS_TEST_CXXFLAGS"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <math.h>
+]])], [enable_s390_excess_float_precision=autodetect], [])
+ CXXFLAGS="$saved_CXXFLAGS"
+ fi
+
+ if test x"$enable_s390_excess_float_precision" = xautodetect; then
+ saved_CXXFLAGS="$CXXFLAGS"
+ if ! test "$target" = "$host" -a "$host" = "$build"; then
+ CXXFLAGS="$CROSS_TEST_CXXFLAGS"
+ unset CROSS_TEST_CXXFLAGS
+ fi
+ AC_CACHE_CHECK([for glibc clamping float_t to double],
+ gcc_cv_float_t_clamped_to_double, [
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#define __FLT_EVAL_METHOD__ 0
#include <math.h>
-int main() {
- return !(sizeof(float_t) == sizeof(double));
-}])],
- [gcc_cv_float_t_clamped_to_double=yes],
- [gcc_cv_float_t_clamped_to_double=no])])
- if test x"$gcc_cv_float_t_clamped_to_double" = xyes; then
- enable_s390_excess_float_precision=yes
+int dummy[sizeof(float_t) == sizeof(double) ? 1 : -1];
+]])],
+ [gcc_cv_float_t_clamped_to_double=yes],
+ [gcc_cv_float_t_clamped_to_double=no])])
+ CXXFLAGS="$saved_CXXFLAGS"
+ enable_s390_excess_float_precision="$gcc_cv_float_t_clamped_to_double"
+ else
+ # no way to detect behavior of target libc, default to new model
+ enable_s390_excess_float_precision=no
fi
fi
when in standards-compliant mode (e.g., when @code{--std=c99} or
@code{-fexcess-precision=standard} are given).
-For a native build, the option's default is derived from glibc's behavior. When
-glibc clamps float_t to double, gcc follows and enables the option. In all other
-cases, it defaults to off.
+For a native build and cross compiles that have target headers, the option's
+default is derived from glibc's behavior. When glibc clamps float_t to double,
+GCC follows and enables the option. For other cross compiles, the default is
+disabled.
@end table
@subheading Cross-Compiler-Specific Options