meson.build: work around Meson bug detecting strndup() on Windows

Work around Meson bug https://github.com/mesonbuild/meson/issues/3672
This commit is contained in:
Max Kellermann 2020-05-26 20:50:16 +02:00
parent 03b9bd3a9e
commit f7b6431b6f
2 changed files with 8 additions and 1 deletions

1
NEWS
View File

@ -5,6 +5,7 @@ ver 0.21.24 (not yet released)
- simple: fix crash when mounting twice
* fix unit test failure
* fix build failure with Android NDK r21
* work around Meson bug breaking the Windows build with GCC 10
ver 0.21.23 (2020/04/23)
* protocol

View File

@ -142,7 +142,13 @@ conf.set('HAVE_GETPWNAM_R', compiler.has_function('getpwnam_r'))
conf.set('HAVE_GETPWUID_R', compiler.has_function('getpwuid_r'))
conf.set('HAVE_INITGROUPS', compiler.has_function('initgroups'))
conf.set('HAVE_FNMATCH', compiler.has_function('fnmatch'))
conf.set('HAVE_STRNDUP', compiler.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include <string.h>'))
# Explicitly exclude Windows in this check because
# https://github.com/mesonbuild/meson/issues/3672 (reported in 2018,
# still not fixed in 2020) causes Meson to believe it exists, because
# __builtin_strndup() exists (but strndup() still cannot be used).
conf.set('HAVE_STRNDUP', not is_windows and compiler.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include <string.h>'))
conf.set('HAVE_STRCASESTR', compiler.has_function('strcasestr'))
conf.set('HAVE_PRCTL', is_linux)