summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2005-01-11 21:05:21 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2005-01-11 21:05:21 (GMT)
commit7945e9929ee7fcbbe28e7dd1c56816ef3307cbcf (patch)
tree67163271d341b809d96afd5df653ab1e11496115 /configure.in
parent7b42f786bd4a80259d3731d00f890ca1bcec9cba (diff)
downloadhdf5-7945e9929ee7fcbbe28e7dd1c56816ef3307cbcf.zip
hdf5-7945e9929ee7fcbbe28e7dd1c56816ef3307cbcf.tar.gz
hdf5-7945e9929ee7fcbbe28e7dd1c56816ef3307cbcf.tar.bz2
[svn-r9809] Purpose: bug fix
Description: For HP-UX11.00, compiler's casting from 'long double' to most of integers. A macro was hard set in config/hpux11.00 before. Solution: Let configure detect this case and set the macro. Platforms tested: kelgia, fuss, modi4. These systems are mainly concerned.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in36
1 files changed, 31 insertions, 5 deletions
diff --git a/configure.in b/configure.in
index 3dfacbc..898bd18 100644
--- a/configure.in
+++ b/configure.in
@@ -2509,13 +2509,39 @@ fi
dnl -----------------------------------------------------------------------
dnl Set flag to indicate that the machine can handle conversion from
-dnl long double to integers. (This flag should be set "yes" for all
-dnl machines except all SGIs and HP-UX 11.00, where some conversions are
+dnl long double to integers. This flag should be set "yes" for all
+dnl machines except all SGIs and HP-UX 11.00. For SGIs, some conversions are
dnl incorrect and its cache value is set "no" in its config/irix6.x and
-dnl irix5.x and config/hpux11.00 files.)
-dnl
+dnl irix5.x. For HP-UX 11.00, the compiler has 'floating exception'
+dnl when converting 'long double' to all integers except 'unsigned long long'.
+dnl Other HP-UX systems are unknown yet. (1/8/05 - SLU)
+
AC_MSG_CHECKING([if accurately converting from long double to integers works])
-AC_CACHE_VAL([hdf5_cv_sw_ldouble_to_integer_works], [hdf5_cv_sw_ldouble_to_integer_works=yes])
+
+AC_CACHE_VAL([hdf5_cv_sw_ldouble_to_integer_works],
+ [AC_TRY_RUN([
+ int main(void)
+ {
+ void *align;
+ long double ld= 9701917572145405952.00L;
+ unsigned char v1;
+ short v2;
+ unsigned int v3;
+ int ret = 0;
+
+ align = (void*)malloc(sizeof(long double));
+ memcpy(align, &ld, sizeof(long double));
+
+ /*For HU-UX11.00, there's floating exception(core dump) when doing some of casting
+ *from 'long double' to integers*/
+ v1=(unsigned char)(*((long double*)align));
+ v2=(short)(*((long double*)align));
+ v3=(unsigned int)(*((long double*)align));
+
+done:
+ exit(ret);
+ }
+ ], [hdf5_cv_sw_ldouble_to_integer_works=yes], [hdf5_cv_sw_ldouble_to_integer_works=no],)])
if test ${hdf5_cv_sw_ldouble_to_integer_works} = "yes"; then
AC_DEFINE([SW_LDOUBLE_TO_INTEGER_WORKS], [1],