From 2bb53f7253765f652b21547a9aeb001b909aa05b Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Thu, 10 Jan 2019 19:51:12 -0600 Subject: [PATCH] Fix `locale_t` under macOS 10.10 `xlocale.h` is not available on Linux, so we can't just universally include it. `HAVE_XLOCALE_H` was already being tested/set in the CMake script as a possible requirement for `wcstod_l` support, this just adds it to `config_cmake_h.in` and uses it in `wutil.h` to gate the include. --- config_cmake.h.in | 3 +++ src/wutil.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/config_cmake.h.in b/config_cmake.h.in index 162f76de0..2c6fde27d 100644 --- a/config_cmake.h.in +++ b/config_cmake.h.in @@ -156,6 +156,9 @@ /* The size of wchar_t in bits. */ #define WCHAR_T_BITS ${WCHAR_T_BITS} +/* Define if xlocale.h is required for locale_t or wide character support */ +#cmakedefine HAVE_XLOCALE_H 1 + /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 diff --git a/src/wutil.h b/src/wutil.h index 28a8540d1..661e82d05 100644 --- a/src/wutil.h +++ b/src/wutil.h @@ -10,6 +10,10 @@ #include #include +#ifdef HAVE_XLOCALE_H +#include +#endif + #include "common.h" #include "maybe.h"