[Mesa-dev] [PATCH] meson: add toggle for TLS support in GLX

Patrick Steinhardt ps at pks.im
Thu Jan 24 18:47:58 UTC 2019


The musl libc library does not have any support for the
"initial-exec" TLS model and is unlikely to ever implement it.
Thus, TLS support in GLX has been turned off in musl-based
distributions to work around problems when dlopen'ing drivers.
While this is easily possible using the autoconf build system by
passing `--disable-glx-tls`, meson does not yet have such an
option.

Add a new toggle "glx-tls" that defaults to `true` to gain parity
with autoconf. If disabled, `GLX_USE_TLS` will not be defined and
thus mesa will be built without TLS support.

Signed-off-by: Patrick Steinhardt <ps at pks.im>
---
 meson.build       | 6 +++++-
 meson_options.txt | 6 ++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 34e2a03254..3981bf1a67 100644
--- a/meson.build
+++ b/meson.build
@@ -50,6 +50,7 @@ with_tests = get_option('build-tests')
 with_valgrind = get_option('valgrind')
 with_libunwind = get_option('libunwind')
 with_asm = get_option('asm')
+with_glx_tls = get_option('glx-tls')
 with_glx_read_only_text = get_option('glx-read-only-text')
 with_glx_direct = get_option('glx-direct')
 with_osmesa = get_option('osmesa')
@@ -332,7 +333,10 @@ if with_egl and not (with_platform_drm or with_platform_surfaceless)
   endif
 endif
 
-pre_args += '-DGLX_USE_TLS'
+if with_glx_tls
+  pre_args += '-DGLX_USE_TLS'
+endif
+
 if with_glx != 'disabled'
   if not (with_platform_x11 and with_any_opengl)
     error('Cannot build GLX support without X11 platform support and at least one OpenGL API')
diff --git a/meson_options.txt b/meson_options.txt
index bfb06c4dd4..8ff63f20b4 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -224,6 +224,12 @@ option(
   value : true,
   description : 'Build assembly code if possible'
 )
+option(
+  'glx-tls',
+  type : 'boolean',
+  value : true,
+  description : 'Enable TLS support in GLX'
+)
 option(
    'glx-read-only-text',
    type : 'boolean',
-- 
2.20.1



More information about the mesa-dev mailing list