From 7ef85a0d92871b5ec555846bb091c246b5c4baf5 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 18 Apr 2018 13:54:12 -0700 Subject: [PATCH] meson: Don't check for posix_memalign on windows There's a mingw bug for this, it exports __builtin_posix_memalign but not posix_memalign, so the check will succeed, but compiling will fail. Reviewed-by: Eric Engestrom Acked-by: Kristian H. Kristensen --- meson.build | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 8c5ae52ba37..824765ec082 100644 --- a/meson.build +++ b/meson.build @@ -1145,7 +1145,7 @@ foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h' endif endforeach -foreach f : ['strtof', 'mkostemp', 'posix_memalign', 'timespec_get', 'memfd_create', 'random_r'] +foreach f : ['strtof', 'mkostemp', 'timespec_get', 'memfd_create', 'random_r'] if cc.has_function(f) pre_args += '-DHAVE_@0@'.format(f.to_upper()) endif @@ -1158,6 +1158,16 @@ elif with_tools.contains('intel') error('Intel tools require the program_invocation_name variable') endif +# MinGW provides a __builtin_posix_memalign function, but not a posix_memalign. +# This means that this check will succeed, but then compilation will later +# fail. MSVC doesn't have this function at all, so only check for it on +# non-windows platforms. +if host_machine.system() != 'windows' + if cc.has_function('posix_memalign') + pre_args += '-DHAVE_POSIX_MEMALIGN' + endif +endif + # strtod locale support if cc.links(''' #define _GNU_SOURCE -- 2.30.2