aboutsummaryrefslogtreecommitdiffstats
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
commit4857e1d30018e0fc7449af149449745410db01a6 (patch)
tree7c1225ba1433d5be04bf08046cd8142daec78bb1 /lib/mkmf.rb
parent759410a8c9c1aa222b2dfb1fd562b41aa6945b3b (diff)
downloadruby-4857e1d30018e0fc7449af149449745410db01a6.tar.gz
* 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/trunk@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 29675b2d5a..400d890aa2 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))