pixman: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 18 01:04:59 UTC 2022


 meson.build       |   28 +++++++++++++++++++---------
 meson_options.txt |    5 +++++
 2 files changed, 24 insertions(+), 9 deletions(-)

New commits:
commit 421fc252ab7e8768f1d200f064f5222c5c9b7b63
Author: Benjamin Gilbert <bgilbert at backtick.net>
Date:   Wed Jun 29 01:28:23 2022 -0400

    meson: Add feature to disable compiler TLS support
    
    When compiling with MinGW, use of the __thread attribute causes pixman
    to gain a dependency on the winpthread DLL.  With Autotools, this could
    be avoided by configuring with ac_cv_tls=none, causing pixman to fall
    back to TlsSetValue() instead.
    
    Add a Meson 'tls' option that can be 'disabled' to skip support for TLS
    compiler attributes, or 'enabled' to require a working TLS attribute.

diff --git a/meson.build b/meson.build
index 58a1406..a485d8b 100644
--- a/meson.build
+++ b/meson.build
@@ -492,15 +492,25 @@ foreach h : ['sys/mman.h', 'fenv.h', 'unistd.h']
   endif
 endforeach
 
-# gcc on Windows only warns that __declspec(thread) isn't supported,
-# passing -Werror=attributes makes it fail.
-if (host_machine.system() == 'windows' and
-    cc.compiles('int __declspec(thread) foo;',
-                args : cc.get_supported_arguments(['-Werror=attributes']),
-                name : 'TLS via __declspec(thread)'))
-  config.set('TLS', '__declspec(thread)')
-elif cc.compiles('int __thread foo;', name : 'TLS via __thread')
-  config.set('TLS', '__thread')
+use_tls = get_option('tls')
+have_tls = ''
+if not use_tls.disabled()
+  # gcc on Windows only warns that __declspec(thread) isn't supported,
+  # passing -Werror=attributes makes it fail.
+  if (host_machine.system() == 'windows' and
+      cc.compiles('int __declspec(thread) foo;',
+                  args : cc.get_supported_arguments(['-Werror=attributes']),
+                  name : 'TLS via __declspec(thread)'))
+    have_tls = '__declspec(thread)'
+  elif cc.compiles('int __thread foo;', name : 'TLS via __thread')
+    have_tls = '__thread'
+  endif
+endif
+
+if have_tls != ''
+  config.set('TLS', have_tls)
+elif use_tls.enabled()
+  error('Compiler TLS Support unavailable, but required')
 endif
 
 if cc.links('''
diff --git a/meson_options.txt b/meson_options.txt
index 8a1cfea..99dbb4e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -79,6 +79,11 @@ option(
   type : 'feature',
   description : 'Use GNU style inline assembler',
 )
+option(
+  'tls',
+  type : 'feature',
+  description : 'Use compiler support for thread-local storage',
+)
 option(
   'cpu-features-path',
   type : 'string',


More information about the xorg-commit mailing list