diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-22 14:37:02 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-22 14:37:02 +0000 |
commit | f7205819901931c4693af22efabe2cbf2ab936cd (patch) | |
tree | 55b98de11e770a5efa3ad473401d4f4452ec554d | |
parent | 3cd403df5daf9546778437d9980fc7567825861b (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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/mkmf.rb | 11 |
2 files changed, 15 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Thu Sep 22 23:36:24 2005 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * lib/mkmf.rb (find_executable0): default path if environment is not + set. [ruby-dev:27281] + Thu Sep 22 16:33:12 2005 Shugo Maeda <shugo@ruby-lang.org> * test/readline/test_readline.rb (TestReadline::replace_stdio): 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)) |