diff options
Diffstat (limited to 'ext/dl/extconf.rb')
-rw-r--r-- | ext/dl/extconf.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/dl/extconf.rb b/ext/dl/extconf.rb index 6d4d6c5d51..4ef46f85fb 100644 --- a/ext/dl/extconf.rb +++ b/ext/dl/extconf.rb @@ -25,6 +25,19 @@ else end if check + config = File.read(RbConfig.expand(File.join($arch_hdrdir, "ruby/config.h"))) + types = {"SIZE_T"=>"SSIZE_T", "PTRDIFF_T"=>nil, "INTPTR_T"=>nil} + types.each do |type, signed| + if /^\#define\s+SIZEOF_#{type}\s+(SIZEOF_(.+)|\d+)/ =~ config + if size = $2 and size != 'VOIDP' + size = types.fetch(size) {size} + $defs << format("-DDLTYPE_%s=DLTYPE_%s", signed||type, size) + end + if signed + check_signedness(type.downcase, "stddef.h") + end + end + end $defs << %[-DRUBY_VERSION=\\"#{RUBY_VERSION}\\"] create_makefile("dl") end |