From: Dylan Baker Date: Wed, 18 Apr 2018 20:54:12 +0000 (-0700) Subject: meson: Don't check for posix_memalign on windows X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7ef85a0d92871b5ec555846bb091c246b5c4baf5;p=mesa.git 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 --- 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