pkg-config can be used in your extconf.rb to properly detect need libraries for compiling Ruby native extensions.