(autoconf.info)Generic Headers


Prev: Particular Headers Up: Header Files

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 (Note: Writing Tests).

 -- Macro: AC_CHECK_HEADER (HEADER-FILE, [ACTION-IF-FOUND],
          [ACTION-IF-NOT-FOUND], [INCLUDES = `AC_INCLUDES_DEFAULT'])
     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.

     INCLUDES is a series of include directives, defaulting to
     `AC_INCLUDES_DEFAULT' (Note: Default Includes), which are used
     prior to the header under test.

     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 = `AC_INCLUDES_DEFAULT'])
     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.

     INCLUDES is a series of include directives, defaulting to
     `AC_INCLUDES_DEFAULT' (Note: Default Includes), which are used
     prior to the headers under test.

     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' (*note
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, (Note: 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], [], [],
[#ifdef 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.


automatically generated by info2www