2010-05-06 02:59:24 -04:00
|
|
|
require 'mkmf'
|
|
|
|
|
|
|
|
# :stopdoc:
|
|
|
|
|
|
|
|
dir_config 'libffi'
|
|
|
|
|
2010-06-15 12:43:46 -04:00
|
|
|
pkg_config("libffi")
|
|
|
|
unless have_header('ffi.h')
|
2010-05-06 02:59:24 -04:00
|
|
|
if have_header('ffi/ffi.h')
|
|
|
|
$defs.push(format('-DUSE_HEADER_HACKS'))
|
|
|
|
else
|
|
|
|
abort "ffi.h is missing. Please install libffi."
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-11-04 11:15:39 -04:00
|
|
|
unless have_library('ffi') || have_library('libffi')
|
2010-05-06 02:59:24 -04:00
|
|
|
abort "libffi is missing. Please install libffi."
|
|
|
|
end
|
|
|
|
|
|
|
|
have_header 'sys/mman.h'
|
|
|
|
|
2012-02-25 00:47:16 -05:00
|
|
|
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("-DTYPE_%s=TYPE_%s", signed||type, size)
|
|
|
|
end
|
|
|
|
if signed
|
|
|
|
check_signedness(type.downcase, "stddef.h")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-05-06 02:59:24 -04:00
|
|
|
create_makefile 'fiddle'
|
|
|
|
|
|
|
|
# :startdoc:
|