summaryrefslogtreecommitdiffstats
path: root/m4/threadlib.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/threadlib.m4')
-rw-r--r--m4/threadlib.m429
1 files changed, 21 insertions, 8 deletions
diff --git a/m4/threadlib.m4 b/m4/threadlib.m4
index 1fc5777..6dee893 100644
--- a/m4/threadlib.m4
+++ b/m4/threadlib.m4
@@ -1,5 +1,5 @@
-# threadlib.m4 serial 38
-dnl Copyright (C) 2005-2023 Free Software Foundation, Inc.
+# threadlib.m4 serial 42
+dnl Copyright (C) 2005-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -85,7 +85,7 @@ AC_DEFUN([gl_WEAK_SYMBOLS],
AC_CACHE_CHECK([whether imported symbols can be declared weak],
[gl_cv_have_weak],
[case "$host_os" in
- cygwin* | mingw*)
+ cygwin* | mingw* | windows*)
dnl On Cygwin 3.2.0 with gcc 10.2, and likewise on mingw 10.0.0 with
dnl gcc 11.3, the test below would succeed, but programs that use
dnl pthread_in_use() with weak symbol references crash miserably at
@@ -206,7 +206,7 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
# If -pthread works, prefer it to -lpthread, since Ubuntu 14.04
# needs -pthread for some reason. See:
# https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html
- save_LIBS=$LIBS
+ saved_LIBS="$LIBS"
for gl_pthread in '' '-pthread'; do
LIBS="$LIBS $gl_pthread"
AC_LINK_IFELSE(
@@ -220,7 +220,7 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
[gl_pthread_api=yes
LIBPTHREAD=$gl_pthread
LIBPMULTITHREAD=$gl_pthread])
- LIBS=$save_LIBS
+ LIBS="$saved_LIBS"
test $gl_pthread_api = yes && break
done
echo "$as_me:__oline__: gl_pthread_api=$gl_pthread_api" >&AS_MESSAGE_LOG_FD
@@ -269,6 +269,15 @@ changequote([,])dnl
[Define if the pthread_in_use() detection is hard.])
esac
fi
+ ],
+ [dnl This is needed on FreeBSD 5.2.1.
+ AC_CHECK_LIB([thr], [pthread_kill],
+ [if test $gl_pthread_in_glibc = yes; then
+ LIBPMULTITHREAD=
+ else
+ LIBPMULTITHREAD=-lthr
+ fi
+ ])
])
elif test $gl_pthread_api != yes; then
# Some library is needed. Try libpthread and libc_r.
@@ -344,7 +353,7 @@ AC_DEFUN([gl_STDTHREADLIB_BODY],
AC_CHECK_HEADERS_ONCE([threads.h])
case "$host_os" in
- mingw*)
+ mingw* | windows*)
LIBSTDTHREAD=
;;
*)
@@ -465,7 +474,7 @@ changequote(,)dnl
esac
;;
dnl Obey gl_AVOID_WINPTHREAD on mingw.
- mingw*)
+ mingw* | windows*)
case "$gl_use_winpthreads_default" in
yes) gl_use_threads=posix ;;
no) gl_use_threads=windows ;;
@@ -564,7 +573,7 @@ AC_DEFUN([gl_THREADLIB_BODY],
case "$gl_use_threads" in
yes | windows | win32) # The 'win32' is for backward compatibility.
if { case "$host_os" in
- mingw*) true;;
+ mingw* | windows*) true;;
*) false;;
esac
}; then
@@ -575,6 +584,10 @@ AC_DEFUN([gl_THREADLIB_BODY],
;;
esac
fi
+ else
+ dnl "$gl_use_threads" is "no".
+ AC_DEFINE([AVOID_ANY_THREADS], [1],
+ [Define if no multithread safety and no multithreading is desired.])
fi
AC_MSG_CHECKING([for multithread API to use])
AC_MSG_RESULT([$gl_threads_api])