diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/extmk.rb.in | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index a2f1a2cbf6..cebb115214 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -295,6 +295,25 @@ SRC return true end +def find_executable(bin, path = nil) + if path.nil? + path = ENV['PATH'].split(Config::CONFIG['PATH_SEPARATOR']) + else + path = path.split(Config::CONFIG['PATH_SEPARATOR']) + end + + bin += "@EXEEXT@" + for dir in path + file = File.join(dir, bin) + if FileTest.executable?(file) + return file + else + next + end + end + return nil +end + def arg_config(config, default=nil) unless defined? $configure_args $configure_args = {} |