Merge pull request #278 from shinh/contrib
[platform/upstream/glog.git] / CMakeLists.txt
index b6d4644..2fd5351 100644 (file)
@@ -84,6 +84,7 @@ check_include_file (syslog.h HAVE_SYSLOG_H)
 check_include_file (ucontext.h HAVE_UCONTEXT_H)
 check_include_file (unistd.h HAVE_UNISTD_H)
 check_include_file (unwind.h HAVE_UNWIND_H)
+check_include_file (pwd.h HAVE_PWD_H)
 
 check_include_file_cxx ("ext/hash_map" HAVE_EXT_HASH_MAP)
 check_include_file_cxx ("ext/hash_set" HAVE_EXT_HASH_SET)
@@ -193,6 +194,11 @@ int main() { return i; }
 " HAVE_NAMESPACES)
 
 check_cxx_source_compiles ("
+__thread int tls;
+int main() { }
+" HAVE_GCC_TLS)
+
+check_cxx_source_compiles ("
 __declspec(thread) int tls;
 int main() { }
 " HAVE_MSVC_TLS)
@@ -202,19 +208,15 @@ thread_local int tls;
 int main() { }
 " HAVE_CXX11_TLS)
 
-check_cxx_source_compiles ("
-__attribute__((thread)) int tls;
-int main() { }
-" HAVE_CYGWIN_TLS)
-
 if (WITH_TLS)
-  if (HAVE_CYGWIN_TLS)
-    set (GLOG_THREAD_LOCAL_STORAGE "__attribute__((thread))")
+  # Cygwin does not support the thread attribute. Don't bother.
+  if (HAVE_GCC_TLS)
+    set (GLOG_THREAD_LOCAL_STORAGE "__thread")
   elseif (HAVE_MSVC_TLS)
     set (GLOG_THREAD_LOCAL_STORAGE "__declspec(thread)")
   elseif (HAVE_CXX11_TLS)
     set (GLOG_THREAD_LOCAL_STORAGE thread_local)
-  endif (HAVE_CYGWIN_TLS)
+  endif (HAVE_GCC_TLS)
 endif (WITH_TLS)
 
 set (_PC_FIELDS