]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
meson: simplify __thread check and fix MinGW
authorRosen Penev <rosenp@gmail.com>
Sun, 23 Nov 2025 22:50:55 +0000 (14:50 -0800)
committerRosen Penev <rosenp@gmail.com>
Thu, 5 Feb 2026 21:21:54 +0000 (13:21 -0800)
> was missing.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
meson.build

index d5a92a74e3862b822e5ab9c1fe3fb47068b4f1d9..5b153e83d39e18dc4e499da936566bb2764228b1 100644 (file)
@@ -124,16 +124,12 @@ foreach d, h : decls
   endif
 endforeach
 
-check_thread = cc.compiles('''
-    __thread int x = 0;
-    int main() { return x; }
-  ''',
-  name: 'Check for __thread support')
+check_thread = cc.compiles('__thread int x;', name: 'Check for __thread support')
 
 if check_thread
   conf_data.set('HAVE___THREAD', 1)
   conf_data.set('SPEC___THREAD', '__thread')
-elif cc.get_id().contains('msvc')
+elif cc.get_argument_syntax() == 'msvc'
   conf_data.set('SPEC___THREAD', '__declspec(thread)')
 endif
 
@@ -212,7 +208,6 @@ json_header = configure_file(
   configuration: jhconf_data
 )
 
-
 # Platform-specific flags
 add_project_arguments('-D_GNU_SOURCE', language: 'c')