1 m4_define([libcairo_pthread_setspecific_program],[dnl
6 static pthread_once_t once_control = PTHREAD_ONCE_INIT;
7 static pthread_key_t key;
12 pthread_key_create (&key, NULL);
16 main (int argc, char **argv)
20 if (pthread_once (&once_control, make_key) != 0)
26 value = pthread_getspecific (key);
30 pthread_setspecific (key, value);
34 printf ("%d, %p\n", argc, argv);
39 AC_DEFUN([CAIRO_CONFIGURE_TLS], [dnl
41 AC_CACHE_VAL(ac_cv_tls, [
43 keywords="__thread __declspec(thread)"
44 for kw in $keywords ; do
46 #if defined(__MINGW32__) && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
47 #error This MinGW version has broken __thread support
50 #error OpenBSD has broken __thread support
53 int $kw test;], [], [ac_cv_tls=$kw; break])
57 if test "$ac_cv_tls" != "none"; then
59 AC_DEFINE([CAIRO_HAS_TLS], 1, [Define to 1 if we have tls support])
60 AC_DEFINE_UNQUOTED([TLS], $ac_cv_tls, [The compiler supported TLS storage class])
63 dnl Set the output variables for CAIRO_ENABLE.
68 AC_DEFUN([CAIRO_CHECK_PTHREAD_SETSPECIFIC],[dnl
69 CAIRO_CC_TRY_LINK_WITH_ENV_SILENT(
81 AC_DEFUN([CAIRO_CONFIGURE_PTHREAD_SETSPECIFIC],[dnl
82 if test "x$PTHREAD_SETSPECIFIC_CFLAGS" = "x"; then
83 PTHREAD_SETSPECIFIC_CFLAGS="-D_REENTRANT"
86 if test "x$PTHREAD_SETSPECIFIC_LIBS" = "x"; then
87 PTHREAD_SETSPECIFIC_LIBS="-lpthread"
90 CAIRO_CHECK_PTHREAD_SETSPECIFIC(
91 [pthread_setspecific], [$PTHREAD_SETSPECIFIC_CFLAGS], [$PTHREAD_SETSPECIFIC_LIBS],
92 [libcairo_pthread_setspecific_program],
93 [have_pthread_setspecific=yes],
94 [have_pthread_setspecific=no])
96 PTHREAD_SETSPECIFIC_CFLAGS=
97 PTHREAD_SETSPECIFIC_LIBS=
99 dnl Tell autoconf about the results.
100 if test "x$have_pthread_setspecific" = "xyes"; then
101 AC_DEFINE([CAIRO_HAS_PTHREAD_SETSPECIFIC], 1,
102 [Define to 1 if we have pthread_setspecific support])
105 dnl Set the output variables for CAIRO_ENABLE.
106 use_pthread_setspecific="$have_pthread_setspecific"
107 pthread_setspecific_REQUIRES=""