summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
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],