Hash :
a12c7fd1
Author :
Date :
2019-06-21T04:35:41
threads-h: Define 'thread_local' if and only it actually works. * m4/threads.m4 (gl_THREAD_LOCAL_DEFINITION): New macro. (gl_THREADS_H): Define _Thread_local to __thread also for ARM C, IBM C, Oracle Solaris Studio C. Compile a simple program, to see whether _Thread_local basically works. Set HAVE_THREAD_LOCAL and LIBTHREADLOCAL. (gl_THREADS_H_DEFAULTS): Initialize HAVE_THREAD_LOCAL. * lib/threads.in.h (thread_local): Undefine if it does not work. * modules/threads-h (Makefile.am): Substitute HAVE_THREAD_LOCAL. (Link): Mention LIBTHREADLOCAL. * tests/test-threads.c: Don't check that thread_local is defined. * tests/test-thread_local.c: New file. * modules/threads-h-tests (Files): Add it and macros.h. (Depends-on): Add thrd and stdint. (configure.ac): Test whether 'alarm' is declared. (Makefile.am): Arrange to build and link test-thread_local. * doc/posix-headers/threads.texi: Mention the platforms that don't support 'thread_local'.
Files:
tests/test-threads.c
tests/test-thread_local.c
tests/macros.h
Depends-on:
threads-h-c++-tests
thrd
stdint
configure.ac:
AC_CHECK_DECLS_ONCE([alarm])
Makefile.am:
TESTS += test-threads test-thread_local
check_PROGRAMS += test-threads test-thread_local
test_threads_LDADD = $(LDADD) @LIBSTDTHREAD@
test_thread_local_LDADD = $(LDADD) @LIBSTDTHREAD@ @LIBTHREADLOCAL@