summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2018-08-01 13:49:54 -0700
committerAdam Jackson <ajax@redhat.com>2018-08-02 10:27:40 -0400
commitc20e7b5e2222c0cae2a487264748fa5db711e6e4 (patch)
tree5cd1615fb646291f598a722289554d4e88c286c2
parent86c9245838b95e8a0c37fa61d835112933c738f0 (diff)
meson: Automatically detect HAVE_PTHREAD_SETNAME_NP
Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--include/meson.build18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/meson.build b/include/meson.build
index 6ed7cc6ca..678555692 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -58,7 +58,23 @@ conf_data.set('HAS_APERTURE_DRV', host_machine.system() == 'openbsd')
# XXX: HAVE_LIBDISPATCH
conf_data.set_quoted('OSNAME', 'Linux') # XXX
conf_data.set('HAVE_INPUTTHREAD', '1') # XXX
-conf_data.set('HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID', '1') # XXX
+
+if cc.compiles('''
+ #define _GNU_SOURCE 1
+ #include <pthread.h>
+ void foo(int bar) { pthread_setname_np(pthread_self(), "example"); }
+''',
+ name: 'pthread_setname_np(tid, name)')
+ conf_data.set('HAVE_PTHREAD_SETNAME_NP_WITH_TID', 1)
+elif cc.compiles('''
+ #define _GNU_SOURCE 1
+ #include <pthread.h>
+ void foo(int bar) { pthread_setname_np("example"); }
+''',
+ name: 'pthread_setname_np(name)')
+ conf_data.set('HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID', 1)
+endif
+
conf_data.set('HAVE_LIBBSD', libbsd_dep.found())
# XXX: HAVE_SYSTEMD_DAEMON
conf_data.set('CONFIG_UDEV', build_udev)