summaryrefslogtreecommitdiff
path: root/ext/dl/extconf.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-25 05:47:16 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-25 05:47:16 +0000
commitb4288080e7d025729f88479c44ed054f65b30f60 (patch)
tree2f77c1a499dd3a53e17e22f99de797f6a5e9afb9 /ext/dl/extconf.rb
parentd9adb03dd902c1cf7e5fadc8320dccec0ef73139 (diff)
* ext/dl/dl.c (Init_dl): support intrinsic types, size_t, ptrdiff_t
and intptr_t. [ruby-core:42460][Feature #5992] * ext/fiddle/fiddle.c (Init_fiddle): ditto. * ext/dl/lib/dl/cparser.rb (DL::CParser#parse_ctype): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/extconf.rb')
-rw-r--r--ext/dl/extconf.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/dl/extconf.rb b/ext/dl/extconf.rb
index 6d4d6c5d517..4ef46f85fb1 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