diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2009-05-15 20:15:57 +0400 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2009-05-15 20:15:57 +0400 |
commit | de8a5b78105f9c7f60213a4d15a31a03f7485b6d (patch) | |
tree | ea9f18eb497d1a05f8370ce2b7f974ed3afee1c9 /newlib/configure.in | |
parent | 7aa710a782ffee5e1f824ca53436296bc9242f20 (diff) |
2009-05-15 Craig Howland <howland@LGSInnovations.com>
* configure.in: Add configuration test for long double type existing
and set flag _HAVE_LONG_DOUBLE if true. Fix INIT_ARRAY (.init_array)
and _LDBL_EQ_DBL tests to not link so that will work with
cross-compilers.
* configure: Regenerated.
* Makefile.in: Ditto.
* newlib.hin: Add _HAVE_LONG_DOUBLE flag.
* libc/include/math.h: Change non-builtin defines for HUGE_VAL,
HUGE_VALF, and HUGE_VALL to be constant expressions. Add definitions
for the non-builtin case for INFINITY and NAN. Gate HUGE_VALL and
union __ldmath definitions with (new) _HAVE_LONG_DOUBLE.
*libm/common/s_infconst.c: Change definitions to use values from
float.h instead of non-so-portable integer forms. Mark as being
deprecated (because now removed from math.h, are not used anywhere
in Newlib, itself).
Diffstat (limited to 'newlib/configure.in')
-rw-r--r-- | newlib/configure.in | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/newlib/configure.in b/newlib/configure.in index 9ff520100..86b5397c9 100644 --- a/newlib/configure.in +++ b/newlib/configure.in @@ -378,8 +378,8 @@ int __start (void) { return 0; } int foo (void) { return 1; } int (*fp) (void) __attribute__ ((section (".init_array"))) = foo; EOF -if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c - -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD]) +if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest conftest.c + 1>&AS_MESSAGE_LOG_FD]) then if ${READELF} -S conftest | grep -e INIT_ARRAY > /dev/null; then libc_cv_initfinit_array=yes @@ -395,7 +395,41 @@ if test $libc_cv_initfinit_array = yes; then AC_DEFINE_UNQUOTED(HAVE_INITFINI_ARRAY) fi -AC_CACHE_CHECK(long double equals double, +dnl Autoconf 2.59 doesn't support the AC_TYPE_LONG_DOUBLE macro. Instead of: +dnl AC_TYPE_LONG_DOUBLE +dnl AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$ac_cv_type_long_double" = x"yes") +dnl we specify our own long double test. +dnl Additionally, ac_cv_objext is broken so that AC_COMPILE_IFELSE cannot be +dnl used, so use AC_TRY_COMMAND instead. +AC_CACHE_CHECK(whether long double type exists, + acnewlib_cv_type_long_double, [dnl +cat > conftest.c <<EOF +/* Check two ways: float.h defines and direct type declaration. */ +#include <float.h> +#if defined(LDBL_MANT_DIG) + #define _HAVE_LONG_DOUBLE + #else + #error "LDBL != DBL" +#endif +long double test() { +long double ld = 0.0L; +return ld; +} +EOF +if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c + 1>&AS_MESSAGE_LOG_FD]) +then + acnewlib_cv_type_long_double=yes; +else + acnewlib_cv_type_long_double=no; +fi +rm -f conftest*]) +if test $acnewlib_cv_type_long_double = yes; then + AC_DEFINE_UNQUOTED(_HAVE_LONG_DOUBLE) +fi +AM_CONDITIONAL(HAVE_LONG_DOUBLE, test x"$acnewlib_cv_type_long_double" = x"yes") + +AC_CACHE_CHECK(whether long double equals double, newlib_ldbl_eq_dbl, [dnl cat > conftest.c <<EOF #include <float.h> @@ -406,8 +440,8 @@ cat > conftest.c <<EOF #error "LDBL != DBL" #endif EOF -if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c - -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD]) +if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c + 1>&AS_MESSAGE_LOG_FD]) then newlib_ldbl_eq_dbl=yes; else |