From 1d4885ad09899ff4df1ac63cd08e362afcf8f449 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 24 Nov 2025 16:46:45 -0800 Subject: [PATCH] fix compilation with clang-cl 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 --- json_tokener.c | 2 +- meson.build | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/json_tokener.c b/json_tokener.c index 8412eae..1b44ec5 100644 --- a/json_tokener.c +++ b/json_tokener.c @@ -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 diff --git a/meson.build b/meson.build index 39e9956..d64f3be 100644 --- a/meson.build +++ b/meson.build @@ -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)) -- 2.47.3