From e270b13cb98d39b175f04d5b3a53df723b19703c Mon Sep 17 00:00:00 2001 From: vlefevre Date: Thu, 9 Jan 2020 14:37:48 +0000 Subject: [acinclude.m4,configure.ac] * Moved the code that tries to determine the format of double from configure.ac to acinclude.m4 in MPFR_CONFIGS (as required), just before the one for long double. * Added a FIXME comment: This code uses AC_RUN_IFELSE, which cannot run the test when cross-compiling; use a test like for long double instead. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13663 280ebfd0-de03-0410-8827-d642c229c3f4 --- acinclude.m4 | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'acinclude.m4') diff --git a/acinclude.m4 b/acinclude.m4 index 437923dd3..fc98848f9 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -526,7 +526,44 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([[ LIBS="$saved_LIBS" -dnl Now try to check the long double format +dnl Try to determine the format of double +dnl FIXME: Use a test like for long double instead of AC_RUN_IFELSE, +dnl which cannot run the test when cross-compiling. +AC_MSG_CHECKING(format of floating-point type `double') +AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +]], [[ +union ieee_double_extract +{ + double d; + unsigned char x[8]; +} t; +t.d = 2.877939254133025759330166692961938679218292236328125; /* exact */ +if (sizeof (double) != 8) + return 0; +if (sizeof (unsigned char) != 1) + return 0; +if (t.x[0] == 1 && t.x[1] == 2 && t.x[2] == 3 && t.x[3] == 4 && + t.x[4] == 5 && t.x[5] == 6 && t.x[6] == 7 && t.x[7] == 64) + return 1; /* little endian */ +else if (t.x[7] == 1 && t.x[6] == 2 && t.x[5] == 3 && t.x[4] == 4 && + t.x[3] == 5 && t.x[2] == 6 && t.x[1] == 7 && t.x[0] == 64) + return 2; /* big endian */ +else + return 0; /* unknown */ +]])], + [mpfr_ieee_double=$?], + [mpfr_ieee_double=$?], + [mpfr_ieee_double=0]) +case "$mpfr_ieee_double" in + 1) AC_MSG_RESULT([IEEE little endian]) + AC_DEFINE(HAVE_DOUBLE_IEEE_LITTLE_ENDIAN) ;; + 2) AC_MSG_RESULT([IEEE big endian]) + AC_DEFINE(HAVE_DOUBLE_IEEE_BIG_ENDIAN) ;; + *) AC_MSG_RESULT([unknown]) + AC_MSG_WARN([format of `double' not recognized]) ;; +esac + +dnl Now try to determine the format of long double MPFR_C_LONG_DOUBLE_FORMAT dnl Check if thread-local variables are supported. -- cgit v1.2.1