View Full Version : detect thread support
gergo
02-10-2009, 10:37 AM
find the right pthread flag, detecting the thread-local storage support is pretty tricky to get right, so copied the tls.m4 macro file from gcc4+ cvs, and added the HAVE_TLS defs where needed.
added the .patch extension to tls.m4 file so i can attach it
rombust
02-10-2009, 02:18 PM
I am having trouble trying to get this to work. "HAVE_TLS" is not defined
Would if be sufficient to add something like
" CLANLIB_CHECK_LIB(tls, [`cat $srcdir/Setup/Tests/tls.cpp`], clanCore, [ *** Cannot find tls], [-pthread]) "
?
where Setup/Tests/tls.cpp tries compile pthread
Also clanlib will not work without thread_local_storage - so why have a #ifdef for it ?
/me is confused
gergo
02-11-2009, 07:49 AM
I am having trouble trying to get this to work. "HAVE_TLS" is not defined
make sure you rename tls.m4.patch to tls.m4 and copy it to root folder same place where configure.ac is located as HAVE_TLS is defined in there.
i used sinclude(tls.m4) in acinclude.m4, sinclude definition makes it silently ignore fatal errors, which may not be the best way of doing things. so one could use include instead
Would if be sufficient to add something like
" CLANLIB_CHECK_LIB(tls, [`cat $srcdir/Setup/Tests/tls.cpp`], clanCore, [ *** Cannot find tls], [-pthread]) "
?
where Setup/Tests/tls.cpp tries compile pthread
simple compile test would give wrong results, we have to assure binutils/compiler and libc supports TLS, the tls.m4 file contains good comments what needs to be tested.
Also clanlib will not work without thread_local_storage - so why have a #ifdef for it ?
__APPLE__ does not have TLS, so instead of ifdef this and that, HAVE_TLS is better way to detect this.
rombust
02-11-2009, 01:43 PM
I have applied a modified version of your patch.
I hope that it is still okay
The tls.m4 did not work on my machine, but the updated tls.m4 from gcc v4.3.3 does work.
Thanks
gergo
02-12-2009, 09:26 AM
noticed i forgot to replace one ifdef, else it looks just fine.
rombust
02-13-2009, 10:12 AM
Patch applied, Many thanks
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.