The Meson Build System
http://mesonbuild.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
2.1 KiB
55 lines
2.1 KiB
8 years ago
|
project('has header', 'c', 'cpp')
|
||
12 years ago
|
|
||
8 years ago
|
host_system = host_machine.system()
|
||
|
|
||
|
non_existant_header = 'ouagadougou.h'
|
||
|
|
||
|
# Copy it into the builddir to ensure that it isn't found even if it's there
|
||
|
configure_file(input : non_existant_header,
|
||
|
output : non_existant_header,
|
||
|
configuration : configuration_data())
|
||
|
|
||
8 years ago
|
# Test that the fallback to __has_include also works on all compilers
|
||
8 years ago
|
if host_system != 'darwin'
|
||
8 years ago
|
fallbacks = ['', '\n#undef __has_include']
|
||
8 years ago
|
else
|
||
|
# On Darwin's clang you can't redefine builtin macros so the above doesn't work
|
||
8 years ago
|
fallbacks = ['']
|
||
8 years ago
|
endif
|
||
8 years ago
|
|
||
8 years ago
|
foreach fallback : fallbacks
|
||
8 years ago
|
foreach comp : [meson.get_compiler('c'), meson.get_compiler('cpp')]
|
||
8 years ago
|
assert(comp.has_header('stdio.h', prefix : fallback), 'Stdio missing.')
|
||
8 years ago
|
|
||
|
# stdio.h doesn't actually need stdlib.h, but just test that setting the
|
||
|
# prefix does not result in an error.
|
||
8 years ago
|
assert(comp.has_header('stdio.h', prefix : '#include <stdlib.h>' + fallback),
|
||
8 years ago
|
'Stdio missing.')
|
||
|
|
||
|
# XInput.h should not require type definitions from windows.h, but it does
|
||
|
# require macro definitions. Specifically, it requires an arch setting for
|
||
|
# VS2015 at least.
|
||
|
# We only do this check on MSVC because MinGW often defines its own wrappers
|
||
|
# that pre-include windows.h
|
||
|
if comp.get_id() == 'msvc'
|
||
8 years ago
|
assert(comp.has_header('XInput.h', prefix : '#include <windows.h>' + fallback),
|
||
8 years ago
|
'XInput.h should not be missing on Windows')
|
||
8 years ago
|
assert(comp.has_header('XInput.h', prefix : '#define _X86_' + fallback),
|
||
8 years ago
|
'XInput.h should not need windows.h')
|
||
8 years ago
|
endif
|
||
8 years ago
|
|
||
|
# Test that the following GCC bug doesn't happen:
|
||
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80005
|
||
|
# https://github.com/mesonbuild/meson/issues/1458
|
||
|
if host_system == 'linux'
|
||
8 years ago
|
assert(comp.has_header('linux/if.h', prefix : fallback),
|
||
8 years ago
|
'Could not find <linux/if.h>')
|
||
8 years ago
|
endif
|
||
8 years ago
|
|
||
|
# This header exists in the source and the builddir, but we still must not
|
||
|
# find it since we are looking in the system directories.
|
||
8 years ago
|
assert(not comp.has_header(non_existant_header, prefix : fallback),
|
||
8 years ago
|
'Found non-existant header.')
|
||
|
endforeach
|
||
8 years ago
|
endforeach
|