tests: perf: UNHALTED_REFERENCE_CYCLES might not be actionable on a host
[lttng-tools.git] / m4 / lttng_pthread_setname_np.m4
CommitLineData
cb8d0d24
MJ
1# SYNOPSIS
2#
3# LTTNG_PTHREAD_SETNAME_NP
4#
5# LICENSE
6#
7# Copyright (c) 2020 Michael Jeanson <mjeanson@efficios.com>
8#
9# This program is free software; you can redistribute it and/or modify it
10# under the terms of the GNU General Public License as published by the
11# Free Software Foundation; either version 2 of the License, or (at your
12# option) any later version.
13#
14# This program is distributed in the hope that it will be useful, but
15# WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17# Public License for more details.
18#
19# You should have received a copy of the GNU General Public License along
20# with this program. If not, see <https://www.gnu.org/licenses/>.
21#
22# As a special exception, the respective Autoconf Macro's copyright owner
23# gives unlimited permission to copy, distribute and modify the configure
24# scripts that are the output of Autoconf when processing the Macro. You
25# need not follow the terms of the GNU General Public License when using
26# or distributing such scripts, even though portions of the text of the
27# Macro appear in them. The GNU General Public License (GPL) does govern
28# all other use of the material that constitutes the Autoconf Macro.
29#
30# This special exception to the GPL applies to versions of the Autoconf
31# Macro released by the Autoconf Archive. When you make and distribute a
32# modified version of the Autoconf Macro, you may extend this special
33# exception to the GPL to apply to your modified version as well.
34
35AC_DEFUN([LTTNG_PTHREAD_SETNAME_NP], [
36AC_REQUIRE([AX_PTHREAD])
37AC_LANG_PUSH([C])
38
39lttng_pthread_setname_np_save_LDFLAGS="$LDFLAGS"
40lttng_pthread_setname_np_save_LIBS="$LIBS"
41LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS"
42LIBS="$LIBS $PTHREAD_LIBS"
43
3f3e7eb7 44# GLIBC >= 2.12, Solaris >= 11.3, FreeBSD >= 12.2
cb8d0d24
MJ
45AC_MSG_CHECKING(for pthread_setname_np(pthread_t, const char*))
46AC_LINK_IFELSE(
47 [AC_LANG_PROGRAM(
3f3e7eb7
MJ
48 [[#include <pthread.h>
49 #ifdef __FreeBSD__
50 #include <pthread_np.h>
51 #endif]],
cb8d0d24
MJ
52 [pthread_setname_np(pthread_self(), "example")])],
53 [AC_MSG_RESULT(yes)
54 AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITH_TID,1,
55 [Have function pthread_setname_np(pthread_t, const char*)])],
56 [AC_MSG_RESULT(no)])
57
58# MacOS X >= 10.6, iOS >= 3.2
59AC_MSG_CHECKING(for pthread_setname_np(const char*))
60AC_LINK_IFELSE(
61 [AC_LANG_PROGRAM(
3f3e7eb7
MJ
62 [[#include <pthread.h>
63 #ifdef __FreeBSD__
64 #include <pthread_np.h>
65 #endif]],
cb8d0d24
MJ
66 [pthread_setname_np("example")])],
67 [AC_MSG_RESULT(yes)
68 AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID,1,
69 [Have function pthread_setname_np(const char*)])],
70 [AC_MSG_RESULT(no)])
71
014d7d3b
MJ
72# FreeBSD
73AC_MSG_CHECKING(for pthread_set_name_np(pthread_t, const char*))
74AC_LINK_IFELSE(
75 [AC_LANG_PROGRAM(
3f3e7eb7
MJ
76 [[#include <pthread.h>
77 #ifdef __FreeBSD__
78 #include <pthread_np.h>
79 #endif]],
014d7d3b
MJ
80 [pthread_set_name_np(pthread_self(), "example")])],
81 [AC_MSG_RESULT(yes)
82 AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP_WITH_TID,1,
83 [Have function pthread_set_name_np(pthread_t, const char*)])],
84 [AC_MSG_RESULT(no)])
85
cb8d0d24
MJ
86LDFLAGS=$lttng_pthread_setname_np_save_LDFLAGS
87LIBS=$lttng_pthread_setname_np_save_LIBS
88
89AC_LANG_POP
90])dnl LTTNG_PTHREAD_SETNAME_NP
This page took 0.025775 seconds and 4 git commands to generate.