summaryrefslogtreecommitdiffstats
path: root/extconf.rb
diff options
context:
space:
mode:
authorguy Decoux <ts@moulon.inra.fr>2009-02-28 20:14:19 +0100
committerguy Decoux <ts@moulon.inra.fr>2009-02-28 20:14:19 +0100
commit9bb068fbdccc014512a4971afce2e7ca85154f0a (patch)
tree3268701ad21ef902d3ee028d37da2c2f57b1cdff /extconf.rb
parent74b85a22dbbea2dbb74e0e94c996178814eced59 (diff)
downloadmmap-ruby-9bb068fbdccc014512a4971afce2e7ca85154f0a.zip
mmap-ruby-9bb068fbdccc014512a4971afce2e7ca85154f0a.tar.gz
mmap-0.2.1
Diffstat (limited to 'extconf.rb')
-rw-r--r--extconf.rb27
1 files changed, 18 insertions, 9 deletions
diff --git a/extconf.rb b/extconf.rb
index 78d9bd8..5f2e6ce 100644
--- a/extconf.rb
+++ b/extconf.rb
@@ -1,12 +1,21 @@
-require "mkmf"
+#!/usr/bin/ruby
+ARGV.collect! {|x| x.sub(/^--with-mmap-prefix=/, "--with-mmap-dir=") }
-$stat_lib = if CONFIG.key?("LIBRUBYARG_STATIC")
- $LDFLAGS += " -L#{CONFIG['libdir']}"
- CONFIG["LIBRUBYARG_STATIC"]
- else
- "-lruby"
- end
-$static ||= nil
+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"
+end
+
+dir_config("mmap")
create_makefile "mmap"
@@ -22,7 +31,7 @@ begin
unknown: $(DLLIB)
\t@echo "main() {}" > /tmp/a.c
-\t$(CC) -static /tmp/a.c $(OBJS) $(CPPFLAGS) $(DLDFLAGS) #$stat_lib #{CONFIG["LIBS"]} $(LIBS) $(LOCAL_LIBS)
+\t$(CC) -static /tmp/a.c $(OBJS) $(CPPFLAGS) $(DLDFLAGS) #{CONFIG["LIBS"]} $(LIBS) $(LOCAL_LIBS)
\t@-rm /tmp/a.c a.out
%.html: %.rd