brew doctor - add check for /usr/bin/cc symlinks.

If you symlink /usr/bin/cc to llvm, then Homebrew's "fails_with_llvm"
checks are bypassed. So add a warning to "brew doctor".
This commit is contained in:
Adam Vandenberg 2010-08-09 21:06:33 -07:00
parent 80c090aaae
commit a62c16e77f

View File

@ -98,7 +98,7 @@ def check_gcc_versions
if gcc_42 == nil if gcc_42 == nil
puts <<-EOS.undent puts <<-EOS.undent
We couldn't detect gcc 4.2.x. Some formulas require this compiler. We couldn't detect gcc 4.2.x. Some formulae require this compiler.
EOS EOS
elsif gcc_42 < RECOMMENDED_GCC_42 elsif gcc_42 < RECOMMENDED_GCC_42
@ -111,7 +111,7 @@ def check_gcc_versions
if gcc_40 == nil if gcc_40 == nil
puts <<-EOS.undent puts <<-EOS.undent
We couldn't detect gcc 4.0.x. Some formulas require this compiler. We couldn't detect gcc 4.0.x. Some formulae require this compiler.
EOS EOS
elsif gcc_40 < RECOMMENDED_GCC_40 elsif gcc_40 < RECOMMENDED_GCC_40
@ -123,6 +123,21 @@ def check_gcc_versions
end end
end end
def check_cc_symlink
which_cc = Pathname.new('/usr/bin/cc').realpath.basename.to_s
if which_cc == "llvm-gcc-4.2"
puts <<-EOS.undent
You changed your cc to symlink to llvm.
This bypasses LLVM checks, and some formulae may mysteriously fail to work.
You may want to change /usr/bin/cc to point back at gcc.
To force Homebrew to use LLVM, you can set the "HOMEBREW_LLVM" environmental
variable, or pass "--use-lvm" to "brew install".
EOS
end
end
def __check_subdir_access base def __check_subdir_access base
target = HOMEBREW_PREFIX+base target = HOMEBREW_PREFIX+base
return unless target.exist? return unless target.exist?
@ -427,6 +442,7 @@ def brew_doctor
check_homebrew_prefix check_homebrew_prefix
check_for_stray_dylibs check_for_stray_dylibs
check_gcc_versions check_gcc_versions
check_cc_symlink
check_for_other_package_managers check_for_other_package_managers
check_for_x11 check_for_x11
check_for_nonstandard_x11 check_for_nonstandard_x11