Project

General

Profile

Bug #18000 » no-static-no-shared.diff

jeremyevans0 (Jeremy Evans), 08/12/2021 05:26 PM

View differences:

lib/mkmf.rb
# [+headers+] a String or an Array of strings which contains names of header
# files.
def try_func(func, libs, headers = nil, opt = "", &b)
_try_func(:try_link, func, libs, headers, opt, &b)
end
private def _try_func(try_method, func, libs, headers = nil, opt = "", &b)
headers = cpp_include(headers)
case func
when /^&/
......
else
opt = libs
end
decltype && try_link(<<"SRC", opt, &b) or
decltype && send(try_method, <<"SRC", opt, &b) or
#{headers}
/*top*/
extern int t(void);
#{MAIN_DOES_NOTHING 't'}
int t(void) { #{decltype["volatile p"]}; p = (#{decltype[]})#{func}; return !p; }
SRC
call && try_link(<<"SRC", opt, &b)
try_method == :try_link && call && try_link(<<"SRC", opt, &b)
#{headers}
/*top*/
extern int t(void);
......
#
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)
try_method = if RbConfig::CONFIG["LIBRUBYARG"].include?('-lruby')
:try_link
else
:try_compile
end
if _try_func(try_method, func, $libs, headers, opt, &b)
$defs << "-DHAVE_#{func.sans_arguments.tr_cpp}"
true
else
tool/mkconfig.rb
install_name = nil
so_name = nil
platform = nil
disable_install_static_library = nil
File.foreach "config.status" do |line|
next if /^#/ =~ line
name = nil
......
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
......
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]
(1-1/2)