[svn-r27225] new test for __float128

This commit is contained in:
Scot Breitenfeld 2015-06-17 10:40:24 -05:00
parent 1ea6564419
commit f51fcf3ffa
4 changed files with 116 additions and 104 deletions

179
configure vendored
View File

@ -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
##
@ -7617,7 +7700,6 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu
## Setting definition if there is a 16 byte fortran integer
@ -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

View File

@ -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

View File

@ -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])
])

View File

@ -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 */