2015-12-16 08:31:54 +03:00
|
|
|
# frozen_string_literal: false
|
2003-03-28 08:00:21 +03:00
|
|
|
require 'mkmf'
|
2008-02-09 11:51:26 +03:00
|
|
|
|
2017-12-14 07:40:15 +03:00
|
|
|
gemspec_name = gemspec_path = nil
|
|
|
|
unless ['', '../../'].any? {|dir|
|
|
|
|
gemspec_name = "#{dir}bigdecimal.gemspec"
|
|
|
|
gemspec_path = File.expand_path("../#{gemspec_name}", __FILE__)
|
|
|
|
File.file?(gemspec_path)
|
|
|
|
}
|
2017-12-13 18:28:30 +03:00
|
|
|
$stderr.puts "Unable to find bigdecimal.gemspec"
|
|
|
|
abort
|
|
|
|
end
|
|
|
|
|
|
|
|
bigdecimal_version =
|
|
|
|
IO.readlines(gemspec_path)
|
|
|
|
.grep(/\Abigdecimal_version\s+=\s+/)[0][/\'([\d\.]+)\'/, 1]
|
|
|
|
|
|
|
|
$defs << %Q[-DRUBY_BIGDECIMAL_VERSION=\\"#{bigdecimal_version}\\"]
|
|
|
|
|
2016-12-10 10:49:15 +03:00
|
|
|
alias __have_macro__ have_macro
|
|
|
|
|
2010-08-14 19:22:43 +04:00
|
|
|
have_func("labs", "stdlib.h")
|
|
|
|
have_func("llabs", "stdlib.h")
|
2016-12-10 10:49:15 +03:00
|
|
|
have_func("finite", "math.h")
|
|
|
|
have_func("isfinite", "math.h")
|
2010-08-14 19:22:43 +04:00
|
|
|
|
2015-01-29 17:34:43 +03:00
|
|
|
have_type("struct RRational", "ruby.h")
|
|
|
|
have_func("rb_rational_num", "ruby.h")
|
|
|
|
have_func("rb_rational_den", "ruby.h")
|
2016-12-10 10:49:15 +03:00
|
|
|
have_func("rb_array_const_ptr", "ruby.h")
|
|
|
|
have_func("rb_sym2str", "ruby.h")
|
|
|
|
|
2017-12-14 07:40:15 +03:00
|
|
|
create_makefile('bigdecimal') {|mf|
|
|
|
|
mf << "\nall:\n\nextconf.h: $(srcdir)/#{gemspec_name}\n"
|
|
|
|
}
|