build: fix pthread detection code in boost tool
It failed to build with several "null argument where
non-null required" errors on some Linux systems.
Change-Id: Ia3dccf3bb0e63d80d73b870632adc3308da6ecd0
diff --git a/.waf-tools/boost.py b/.waf-tools/boost.py
index 6b27bce..9b9395e 100644
--- a/.waf-tools/boost.py
+++ b/.waf-tools/boost.py
@@ -71,12 +71,16 @@
PTHREAD_CODE = '''
#include <pthread.h>
+static void* f(void*) { return 0; }
int main() {
pthread_t th;
- pthread_create(&th, 0, 0, 0);
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_create(&th, &attr, &f, 0);
pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0);
+ pthread_cleanup_push(0, 0);
+ pthread_cleanup_pop(0);
+ pthread_attr_destroy(&attr);
}
'''
@@ -361,7 +365,7 @@
# we'll just look for -pthreads and -lpthread first:
boost_pthread_flags = ["-pthreads", "-lpthread", "-mt", "-pthread"]
else:
- boost_pthread_flags = ["-lpthreads", "-Kthread", "-kthread", "-llthread", "-pthread",
+ boost_pthread_flags = ["", "-lpthreads", "-Kthread", "-kthread", "-llthread", "-pthread",
"-pthreads", "-mthreads", "-lpthread", "--thread-safe", "-mt"]
for boost_pthread_flag in boost_pthread_flags: