AX_PTHREAD incorrectly adds -pthread on OSX
Jason Gross <[email protected]>
| Newsgroups | gmane.comp.sysutils.autoconf.archive-maintainers |
|---|---|
| Message-ID | <CAKObCary6KT=AeWmCGTmO8cob9r_n2vSo2g0fU1ApukEJQwVCg@mail.gmail.com> |
The latest version of AX_PTHREAD (dd946914edb9da25e2d8c8b2186fab5d8103f3d4,
serial 21) does not work on OS X. It tests for whether or not `clang -o
conftest -g -O2 -pthread -Werror conftest.c` succeeds (which it does),
when it actually needs to be checking for `clang -o conftest.o -g -O2
-pthread -Werror *-c* conftest.c && clang -o conftest -g -O2 -pthread
-Werror conftest.o` (which, I believe, fails). If there's a variant of
AC_LINK_IFELSE that does the compilation separately from the linking, then
the change should be as simple as
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
+ AC_COMPILE_AND_LINK_SEPARATELY_IFELSE([AC_LANG_PROGRAM([#include
<pthread.h>
static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
plus associated documentation and indentation changes, but I don't know if
anything like AC_COMPILE_AND_LINK_SEPARATELY_IFELSE exists----does it?
Thanks,
Jason