Top Level Namespace

Defined Under Namespace

Modules: Digest

Instance Method Summary collapse

Instance Method Details

#check_supported_flags(flags, obj_if_enabled, def_if_disabled) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'ext/digest/blake3/extconf.rb', line 24

def check_supported_flags(flags, obj_if_enabled, def_if_disabled)
  # run an arbitrary compilation test to see if these flags work; unfortunately there's no documented
  # mkmf method to do that, but all the have_ methods accept optional flags, so we use have_header.
  if have_header("blake3.h", nil, flags)
    # we have to explicitly add a compilation rule for the object file to inject the additional flags -
    # apart from the #{flags} subsitution, this is otherwise just what mkmf.rb puts in the .c.o rule.
    $confs << "#{obj_if_enabled}: #{obj_if_enabled[0..-2]}c\n\t$(ECHO) compiling $(<)\n\t$(Q) #{COMPILE_C.sub "$(CC)", "$(CC) #{flags}"}\n\n"
    $objs << obj_if_enabled
  else
    $defs << def_if_disabled
  end
end