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 <eric.engestrom@intel.com>
Acked-by: Kristian H. Kristensen <hoegsberg@google.com>
This commit is contained in:
Dylan Baker 2018-04-18 13:54:12 -07:00
parent 597a063551
commit 7ef85a0d92
1 changed files with 11 additions and 1 deletions

View File

@ -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