1
mirror of https://code.videolan.org/videolan/vlc synced 2024-07-17 05:01:41 +02:00

vlc_fixup: Provide a thread_local macro

This commit is contained in:
Hugo Beauzée-Luyssen 2017-06-15 16:17:06 +02:00
parent 91fed327a3
commit d0e2ad922a
2 changed files with 23 additions and 0 deletions

View File

@ -757,6 +757,17 @@ AC_CHECK_LIB(m,sincos, [
AC_LIBOBJ([sincos])
])
AC_MSG_CHECKING([_Thread_local support])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_Thread_local int foo = 0;
int main() {}])], [
AC_MSG_RESULT([ok])
AC_DEFINE(HAVE_THREAD_LOCAL, 1, [Defined to 1 if C11 _Thread_local storage qualifier is supported])
],[ AC_MSG_RESULT([no])])
dnl __STDC_NO_THREADS__ can't be trusted on some platforms.
dnl check for its availability explicitely
AC_CHECK_HEADERS([threads.h])
dnl Check for dynamic plugins
LIBDL=""
have_dynamic_objects="no"

View File

@ -45,6 +45,18 @@
# endif
#endif
#ifndef __cplusplus
# ifdef HAVE_THREADS_H
# include <threads.h>
# elif !defined(thread_local)
# ifdef HAVE_THREAD_LOCAL
# define thread_local _Thread_local
# elif defined(_MSC_VER)
# define thread_local __declspec(thread)
# endif
# endif
#endif
#if !defined (HAVE_GMTIME_R) || !defined (HAVE_LOCALTIME_R) \
|| !defined (HAVE_TIMEGM)
# include <time.h> /* time_t */