summaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-12-17 14:00:08 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2016-12-18 10:17:36 +0530
commit6292122a19ed765ed060c8d4aad9d0791cfef9f1 (patch)
tree9694ee52a64526251665f54ae1f070ebccc98675 /test cases
parentb389f430609a4956d23beddcdaa26b3fea06bc23 (diff)
downloadmeson-6292122a19ed765ed060c8d4aad9d0791cfef9f1.tar.gz
has_header: Don't compile, only preprocess
Since we're checking for the existence of a header, just running the preprocessor is enough. According to my benchmarks, doing this makes the test roughly 2x faster. I'm sure this will be useful for other checks too in the future. This shaves off 7% on the configure time for glib on my machine. This also fixes the issue that we had earlier where you had to specify any extra headers needed to resolve symbols in the header being checked for with `prefix`.
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/37 has header/meson.build17
1 files changed, 10 insertions, 7 deletions
diff --git a/test cases/common/37 has header/meson.build b/test cases/common/37 has header/meson.build
index 4f9b94f03..2f763ae4d 100644
--- a/test cases/common/37 has header/meson.build
+++ b/test cases/common/37 has header/meson.build
@@ -5,20 +5,23 @@ foreach comp : [meson.get_compiler('c'), meson.get_compiler('cpp')]
error('Stdio missing.')
endif
- # stdio.h doesn't actually need stdlib.h, but I don't know any headers on
- # UNIX/Linux that need other headers defined beforehand
+ # stdio.h doesn't actually need stdlib.h, but just test that setting the
+ # prefix does not result in an error.
if not comp.has_header('stdio.h', prefix : '#include <stdlib.h>')
error('Stdio missing.')
endif
- # XInput.h needs windows.h included beforehand. We only do this check on MSVC
- # because MinGW often defines its own wrappers that pre-include windows.h
+ # 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'
if not comp.has_header('XInput.h', prefix : '#include <windows.h>')
- error('XInput.h is missing on Windows')
+ error('XInput.h should not be missing on Windows')
endif
- if comp.has_header('XInput.h')
- error('XInput.h needs windows.h')
+ if not comp.has_header('XInput.h', prefix : '#define _X86_')
+ error('XInput.h should not need windows.h')
endif
endif