mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/extmk.rb, lib/mkmf.rb (with_config): support --with-extension
options. [ruby-dev:27449] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
755a8aa07f
commit
d6837060be
3 changed files with 39 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Oct 22 23:54:07 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/extmk.rb, lib/mkmf.rb (with_config): support --with-extension
|
||||
options. [ruby-dev:27449]
|
||||
|
||||
Sat Oct 22 14:25:43 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||
|
||||
* util.[hc] (ruby_add_suffix): constified.
|
||||
|
@ -25,7 +30,7 @@ Sat Oct 22 13:26:57 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|||
test/rss/test_trackback.rb, test/ruby/test_eval.rb,
|
||||
test/socket/test_socket.rb, test/socket/test_udp.rb:
|
||||
Object#fcall was renamed as Object#funcall.
|
||||
|
||||
|
||||
Sat Oct 22 10:08:28 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||
|
||||
* missing.h, missing/*.c: SUSv3 compatible strcasecmp and strncasecmp,
|
||||
|
|
15
ext/extmk.rb
15
ext/extmk.rb
|
@ -354,10 +354,25 @@ exts = $static_ext.sort_by {|t, i| i}.collect {|t, i| t}
|
|||
if $extension
|
||||
exts |= $extension.select {|d| File.directory?("#{ext_prefix}/#{d}")}
|
||||
else
|
||||
withes, withouts = %w[--with --without].collect {|w|
|
||||
if not (w = %w[-extensions -ext].collect {|opt|arg_config(w+opt)}).any?
|
||||
proc {false}
|
||||
elsif (w = w.grep(String)).empty?
|
||||
proc {true}
|
||||
else
|
||||
w.collect {|opt| opt.split(/,/)}.flatten.method(:any?)
|
||||
end
|
||||
}
|
||||
cond = proc {|ext|
|
||||
cond1 = proc {|n| File.fnmatch(n, ext, File::FNM_PATHNAME)}
|
||||
withes.call(&cond1) or !withouts.call(&cond1)
|
||||
}
|
||||
exts |= Dir.glob("#{ext_prefix}/*/**/extconf.rb").collect {|d|
|
||||
d = File.dirname(d)
|
||||
d.slice!(0, ext_prefix.length + 1)
|
||||
d
|
||||
}.find_all {|ext|
|
||||
with_config(ext, &cond)
|
||||
}.sort
|
||||
end
|
||||
|
||||
|
|
22
lib/mkmf.rb
22
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)
|
||||
|
|
Loading…
Reference in a new issue