Commit 729fb83d authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Import pthread detection changes from devel.

parent c032cb29
This diff is collapsed.
......@@ -485,6 +485,15 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
LIBS="$save_LIBS"
fi
if test $ol_link_threads = no ; then
dnl try -lpthreads
save_LIBS="$LIBS"
AC_CHECK_LIB(pthreads, pthread_create, [
ol_link_threads=posix
LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads"])
LIBS="$save_LIBS"
fi
if test $ol_link_threads != no ; then
AC_DEFINE(HAVE_PTHREADS)
......@@ -602,10 +611,10 @@ static void *task(p)
if(i < 0) {
perror("select");
exit(0);
exit(10);
}
exit(1); /* if we exit here, the select blocked the whole process */
exit(0); /* if we exit here, the select blocked the whole process */
}
int main(argc, argv)
......@@ -617,7 +626,7 @@ int main(argc, argv)
/* create a pipe to select */
if(pipe(&fildes[0])) {
perror("select");
exit(0);
exit(1);
}
#ifdef HAVE_PTHREAD_SETCONCURRENCY
......@@ -638,10 +647,11 @@ int main(argc, argv)
pthread_yield(); /* make sure task runs first */
#endif
#endif
exit(0);
exit(2);
}],
[ol_cv_pthread_select_yields=yes],
[ol_cv_pthread_select_yields=no], [
[ol_cv_pthread_select_yields=no],
[ol_cv_pthread_select_yields=yes], [
AC_MSG_ERROR([crossing compiling: use --with-yielding_select=yes|no|manual])])])
AC_MSG_RESULT($ol_cv_pthread_select_yields)
......@@ -650,17 +660,6 @@ int main(argc, argv)
fi
fi
dnl dnl check for reentrant/threadsafe functions
dnl AC_CHECK_FUNCS( \
dnl feof_unlocked \
dnl unlocked_feof \
dnl ftrylockfile \
dnl flockfile \
dnl putc_unlocked \
dnl gmtime_r \
dnl strtok_r \
dnl )
dnl restore flags
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"
......@@ -803,6 +802,25 @@ int x = errno;
LIBS="$LTHREAD_LIBS $LIBS"
LTHREAD_LIBS=""
fi
dnl check for reentrant/threadsafe functions
dnl
dnl note: these should only be used when linking
dnl with $LTHREAD_LIBS
dnl
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
LIBS="$LTHREAD_LIBS $LIBS"
AC_CHECK_FUNCS( \
strtok_r \
gmtime_r \
gethostbyaddr_r gethostbyname_r \
feof_unlocked unlocked_feof \
putc_unlocked unlocked_putc \
flockfile ftrylockfile \
)
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"
fi
dnl ----------------------------------------------------------------
......
......@@ -279,15 +279,27 @@ is provided ``as is'' without express or implied warranty.
/* Define if you have the bcopy function. */
#undef HAVE_BCOPY
/* Define if you have the des_string_to_key function. */
#undef HAVE_DES_STRING_TO_KEY
/* Define if you have the feof_unlocked function. */
#undef HAVE_FEOF_UNLOCKED
/* Define if you have the flock function. */
#undef HAVE_FLOCK
/* Define if you have the flockfile function. */
#undef HAVE_FLOCKFILE
/* Define if you have the ftrylockfile function. */
#undef HAVE_FTRYLOCKFILE
/* Define if you have the getdtablesize function. */
#undef HAVE_GETDTABLESIZE
/* Define if you have the gethostbyaddr_r function. */
#undef HAVE_GETHOSTBYADDR_R
/* Define if you have the gethostbyname_r function. */
#undef HAVE_GETHOSTBYNAME_R
/* Define if you have the gethostname function. */
#undef HAVE_GETHOSTNAME
......@@ -300,6 +312,9 @@ is provided ``as is'' without express or implied warranty.
/* Define if you have the gettimeofday function. */
#undef HAVE_GETTIMEOFDAY
/* Define if you have the gmtime_r function. */
#undef HAVE_GMTIME_R
/* Define if you have the lockf function. */
#undef HAVE_LOCKF
......@@ -339,6 +354,9 @@ is provided ``as is'' without express or implied warranty.
/* Define if you have the pthread_yield function. */
#undef HAVE_PTHREAD_YIELD
/* Define if you have the putc_unlocked function. */
#undef HAVE_PUTC_UNLOCKED
/* Define if you have the res_search function. */
#undef HAVE_RES_SEARCH
......@@ -387,6 +405,9 @@ is provided ``as is'' without express or implied warranty.
/* Define if you have the strtok function. */
#undef HAVE_STRTOK
/* Define if you have the strtok_r function. */
#undef HAVE_STRTOK_R
/* Define if you have the strtol function. */
#undef HAVE_STRTOL
......@@ -402,6 +423,12 @@ is provided ``as is'' without express or implied warranty.
/* Define if you have the thr_setconcurrency function. */
#undef HAVE_THR_SETCONCURRENCY
/* Define if you have the unlocked_feof function. */
#undef HAVE_UNLOCKED_FEOF
/* Define if you have the unlocked_putc function. */
#undef HAVE_UNLOCKED_PUTC
/* Define if you have the vsnprintf function. */
#undef HAVE_VSNPRINTF
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment