diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-04-07 20:19:52 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-04-07 20:53:12 +0530 |
commit | 700010e452517d0a0b11e8e460d65b257a449302 (patch) | |
tree | 39551f6ad7ecb75d552def4ad5b219d9aefe267e /test cases | |
parent | cab5ce4fc0eeee6024632cfb3815a7b6e3b70885 (diff) | |
download | meson-700010e452517d0a0b11e8e460d65b257a449302.zip meson-700010e452517d0a0b11e8e460d65b257a449302.tar.gz meson-700010e452517d0a0b11e8e460d65b257a449302.tar.bz2 |
New API: cc.has_header_symbol to check if a header defines a specific symbol
Also supports a 'prefix' keyword argument for feature checks such as _GNU_SOURCE
or for headers that need to be included first
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/common/111 has header symbol/meson.build | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test cases/common/111 has header symbol/meson.build b/test cases/common/111 has header symbol/meson.build new file mode 100644 index 0000000..e0afb42 --- /dev/null +++ b/test cases/common/111 has header symbol/meson.build @@ -0,0 +1,18 @@ +project('has header symbol', 'c') + +cc = meson.get_compiler('c') + +assert (cc.has_header_symbol('stdio.h', 'int'), 'base types should always be available') +assert (cc.has_header_symbol('stdio.h', 'printf'), 'printf function not found') +assert (cc.has_header_symbol('stdio.h', 'FILE'), 'FILE structure not found') +assert (cc.has_header_symbol('limits.h', 'INT_MAX'), 'INT_MAX define not found') +assert (not cc.has_header_symbol('limits.h', 'guint64'), 'guint64 is not defined in limits.h') +assert (not cc.has_header_symbol('stdlib.h', 'FILE'), 'FILE structure is defined in stdio.h, not stdlib.h') +assert (not cc.has_header_symbol('stdlol.h', 'printf'), 'stdlol.h shouldn\'t exist') +assert (not cc.has_header_symbol('stdlol.h', 'int'), 'shouldn\'t be able to find "int" with invalid header') + +# This is likely only available on Glibc, so just test for it +if cc.has_function('ppoll') + assert (not cc.has_header_symbol('poll.h', 'ppoll'), 'ppoll should not be accessible without _GNU_SOURCE') + assert (cc.has_header_symbol('poll.h', 'ppoll', prefix : '#define _GNU_SOURCE'), 'ppoll should be accessible with _GNU_SOURCE') +endif |