-AC_CHECK_LIB(pthread, pthread_exit)
-if test "x$ac_cv_lib_pthread_pthread_exit" != "xyes" \
- -a "x$ac_cv_header_pthread_h" = "xyes"; then
- dnl FreeBSD: System has pthread.h, but -lpthread library check
- dnl fails. See if we need -pthread instead of -lpthread and look
- dnl for the functions in libc_r.
- save_CXXFLAGS="$CXXFLAGS"
- save_CFLAGS="$CFLAGS"
+AC_SEARCH_LIBS(pthread_cancel, [pthread c_r])
+if test "x$ac_cv_header_pthread_h" = "xyes"; then
+ if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then