[glib: 1/2] meson: fix str[n]casecmp detection on clang-cl
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] meson: fix str[n]casecmp detection on clang-cl
- Date: Mon, 1 Mar 2021 11:45:48 +0000 (UTC)
commit 1eac0c39f9828c1cd3a3d9d052d10974a359dd51
Author: Aleksandr Mezin <mezin alexander gmail com>
Date: Sun Feb 28 02:27:13 2021 +0600
meson: fix str[n]casecmp detection on clang-cl
Meson incorrectly detects strcasecmp, strncasecmp on clang-cl if 'prefix:'
is not specified for cc.has_function().
See https://github.com/mesonbuild/meson/issues/5628
Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2337
Before this change:
msvc was using _stricmp()
gcc on mingw was using strcasecmp()
gcc on linux was using strcasecmp()
clang-cl was trying to use strcasecmp()
After this change:
msvc is using _stricmp()
gcc on mingw is using strcasecmp()
gcc on linux is using strcasecmp()
clang-cl is using _stricmp()
Tests are still failing to build with clang-cl, but that's a separate issue.
meson.build | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/meson.build b/meson.build
index 1de9d929c..b091a7489 100644
--- a/meson.build
+++ b/meson.build
@@ -662,7 +662,7 @@ elif cc.has_function('_snprintf') or cc.has_header_symbol('stdio.h', '_snprintf'
glib_conf_prefix = glib_conf_prefix + '#define HAVE_SNPRINTF ' + hack_define
endif
-if cc.has_function('strcasecmp')
+if cc.has_function('strcasecmp', prefix: '#include <strings.h>')
glib_conf.set('HAVE_STRCASECMP', 1)
glib_conf_prefix = glib_conf_prefix + '#define HAVE_STRCASECMP 1\n'
elif cc.has_function('_stricmp')
@@ -671,7 +671,7 @@ elif cc.has_function('_stricmp')
glib_conf_prefix = glib_conf_prefix + '#define HAVE_STRCASECMP ' + hack_define
endif
-if cc.has_function('strncasecmp')
+if cc.has_function('strncasecmp', prefix: '#include <strings.h>')
glib_conf.set('HAVE_STRNCASECMP', 1)
glib_conf_prefix = glib_conf_prefix + '#define HAVE_STRNCASECMP 1\n'
elif cc.has_function('_strnicmp')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]