autoconf-archive-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AX_PTHREAD incorrectly adds -pthread on OSX


From: Jason Gross
Subject: AX_PTHREAD incorrectly adds -pthread on OSX
Date: Fri, 1 Jan 2016 22:38:22 -0500

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]