From: Robert Feldt Date: 2000-11-08T20:13:15+09:00 Subject: [ruby-talk:6165] mkmf: Why not have_library(lib, [funcs])? Hi, Really minor question/proposal: Why can you only test that one func is available with have_library? Wouldn't it be nice to give an array of funcs (the ones you need in your extension)? You can do multiple calls to have_library but that will include the lib multiple times => doesn't look nice. Below is the simple patch. I'd appreciate if you have an opinion/comment. Regards, Robert *** mkmf.rb.orig Wed Nov 8 11:50:00 2000 --- mkmf.rb Wed Nov 8 12:10:15 2000 *************** *** 148,160 **** def append_library(libs, lib) if /mswin32/ =~ RUBY_PLATFORM ! lib + ".lib " + libs else ! "-l" + lib + " " + libs end end def have_library(lib, func="main") printf "checking for %s() in -l%s... ", func, lib STDOUT.flush --- 148,173 ---- def append_library(libs, lib) if /mswin32/ =~ RUBY_PLATFORM ! str_to_append = lib + ".lib " else ! str_to_append = "-l" + lib + " " ! end ! if libs.include?(str_to_append) ! libs ! else ! str_to_append + libs end end def have_library(lib, func="main") + if Array == func.type + func.each {|function| library_have_function(lib, function)} + else + library_have_function(lib, func) + end + end + + def library_have_function(lib, func="main") printf "checking for %s() in -l%s... ", func, lib STDOUT.flush *************** *** 195,200 **** --- 208,221 ---- end def find_library(lib, func, *paths) + if Array == func.type + func.each {|function| library_find_function(lib, function, paths)} + else + library_have_function(lib, func) + end + end + + def library_find_function(lib, func, *paths) printf "checking for %s() in -l%s... ", func, lib STDOUT.flush