diff options
Diffstat (limited to 'extconf.rb')
-rw-r--r-- | extconf.rb | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -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} |