Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
MakeMakefile#with_config
with_config(config, default=nil) { |config, default| ... }
lib/mkmf.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/mkmf.rb, line 1767
def with_config(config, default=nil)
config = config.sub(/^--with[-_]/, '')
val = arg_config("--with-"+config) do
if arg_config("--without-"+config)
false
elsif block_given?
yield(config, default)
else
break default
end
end
case val
when "yes"
true
when "no"
false
else
val
end
end
Tests for the presence of a --with-config or --without-config option. Returns true if the with option is given, false if the without option is given, and the default value otherwise.
This can be useful for adding custom definitions, such as debug information.
Example:
Example
if with_config("debug") $defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG" end