summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-05-30 14:24:59 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-05-30 15:25:39 +0530
commit27b290d6dff14fdb7717d414fb941aca0fd2dc55 (patch)
tree05f8b0a6afa47fdb934b26bdd3280c138295eb4b
parentff07314a865d960aac2c377a94de766b68888ee5 (diff)
downloadmeson-27b290d6dff14fdb7717d414fb941aca0fd2dc55.tar.gz
Add check_header to Reference manual and release notes [skip ci]nirbheek/check_header
-rw-r--r--docs/markdown/Reference-manual.md16
-rw-r--r--docs/markdown/snippets/compiler_check_header.md12
2 files changed, 25 insertions, 3 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index 994801716..e29f4d93c 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -1567,8 +1567,18 @@ the following methods:
`args` keyword, you can specify external dependencies to use with
`dependencies` keyword argument.
-- `has_header` returns true if the specified header can be included,
- you can specify external dependencies to use with `dependencies`
+- `check_header` returns true if the specified header is *usable* with
+ the specified prefix, dependencies, and arguments.
+ You can specify external dependencies to use with `dependencies`
+ keyword argument and extra code to put above the header test with
+ the `prefix` keyword. In order to look for headers in a specific
+ directory you can use `args : '-I/extra/include/dir`, but this
+ should only be used in exceptional cases for includes that can't be
+ detected via pkg-config and passed via `dependencies`.
+
+- `has_header` returns true if the specified header *exists*, and is
+ faster than `check_header()` since it only does a pre-processor check.
+ You can specify external dependencies to use with `dependencies`
keyword argument and extra code to put above the header test with
the `prefix` keyword. In order to look for headers in a specific
directory you can use `args : '-I/extra/include/dir`, but this
@@ -1651,7 +1661,7 @@ The following keyword arguments can be used:
some symbols to be exposed on Linux, and it should be passed via
`args` keyword argument, see below). Supported by the methods
`sizeof`, `has_type`, `has_function`, `has_member`, `has_members`,
- `has_header_symbol`.
+ `check_header`, `has_header`, `has_header_symbol`.
**Note:** These compiler checks do not use compiler arguments added with
`add_*_arguments()`, via `-Dlang_args` on the command-line, or through
diff --git a/docs/markdown/snippets/compiler_check_header.md b/docs/markdown/snippets/compiler_check_header.md
new file mode 100644
index 000000000..8981d139d
--- /dev/null
+++ b/docs/markdown/snippets/compiler_check_header.md
@@ -0,0 +1,12 @@
+## New compiler check: check_header()
+
+The existing compiler check `has_header()` only checks if the header exists,
+either with the `__has_include` C++11 builtin, or by running the pre-processor.
+
+However, sometimes the header you are looking for is unusable on some platforms
+or with some compilers in a way that is only detectable at compile-time. For
+such cases, you should use `check_header()` which will include the header and
+run a full compile.
+
+Note that `has_header()` is much faster than `check_header()`, so it should be
+used whenever possible.