Fix: sessiond: ust-app: assertion failure on registration of dead app
[lttng-tools.git] / m4 / lttng_pthread_setname_np.m4
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
35 AC_DEFUN([LTTNG_PTHREAD_SETNAME_NP], [
36 AC_REQUIRE([AX_PTHREAD])
37 AC_LANG_PUSH([C])
38
39 lttng_pthread_setname_np_save_LDFLAGS="$LDFLAGS"
40 lttng_pthread_setname_np_save_LIBS="$LIBS"
41 LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS"
42 LIBS="$LIBS $PTHREAD_LIBS"
43
44 # GLIBC >= 2.12, Solaris >= 11.3, FreeBSD >= 12.2
45 AC_MSG_CHECKING(for pthread_setname_np(pthread_t, const char*))
46 AC_LINK_IFELSE(
47 [AC_LANG_PROGRAM(
48 [[#include <pthread.h>
49 #ifdef __FreeBSD__
50 #include <pthread_np.h>
51 #endif]],
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
59 AC_MSG_CHECKING(for pthread_setname_np(const char*))
60 AC_LINK_IFELSE(
61 [AC_LANG_PROGRAM(
62 [[#include <pthread.h>
63 #ifdef __FreeBSD__
64 #include <pthread_np.h>
65 #endif]],
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
72 # FreeBSD
73 AC_MSG_CHECKING(for pthread_set_name_np(pthread_t, const char*))
74 AC_LINK_IFELSE(
75 [AC_LANG_PROGRAM(
76 [[#include <pthread.h>
77 #ifdef __FreeBSD__
78 #include <pthread_np.h>
79 #endif]],
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
86 LDFLAGS=$lttng_pthread_setname_np_save_LDFLAGS
87 LIBS=$lttng_pthread_setname_np_save_LIBS
88
89 AC_LANG_POP
90 ])dnl LTTNG_PTHREAD_SETNAME_NP
This page took 0.0311 seconds and 4 git commands to generate.