Upstream-Status: Pending

From 904bd5127bd88f45abf4a376676e0a487cfb018a Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Thu, 13 Oct 2011 12:46:53 +0200
Subject: [PATCH] configure: add check HAVE_NEWLOCALE to fix build with uclibc

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 configure.ac            |    3 +++
 src/glsl/strtod.c       |    2 +-
 src/mesa/main/imports.c |    2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 49e81ad..468cfd7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -507,6 +507,9 @@ AC_SUBST([DLOPEN_LIBS])
 dnl See if posix_memalign is available
 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
 
+dnl See if newlocale is available
+AC_CHECK_FUNCS_ONCE(newlocale)
+
 dnl SELinux awareness.
 AC_ARG_ENABLE([selinux],
     [AS_HELP_STRING([--enable-selinux],
diff --git a/src/glsl/strtod.c b/src/glsl/strtod.c
index ff34591..88aa5ef 100644
--- a/src/glsl/strtod.c
+++ b/src/glsl/strtod.c
@@ -44,7 +44,7 @@
 double
 glsl_strtod(const char *s, char **end)
 {
-#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__)
+#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && defined (HAVE_NEWLOCALE)
    static locale_t loc = NULL;
    if (!loc) {
       loc = newlocale(LC_CTYPE_MASK, "C", NULL);
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 345a1c5..493e0fb 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -767,7 +767,7 @@ float
 _mesa_strtof( const char *s, char **end )
 {
 #if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \
-    !defined(ANDROID)
+    !defined(ANDROID) && defined (HAVE_NEWLOCALE)
    static locale_t loc = NULL;
    if (!loc) {
       loc = newlocale(LC_CTYPE_MASK, "C", NULL);
-- 
1.7.7

