A while back I checked in a Fortran configure patch that allowed me to build
Fortran for the mips-mti-elf target.  I used the same mechanism (checking
with_newlib) that libstdc++ and libjava use.  This change broke the aarch64
Fortran build because that platform's newlib does not have strtold.  I would
like to change configure to not define HAVE_STRTOLD.  I could just remove that
define but instead I would again like to use the same code that the libstdc++
uses, by checking long_double_math_on_this_cpu.  This variable is actually
never set, and because of this HAVE_STRTOLD is never set but that allows us to
build Fortran on mips and aarch64.

Mips would not use strtold even if HAVE_STRTOLD was defined because mips does
not define REAL*10 and the REAL*16 code checks GFC_REAL_16_IS_FLOAT128
(set for mips) before checking for HAVE_STRTOLD.

Marcus Shawcroft said it works for him on aarch64 and I tested it on mips,
OK for checkin?

Steve Ellcey
sell...@mips.com


2013-11-15  Steve Ellcey  <sell...@mips.com>

        * configure.ac: Do not define HAVE_STRTOLD.
        * configure: Regenerate.



diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 6417373..6acc0f2 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -267,12 +267,18 @@ if test "x${with_newlib}" = "xyes"; then
    # link executables.
    AC_DEFINE(HAVE_MKSTEMP, 1, [Define if you have mkstemp.])
    AC_DEFINE(HAVE_STRTOF, 1, [Define if you have strtof.])
-   AC_DEFINE(HAVE_STRTOLD, 1, [Define if you have strtold.])
    AC_DEFINE(HAVE_SNPRINTF, 1, [Define if you have snprintf.])
    AC_DEFINE(HAVE_STRCASESTR, 1, [Define if you have strcasestr.])
    AC_DEFINE(HAVE_VSNPRINTF, 1, [Define if you have vsnprintf.])
    AC_DEFINE(HAVE_LOCALTIME_R, 1, [Define if you have localtime_r.])
    AC_DEFINE(HAVE_GMTIME_R, 1, [Define if you have gmtime_r.])
+
+   # At some point, we should differentiate between architectures
+   # like x86, which have long double versions, and alpha/powerpc/etc.,
+   # which don't. For the time being, punt.
+   if test x"long_double_math_on_this_cpu" = x"yes"; then
+     AC_DEFINE(HAVE_STRTOLD, 1, [Define if you have strtold.])
+   fi
 else
    AC_CHECK_FUNCS_ONCE(getrusage times mkstemp strtof strtold snprintf \
    ftruncate chsize chdir getlogin gethostname kill link symlink sleep ttyname 
\

Reply via email to