summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--config/hpux11.006
-rwxr-xr-xconfigure54
-rw-r--r--configure.in36
3 files changed, 85 insertions, 11 deletions
diff --git a/config/hpux11.00 b/config/hpux11.00
index d6327b2..f42839a 100644
--- a/config/hpux11.00
+++ b/config/hpux11.00
@@ -97,9 +97,3 @@ case "X-$CXX" in
PROFILE_CPPFLAGS=
;;
esac
-
-# Set flag to avoid conversion from 'long double' to integers because of
-# HP-UX's compiler problems. For HP-UX 11.00, the compiler has 'floating exception'
-# when converting 'long double' to all integers except 'unsigned long long'.
-# Other HP-UX systems are unknown yet. (1/8/05 - SLU)
-hdf5_cv_sw_ldouble_to_integer_works=${hdf5_cv_sw_ldouble_to_integer_works='no'}
diff --git a/configure b/configure
index 708ff29..1184ee4 100755
--- a/configure
+++ b/configure
@@ -33548,12 +33548,66 @@ else
echo "${ECHO_T}no" >&6
fi
+
echo "$as_me:$LINENO: checking if accurately converting from long double to integers works" >&5
echo $ECHO_N "checking if accurately converting from long double to integers works... $ECHO_C" >&6
+
if test "${hdf5_cv_sw_ldouble_to_integer_works+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+ 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);
+ }
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
hdf5_cv_sw_ldouble_to_integer_works=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+hdf5_cv_sw_ldouble_to_integer_works=no
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
fi
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],