summaryrefslogtreecommitdiffstats
path: root/modules/mono/tls_configure.py
diff options
context:
space:
mode:
authorIgnacio Etcheverry <neikeq@users.noreply.github.com>2018-07-04 03:45:10 +0200
committerGitHub <noreply@github.com>2018-07-04 03:45:10 +0200
commitac9e736b065f0ec30f3b1af19c41b7cd3a0371e6 (patch)
tree9249cc66bd2250defda0ca66535791dac433343e /modules/mono/tls_configure.py
parent88b89c20848ebccfac6451bbaa88e76e977aec82 (diff)
parent4739cb8c0003a7c35220ce43d8263df617c6fbe0 (diff)
downloadredot-engine-ac9e736b065f0ec30f3b1af19c41b7cd3a0371e6.tar.gz
Merge pull request #16987 from neikeq/pending-exceptions
Mono: Pending exceptions and cleanup
Diffstat (limited to 'modules/mono/tls_configure.py')
-rw-r--r--modules/mono/tls_configure.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/modules/mono/tls_configure.py b/modules/mono/tls_configure.py
new file mode 100644
index 0000000000..622280b00b
--- /dev/null
+++ b/modules/mono/tls_configure.py
@@ -0,0 +1,36 @@
+from __future__ import print_function
+
+def supported(result):
+ return 'supported' if result else 'not supported'
+
+
+def check_cxx11_thread_local(conf):
+ print('Checking for `thread_local` support...', end=" ")
+ result = conf.TryCompile('thread_local int foo = 0; int main() { return foo; }', '.cpp')
+ print(supported(result))
+ return bool(result)
+
+
+def check_declspec_thread(conf):
+ print('Checking for `__declspec(thread)` support...', end=" ")
+ result = conf.TryCompile('__declspec(thread) int foo = 0; int main() { return foo; }', '.cpp')
+ print(supported(result))
+ return bool(result)
+
+
+def check_gcc___thread(conf):
+ print('Checking for `__thread` support...', end=" ")
+ result = conf.TryCompile('__thread int foo = 0; int main() { return foo; }', '.cpp')
+ print(supported(result))
+ return bool(result)
+
+
+def configure(conf):
+ if check_cxx11_thread_local(conf):
+ conf.env.Append(CPPDEFINES=['HAVE_CXX11_THREAD_LOCAL'])
+ else:
+ if conf.env.msvc:
+ if check_declspec_thread(conf):
+ conf.env.Append(CPPDEFINES=['HAVE_DECLSPEC_THREAD'])
+ elif check_gcc___thread(conf):
+ conf.env.Append(CPPDEFINES=['HAVE_GCC___THREAD'])