]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
fix compilation with clang-cl
authorRosen Penev <rosenp@gmail.com>
Tue, 25 Nov 2025 00:46:45 +0000 (16:46 -0800)
committerRosen Penev <rosenp@gmail.com>
Thu, 5 Feb 2026 21:46:00 +0000 (13:46 -0800)
Something in the configure stage goes wrong where it believe strncasecmp
is present but the header defining it is not. Work around this.

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

index 8412eaeabba989a0f7e8198425800820821aae3a..1b44ec5d372ef9e05207af0ddbc0de631d25607a 100644 (file)
@@ -46,7 +46,7 @@
 
 #define jt_hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x)&7) + 9)
 
-#if !HAVE_STRNCASECMP && defined(_MSC_VER)
+#if !HAVE_STRNCASECMP && defined(_WIN32)
 /* MSC has the version as _strnicmp */
 #define strncasecmp _strnicmp
 #elif !HAVE_STRNCASECMP
index 39e9956ac80fc5327b76ebb066e52d8612200cc4..d64f3be2163f499011f45316e86186d94d8cf522 100644 (file)
@@ -74,14 +74,16 @@ funcs = [
   'vsyslog',
   'getrandom',
   'getrusage',
-  'strcasecmp',
-  'strncasecmp',
   'strtoll',
   'strtoull',
   'arc4random',
   'vasprintf',
 ]
 
+if conf_data.has('HAVE_STRINGS_H')
+  funcs += ['strcasecmp', 'strncasecmp']
+endif
+
 foreach f : funcs
   if cc.has_function(f)
     conf_data.set('HAVE_@0@'.format(f.to_upper()), 1, description : 'Define to 1 if you have the `@0@` function.'.format(f))