From 6a6223a8e217664a348835e92d5a602f50e18b2c Mon Sep 17 00:00:00 2001
|
From: Joshua Watt <JPEWhacker@gmail.com>
|
Date: Thu, 20 Feb 2020 15:20:45 -0600
|
Subject: [PATCH] build: Fix strndup detection on MinGW
|
|
GCC and meson conspire together to incorrectly detect that strndup()
|
exists on MinGW as __builtin_strndup, when no such function exists. As a
|
work around, meson will skip looking for __builtin functions if an
|
'#include' is in the prefix, so add '#include <string.h>' when looking
|
for strndup().
|
|
See: https://github.com/mesonbuild/meson/issues/3672
|
|
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
|
Upstream-Status: Submitted [https://gitlab.freedesktop.org/wayland/wayland/merge_requests/63]
|
|
---
|
meson.build | 2 +-
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
diff --git a/meson.build b/meson.build
|
index 11c35fa..80729d0 100644
|
--- a/meson.build
|
+++ b/meson.build
|
@@ -36,11 +36,11 @@ have_funcs = [
|
'posix_fallocate',
|
'prctl',
|
'memfd_create',
|
- 'strndup',
|
]
|
foreach f: have_funcs
|
config_h.set('HAVE_' + f.underscorify().to_upper(), cc.has_function(f))
|
endforeach
|
+config_h.set('HAVE_STRNDUP', cc.has_function('strndup') and cc.has_header_symbol('string.h', 'strndup'))
|
|
if get_option('libraries')
|
ffi_dep = dependency('libffi')
|