summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2020-02-07 11:18:46 +0300
committerIvan Maidanski <ivmai@mail.ru>2020-02-07 11:44:08 +0300
commit294f0b8eb279f9d0517bfa39decaf7ac4aaa3b5d (patch)
treeb7948ffe9dac7439d8e498db49a3a6653cd49614 /configure.ac
parentab91e4e84d166fb7536056ae95d55c00d2ea2f46 (diff)
downloadbdwgc-294f0b8eb279f9d0517bfa39decaf7ac4aaa3b5d.tar.gz
Fix pthread_setname_np detection on Linux and snprintf usage warning
(fix of commit ab91e4e84) Issue #300 (bdwgc). * configure.ac [$THREADS==posix]: Replace AC_TRY_LINK with AC_TRY_COMPILE to detect pthread_setname_np presence and kind. * pthread_support.c [PARALLEL_MARK && (HAVE_PTHREAD_SETNAME_NP_WITH_TID || HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID)] (set_marker_thread_name): Replace snprintf() with BCOPY() call and manual conversion of an integer (with 1-2 digits) to a string; remove undef name_buf. * win32_threads.c [PARALLEL_MARK && HAVE_PTHREAD_SETNAME_NP_WITH_TID] (set_marker_thread_name): Likewise.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac12
1 files changed, 6 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 050ad147..09c1f597 100644
--- a/configure.ac
+++ b/configure.ac
@@ -785,25 +785,25 @@ AS_IF([test "$THREADS" = posix],
[AC_MSG_CHECKING(for pthread_setname_np)
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $CFLAGS_EXTRA -Werror"
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_setname_np("thread-name")],
+ AC_TRY_COMPILE([#include <pthread.h>],
+ [pthread_setname_np("thread-name")],
[AC_MSG_RESULT([yes (w/o tid)])
AC_DEFINE([HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID], [1],
[Define to use 'pthread_setname_np(const char*)' function.])],
- [AC_TRY_LINK([#include <pthread.h>],
- [pthread_setname_np(pthread_self(), "thread-name-%u", 0)],
+ [AC_TRY_COMPILE([#include <pthread.h>],
+ [pthread_setname_np(pthread_self(), "thread-name-%u", 0)],
[AC_MSG_RESULT([yes (with tid and arg)])
AC_DEFINE([HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG], [1],
[Define to use 'pthread_setname_np(pthread_t, const char*, void *)'
function.])],
- [AC_TRY_LINK([
+ [AC_TRY_COMPILE([
#ifdef __CYGWIN__
#define _GNU_SOURCE 1
#elif defined(__linux__) || defined(__GLIBC__) || defined(__GNU__)
#define _GNU_SOURCE 1
#endif
#include <pthread.h>],
- [pthread_setname_np(pthread_self(), "thread-name")],
+ [pthread_setname_np(pthread_self(), "thread-name")],
[AC_MSG_RESULT([yes (with tid)])
AC_DEFINE([HAVE_PTHREAD_SETNAME_NP_WITH_TID], [1],
[Define to use 'pthread_setname_np(pthread_t, const char*)'