Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
MakeMakefile#have_var
have_var(var, headers = nil, opt = "", &b)
lib/mkmf.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/mkmf.rb, line 1216
def have_var(var, headers = nil, opt = "", &b)
checking_for checking_message(var, headers, opt) do
if try_var(var, headers, opt, &b)
$defs.push(format("-DHAVE_%s", var.tr_cpp))
true
else
false
end
end
end
Returns whether or not the variable var 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 variable name, in uppercase, prepended with HAVE_.
To check variables in an additional library, you need to check that library first using have_library().
For example, if have_var('foo') returned true, then the HAVE_FOO preprocessor macro would be passed to the compiler.
See also
#have_struct_member
#log_src
#have_macro
#modified?
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0