mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 20:30:38 +09:00
cmake: Check if we have Thread Local Storage support.
This commit is contained in:
@@ -165,6 +165,20 @@ if (CMAKE_HAVE_THREADS_LIBRARY)
|
||||
endif (CMAKE_HAVE_THREADS_LIBRARY)
|
||||
|
||||
# OPTIONS
|
||||
check_c_source_compiles("
|
||||
__thread int tls;
|
||||
|
||||
int main(void) {
|
||||
return 0;
|
||||
}" HAVE_GCC_THREAD_LOCAL_STORAGE)
|
||||
|
||||
check_c_source_compiles("
|
||||
__declspec(thread) int tls;
|
||||
|
||||
int main(void) {
|
||||
return 0;
|
||||
}" HAVE_MSC_THREAD_LOCAL_STORAGE)
|
||||
|
||||
if (WITH_DEBUG_CRYPTO)
|
||||
set(DEBUG_CRYPTO 1)
|
||||
endif (WITH_DEBUG_CRYPTO)
|
||||
|
||||
@@ -120,6 +120,9 @@
|
||||
|
||||
/**************************** OPTIONS ****************************/
|
||||
|
||||
#cmakedefine HAVE_GCC_THREAD_LOCAL_STORAGE 1
|
||||
#cmakedefine HAVE_MSC_THREAD_LOCAL_STORAGE 1
|
||||
|
||||
/* Define to 1 if you want to enable GSSAPI */
|
||||
#cmakedefine WITH_GSSAPI 1
|
||||
|
||||
|
||||
@@ -130,6 +130,14 @@ int gettimeofday(struct timeval *__p, void *__t);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GCC_THREAD_LOCAL_STORAGE)
|
||||
# define LIBSSH_THREAD __thread
|
||||
#elif defined(HAVE_MSC_THREAD_LOCAL_STORAGE)
|
||||
# define LIBSSH_THREAD __declspec(thread)
|
||||
#else
|
||||
# define LIBSSH_THREAD
|
||||
#endif
|
||||
|
||||
#define enter_function() (void)session
|
||||
#define leave_function() (void)session
|
||||
|
||||
|
||||
Reference in New Issue
Block a user