Build system: implement REUSE with SPDX identifiers
[lttng-ust.git] / m4 / ae_pthread_setname_np.m4
1 # SPDX-FileCopyrightText: 2020 Michael Jeanson <mjeanson@efficios.com>
2 #
3 # SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Autoconf-exception-macro
4 #
5 # SYNOPSIS
6 #
7 # AE_PTHREAD_SETNAME_NP
8 #
9
10 #serial 2
11
12 AC_DEFUN([AE_PTHREAD_SETNAME_NP], [
13 AC_REQUIRE([AX_PTHREAD])
14 AC_LANG_PUSH([C])
15
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"
20
21 # GLIBC >= 2.12, Solaris >= 11.3, FreeBSD >= 12.2
22 AC_MSG_CHECKING(for pthread_setname_np(pthread_t, const char*))
23 AC_LINK_IFELSE(
24 [AC_LANG_PROGRAM(
25 [[#include <pthread.h>
26 #ifdef __FreeBSD__
27 #include <pthread_np.h>
28 #endif]],
29 [pthread_setname_np(pthread_self(), "example")])],
30 [AC_MSG_RESULT(yes)
31 AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITH_TID,1,
32 [Have function pthread_setname_np(pthread_t, const char*)])],
33 [AC_MSG_RESULT(no)])
34
35 # MacOS X >= 10.6, iOS >= 3.2
36 AC_MSG_CHECKING(for pthread_setname_np(const char*))
37 AC_LINK_IFELSE(
38 [AC_LANG_PROGRAM(
39 [[#include <pthread.h>
40 #ifdef __FreeBSD__
41 #include <pthread_np.h>
42 #endif]],
43 [pthread_setname_np("example")])],
44 [AC_MSG_RESULT(yes)
45 AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID,1,
46 [Have function pthread_setname_np(const char*)])],
47 [AC_MSG_RESULT(no)])
48
49 # FreeBSD
50 AC_MSG_CHECKING(for pthread_set_name_np(pthread_t, const char*))
51 AC_LINK_IFELSE(
52 [AC_LANG_PROGRAM(
53 [[#include <pthread.h>
54 #ifdef __FreeBSD__
55 #include <pthread_np.h>
56 #endif]],
57 [pthread_set_name_np(pthread_self(), "example")])],
58 [AC_MSG_RESULT(yes)
59 AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP_WITH_TID,1,
60 [Have function pthread_set_name_np(pthread_t, const char*)])],
61 [AC_MSG_RESULT(no)])
62
63 LDFLAGS=$ae_pthread_setname_np_save_LDFLAGS
64 LIBS=$ae_pthread_setname_np_save_LIBS
65
66 AC_LANG_POP
67 ])dnl AE_PTHREAD_SETNAME_NP
This page took 0.030771 seconds and 4 git commands to generate.