Skip to content

Commit

Permalink
Fix detection of libffi on MacOS (or other OS with dodgy system libff…
Browse files Browse the repository at this point in the history
…i). Based on patch from Jeremy Hinegardner <jeremy@hinegardner.org>
  • Loading branch information
vp-of-awesome committed Dec 10, 2009
1 parent f1dc758 commit 31e65ab
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ext/ffi_c/extconf.rb
Expand Up @@ -4,13 +4,16 @@
dir_config("ffi_c")

unless Config::CONFIG['host_os'] =~ /mswin32|mingw32/
pkg_config("libffi") || find_header("ffi.h", "/usr/local/include", "/opt/local/include")
have_ffi_call = have_library("ffi", "ffi_call", [ "ffi.h" ])
have_prep_closure = have_func("ffi_prep_closure")
libffi_ok = have_ffi_call && have_prep_closure
$defs << "-DHAVE_LIBFFI" if libffi_ok
$defs << "-DHAVE_RAW_API" if have_func("ffi_raw_call") && have_func("ffi_prep_raw_closure")
if pkg_config("libffi") || find_header("ffi.h", "/usr/local/include", "/opt/local/include")

# We need at least ffi_call and ffi_prep_closure
libffi_ok = have_library("ffi", "ffi_call", [ "ffi.h" ]) && have_func("ffi_prep_closure")

# Check if the raw api is available.
$defs << "-DHAVE_RAW_API" if have_func("ffi_raw_call") && have_func("ffi_prep_raw_closure")
end
end

have_func('rb_thread_blocking_region')

$defs << "-DHAVE_EXTCONF_H" if $defs.empty? # needed so create_header works
Expand Down

0 comments on commit 31e65ab

Please sign in to comment.