On Tue, Nov 07, 2017 at 01:50:47PM +0000, Edd Barrett wrote:
> Ah, I have the same. It's just a matter of killing that entry.
> 
> > > -# not without -pthread
> > > -CONFIGURE_ENV +=         gpgme_cv_tls_works=no
> > 
> > So now TLS is detected/works properly because gpgme links against
> > libpthread?

I've just realised that TLS here is nothing to do with SSL. It's Thread
Local Storage.

The check looks like this:

---8<---
# Only used for debugging, so no serious test needed (for actual
# functionality you have to test libc as well, this only tests the
# compiler).
AC_CACHE_CHECK([for __thread],[gpgme_cv_tls_works],
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([__thread int foo;])],
                     gpgme_cv_tls_works=yes,gpgme_cv_tls_works=no))
if test "$gpgme_cv_tls_works" = yes; then
  AC_DEFINE(HAVE_TLS, [1], [Define if __thread is supported])
fi
--->8---

And the result is:

---8<---
configure:21195: checking for __thread
configure:21211: cc -c -O2 -pipe -Wall -Wcast-align -Wshadow 
-Wstrict-prototypes  conftest.c >&5
configure:21211: $? = 0
configure:21218: result: yes
--->8---

And gives us `#define HAVE_TLS 1` in config.h.

So it looks like it TLS is detected all right, but notice that we don't
link libpthread.

The only use of HAVE_TLS is in src/debug.c:

---8<---
#ifdef HAVE_TLS
#define FRAME_NR
static __thread int frame_nr = 0;
#endif
--->8---

And I added a '#warning' to verify this line is actually compiled, it
is. So is it correct that we didn't link pthread despite the use of
__thread?

-- 
Best Regards
Edd Barrett

http://www.theunixzoo.co.uk

Reply via email to