HDFS-14033. [libhdfs++] Disable libhdfs++ build on systems that do not support 
thread_local. Contributed by Anatoli Shein.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/9c438abe
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/9c438abe
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/9c438abe

Branch: refs/heads/HDDS-4
Commit: 9c438abe52d4ee0b25345a4b7ec1697dd66f85e9
Parents: fac9f91
Author: Sunil G <sun...@apache.org>
Authored: Wed Oct 31 12:32:49 2018 +0530
Committer: Sunil G <sun...@apache.org>
Committed: Wed Oct 31 12:32:49 2018 +0530

----------------------------------------------------------------------
 .../src/CMakeLists.txt                          | 22 +++++++++++++++++++-
 .../src/main/native/libhdfspp/CMakeLists.txt    |  4 ++--
 2 files changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/9c438abe/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt 
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt
index 1813ec1..026be9f 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/CMakeLists.txt
@@ -138,7 +138,27 @@ endif()
 
 add_subdirectory(main/native/libhdfs)
 add_subdirectory(main/native/libhdfs-tests)
-add_subdirectory(main/native/libhdfspp)
+
+# Temporary fix to disable Libhdfs++ build on older systems that do not 
support thread_local
+include(CheckCXXSourceCompiles)
+unset (THREAD_LOCAL_SUPPORTED CACHE)
+set (CMAKE_REQUIRED_DEFINITIONS "-std=c++11")
+set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
+check_cxx_source_compiles(
+    "#include <thread>
+    int main(void) {
+      thread_local int s;
+      return 0;
+    }"
+    THREAD_LOCAL_SUPPORTED)
+if (THREAD_LOCAL_SUPPORTED)
+    add_subdirectory(main/native/libhdfspp)
+else()
+    message(WARNING
+    "WARNING: Libhdfs++ library was not built because the required feature 
thread_local storage \
+    is not supported by your compiler. Known compilers that support this 
feature: GCC 4.8+, Visual Studio 2015+, \
+    Clang (community version 3.3+), Clang (version for Xcode 8+ and iOS 9+).")
+endif (THREAD_LOCAL_SUPPORTED)
 
 if(REQUIRE_LIBWEBHDFS)
     add_subdirectory(contrib/libwebhdfs)

http://git-wip-us.apache.org/repos/asf/hadoop/blob/9c438abe/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt
 
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt
index 63fa80d..411320a 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt
@@ -63,8 +63,8 @@ check_cxx_source_compiles(
 if (NOT THREAD_LOCAL_SUPPORTED)
   message(FATAL_ERROR
   "FATAL ERROR: The required feature thread_local storage is not supported by 
your compiler. \
-  Known compilers that support this feature: GCC, Visual Studio, Clang 
(community version), \
-  Clang (version for iOS 9 and later).")
+  Known compilers that support this feature: GCC 4.8+, Visual Studio 2015+, 
Clang (community \
+  version 3.3+), Clang (version for Xcode 8+ and iOS 9+).")
 endif (NOT THREAD_LOCAL_SUPPORTED)
 
 # Check if PROTOC library was compiled with the compatible compiler by trying


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to