Skip to content

Commit

Permalink
Workaround for MinGW non-standard strtod.
Browse files Browse the repository at this point in the history
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().
  • Loading branch information
Martin Whitaker authored and steveicarus committed Oct 27, 2011
1 parent 0b978da commit b6cb065
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 12 additions & 1 deletion aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
Expand Down

0 comments on commit b6cb065

Please sign in to comment.