Require both CFLAGS and LDFLAGS to be empty in order to skip.
In Fedora 20 I observed that installing ruby-lua-0.4.0 succeeded, but the compiled lua.so did not know to dynamically load the lua library. It was missing the -llua flag.
examining extconf.rb showed the when falling back to using pkg-config a result is skipped if both cf and ldf are empty. In Fedora 20 CFLAGS is empty, and that is not an error, while LDFLAGS has the missing libraries.
I thought the easiest change would be to make the or and and as you can see in the diff. If pkg-config has nothing to add to the compilation, try again. If it adds anything, assume it is correct and complete.
Confirm, experienced same problem, this will fix the issue.
Also it'll be good to raise "lua not found" message if no lua found in section "["lua", "lua5.1", "lua5.2"].any?"; like this:
found = ["lua", "lua5.1", "lua5.2"].any? do |l|
ldf = `#{ex} --libs #{l}`.chomp
cf = `#{ex} --cflags #{l}`.chomp
next false if ldf.empty? and cf.empty?
$LDFLAGS << " #{ldf}"
$CFLAGS << " #{cf}"
true
end
if !found
crash_lua_not_found()
end