aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Vandenberg2010-06-10 14:48:34 -0700
committerAdam Vandenberg2010-06-10 16:25:59 -0700
commit5462ec27b8b36a35dbf830bc4edcbb15e9bc91e1 (patch)
tree1aa0f185c79ccec115d6caab3942aaaf2b6e4049
parent1761ba66bfca0784d49de10bd684cc54d53fded8 (diff)
downloadbrew-5462ec27b8b36a35dbf830bc4edcbb15e9bc91e1.tar.bz2
Added check for stray 'config' scripts in $PATH.
If the user has, for instance, a non-system "xml2-config" in the path ahead of the system and Homebrew folders, ./configure scripts which look for and use this config script will get confused.
-rw-r--r--Library/Homebrew/brew_doctor.rb37
1 files changed, 36 insertions, 1 deletions
diff --git a/Library/Homebrew/brew_doctor.rb b/Library/Homebrew/brew_doctor.rb
index aca8caab7..7aa6c616d 100644
--- a/Library/Homebrew/brew_doctor.rb
+++ b/Library/Homebrew/brew_doctor.rb
@@ -225,13 +225,47 @@ def check_for_gettext
end
end
+def check_for_config_scripts
+ real_cellar = HOMEBREW_CELLAR.realpath
+
+ config_scripts = []
+
+ paths = ENV['PATH'].split(':').collect{|p| File.expand_path p}
+ paths.each do |p|
+ next if ['/usr/bin', '/usr/sbin', '/usr/X11/bin', "#{HOMEBREW_PREFIX}/bin", "#{HOMEBREW_PREFIX}/sbin"].include? p
+ next if %r[^(#{real_cellar.to_s}|#{HOMEBREW_CELLAR.to_s})] =~ p
+
+ configs = Dir["#{p}/*-config"]
+ # puts "#{p}\n #{configs * ' '}" unless configs.empty?
+ config_scripts << [p, configs.collect {|p| File.basename(p)}] unless configs.empty?
+ end
+
+ unless config_scripts.empty?
+ puts <<-EOS.undent
+ Some "config" scripts were found in your path, but not in system or Homebrew folders.
+
+ `./configure` scripts often look for *-config scripts to determine if software packages
+ are installed, and what additional flags to use when compiling and linking.
+
+ Having additional scripts in your path can confuse software installed via Homebrew if
+ the config script overrides a system or Homebrew provided script of the same name.
+
+ EOS
+
+ config_scripts.each do |pair|
+ puts pair[0]
+ puts " " + pair[1] * " "
+ end
+ end
+end
+
def brew_doctor
read, write = IO.pipe
if fork == nil
read.close
$stdout.reopen write
-
+
check_usr_bin_ruby
check_homebrew_prefix
check_for_stray_dylibs
@@ -243,6 +277,7 @@ def brew_doctor
check_which_pkg_config
check_pkg_config_paths
check_for_gettext
+ check_for_config_scripts
exit! 0
else