dnl FIXME replace main with a function we actually want from this library.
AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
-dnl Check for C11 threads.
-AC_CHECK_HEADERS_ONCE(threads.h)
-
dnl Check for the POSIX thread library.
LIB_PTHREAD=
AC_CHECK_HEADERS_ONCE(pthread.h)
AC_CACHE_CHECK([for pthread library],
[emacs_cv_pthread_lib],
[emacs_cv_pthread_lib=no
- OLD_CPPFLAGS=$CPPFLAGS
OLD_LIBS=$LIBS
for emacs_pthread_lib in 'none needed' -lpthread; do
case $emacs_pthread_lib in
if test "$emacs_cv_pthread_lib" != no; then
break
fi
- done
- CPPFLAGS=$OLD_CPPFLAGS])
+ done])
if test "$emacs_cv_pthread_lib" != no; then
AC_DEFINE([HAVE_PTHREAD], 1, [Define to 1 if you have POSIX threads.])
case $emacs_cv_pthread_lib in
/* Handle to the main thread. Used to verify that modules call us in
the right thread. */
-#ifdef HAVE_THREADS_H
-# include <threads.h>
-static thrd_t main_thread;
-#elif defined HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
# include <pthread.h>
static pthread_t main_thread;
#elif defined WINDOWSNT
static void
check_main_thread (void)
{
-#ifdef HAVE_THREADS_H
- eassert (thrd_equal (thdr_current (), main_thread));
-#elif defined HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
eassert (pthread_equal (pthread_self (), main_thread));
#elif defined WINDOWSNT
eassert (GetCurrentThreadId () == main_thread);
{
/* It is not guaranteed that dynamic initializers run in the main thread,
therefore detect the main thread here. */
-#ifdef HAVE_THREADS_H
- main_thread = thrd_current ();
-#elif defined HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
main_thread = pthread_self ();
#elif defined WINDOWSNT
/* The 'main' function already recorded the main thread's thread ID,