aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2010-06-10 14:48:34 -0700
committerAdam Vandenberg2010-06-10 16:25:59 -0700
commit4d94667e297d8d36ae5dad5b2c76014f4f16c898 (patch)
tree59f10f596c9c0cec2bdcdc38a0c966e36bee5d6b /Library
parentba855c10b697408111453d58b24cdb02cef4b7f8 (diff)
downloadhomebrew-4d94667e297d8d36ae5dad5b2c76014f4f16c898.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.
Diffstat (limited to 'Library')
-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