class Object

Public Instance Methods

have_const(const, headers = nil, opt = "", &b) click to toggle source
# File ext/libvirt/extconf.rb, line 28
def have_const(const, headers = nil, opt = "", &b)
  checking_for libvirt_checking_message(const, headers, opt) do
    headers = cpp_include(headers)
    if try_compile("#{COMMON_HEADERS}
#{headers}
/*top*/
static int t = #{const};
", opt, &b)
      $defs.push(format("-DHAVE_CONST_%s", const.strip.upcase.tr_s("^A-Z0-9_", "_")))
      true
    else
      false
    end
  end
end
have_libvirt_consts(consts) click to toggle source
# File ext/libvirt/extconf.rb, line 45
def have_libvirt_consts(consts)
  consts.each { |c| have_const(c, ["libvirt/libvirt.h", "libvirt/virterror.h"]) }
end
have_libvirt_funcs(funcs) click to toggle source
# File ext/libvirt/extconf.rb, line 5
def have_libvirt_funcs(funcs)
    funcs.each { |f| have_func(f, "libvirt/libvirt.h") }
end
have_libvirt_types(types) click to toggle source
# File ext/libvirt/extconf.rb, line 9
def have_libvirt_types(types)
    types.each { |t| have_type(t, "libvirt/libvirt.h") }
end
libvirt_checking_message(target, place = nil, opt = nil) click to toggle source

older mkmf does not have checking_message, so implement our own here

# File ext/libvirt/extconf.rb, line 14
def libvirt_checking_message(target, place = nil, opt = nil)
  [["in", place], ["with", opt]].inject("#{target}") do |msg, (pre, noun)|
    if noun
      [[:to_str], [:join, ","], [:to_s]].each do |meth, *args|
        if noun.respond_to?(meth)
          break noun = noun.send(meth, *args)
        end
      end
      msg << " #{pre} #{noun}" unless noun.empty?
    end
    msg
  end
end