Merge @seratch's four PRs on build settings into 2.4.x branch

I did `git cherry-pick` my PRs (#423, #424, #425 and #426) and merged into 2.4.x branch. After merging this, please activate Travis CI when you have time.