1 From 913c2cc740d60450e91e066cf38f5654936a6015 Mon Sep 17 00:00:00 2001
2 From: Paul Cercueil <paul.cercueil@analog.com>
3 Date: Mon, 6 Feb 2017 14:04:47 +0100
4 Subject: [PATCH] utilities.c: Add a check for newlocale() function
6 uClibc might define __UCLIBC_HAS_LOCALE__, without actually providing
7 the locale_t type or the setlocale() function.
9 Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
12 iio-config.h.cmakein | 1 +
14 3 files changed, 3 insertions(+), 1 deletion(-)
16 diff --git a/CMakeLists.txt b/CMakeLists.txt
17 index cb3a48f..b24eff3 100644
20 @@ -66,6 +66,7 @@ endif()
21 include(CheckSymbolExists)
22 check_symbol_exists(strdup "string.h" HAS_STRDUP)
23 check_symbol_exists(strerror_r "string.h" HAS_STRERROR_R)
24 +check_symbol_exists(newlocale "locale.h" HAS_NEWLOCALE)
26 IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
27 option(WITH_IIOD "Build the IIO Daemon" ON)
28 diff --git a/iio-config.h.cmakein b/iio-config.h.cmakein
29 index 1b8608e..6700326 100644
30 --- a/iio-config.h.cmakein
31 +++ b/iio-config.h.cmakein
33 #cmakedefine HAS_PIPE2
34 #cmakedefine HAS_STRDUP
35 #cmakedefine HAS_STRERROR_R
36 +#cmakedefine HAS_NEWLOCALE
37 #cmakedefine HAS_PTHREAD_SETNAME_NP
38 #cmakedefine HAVE_IPV6
39 #cmakedefine HAVE_AVAHI
40 diff --git a/utilities.c b/utilities.c
41 index 88b8257..21dbd10 100644
48 -#if defined(__MINGW32__)
49 +#if defined(__MINGW32__) || (!defined(_WIN32) && !defined(HAS_NEWLOCALE))
50 static int read_double_locale(const char *str, double *val)
52 char *end, *old_locale;