diff --git a/ChangeLog b/ChangeLog index beec695847..44f6fcef5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jan 21 13:51:21 2013 Nobuyoshi Nakada + + * lib/mkmf.rb ($extmk): traverse parent directories for the case + srcdir is a symlink. + Sun Jan 20 23:55:37 2013 Nobuyoshi Nakada * marshal.c (w_object, r_object0): separate respond_to checks and diff --git a/lib/mkmf.rb b/lib/mkmf.rb index e54f6113c5..7f7d13627f 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -199,9 +199,14 @@ module MakeMakefile topdir = File.dirname(File.dirname(__FILE__)) path = File.expand_path($0) - $extmk = path[0, topdir.size+1] == topdir+"/" - $extmk &&= %r"\A(?:ext|enc|tool|test(?:/.+)?)\z" =~ File.dirname(path[topdir.size+1..-1]) - $extmk &&= true + until (dir = File.dirname(path)) == path + if File.identical?(dir, topdir) + $extmk = true if %r"\A(?:ext|enc|tool|test)\z" =~ File.basename(path) + break + end + path = dir + end + $extmk ||= false if not $extmk and File.exist?(RbConfig::CONFIG["rubyhdrdir"] + "/ruby/ruby.h") $hdrdir = CONFIG["rubyhdrdir"] $topdir = $hdrdir