From f7b6431b6f02e9d479427dd2054cb97273e414e7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 May 2020 20:50:16 +0200 Subject: [PATCH] meson.build: work around Meson bug detecting strndup() on Windows Work around Meson bug https://github.com/mesonbuild/meson/issues/3672 --- NEWS | 1 + meson.build | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 35b762de3..44252f4e6 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/meson.build b/meson.build index 7c5dcac9f..ab28340a6 100644 --- a/meson.build +++ b/meson.build @@ -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 ')) + +# 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 ')) + conf.set('HAVE_STRCASESTR', compiler.has_function('strcasestr')) conf.set('HAVE_PRCTL', is_linux)