summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/digest/sha1/extconf.rb1
-rw-r--r--ext/extmk.rb22
-rw-r--r--ext/io/wait/extconf.rb2
3 files changed, 16 insertions, 9 deletions
diff --git a/ext/digest/sha1/extconf.rb b/ext/digest/sha1/extconf.rb
index d5b7e06d9c..c249a415ed 100644
--- a/ext/digest/sha1/extconf.rb
+++ b/ext/digest/sha1/extconf.rb
@@ -12,7 +12,6 @@ dir_config("openssl")
if !with_config("bundled-sha1") &&
have_library("crypto") && have_header("openssl/sha.h")
$objs << "sha1ossl.#{$OBJEXT}"
- $libs << " -lcrypto"
else
$objs << "sha1.#{$OBJEXT}" << "sha1hl.#{$OBJEXT}"
end
diff --git a/ext/extmk.rb b/ext/extmk.rb
index 68274efde6..eb2a277600 100644
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -101,10 +101,12 @@ def extmake(target)
if $static
$extflags ||= ""
$extlibs ||= ""
- $extflags += " " + $DLDFLAGS if $DLDFLAGS
- $extflags += " " + $LDFLAGS unless $LDFLAGS == ""
- $extlibs += " " + $libs unless $libs == ""
- $extlibs += " " + $LOCAL_LIBS unless $LOCAL_LIBS == ""
+ $extpath ||= []
+ $extflags += " " + $DLDFLAGS unless $DLDFLAGS.empty?
+ $extflags += " " + $LDFLAGS unless $LDFLAGS.empty?
+ libs = ($libs.split+$LOCAL_LIBS.split).uniq
+ $extlibs = [$extlibs, *libs].join(" ") unless libs.empty?
+ $extpath |= $LIBPATH
end
ensure
Dir.chdir dir
@@ -212,7 +214,7 @@ File::makedirs('ext')
Dir::chdir('ext')
ext_prefix = "#{$top_srcdir}/ext"
-Dir.glob("#{ext_prefix}/**/MANIFEST") do |d|
+Dir.glob("#{ext_prefix}/*/**/MANIFEST") do |d|
d = File.dirname(d)
d.slice!(0, ext_prefix.length + 1)
extmake(d) or exit(1)
@@ -229,12 +231,16 @@ if $extlist.size > 0
for s,t,i in $extlist
f = format("%s/%s.%s", s, i, $LIBEXT)
if File.exist?(f)
- $extinit += "\tInit_#{i}();\n\trb_provide(\"#{t}.so\");\n"
+ $extinit += "\tinit(Init_#{i}, \"#{t}.so\");\n"
$extobjs += "ext/#{f} "
end
end
- src = "void Init_ext() {\n#$extinit}\n"
+ src = <<SRC
+extern char *ruby_sourcefile, *rb_source_filename();
+#define init(func, name) (ruby_sourcefile = src = rb_source_filename(name), func(), rb_provide(src))
+void Init_ext() {\n\tchar* src;\n#$extinit}
+SRC
if !modified?("extinit.c", MTIMES) || IO.read("extinit.c") != src
open("extinit.c", "w") {|f| f.print src}
end
@@ -243,6 +249,8 @@ if $extlist.size > 0
if RUBY_PLATFORM =~ /m68k-human|beos/
$extlibs.gsub!("-L/usr/local/lib", "") if $extlibs
end
+ $extpath.delete("$(topdir)")
+ $extflags = libpathflag($extpath) << " " << $extflags.strip
conf = [
['SETUP', $setup], ['EXTOBJS', $extobjs],
['EXTLIBS', $extlibs], ['EXTLDFLAGS', $extflags]
diff --git a/ext/io/wait/extconf.rb b/ext/io/wait/extconf.rb
index a766ccbe6f..ea7dc9f6cf 100644
--- a/ext/io/wait/extconf.rb
+++ b/ext/io/wait/extconf.rb
@@ -1,7 +1,7 @@
require 'mkmf'
target = "io/wait"
-unless /djgpp|mswin|mingw|human/ =~ RUBY_PLATFORM
+unless macro_defined?("DOSISH", "#include <ruby.h>")
fionread = %w[sys/ioctl.h sys/filio.h].find do |h|
checking_for("FIONREAD") {macro_defined?("FIONREAD", "#include <#{h}>\n")}
end