Use mkmf from latest ruby head:

http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/mkmf.rb?view=markup&pathrev=40283

to fix dir_config's lack of parsing --with-*-dir options.