End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
MakeMakefile#have_func
have_func(func, headers = nil, opt = "", &b)
lib/mkmf.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/mkmf.rb, line 1080
def have_func(func, headers = nil, opt = "", &b)
checking_for checking_message(func.funcall_style, headers, opt) do
if try_func(func, $libs, headers, opt, &b)
$defs << "-DHAVE_#{func.sans_arguments.tr_cpp}"
true
else
false
end
end
end
Returns whether or not the function func can be found in the common header files, or within any headers that you provide. If found, a macro is passed as a preprocessor constant to the compiler using the function name, in uppercase, prepended with HAVE_.
To check functions in an additional library, you need to check that library first using have_library(). The func shall be either mere function name or function name with arguments.
For example, if have_func('foo') returned true, then the HAVE_FOO preprocessor macro would be passed to the compiler.
See also
#have_framework
#have_header
#have_devel?
#have_library
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1