summaryrefslogtreecommitdiff
path: root/ext/bigdecimal/extconf.rb
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-02 05:21:54 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-02 05:21:54 +0000
commita0e438cd3c28d2eaf4efa18243d5b6edafa14d88 (patch)
treec8a0e8d7a8553034c2cc4957890ea48ad7277693 /ext/bigdecimal/extconf.rb
parent096d362939816b569b22ed3de87c06277ef4c3fb (diff)
Import bigdecimal-1.4.0.pre-20181130a
* https://github.com/ruby/bigdecimal/compare/74d25ef..v1.4.0.pre.20181130a git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal/extconf.rb')
-rw-r--r--ext/bigdecimal/extconf.rb38
1 files changed, 36 insertions, 2 deletions
diff --git a/ext/bigdecimal/extconf.rb b/ext/bigdecimal/extconf.rb
index e565da891a3..602c7d6162b 100644
--- a/ext/bigdecimal/extconf.rb
+++ b/ext/bigdecimal/extconf.rb
@@ -1,6 +1,10 @@
# frozen_string_literal: false
require 'mkmf'
+def windows_platform?
+ /cygwin|mingw|mswin/ === RUBY_PLATFORM
+end
+
gemspec_name = gemspec_path = nil
unless ['', '../../'].any? {|dir|
gemspec_name = "#{dir}bigdecimal.gemspec"
@@ -17,8 +21,6 @@ bigdecimal_version =
$defs << %Q[-DRUBY_BIGDECIMAL_VERSION=\\"#{bigdecimal_version}\\"]
-alias __have_macro__ have_macro
-
have_func("labs", "stdlib.h")
have_func("llabs", "stdlib.h")
have_func("finite", "math.h")
@@ -30,6 +32,38 @@ have_func("rb_rational_den", "ruby.h")
have_func("rb_array_const_ptr", "ruby.h")
have_func("rb_sym2str", "ruby.h")
+if windows_platform?
+ library_base_name = "ruby-bigdecimal"
+ case RUBY_PLATFORM
+ when /cygwin|mingw/
+ import_library_name = "libruby-bigdecimal.a"
+ when /mswin/
+ import_library_name = "bigdecimal-$(arch).lib"
+ end
+end
+
+checking_for(checking_message("Windows")) do
+ if windows_platform?
+ case RUBY_PLATFORM
+ when /cygwin|mingw/
+ $DLDFLAGS << " $(srcdir)/bigdecimal.def"
+ $DLDFLAGS << " -Wl,--out-implib=$(TARGET_SO_DIR)#{import_library_name}"
+ when /mswin/
+ $DLDFLAGS << " /DEF:$(srcdir)/bigdecimal.def"
+ end
+ $cleanfiles << import_library_name
+ true
+ else
+ false
+ end
+end
+
create_makefile('bigdecimal') {|mf|
mf << "\nall:\n\nextconf.h: $(srcdir)/#{gemspec_name}\n"
+ case RUBY_PLATFORM
+ when /mswin/
+ mf << "\nall:\n\tdir $(TARGET_SO_DIR)"
+ else
+ mf << "\nall:\n\tls $(TARGET_SO_DIR)"
+ end
}