Update acx_pthread.m4 to not use AC_LANG_SAVE, AC_LANG_C and AC_TRY_LINK deprecated macros

This commit is contained in:
Christophe Grenier 2009-07-16 09:05:50 +02:00
parent 391b7c18ec
commit 22b018e369

View file

@ -1,7 +1,6 @@
AC_DEFUN([ACX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_SAVE
AC_LANG_C
AC_LANG_PUSH([C])
acx_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
@ -114,11 +113,11 @@ for flag in $acx_pthread_flags; do
# 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_TRY_LINK([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0);
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
[[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
[acx_pthread_ok=yes])
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ]])],
[acx_pthread_ok=yes],[])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
@ -144,8 +143,9 @@ if test "x$acx_pthread_ok" = xyes; then
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
[attr_name=$attr; break])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
[[int attr=$attr; return attr;]])],
[attr_name=$attr; break],[])
done
AC_MSG_RESULT($attr_name)
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
@ -190,6 +190,6 @@ else
acx_pthread_ok=no
$2
fi
AC_LANG_RESTORE
AC_LANG_POP([C])
])dnl ACX_PTHREAD