hc
2023-11-20 2e7bd41e4e8ab3d1efdabd9e263a2f7fe79bff8c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From a826b7b656c165bc35746d9af3ec371387d2bca1 Mon Sep 17 00:00:00 2001
From: Adam Duskett <aduskett@gmail.com>
Date: Mon, 23 Oct 2017 08:11:21 -0400
Subject: [PATCH] fix xlocale header check
 
asyncrt_utils.h checks if __GLIBC__ is not defined before including
xlocal.h.  This will cause a compilation failure on uclibc and musl.
 
Add a proper check in CMakeLists.txt and check for HAVE_XLOCALE_H
instead of __GLIBC__
 
Upstream-Status: Accepted
Signed-off-by: Adam Duskett <aduskett@gmail.com>
---
 Release/CMakeLists.txt                  | 3 +++
 Release/include/cpprest/asyncrt_utils.h | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
 
diff --git a/Release/CMakeLists.txt b/Release/CMakeLists.txt
index d57aa3d..eefae75 100644
--- a/Release/CMakeLists.txt
+++ b/Release/CMakeLists.txt
@@ -42,6 +42,7 @@ include(cmake/cpprest_find_boost.cmake)
 include(cmake/cpprest_find_zlib.cmake)
 include(cmake/cpprest_find_openssl.cmake)
 include(cmake/cpprest_find_websocketpp.cmake)
+include(CheckIncludeFiles)
 
 find_package(Threads REQUIRED)
 if(THREADS_HAVE_PTHREAD_ARG)
@@ -56,6 +57,8 @@ if(CPPREST_EXCLUDE_WEBSOCKETS)
   set(CPPREST_WEBSOCKETS_IMPL none CACHE STRING "Internal use.")
 endif()
 
+CHECK_INCLUDE_FILES(xlocale.h HAVE_XLOCALE_H)
+
 if(APPLE) # Note: also iOS
   set(CPPREST_PPLX_IMPL apple CACHE STRING "Internal use.")
   set(CPPREST_WEBSOCKETS_IMPL wspp CACHE STRING "Internal use.")
diff --git a/Release/include/cpprest/asyncrt_utils.h b/Release/include/cpprest/asyncrt_utils.h
index fac70a9..8faa2dc 100644
--- a/Release/include/cpprest/asyncrt_utils.h
+++ b/Release/include/cpprest/asyncrt_utils.h
@@ -29,7 +29,7 @@
 
 #ifndef _WIN32
 #include <boost/algorithm/string.hpp>
-#if !defined(ANDROID) && !defined(__ANDROID__) && !defined(__GLIBC__) // CodePlex 269
+#if !defined(ANDROID) && !defined(__ANDROID__) && defined(HAVE_XLOCALE_H) // CodePlex 269
 /* Systems using glibc: xlocale.h has been removed from glibc 2.26
    The above include of locale.h is sufficient
    Further details: https://sourceware.org/git/?p=glibc.git;a=commit;h=f0be25b6336db7492e47d2e8e72eb8af53b5506d */
-- 
2.13.6