bitcoin/bitcoin — pull request #5516 by paveljanik (2014-12-20 10:59:04+00:00)
Title: Try also linking without -pthread and do not use it when not needed (clang on OS X)

Labels: Build system, Mac, Priority Low
clang on OS X doesn't want -pthread option when linking and thus emits this on link phase:
```
clang: warning: argument unused during compilation: '-pthread'
```
Our configure is using http://www.gnu.org/software/autoconf-archive/ax_pthread.html for pthread options detection but it doesn't (yet?) try to run clang without -pthread in the current version (compare Savannah patch http://savannah.gnu.org/patch/?8186) on OS X. This PR adds this and configure thus tries it. After this change the configure output changes like this (diff against previous configure log):
```
-checking whether pthreads work with -pthread... yes
+checking whether pthreads work without any flags... yes
```
and the actual build log does not contain the above mentioned warnings at all.

The other possible approach to this is removing the darwin special case completely. This leads to configure trying -lpthreads before no options without success and ending in no options. Ie. the result is almost the same, but this way is safe (we can't know other/old environments and someone could have libpthreads doing something else).

@theuni please have a look.