0039-meson-force-C-2011-for-thread_local.patch 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. From 7a283afb295d6377892c9aa4078f836cb43e43f8 Mon Sep 17 00:00:00 2001
  2. From: Brendan King <Brendan.King@imgtec.com>
  3. Date: Mon, 24 Jun 2019 09:35:39 +0100
  4. Subject: [PATCH] meson: force C++ 2011 for "thread_local"
  5. For some combinations of Meson and the GNU C++ compiler, Meson does
  6. not add '-std=c++11' to the command line arguments, resulting in
  7. compilation errors, due to the use of the "thread_local" keyword (a
  8. C++ 2011 feature). If the C++ compiler doesn't understand the
  9. "thread_local" keyword by default, add '-std=c++11' to the compiler
  10. command line arguments.
  11. ---
  12. meson.build | 6 ++++++
  13. 1 file changed, 6 insertions(+)
  14. diff --git a/meson.build b/meson.build
  15. index 2018562..21d93d3 100644
  16. --- a/meson.build
  17. +++ b/meson.build
  18. @@ -32,6 +32,12 @@ project(
  19. cc = meson.get_compiler('c')
  20. cpp = meson.get_compiler('cpp')
  21. +if not cpp.compiles('thread_local int x = 0;', name : 'thread_local')
  22. + if cpp.has_argument('-std=c++11')
  23. + add_project_arguments('-std=c++11', language : 'cpp')
  24. + endif
  25. +endif
  26. +
  27. null_dep = dependency('', required : false)
  28. if get_option('layout') != 'mirror'