summaryrefslogtreecommitdiffstats
path: root/extconf.rb
diff options
context:
space:
mode:
authorguy Decoux <ts@moulon.inra.fr>2009-02-28 20:15:40 +0100
committerguy Decoux <ts@moulon.inra.fr>2009-02-28 20:15:40 +0100
commit008da6a1b8c7bd7712d226754198a0600c1441a5 (patch)
treec7774d7bda5a182df27372e9cd2855dc98f9905d /extconf.rb
parent9bb068fbdccc014512a4971afce2e7ca85154f0a (diff)
downloadmmap-ruby-008da6a1b8c7bd7712d226754198a0600c1441a5.zip
mmap-ruby-008da6a1b8c7bd7712d226754198a0600c1441a5.tar.gz
mmap-0.2.2
Diffstat (limited to 'extconf.rb')
-rw-r--r--extconf.rb26
1 files changed, 14 insertions, 12 deletions
diff --git a/extconf.rb b/extconf.rb
index 5f2e6ce..79bcfae 100644
--- a/extconf.rb
+++ b/extconf.rb
@@ -3,16 +3,14 @@ ARGV.collect! {|x| x.sub(/^--with-mmap-prefix=/, "--with-mmap-dir=") }
require 'mkmf'
-
-def resolve(key)
- name = key.dup
- true while name.gsub!(/\$\((\w+)\)/) { CONFIG[$1] }
- name
-end
-
-if ! find_library(resolve(CONFIG["LIBRUBY"]).sub(/^lib(.*)\.\w+\z/, '\\1'),
- "ruby_init", resolve(CONFIG["archdir"]))
- raise "can't find -lruby"
+if unknown = enable_config("unknown")
+ libs = if CONFIG.key?("LIBRUBYARG_STATIC")
+ Config::expand(CONFIG["LIBRUBYARG_STATIC"].dup).sub(/^-l/, '')
+ else
+ Config::expand(CONFIG["LIBRUBYARG"].dup).sub(/^lib([^.]*).*/, '\\1')
+ end
+ unknown = find_library(libs, "ruby_init",
+ Config::expand(CONFIG["archdir"].dup))
end
dir_config("mmap")
@@ -27,13 +25,17 @@ begin
next if FileTest.directory?(x)
make.print "\truby tests/#{x}\n"
end
- make.print <<-EOT
+ if unknown
+ make.print <<-EOT
unknown: $(DLLIB)
\t@echo "main() {}" > /tmp/a.c
-\t$(CC) -static /tmp/a.c $(OBJS) $(CPPFLAGS) $(DLDFLAGS) #{CONFIG["LIBS"]} $(LIBS) $(LOCAL_LIBS)
+\t$(CC) -static /tmp/a.c $(OBJS) $(CPPFLAGS) $(LIBPATH) $(LIBS) $(LOCAL_LIBS)
\t@-rm /tmp/a.c a.out
+EOT
+ end
+ make.print <<-EOT
%.html: %.rd
\trd2 $< > ${<:%.rd=%.html}