summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/mkmf.rb22
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 9fe0d9bbfa..6150b59c9a 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -793,11 +793,25 @@ def arg_config(config, *defaults, &block)
$configure_args.fetch(config.tr('_', '-'), *defaults, &block)
end
-def with_config(config, *defaults, &block)
- unless /^--with[-_]/ =~ config
- config = '--with-' + config
+def with_config(config, *defaults)
+ config = config.sub(/^--with[-_]/, '')
+ val = arg_config("--with-"+config) do
+ if arg_config("--without-"+config)
+ false
+ elsif block_given?
+ yield(config, *defaults)
+ else
+ break *defaults
+ end
+ end
+ case val
+ when "yes"
+ true
+ when "no"
+ false
+ else
+ val
end
- arg_config(config, *defaults, &block)
end
def enable_config(config, *defaults)