End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
MakeMakefile#have_header
have_header(header, preheaders = nil, opt = "", &b)
lib/mkmf.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/mkmf.rb, line 1153
def have_header(header, preheaders = nil, opt = "", &b)
dir_config(header[/.*?(?=\/)|.*?(?=\.)/])
checking_for header do
if try_header(cpp_include(preheaders)+cpp_include(header), opt, &b)
$defs.push(format("-DHAVE_%s", header.tr_cpp))
true
else
false
end
end
end
Returns whether or not the given header file can be found on your system. If found, a macro is passed as a preprocessor constant to the compiler using the header file name, in uppercase, prepended with HAVE_.
For example, if have_header('foo.h') returned true, then the HAVE_FOO_H preprocessor macro would be passed to the compiler.
See also
#have_func
#have_library
#have_framework
#have_macro
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0