From b6cb0654042fa570db6e32cc24382ffc911fb79d Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Wed, 26 Oct 2011 21:54:20 +0100 Subject: [PATCH] Workaround for MinGW non-standard strtod. MinGW has reverted to using the Microsoft msvcrt0 implementation of the strtod() function. This implementation doesn't accept "INF" "NaN". MinGW does provide a C99 compliant implementation of this function called __strtod(). We need to force the linker to replace all references to strtod() with references to __strtod(). --- aclocal.m4 | 13 ++++++++++++- configure.in | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index a6982fbeb..cdfa8ca14 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -64,7 +64,7 @@ fi # AX_WIN32 # -------- # Combined check for several flavors of Microsoft Windows so -# their "issues" can be dealt with + # their "issues" can be dealt with AC_DEFUN([AX_WIN32], [AC_MSG_CHECKING([for Microsoft Windows]) AC_REQUIRE([AC_CANONICAL_HOST]) []dnl @@ -230,6 +230,17 @@ case "${host}" in esac ])# AX_CPP_PRECOMP +# AX_C99_STRTOD +# ------------- +AC_DEFUN([AX_C99_STRTOD], +[# On MinGW we need to jump through hoops to get a C99 compliant strtod(). +case "${host}" in + *-*-mingw*) + LDFLAGS="-Wl,--undefined=___strtod,--wrap,strtod,--defsym,___wrap_strtod=___strtod" + ;; +esac +])# AX_C99_STRTOD + # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp file name are based on the header name. diff --git a/configure.in b/configure.in index d3ca2fdc9..cae2abf7c 100644 --- a/configure.in +++ b/configure.in @@ -192,6 +192,9 @@ AX_C_PICFLAG # may modify CPPFLAGS and CFLAGS AX_CPP_PRECOMP +# may modify LDFLAGS +AX_C99_STRTOD + # Processor specific compile flags case "${host}" in alpha*-*-linux*)