summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2004-05-04 18:01:09 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2004-05-04 18:01:09 (GMT)
commitb5d14c22a206314646b783471a9a49f9ffaf0f0e (patch)
tree246db05e28a200b0e888f90e8cbb866df4a2d65c /configure.in
parent0c6229a68d8a8e6148f8a975c5392f62c4b3a35e (diff)
downloadhdf5-b5d14c22a206314646b783471a9a49f9ffaf0f0e.zip
hdf5-b5d14c22a206314646b783471a9a49f9ffaf0f0e.tar.gz
hdf5-b5d14c22a206314646b783471a9a49f9ffaf0f0e.tar.bz2
[svn-r8480] Purpose: bug fix
Description: Solaris 64-bit machines cannot handle round-up correctly during conversion between unsigned (long) long and double. Solution: During configuration, run a program to test if there is any failure during conversion. Enable a macro if failures happen and adjust the test/dtypes for round-up. Platforms tested: h5committest, arabica 64-bit.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in73
1 files changed, 70 insertions, 3 deletions
diff --git a/configure.in b/configure.in
index 61bf9d7..7f5e995 100644
--- a/configure.in
+++ b/configure.in
@@ -2382,12 +2382,79 @@ fi
dnl ----------------------------------------------------------------------
dnl Set the flag to indicate that the machine can accurately convert
-dnl 'unsigned long long' values to 'float' and 'double' values.
+dnl 'unsigned (long) long' values to 'float' and 'double' values.
dnl (This flag should be set for all machines, except for the SGIs, where
-dnl the cache value is set in the config/irix6.x config file)
+dnl the cache value is set in the config/irix6.x config file) and Solaris
+dnl 64-bit machines, where the short program below tests if round-up is
+dnl correctly handled.
dnl
AC_MSG_CHECKING([if accurately converting unsigned long long to floating-point values works])
-AC_CACHE_VAL([hdf5_cv_sw_ulong_to_fp_bottom_bit_works], [hdf5_cv_sw_ulong_to_fp_bottom_bit_works=yes])
+
+if test ${host_os_novers} = "solaris2.x"; then
+ AC_CACHE_VAL([hdf5_cv_sw_ulong_to_fp_bottom_bit_works],
+ [AC_TRY_RUN([
+ int main(void)
+ {
+ unsigned long l1;
+ unsigned long l2;
+ unsigned long l3;
+ unsigned long l4;
+ unsigned long long ld1;
+ unsigned long long ld2;
+ unsigned long long ld3;
+ unsigned long long ld4;
+ double d1, d2, d3, d4;
+ unsigned char s[8];
+ int ret = 0;
+
+ if(sizeof(unsigned long)==8) {
+ l1 = 0xf000000000000b00; /*Round-down case*/
+ l2 = 0xf000000000000401; /*Round-up case*/
+ l3 = 0xf000000000000400; /*Round-down case*/
+ l4 = 0xf000000000000c00; /*Round-up case*/
+
+ d1 = (double)l1;
+ d2 = (double)l2;
+ d3 = (double)l3;
+ d4 = (double)l4;
+ } else if(sizeof(unsigned long long)==8) {
+ ld1 = 0xf000000000000b00; /*Round-down case*/
+ ld2 = 0xf000000000000401; /*Round-up case*/
+ ld3 = 0xf000000000000400; /*Round-down case*/
+ ld4 = 0xf000000000000c00; /*Round-up case*/
+
+ d1 = (double)ld1;
+ d2 = (double)ld2;
+ d3 = (double)ld3;
+ d4 = (double)ld4;
+ } else {
+ ret = 1;
+ goto done;
+ }
+
+ memcpy(s, &d1, 8);
+ if(s[7]!=1)
+ ret = 1;
+
+ memcpy(s, &d2, 8);
+ if(s[7]!=1)
+ ret = 1;
+
+ memcpy(s, &d3, 8);
+ if(s[7]!=0)
+ ret = 1;
+
+ memcpy(s, &d4, 8);
+ if(s[7]!=2)
+ ret = 1;
+
+done:
+ exit(ret);
+ }
+ ], [hdf5_cv_sw_ulong_to_fp_bottom_bit_works=yes], [hdf5_cv_sw_ulong_to_fp_bottom_bit_works=no],)])
+else
+ AC_CACHE_VAL([hdf5_cv_sw_ulong_to_fp_bottom_bit_works], [hdf5_cv_sw_ulong_to_fp_bottom_bit_works=yes])
+fi
if test ${hdf5_cv_sw_ulong_to_fp_bottom_bit_works} = "yes"; then
AC_DEFINE([SW_ULONG_TO_FP_BOTTOM_BIT_WORKS], [1],