From f7205819901931c4693af22efabe2cbf2ab936cd Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 22 Sep 2005 14:37:02 +0000 Subject: * lib/mkmf.rb (find_executable0): default path if environment is not set. [ruby-dev:27281] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/mkmf.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 3ddfced1df..013a671906 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -762,8 +762,17 @@ def what_type?(type, member = nil, headers = nil, &b) end def find_executable0(bin, path = nil) - path = (path || ENV['PATH']).split(File::PATH_SEPARATOR) ext = config_string('EXEEXT') + if File.expand_path(bin) == bin + return bin if File.executable?(bin) + return file if ext and File.executable?(file = bin + ext) + return nil + end + if path ||= ENV['PATH'] + path = path.split(File::PATH_SEPARATOR) + else + path = %w[/usr/local/bin /usr/ucb /usr/bin /bin] + end file = nil path.each do |dir| return file if File.executable?(file = File.join(dir, bin)) -- cgit v1.2.3