The have_library method has a return value:
Returns whether the given func entry point was found inside lib .
So you have to do this:
$defs.push('-DUSE_RUBY_UUID') if !have_library('uuid') create_makefile("identifier")
And then configure your C to use libuuid if USE_RUBY_UUID not defined and is called into the Ruby UUID library if it is defined.
Oddly enough, have_header and have_func in mkmf.rb add macros for you:
# File mkmf.rb, line 840 def have_header(header, preheaders = nil, &b) checking_for header do if try_header(cpp_include(preheaders)+cpp_include(header), &b) $defs.push(format("-DHAVE_%s", header.tr_cpp)) true else false end end end
but have_library makes you do it yourself.
source share