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.
This commit is contained in:
Jon Turney 2019-04-26 19:46:05 +01:00 committed by Adam Jackson
parent d3a528c91e
commit 504468d2cf

View File

@ -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'))