Fix: relayd: live: invalid return code on DETACH_SESSION
[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
44# GLIBC >= 2.12, Solaris >= 11.3
45AC_MSG_CHECKING(for pthread_setname_np(pthread_t, const char*))
46AC_LINK_IFELSE(
47 [AC_LANG_PROGRAM(
48 [#include <pthread.h>],
49 [pthread_setname_np(pthread_self(), "example")])],
50 [AC_MSG_RESULT(yes)
51 AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITH_TID,1,
52 [Have function pthread_setname_np(pthread_t, const char*)])],
53 [AC_MSG_RESULT(no)])
54
55# MacOS X >= 10.6, iOS >= 3.2
56AC_MSG_CHECKING(for pthread_setname_np(const char*))
57AC_LINK_IFELSE(
58 [AC_LANG_PROGRAM(
59 [#include <pthread.h>],
60 [pthread_setname_np("example")])],
61 [AC_MSG_RESULT(yes)
62 AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID,1,
63 [Have function pthread_setname_np(const char*)])],
64 [AC_MSG_RESULT(no)])
65
66LDFLAGS=$lttng_pthread_setname_np_save_LDFLAGS
67LIBS=$lttng_pthread_setname_np_save_LIBS
68
69AC_LANG_POP
70])dnl LTTNG_PTHREAD_SETNAME_NP
This page took 0.024422 seconds and 4 git commands to generate.