Top Level Namespace

Defined Under Namespace

Modules: FFI

Instance Method Summary collapse

Instance Method Details

#system_libffi_usable?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'ext/ffi_c/extconf.rb', line 7

def system_libffi_usable?
  # We need pkg_config or ffi.h
  libffi_ok = pkg_config("libffi") ||
      have_header("ffi.h") ||
      find_header("ffi.h", "/usr/local/include", "/usr/include/ffi",
                  "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi",
                  "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi") ||
      (find_header("ffi.h", `xcrun --sdk macosx --show-sdk-path`.strip + "/usr/include/ffi") rescue false)

  # Ensure we can link to ffi_prep_closure_loc
  libffi_ok &&= have_library("ffi", "ffi_prep_closure_loc", [ "ffi.h" ]) ||
                have_library("libffi", "ffi_prep_closure_loc", [ "ffi.h" ]) ||
                have_library("libffi-8", "ffi_prep_closure_loc", [ "ffi.h" ])

  if RbConfig::CONFIG['host_os'] =~ /mswin/
    have_library('libffi_convenience')
    have_library('shlwapi')
  end

  libffi_ok
end