From 504468d2cf56c6588342249c4625a0bfadf0751d Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Fri, 26 Apr 2019 19:46:05 +0100 Subject: [PATCH] meson: Don't use strndup() unless it's prototyped A workaround for https://github.com/mesonbuild/meson/issues/3672 MinGW-w64 gcc has a built-in strndup, but it's not in the C library and MinGW-w64 headers don't prototype it. Don't try to use it, as that will cause an undefined reference if gcc decides that an out-of-line call is appropriate. --- include/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/meson.build b/include/meson.build index 3f3024b50..09707cec5 100644 --- a/include/meson.build +++ b/include/meson.build @@ -159,7 +159,7 @@ conf_data.set('HAVE_STRCASESTR', cc.has_function('strcasestr')) conf_data.set('HAVE_STRLCAT', cc.has_function('strlcat', dependencies: libbsd_dep)) conf_data.set('HAVE_STRLCPY', cc.has_function('strlcpy', dependencies: libbsd_dep)) conf_data.set('HAVE_STRNCASECMP', cc.has_function('strncasecmp')) -conf_data.set('HAVE_STRNDUP', cc.has_function('strndup')) +conf_data.set('HAVE_STRNDUP', cc.has_function('strndup') and cc.has_header_symbol('string.h', 'strndup')) conf_data.set('HAVE_TIMINGSAFE_MEMCMP', cc.has_function('timingsafe_memcmp')) conf_data.set('HAVE_VASPRINTF', cc.has_function('vasprintf')) conf_data.set('HAVE_VSNPRINTF', cc.has_function('vsnprintf'))