summaryrefslogtreecommitdiffstats
path: root/extconf.rb
diff options
context:
space:
mode:
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