Xcode 4.2 dropped gcc, but ruby generally compiles just fine with clang. So I added multiple compiler support in order to add clang as a possible compiler, as a fallback to gcc. This way it is no longer necessary to install a third party gcc when one has Xcode 4.2.
To that end I added a require_cc stanza, while keeping the require_gcc one. Also, I updated two definitions to use require_cc (since those are the ones I use daily).
Possible improvement: the require_cc stanza could be updated to include a definition's supported compilers as arguments. require_gcc could e.g then theoretically become require_cc gcc if one cares less about the extra error message.
Multiple compiler support
Added clang as fallback for GCC if using require_cc, particularly
useful for Mac OS X and Xcode 4.2. require_gcc still mandates gcc.
Modified requirements for 1.8.7-p352 + 1.9.2-p290
Did not modify other definitions since I did not test them
for compatibility with clang.
My bad: 1.8.7 segfaults on gem inside timeout.rb when compiled with clang.
trunk still has issues with clang as well: http://redmine.ruby-lang.org/issues/5580
@lloeki I've tried your branch and it was able to detect the new LLVM compiler. I have XCode 4.2 without XCode 4.1. Thanks.
@prathe @lloeki Clang/LLVM still aren't safe for building MRI; see @jeremy's link above.
@sstephenson True, make test was failing on all ruby compilation I've tried with Clang for version 1.9.2 and older. I didn't get any error though while using them. Thanks for the warning.
@prathe do 1.9.3-p0 tests pass when using clang?
Anyway, e19dd34 is a bad idea to merge but I suppose a15aa7f could still be pulled since it simply provides alternate compiler support without forcing definitions to use it.
@lloeki No, 1.9.3-p0 didn't passes the tests.
@lloeki But the tests passed on the trunk (a5fc87bd5b)
9775 tests, 2208871 assertions, 0 failures, 0 errors, 46 skips
Probably still too soon but I am looking forward for this one to get merged.
+1 for merging this. Would prefer to use clang over legacy gcc.
Anyone interested in revisiting this? Needs an update for XCode 4.3/4.4 and should only allow clang on 1.9.3-p125 and later.
I think we're just going to rely on $CC here for Ruby versions that can be built with non-GCC compilers.