340
340
acx_pthread_ok=no
343
AC_MSG_CHECKING([whether what we have so far is sufficient with -nostdlib])
344
CFLAGS="-nostdlib $CFLAGS"
345
# we need c with nostdlib
347
AC_TRY_LINK([#include <pthread.h>],
348
[pthread_t th; pthread_join(th, 0);
349
pthread_attr_init(0); pthread_cleanup_push(0, 0);
350
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
351
[done=yes],[done=no])
353
if test "x$done" = xyes; then
359
if test x"$done" = xno; then
360
AC_MSG_CHECKING([whether -lpthread saves the day])
361
LIBS="-lpthread $LIBS"
362
AC_TRY_LINK([#include <pthread.h>],
363
[pthread_t th; pthread_join(th, 0);
364
pthread_attr_init(0); pthread_cleanup_push(0, 0);
365
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
366
[done=yes],[done=no])
368
if test "x$done" = xyes; then
370
PTHREAD_LIBS="$PTHREAD_LIBS -lpthread"
373
AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries and -nostdlib])
343
377
CFLAGS="$save_CFLAGS"
344
378
LIBS="$save_LIBS"