diff options
author | Chia-I Wu <[email protected]> | 2014-08-20 14:40:23 +0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2014-10-30 02:26:19 -0700 |
commit | b039dbfffd8eedef53a5ff9ae6b0ae09e6844d9c (patch) | |
tree | ed157dd7a9cda11a30383534abf40d860fb50261 /src/util/strtod.cpp | |
parent | e3f20294799d727107012d40f6c973975084e4e6 (diff) |
configure: check for xlocale.h and strtof
With the assumptions that xlocale.h implies newlocale and strtof_l. SCons is
updated to define HAVE_XLOCALE_H on linux and darwin.
Signed-off-by: Chia-I Wu <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/util/strtod.cpp')
-rw-r--r-- | src/util/strtod.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/util/strtod.cpp b/src/util/strtod.cpp index 2f1d2290879..2a3e8eb5294 100644 --- a/src/util/strtod.cpp +++ b/src/util/strtod.cpp @@ -28,7 +28,7 @@ #ifdef _GNU_SOURCE #include <locale.h> -#ifdef __APPLE__ +#ifdef HAVE_XLOCALE_H #include <xlocale.h> #endif #endif @@ -44,9 +44,7 @@ double _mesa_strtod(const char *s, char **end) { -#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \ - !defined(ANDROID) && !defined(__HAIKU__) && !defined(__UCLIBC__) && \ - !defined(__NetBSD__) +#if defined(_GNU_SOURCE) && defined(HAVE_XLOCALE_H) static locale_t loc = NULL; if (!loc) { loc = newlocale(LC_CTYPE_MASK, "C", NULL); @@ -65,15 +63,13 @@ _mesa_strtod(const char *s, char **end) float _mesa_strtof(const char *s, char **end) { -#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \ - !defined(ANDROID) && !defined(__HAIKU__) && !defined(__UCLIBC__) && \ - !defined(__NetBSD__) +#if defined(_GNU_SOURCE) && defined(HAVE_XLOCALE_H) static locale_t loc = NULL; if (!loc) { loc = newlocale(LC_CTYPE_MASK, "C", NULL); } return strtof_l(s, end, loc); -#elif defined(_ISOC99_SOURCE) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) +#elif defined(HAVE_STRTOF) return strtof(s, end); #else return (float) strtod(s, end); |