1 # SPDX-FileCopyrightText: 2020 Michael Jeanson <mjeanson@efficios.com>
3 # SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Autoconf-exception-macro
7 # AE_PTHREAD_SETNAME_NP
12 AC_DEFUN([AE_PTHREAD_SETNAME_NP], [
13 AC_REQUIRE([AX_PTHREAD])
16 ae_pthread_setname_np_save_LDFLAGS="$LDFLAGS"
17 ae_pthread_setname_np_save_LIBS="$LIBS"
18 LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS"
19 LIBS="$LIBS $PTHREAD_LIBS"
21 # GLIBC >= 2.12, Solaris >= 11.3, FreeBSD >= 12.2
22 AC_MSG_CHECKING(for pthread_setname_np(pthread_t, const char*))
25 [[#include <pthread.h>
27 #include <pthread_np.h>
29 [pthread_setname_np(pthread_self(), "example")])],
31 AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITH_TID,1,
32 [Have function pthread_setname_np(pthread_t, const char*)])],
35 # MacOS X >= 10.6, iOS >= 3.2
36 AC_MSG_CHECKING(for pthread_setname_np(const char*))
39 [[#include <pthread.h>
41 #include <pthread_np.h>
43 [pthread_setname_np("example")])],
45 AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID,1,
46 [Have function pthread_setname_np(const char*)])],
50 AC_MSG_CHECKING(for pthread_set_name_np(pthread_t, const char*))
53 [[#include <pthread.h>
55 #include <pthread_np.h>
57 [pthread_set_name_np(pthread_self(), "example")])],
59 AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP_WITH_TID,1,
60 [Have function pthread_set_name_np(pthread_t, const char*)])],
63 LDFLAGS=$ae_pthread_setname_np_save_LDFLAGS
64 LIBS=$ae_pthread_setname_np_save_LIBS
67 ])dnl AE_PTHREAD_SETNAME_NP