diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 04b5f26a5e..f4dc191d76 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -1089,7 +1089,12 @@ def find_library(lib, func, *paths, &b) # def have_func(func, headers = nil, opt = "", &b) checking_for checking_message(func.funcall_style, headers, opt) do - if try_func(func, $libs, headers, opt, &b) + if func.start_with?('rb_') && !RbConfig::CONFIG["LIBRUBYARG"].include?('-lruby') + # HACK: Assume calling to check for methods that are already defined. + # Cannot test as there is no libruby to link against. + $defs << "-DHAVE_#{func.sans_arguments.tr_cpp}" + true + elsif try_func(func, $libs, headers, opt, &b) $defs << "-DHAVE_#{func.sans_arguments.tr_cpp}" true else diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb index 6db60724e9..297fd690fa 100755 --- a/tool/mkconfig.rb +++ b/tool/mkconfig.rb @@ -30,6 +30,7 @@ install_name = nil so_name = nil platform = nil +disable_install_static_library = nil File.foreach "config.status" do |line| next if /^#/ =~ line name = nil @@ -110,6 +111,9 @@ eq = win32 && vars[name] ? '<< "\n"' : '=' vars[name] = val if name == "configure_args" + if val.include?('--disable-install-static-library') + disable_install_static_library = true + end val.gsub!(/--with-out-ext/, "--without-ext") end val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump @@ -126,6 +130,10 @@ end when /^includedir$/ val = '"$(SDKROOT)"'+val if /darwin/ =~ arch + when /^LIBRUBYARG_STATIC$/ + if disable_install_static_library + val.sub!('-l$(RUBY_SO_NAME)-static ', '') + end end v = " CONFIG[\"#{name}\"] #{eq} #{val}\n" if fast[name]