diff --git a/meson.build b/meson.build index 507c9730095..765cc4b9ad3 100644 --- a/meson.build +++ b/meson.build @@ -1102,7 +1102,18 @@ elif host_machine.system() == 'windows' '-DNOMINMAX', ] else - pre_args += ['-D__MSVCRT_VERSION__=0x0700'] + # When the target is not mingw/ucrt + # NOTE: clang's stddef.h are conflict with mingw/ucrt's stddef.h + # So do not include headers that defined in clang for detecting + # _UCRT + if cc.compiles(''' + #include + #if defined(__MINGW32__) && defined(_UCRT) + #error + #endif + int main(void) { return 0; }''') + pre_args += ['-D__MSVCRT_VERSION__=0x0700'] + endif endif elif host_machine.system() == 'openbsd' pre_args += '-D_ISOC11_SOURCE'