summaryrefslogtreecommitdiffstats
path: root/lib
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
commitbf6c0d891bee7cda96fc800054c5fcfe6d11bffc (patch)
tree7c1225ba1433d5be04bf08046cd8142daec78bb1 /lib
parent84d371fdab00a84c1111b6a5724d5ed5dbba9348 (diff)
downloadruby-bf6c0d891bee7cda96fc800054c5fcfe6d11bffc.tar.gz
ruby-bf6c0d891bee7cda96fc800054c5fcfe6d11bffc.tar.xz
ruby-bf6c0d891bee7cda96fc800054c5fcfe6d11bffc.zip
* lib/mkmf.rb (find_executable0): default path if environment is not
set. [ruby-dev:27281] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/mkmf.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 29675b2d5..400d890aa 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))