4.1.2 Checking for a Header File

The following methods can be used to check for the presence of a header file:

  • check_c_header will check for a C header to be present
  • check_cxx_header will check for a C++ header to be present

Each of these methods take the name of the header file to check for as the first argument, and take an optional Hash of arguments as the second argument.

Example calls:

configure do
  check_c_header "getopt.h", set_define: "HAVE_GETOPT_H"
  check_c_header "FreeType2.h"
  check_cxx_header "memory"
end

4.1.2.1 Options

4.1.2.1.1 :check_cpppath

Optionally specifies an array of paths to look for the header file in.

4.1.2.1.2 :fail

If the :fail option is set to false, then the absence of the header file will not result in the configure option failing. The :fail option defaults to true if the :set_define option is not defined, and defaults to false if the :set_define option is defined.

4.1.2.1.3 :set_define

If set, a build define of the specified String will be added to the CPPDEFINES construction variable array if the requested header is found.