diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2015-06-17 15:40:24 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2015-06-17 15:40:24 (GMT) |
commit | f51fcf3ffa96b31b3d94434aec6a20ed0432975d (patch) | |
tree | 1923919319c03abbb2b19e04779f106e5c3f322e | |
parent | 1ea65644191f8e260a31ccdc7ca4ba073791951b (diff) | |
download | hdf5-f51fcf3ffa96b31b3d94434aec6a20ed0432975d.zip hdf5-f51fcf3ffa96b31b3d94434aec6a20ed0432975d.tar.gz hdf5-f51fcf3ffa96b31b3d94434aec6a20ed0432975d.tar.bz2 |
[svn-r27225] new test for __float128
-rwxr-xr-x | configure | 179 | ||||
-rw-r--r-- | configure.ac | 23 | ||||
-rw-r--r-- | m4/aclocal_fc.m4 | 16 | ||||
-rw-r--r-- | src/H5config.h.in | 2 |
4 files changed, 116 insertions, 104 deletions
@@ -726,7 +726,6 @@ H5CONFIG_F_NUM_RKIND FORTRAN_SIZEOF_LONG_DOUBLE FORTRAN_C_LONG_DOUBLE_IS_UNIQUE FORTRAN_HAVE_C_LONG_DOUBLE -PAC_C_MAX_REAL_PRECISION HAVE_Fortran_INTEGER_SIZEOF_16 PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF PAC_FORTRAN_NATIVE_DOUBLE_KIND @@ -775,6 +774,7 @@ ac_ct_CC LDFLAGS CFLAGS CC +PAC_C_MAX_REAL_PRECISION UNAME_INFO enable_static enable_shared @@ -3947,6 +3947,7 @@ $as_echo "done" >&6; } UNAME_INFO=`uname -a` + ## ---------------------------------------------------------------------- ## Some platforms have broken basename, and/or xargs programs. Check ## that it actually does what it's supposed to do. Catch this early @@ -5635,12 +5636,9 @@ cat >>confdefs.h <<_ACEOF _ACEOF -if test "$ac_cv_sizeof___float128" != 0; then - -$as_echo "#define HAVE_FLOAT128 1" >>confdefs.h - - HAVE_QUADMATH=0 - for ac_header in quadmath.h +HAVE_FLOAT128=0 +HAVE_QUADMATH=0 +for ac_header in quadmath.h do : ac_fn_c_check_header_mongrel "$LINENO" "quadmath.h" "ac_cv_header_quadmath_h" "$ac_includes_default" if test "x$ac_cv_header_quadmath_h" = xyes; then : @@ -5652,8 +5650,93 @@ fi done - fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking maximum decimal precision for C" >&5 +$as_echo_n "checking maximum decimal precision for C... " >&6; } +rm -f pac_Cconftest.out + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + #include <float.h> + #include <stdio.h> + #define CHECK_FLOAT128 $ac_cv_sizeof___float128 + #if CHECK_FLOAT128!=0 + # if $HAVE_QUADMATH!=0 + #include <quadmath.h> + # endif + #define C_FLT128_DIG FLT128_DIG + #endif + #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define C_LDBL_DIG DECIMAL_DIG + #else + #define C_LDBL_DIG LDBL_DIG + #endif + +int +main () +{ + + FILE * pFile; + pFile = fopen("pac_Cconftest.out","w"); + fprintf(pFile, "%d\n %d\n", C_LDBL_DIG, C_FLT128_DIG); + + ; + return 0; +} + +_ACEOF + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + if ac_fn_c_try_run "$LINENO"; then : + + if test -s pac_Cconftest.out ; then + LDBL_DIG="`sed -n '1p' pac_Cconftest.out`" + FLT128_DIG="`sed -n '2p' pac_Cconftest.out`" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No output from test program!" >&5 +$as_echo "$as_me: WARNING: No output from test program!" >&2;} + fi + rm -f pac_Cconftest.out + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C program fails to build or run!" >&5 +$as_echo "$as_me: WARNING: C program fails to build or run!" >&2;} + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam +fi + + +if test "$ac_cv_sizeof___float128" != 0; then +## Check if __float128 and c_long_double are the same size and precision + if test "$ac_cv_sizeof___float128" = "$ac_cv_sizeof_long_double" && test "$LDBL_DIG" = "$FLT128_DIG"; then + +$as_echo "#define HAVE_FLOAT128 0" >>confdefs.h + + PAC_C_MAX_REAL_PRECISION=$LDBL_DIG + else + +$as_echo "#define HAVE_FLOAT128 1" >>confdefs.h + + PAC_C_MAX_REAL_PRECISION=$FLT128_DIG + fi +else + PAC_C_MAX_REAL_PRECISION=$LDBL_DIG +fi + +cat >>confdefs.h <<_ACEOF +#define PAC_C_MAX_REAL_PRECISION $PAC_C_MAX_REAL_PRECISION +_ACEOF + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PAC_C_MAX_REAL_PRECISION" >&5 +$as_echo "$PAC_C_MAX_REAL_PRECISION" >&6; } ## ---------------------------------------------------------------------- ## Check if they would like the Fortran interface compiled ## @@ -7619,7 +7702,6 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu - ## Setting definition if there is a 16 byte fortran integer if `echo $PAC_FC_ALL_INTEGER_KINDS_SIZEOF | grep '16' >/dev/null`; then HAVE_Fortran_INTEGER_SIZEOF_16="1" @@ -7803,85 +7885,6 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking maximum decimal precision for C" >&5 -$as_echo_n "checking maximum decimal precision for C... " >&6; } -rm -f pac_Cconftest.out - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - - #include <float.h> - #include <stdio.h> - #define CHECK_FLOAT128 $ac_cv_sizeof___float128 - #if CHECK_FLOAT128!=0 - # if $HAVE_QUADMATH!=0 - #include <quadmath.h> - # endif - #define C_LDBL_DIG FLT128_DIG - #else - # if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define C_LDBL_DIG DECIMAL_DIG - # else - #define C_LDBL_DIG LDBL_DIG - # endif - #endif - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ - - FILE * pFile; - pFile = fopen("pac_Cconftest.out","w"); - fprintf(pFile, "%d\n", C_LDBL_DIG); - - ; - return 0; -} - -_ACEOF - if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } -else - if ac_fn_c_try_run "$LINENO"; then : - - if test -s pac_Cconftest.out ; then - LDBL_DIG="`cat pac_Cconftest.out`" - -cat >>confdefs.h <<_ACEOF -#define PAC_C_MAX_REAL_PRECISION $LDBL_DIG -_ACEOF - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No output from test program!" >&5 -$as_echo "$as_me: WARNING: No output from test program!" >&2;} - fi - rm -f pac_Cconftest.out - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C program fails to build or run!" >&5 -$as_echo "$as_me: WARNING: C program fails to build or run!" >&2;} - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDBL_DIG" >&5 -$as_echo "$LDBL_DIG" >&6; } - else FC="no" fi diff --git a/configure.ac b/configure.ac index b836611..3842734 100644 --- a/configure.ac +++ b/configure.ac @@ -194,6 +194,7 @@ AC_SUBST([STATIC_SHARED]) AC_SUBST([enable_shared]) AC_SUBST([enable_static]) AC_SUBST([UNAME_INFO]) UNAME_INFO=`uname -a` +AC_SUBST([PAC_C_MAX_REAL_PRECISION]) ## ---------------------------------------------------------------------- ## Some platforms have broken basename, and/or xargs programs. Check @@ -361,14 +362,26 @@ AC_CHECK_SIZEOF([long double], [8]) ## Check for __FLOAT128 extension AC_CHECK_SIZEOF([__float128]) +HAVE_FLOAT128=0 +HAVE_QUADMATH=0 +AC_CHECK_HEADERS([quadmath.h], [HAVE_QUADMATH=1], []) +PAC_LDBL_DIG if test "$ac_cv_sizeof___float128" != 0; then - AC_DEFINE([HAVE_FLOAT128], [1], [Determine if __float128 is available]) - HAVE_QUADMATH=0 - AC_CHECK_HEADERS([quadmath.h], [HAVE_QUADMATH=1], []) +## Check if __float128 and c_long_double are the same size and precision + if test "$ac_cv_sizeof___float128" = "$ac_cv_sizeof_long_double" && test "$LDBL_DIG" = "$FLT128_DIG"; then + AC_DEFINE([HAVE_FLOAT128], [0], [Determine if __float128 is available]) + PAC_C_MAX_REAL_PRECISION=$LDBL_DIG + else + AC_DEFINE([HAVE_FLOAT128], [1], [Determine if __float128 is available]) + PAC_C_MAX_REAL_PRECISION=$FLT128_DIG dnl AC_MSG_CHECKING([for quadmath.h]) dnl AC_MSG_RESULT([$HAVE_QUADMATH]) + fi +else + PAC_C_MAX_REAL_PRECISION=$LDBL_DIG fi - +AC_DEFINE_UNQUOTED([PAC_C_MAX_REAL_PRECISION], $PAC_C_MAX_REAL_PRECISION, [Determine the maximum decimal precision in C]) +AC_MSG_RESULT([$PAC_C_MAX_REAL_PRECISION]) ## ---------------------------------------------------------------------- ## Check if they would like the Fortran interface compiled ## @@ -489,7 +502,6 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_SUBST([PAC_FORTRAN_NATIVE_DOUBLE_KIND]) AC_SUBST([PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF]) AC_SUBST([HAVE_Fortran_INTEGER_SIZEOF_16]) - AC_SUBST([PAC_C_MAX_REAL_PRECISION]) AC_SUBST([FORTRAN_HAVE_C_LONG_DOUBLE]) AC_SUBST([FORTRAN_C_LONG_DOUBLE_IS_UNIQUE]) AC_SUBST([FORTRAN_SIZEOF_LONG_DOUBLE]) @@ -601,7 +613,6 @@ if test "X$HDF_FORTRAN" = "Xyes"; then ## Change back to the C language AC_LANG_POP(Fortran) - PAC_LDBL_DIG else FC="no" fi diff --git a/m4/aclocal_fc.m4 b/m4/aclocal_fc.m4 index e55165c..678ed0f 100644 --- a/m4/aclocal_fc.m4 +++ b/m4/aclocal_fc.m4 @@ -563,24 +563,23 @@ rm -f pac_Cconftest.out # if $HAVE_QUADMATH!=0 #include <quadmath.h> # endif - #define C_LDBL_DIG FLT128_DIG - #else - # if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define C_FLT128_DIG FLT128_DIG + #endif + #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define C_LDBL_DIG DECIMAL_DIG - # else + #else #define C_LDBL_DIG LDBL_DIG - # endif #endif ],[[ FILE * pFile; pFile = fopen("pac_Cconftest.out","w"); - fprintf(pFile, "%d\n", C_LDBL_DIG); + fprintf(pFile, "%d\n %d\n", C_LDBL_DIG, C_FLT128_DIG); ]]) ]) AC_RUN_IFELSE([],[ if test -s pac_Cconftest.out ; then - LDBL_DIG="`cat pac_Cconftest.out`" - AC_DEFINE_UNQUOTED([PAC_C_MAX_REAL_PRECISION], $LDBL_DIG, [Determine the decimal precision of C long double]) + LDBL_DIG="`sed -n '1p' pac_Cconftest.out`" + FLT128_DIG="`sed -n '2p' pac_Cconftest.out`" else AC_MSG_WARN([No output from test program!]) fi @@ -588,7 +587,6 @@ rm -f pac_Cconftest.out ],[ AC_MSG_WARN([C program fails to build or run!]) ],[]) -AC_MSG_RESULT([$LDBL_DIG]) ]) diff --git a/src/H5config.h.in b/src/H5config.h.in index 387c4d5..4a4b6e0 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -443,7 +443,7 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Determine the decimal precision of C long double */ +/* Determine the maximum decimal precision in C */ #undef PAC_C_MAX_REAL_PRECISION /* Define Fortran Maximum Real Decimal Precision */ |