summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-04-11 17:32:13 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-04-11 17:32:13 +0200
commitb6d41cbd12e116b9e37e1f8afb37927e4944bc95 (patch)
tree09bdbcf3e30d309794612d1bc375cb68b84cb6f5
parent2cf4445f446410a072d90a2aca84d3b61bb9d5cf (diff)
downloadxine-lib-b6d41cbd12e116b9e37e1f8afb37927e4944bc95.tar.gz
xine-lib-b6d41cbd12e116b9e37e1f8afb37927e4944bc95.tar.bz2
Try linking the program for Pthread support, and feed proper parameters to pthread_create.
The link is needed to make sure that the LIBS variable is set correctly, otherwise it might just be finding the definition but using the wrong link-time parameter. Also, feed proper parameters to pthread_create to avoid -Wnonnull to cause a test failure (GCC/GLIBC).
-rw-r--r--m4/pthreads.m410
1 files changed, 7 insertions, 3 deletions
diff --git a/m4/pthreads.m4 b/m4/pthreads.m4
index 28d72dd4f..35193370d 100644
--- a/m4/pthreads.m4
+++ b/m4/pthreads.m4
@@ -36,11 +36,15 @@ AC_DEFUN([CC_PTHREAD_FLAGS], [
[ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $cc_cv_werror $PTHREAD_CFLAGS"
+
LIBS="$LIBS $PTHREAD_LIBS"
- AC_COMPILE_IFELSE(
+ AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
- [[#include <pthread.h>]],
- [[pthread_create(NULL, NULL, NULL, NULL);]]
+ [[#include <pthread.h>
+ void *fakethread(void *arg) { }
+ pthread_t fakevariable;
+ ]],
+ [[pthread_create(&fakevariable, NULL, &fakethread, NULL);]]
)],
[cc_cv_pthreads=yes],
[cc_cv_pthreads=no])