summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2020-01-07 17:08:25 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2020-01-07 17:57:31 +0100
commit73fd8a4b535928990f24702cdfaeeeceb6d33d3d (patch)
tree56cd425a191c863f87cd4d2b0742464fea8b540a /configure.ac
parentf54b24304decc52defbf12576993d746e02a80ee (diff)
downloademacs-73fd8a4b535928990f24702cdfaeeeceb6d33d3d.tar.gz
Fix BSD and macOS builds w.r.t. pthread_setname_np (bug#38632)
pthread_setname_np takes only a single argument on BSD and macOS, and affects the current thread only. * configure.ac: Add check for single-argument pthread_setname_np * src/systhread.c (sys_thread_set_name): New (w32 and pthread versions). (sys_thread_create): Remove name argument and name-setting. (w32_beginthread_wrapper): Remove name-setting. * src/systhread.h (sys_thread_create, sys_thread_set_name): Update prototypes. * src/thread.c (run_thread): Call sys_thread_set_name. (Fmake_thread): Adapt call to sys_thread_create. * src/thread.h (struct thread_state): Adjust comment.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac17
1 files changed, 17 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index de4710f150a..068ef5c20c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4183,6 +4183,23 @@ getpwent endpwent getgrent endgrent \
cfmakeraw cfsetspeed __executable_start log2 pthread_setname_np)
LIBS=$OLD_LIBS
+if test "$ac_cv_func_pthread_setname_np" = "yes"; then
+ AC_CACHE_CHECK(
+ [whether pthread_setname_np takes a single argument],
+ [emacs_cv_pthread_setname_np_1arg],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <pthread.h>]],
+ [[pthread_setname_np ("a");]])],
+ [emacs_cv_pthread_setname_np_1arg=yes],
+ [emacs_cv_pthread_setname_np_1arg=no])])
+ if test "$emacs_cv_pthread_setname_np_1arg" = "yes"; then
+ AC_DEFINE(
+ HAVE_PTHREAD_SETNAME_NP_1ARG, 1,
+ [Define to 1 if pthread_setname_np takes a single argument.])
+ fi
+fi
+
dnl No need to check for posix_memalign if aligned_alloc works.
AC_CHECK_FUNCS([aligned_alloc posix_memalign], [break])
AC_CHECK_DECLS([aligned_alloc], [], [], [[#include <stdlib.h>]])