summaryrefslogtreecommitdiff
path: root/lib/mkmf.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-22 14:37:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-22 14:37:02 +0000
commitf7205819901931c4693af22efabe2cbf2ab936cd (patch)
tree55b98de11e770a5efa3ad473401d4f4452ec554d /lib/mkmf.rb
parent3cd403df5daf9546778437d9980fc7567825861b (diff)
* 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
Diffstat (limited to 'lib/mkmf.rb')
-rw-r--r--lib/mkmf.rb11
1 files changed, 10 insertions, 1 deletions
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))