From fae1bd921467e3633f58fc232519c10ebec23e56 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Mon, 9 Nov 2020 01:12:38 +0200 Subject: [PATCH] check for nl_langinfo() Signed-off-by: Ivailo Monev --- CMakeLists.txt | 1 + src/core/codecs/qtextcodec.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef9622fe8..c32584d0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,6 +181,7 @@ check_type_size(size_t QT_POINTER_SIZE) katie_check_function(getpwnam_r "pwd.h") katie_check_function(getpwuid_r "pwd.h") katie_check_function(getgrgid_r "grp.h") +katie_check_function(nl_langinfo "langinfo.h") # XSI/POSIX.1-2001 katie_check_function(strerror_r "string.h") # SUSv2 diff --git a/src/core/codecs/qtextcodec.cpp b/src/core/codecs/qtextcodec.cpp index ad0759a56..5aa416bd7 100644 --- a/src/core/codecs/qtextcodec.cpp +++ b/src/core/codecs/qtextcodec.cpp @@ -56,7 +56,8 @@ #include #include #include -#if defined(_XOPEN_UNIX) + +#if defined(QT_HAVE_NL_LANGINFO) #include #endif @@ -191,9 +192,9 @@ static void setupLocaleMapper() } -#if defined(_XOPEN_UNIX) +#if defined(QT_HAVE_NL_LANGINFO) if (!localeMapper) { - const char *charset = nl_langinfo(CODESET); + const char *charset = ::nl_langinfo(CODESET); if (charset) localeMapper = QTextCodec::codecForName(charset); } -- 2.11.0