Skip to content

Commit 528a3a1

Browse files
committed
[ruby/fiddle] use ffi_closure_alloc only with 3.2 or later
1 parent 5bb80b7 commit 528a3a1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ext/fiddle/extconf.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@
114114

115115
if ver
116116
ver = ver.gsub(/-rc\d+/, '') # If ver contains rc version, just ignored.
117-
ver = (ver.split('.') + [0,0])[0,3]
117+
ver = (ver.split('.').map(&:to_i) + [0,0])[0,3]
118118
$defs.push(%{-DRUBY_LIBFFI_MODVERSION=#{ '%d%03d%03d' % ver }})
119+
$defs << "-DUSE_FFI_CLOSURE_ALLOC=1" if (ver <=> [3, 2]) >= 0
119120
end
120121

121122
have_header 'sys/mman.h'
@@ -153,9 +154,6 @@
153154
if libffi
154155
$LOCAL_LIBS.prepend("./#{libffi.a} ").strip! # to exts.mk
155156
$INCFLAGS.gsub!(/-I#{libffi.dir}/, '-I$(LIBFFI_DIR)')
156-
$defs << "-DUSE_FFI_CLOSURE_ALLOC=1"
157-
else
158-
have_func('ffi_closure_alloc', ffi_header)
159157
end
160158
$INCFLAGS << " -I$(top_srcdir)"
161159
create_makefile 'fiddle' do |conf|

0 commit comments

Comments
 (0)