Don't hardcode gcc; use BUILD_CONFIG[:cc]
Extract duplicated code for refactoring
Merge pull request #2395 from ryoqun/ffi-use-buildcfg

Don't hardcode gcc; use BUILD_CONFIG[:cc]