Fix Xcode 4.2 cc compiles

It seems like latest build of Xcode 4.2 doesn't create "-4.2" links in /usr/bin. Because of this recipes fail with "configure: error: C compiler cannot create executables" error.

Closes Homebrew/homebrew#7254.
Closes Homebrew/homebrew#7276.

Signed-off-by: Max Howell <max@methylblue.com>

Amended to work as intended, since /usr/bin/cc is actually since Xcode 4.

Amended commit message. First line must be less than 72 characters! :P
This commit is contained in:
Eugene Ray 2011-08-28 12:11:46 -07:00 committed by Max Howell
parent 27fd2d7a70
commit b6fa7ebcca

View File

@ -127,6 +127,10 @@ module HomebrewEnvExtension
if MacOS.xcode_version < '4'
self['CC'] = '/usr/bin/cc'
self['CXX'] = '/usr/bin/c++'
elsif MacOS.xcode_version >= '4.2'
# Apple stopped adding the -4.2 suffixes
self['CC'] = "#{MacOS.xcode_prefix}/usr/bin/gcc"
self['CXX'] = "#{MacOS.xcode_prefix}/usr/bin/g++"
else
# With Xcode4 cc, c++, gcc and g++ are actually symlinks to llvm-gcc
self['CC'] = "#{MacOS.xcode_prefix}/usr/bin/gcc-4.2"