pkg-config can be used in your extconf.rb to properly detect need libraries for compiling Ruby native extensions
Kouhei Sutou
gem "pkg-config", "~> 1.1.2"