[patch #8186] ax_pthread adds -pthread when it should not on OSX when compiling with clang

Alistair King <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.archive-maintainers
Message-ID <[email protected]>
Follow-up Comment #10, patch #8186 (project autoconf-archive):

I am seeing the same issue that Brian mentioned.
Using this patch on OSX 10.9, with CC set to either gcc or clang (it appears
they are both llvm front-ends):

alistair@gibi:~$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

alistair@gibi:~$ clang --version
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

When I use the patched ax_pthread macro it adds -pthread to CFLAGS.
This works just fine during the compilation phase, but when linking yields
this (misleading) warning:

clang: warning: argument unused during compilation: '-pthread'

The fix suggested by Brian does indeed make this go away.
My *guess* as to why this fixes the problem is because while clang will accept
-pthread during compilation, it is not needed; whereas during linking it
throws a warning if it is used.

From man pthread(3):
INSTALLATION
     The default system libraries include pthread functions.  No additional
libraries or CFLAGS are necessary to use these interfaces.

Hope this helps.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8186>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.