|
5.6.3 Generic Header Checks
These macros are used to find system header files not covered by the
“particular” test macros. If you need to check the contents of a header
as well as find out whether it is present, you have to write your own
test for it (see Writing Tests).
— Macro: AC_CHECK_HEADER ( header-file, [action-if-found], [action-if-not-found], [includes = ‘default-includes’])
If the system header file header-file is compilable, execute shell
commands action-if-found, otherwise execute
action-if-not-found. If you just want to define a symbol if the
header file is available, consider using AC_CHECK_HEADERS
instead.
For compatibility issues with older versions of Autoconf, please read
below.
— Macro: AC_CHECK_HEADERS ( header-file..., [action-if-found], [action-if-not-found], [includes = ‘default-includes’])
For each given system header file header-file in the
blank-separated argument list that exists, define
HAVE_ header-file (in all capitals). If action-if-found
is given, it is additional shell code to execute when one of the header
files is found. You can give it a value of ‘break’ to break out of
the loop on the first match. If action-if-not-found is given, it
is executed when one of the header files is not found.
For compatibility issues with older versions of Autoconf, please read
below.
Previous versions of Autoconf merely checked whether the header was
accepted by the preprocessor. This was changed because the old test was
inappropriate for typical uses. Headers are typically used to compile,
not merely to preprocess, and the old behavior sometimes accepted
headers that clashed at compile-time. If you need to check whether a
header is preprocessable, you can use AC_PREPROC_IFELSE
(see Running the Preprocessor).
This scheme, which improves the robustness of the test, also requires
that you make sure that headers that must be included before the
header-file be part of the includes, (see Default Includes). If looking for bar.h, which requires that
foo.h be included before if it exists, we suggest the following
scheme:
AC_CHECK_HEADERS([foo.h])
AC_CHECK_HEADERS([bar.h], [], [],
[#if HAVE_FOO_H
# include <foo.h>
# endif
])
The following variant generates smaller, faster configure
files if you do not need the full power of AC_CHECK_HEADERS .
— Macro: AC_CHECK_HEADERS_ONCE ( header-file...)
For each given system header file header-file in the
blank-separated argument list that exists, define
HAVE_ header-file (in all capitals).
This is a once-only variant of AC_CHECK_HEADERS . It generates the
checking code at most once, so that configure is smaller and
faster; but the checks cannot be conditionalized and are always done once,
early during the configure run.
|
|