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 | b0c36251a9853bd798fde975425cae50d574011a (patch) | |
tree | 55b98de11e770a5efa3ad473401d4f4452ec554d | |
parent | a13fa65fc7bf7c7f2b6a609dbbe1790b2d83ef65 (diff) | |
download | ruby-b0c36251a9853bd798fde975425cae50d574011a.tar.gz ruby-b0c36251a9853bd798fde975425cae50d574011a.tar.xz ruby-b0c36251a9853bd798fde975425cae50d574011a.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/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 3ddfced1d..013a67190 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)) |