[glib] meson: Update the pthread feature checks



commit 50eeb244157a36ea045499eafc4c49ea6d769036
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Aug 9 21:31:59 2017 +0100

    meson: Update the pthread feature checks
    
    For GNU extensions, we need to define _GNU_SOURCE; but, more
    importantly, we need to tell Meson to use the threadlib dependency when
    compiling and linking the feature check.
    
    This currently exposes a bug in Meson; see:
    
    https://github.com/mesonbuild/meson/issues/2165
    
    But once that's fixed, the check will work as intended.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785955

 meson.build |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/meson.build b/meson.build
index 5a37cde..9340735 100644
--- a/meson.build
+++ b/meson.build
@@ -1273,14 +1273,21 @@ else
     glib_conf.set('HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP', 1)
   endif
   if cc.links('''#include <pthread.h>
-                 int main() {
-                   pthread_setname_np("example");
-                 }''', name : 'pthread_setname_np(const char*)')
+              int main() {
+                pthread_setname_np("example");
+              }''',
+              name : 'pthread_setname_np(const char*)',
+              dependencies : thread_dep)
     glib_conf.set('HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID', 1)
-  elif cc.links('''#include <pthread.h>
-                 int main() {
-                   pthread_setname_np(pthread_self(), "example");
-                 }''', name : 'pthread_setname_np(pthread_t, const char*)')
+  elif cc.links('''#ifndef _GNU_SOURCE
+                # define _GNU_SOURCE
+                #endif
+                #include <pthread.h>
+                int main() {
+                  pthread_setname_np(pthread_self(), "example");
+                }''',
+                name : 'pthread_setname_np(pthread_t, const char*)',
+                dependencies : thread_dep)
     glib_conf.set('HAVE_PTHREAD_SETNAME_NP_WITH_TID', 1)
   endif
 endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]