Greetings. I am trying to create an autoconf configure script that automatically checks for which pthread option to use and, ideally, specifies -pthread when compiling with gcc.
It was my hope that AX_PTHREAD would work, but neither seems to work on MacOS 10.6.
I'm using AX_PTHREAD from http://www.nongnu.org/autoconf-archive/ax%5Fpthread.html
For reasons that I do not understand, it just doesn't use the -pthread option for scripts build on a mac.
The problem seems to be that "none" is compiling without error, and as a result the other threads in the ax_pthread_flags variable aren't being checked.
So I've moved the -pthread case before the "none" case and added this case to the case statement:
-pthread)
PTHREAD_CFLAGS="-pthread"
PTHREAD_LIBS="-pthread"
;;
This seems to work, but I am not sure if it will work with non-GCC compilers. And I'm not even sure if I should care.
Equally annoying is the fact that the AX_PTHREAD macro only updates CFLAGS, not CPPFLAGS.
Is there a better way to test for the -pthread option using autoconf?