mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 20:20:18 +01:00
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 <olv@lunarg.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
e3f2029479
commit
b039dbfffd
3 changed files with 11 additions and 8 deletions
|
|
@ -527,6 +527,9 @@ if test "x$enable_asm" = xyes; then
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"])
|
||||||
|
AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"])
|
||||||
|
|
||||||
dnl Check to see if dlopen is in default libraries (like Solaris, which
|
dnl Check to see if dlopen is in default libraries (like Solaris, which
|
||||||
dnl has it in libc), or if libdl is needed to get it.
|
dnl has it in libc), or if libdl is needed to get it.
|
||||||
AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],
|
AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],
|
||||||
|
|
|
||||||
|
|
@ -301,6 +301,10 @@ def generate(env):
|
||||||
cppdefines += ['HAVE_ALIAS']
|
cppdefines += ['HAVE_ALIAS']
|
||||||
else:
|
else:
|
||||||
cppdefines += ['GLX_ALIAS_UNSUPPORTED']
|
cppdefines += ['GLX_ALIAS_UNSUPPORTED']
|
||||||
|
|
||||||
|
if env['platform'] in ('linux', 'darwin'):
|
||||||
|
cppdefines += ['HAVE_XLOCALE_H']
|
||||||
|
|
||||||
if env['platform'] == 'haiku':
|
if env['platform'] == 'haiku':
|
||||||
cppdefines += [
|
cppdefines += [
|
||||||
'HAVE_PTHREAD',
|
'HAVE_PTHREAD',
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#ifdef _GNU_SOURCE
|
#ifdef _GNU_SOURCE
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#ifdef __APPLE__
|
#ifdef HAVE_XLOCALE_H
|
||||||
#include <xlocale.h>
|
#include <xlocale.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -44,9 +44,7 @@
|
||||||
double
|
double
|
||||||
_mesa_strtod(const char *s, char **end)
|
_mesa_strtod(const char *s, char **end)
|
||||||
{
|
{
|
||||||
#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \
|
#if defined(_GNU_SOURCE) && defined(HAVE_XLOCALE_H)
|
||||||
!defined(ANDROID) && !defined(__HAIKU__) && !defined(__UCLIBC__) && \
|
|
||||||
!defined(__NetBSD__)
|
|
||||||
static locale_t loc = NULL;
|
static locale_t loc = NULL;
|
||||||
if (!loc) {
|
if (!loc) {
|
||||||
loc = newlocale(LC_CTYPE_MASK, "C", NULL);
|
loc = newlocale(LC_CTYPE_MASK, "C", NULL);
|
||||||
|
|
@ -65,15 +63,13 @@ _mesa_strtod(const char *s, char **end)
|
||||||
float
|
float
|
||||||
_mesa_strtof(const char *s, char **end)
|
_mesa_strtof(const char *s, char **end)
|
||||||
{
|
{
|
||||||
#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \
|
#if defined(_GNU_SOURCE) && defined(HAVE_XLOCALE_H)
|
||||||
!defined(ANDROID) && !defined(__HAIKU__) && !defined(__UCLIBC__) && \
|
|
||||||
!defined(__NetBSD__)
|
|
||||||
static locale_t loc = NULL;
|
static locale_t loc = NULL;
|
||||||
if (!loc) {
|
if (!loc) {
|
||||||
loc = newlocale(LC_CTYPE_MASK, "C", NULL);
|
loc = newlocale(LC_CTYPE_MASK, "C", NULL);
|
||||||
}
|
}
|
||||||
return strtof_l(s, end, loc);
|
return strtof_l(s, end, loc);
|
||||||
#elif defined(_ISOC99_SOURCE) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600)
|
#elif defined(HAVE_STRTOF)
|
||||||
return strtof(s, end);
|
return strtof(s, end);
|
||||||
#else
|
#else
|
||||||
return (float) strtod(s, end);
|
return (float) strtod(s, end);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue