# LIBPTHREAD_CHECK_CONFIG ([DEFAULT-ACTION])
# ----------------------------------------------------------
# This macro sets @LIBPTHREAD_LDFLAGS@, @LIBPTHREAD_CFLAGS@ and @LIBPTHREAD_LIBS@ to the necessary
# This macro is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
AC_DEFUN([LIBPTHREAD_TRY_LINK],
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
pthread_mutexattr_init(&mta);
pthread_mutex_init(&mutex, &mta);
]])],[found_libpthread="yes"],[])
AC_DEFUN([LIBPTHREAD_TRY_RUN],
pthread_rwlockattr_t rwa;
if (0 != pthread_mutexattr_init(&mta))
if (0 != pthread_mutexattr_setpshared(&mta, PTHREAD_PROCESS_SHARED))
if (0 != pthread_mutex_init(&mutex, &mta))
if (0 != pthread_rwlockattr_init(&rwa))
if (0 != pthread_rwlockattr_setpshared(&rwa, PTHREAD_PROCESS_SHARED))
if (0 != pthread_rwlock_init(&rwlock, &rwa))
found_libpthread_process_shared="yes",
found_libpthread_process_shared="no",
found_libpthread_process_shared="no" dnl action-if-cross-compiling
AC_DEFUN([LIBPTHREAD_CHECK_CONFIG],
AC_ARG_WITH([libpthread],[
If you want to specify pthread installation directories:
AS_HELP_STRING([--with-libpthread@<:@=DIR@:>@], [use libpthread from given base install directory (DIR), default is to search through a number of common places for the libpthread files.])],
test "x$withval" = "xyes" && withval=/usr
LIBPTHREAD_CFLAGS="-I$withval/include"
LIBPTHREAD_LDFLAGS="-L$withval/lib"
_libpthread_dir_set="yes"
AC_ARG_WITH([libpthread-include],
AS_HELP_STRING([--with-libpthread-include@<:@=DIR@:>@],
[use libpthread include headers from given path.]
LIBPTHREAD_CFLAGS="-I$withval"
_libpthread_dir_set="yes"