Sha256: 0a3e5e1a8f43026aadf6efc76d13d6600729e211ef0668d6f7ca4dd29fc7f013

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

#!/usr/bin/env ruby
require 'mkmf'
require 'rbconfig'
dir_config("ffi_c")
#IS_MAC = Config::CONFIG['host_os'] =~ /^darwin/
#if IS_MAC
#  $CPPFLAGS << " -DMACOSX"
#  find_header("ffi.h", "/usr/include/ffi")
#end
have_closure_alloc = have_library("ffi", "ffi_closure_alloc", [ "ffi.h" ])
$defs.push("-DHAVE_FFI_CLOSURE_ALLOC") if have_closure_alloc
libffi_ok = have_closure_alloc
$defs << "-DHAVE_LIBFFI" if libffi_ok
$defs << "-DHAVE_EXTCONF_H" if $defs.empty? # needed so create_header works

create_makefile("ffi_c")
create_header("extconf.h")
File.open("Makefile", "a") do |mf|
  mf.puts "CPPFLAGS += -Werror -Wunused -Wformat"
  unless libffi_ok 
    mf.puts "include $(srcdir)/ffi.mk"
    mf.puts "LIBFFI_HOST=--host=#{Config::CONFIG['host_alias']}" if Config::CONFIG.has_key?("host_alias")
    mf.puts "FFI_MMAP_EXEC=-DFFI_MMAP_EXEC_WRIT=#{Config::CONFIG['host_os'] =~ /win/ ? 0 : 1}"
    if Config::CONFIG['host_os'] =~ /darwin/
      mf.puts "include $(srcdir)/libffi.darwin.mk"
    else
      mf.puts "include $(srcdir)/libffi.mk"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ffi-0.3.1 ext/ffi_c/extconf.rb
ffi-0.3.0 ext/ffi_c/extconf.rb
ffi-0.3.3 ext/ffi_c/extconf.rb
ffi-0.3.2 ext/ffi_c/extconf.rb
ffi-0.3.5 ext/ffi_c/extconf.rb
ffi-0.3.4 ext/ffi_c/extconf.rb