--- Mesa-7.9.1/src/glsl/strtod.c 2011-01-04 01:05:24.000000000 +0000 +++ Mesa/src/glsl/strtod.c 2011-01-27 04:02:42.000000000 +0000 @@ -26,7 +26,7 @@ #include -#ifdef _GNU_SOURCE +#ifdef __GLIBC__ #include #ifdef __APPLE__ #include @@ -35,7 +35,11 @@ #include "strtod.h" - +#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ > 2 && !defined(__CYGWIN__) && !defined(__FreeBSD__) + #define HAVE_STRTOD_L 1 +#else + #define HAVE_STRTOD_L 0 +#endif /** * Wrapper around strtod which uses the "C" locale so the decimal @@ -44,7 +48,7 @@ double glsl_strtod(const char *s, char **end) { -#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) +#if HAVE_STRTOD_L static locale_t loc = NULL; if (!loc) { loc = newlocale(LC_CTYPE_MASK, "C", NULL); --- Mesa-7.9.1/src/mesa/main/imports.c 2010-12-15 21:50:00.000000000 +0000 +++ Mesa/src/mesa/main/imports.c 2011-01-27 04:11:48.000000000 +0000 @@ -43,18 +43,31 @@ */ +#define _XOPEN_SOURCE 600 /* We use strtof/strtof_l */ #include "imports.h" #include "context.h" #include "version.h" -#ifdef _GNU_SOURCE +#ifdef __GLIBC__ #include #ifdef __APPLE__ #include #endif #endif +#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ > 2 && !defined(__CYGWIN__) && !defined(__FreeBSD__) + #define HAVE_STRTOF_L 1 +#else + #define HAVE_STRTOF_L 0 +#endif + +#if defined(__GLIBC__) + #define HAVE_STRTOF 1 + /* True at least as long as we declare _XOPEN_SOURCE >= 600 */ +#else + #define HAVE_STRTOF 0 +#endif #define MAXSTRING 4000 /* for vsnprintf() */ @@ -753,17 +766,16 @@ } } -/** Wrapper around strtof() */ float _mesa_strtof( const char *s, char **end ) { -#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) +#if HAVE_STRTOF_L 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 HAVE_STRTOF return strtof(s, end); #else return (float)strtod(s, end);