* configure.in, win32/Makefile.sub (EXECUTABLE_EXTS): moved from

dln.c:dln_find_1().

* lib/mkmf.rb (def find_executable0): use EXECUTABLE_EXTS, not
  only EXEEXT.  [ruby-core:26821]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-11-30 07:54:26 +00:00
parent 9713d84b5b
commit 7b5ea0ec2f
5 changed files with 25 additions and 4 deletions

View File

@ -1,3 +1,11 @@
Mon Nov 30 16:54:22 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in, win32/Makefile.sub (EXECUTABLE_EXTS): moved from
dln.c:dln_find_1().
* lib/mkmf.rb (def find_executable0): use EXECUTABLE_EXTS, not
only EXEEXT. [ruby-core:26821]
Mon Nov 30 11:00:12 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (parser_yylex): suppress an extra error message after

View File

@ -2175,6 +2175,12 @@ fi
LDFLAGS="-L. $LDFLAGS"
AC_SUBST(ARCHFILE)
if test "$EXEEXT" = .exe; then
EXECUTABLE_EXTS='".exe",".com",".cmd",".bat"'
AC_DEFINE_UNQUOTED(EXECUTABLE_EXTS, $EXECUTABLE_EXTS)
AC_SUBST(EXECUTABLE_EXTS)
fi
dnl }
dnl build section {

2
dln.c
View File

@ -1552,7 +1552,7 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
size_t i, fspace;
#ifdef DOSISH
static const char extension[][5] = {
".exe", ".com", ".cmd", ".bat",
EXECUTABLE_EXTS,
};
size_t j;
int is_abs = 0, has_path = 0;

View File

@ -1123,10 +1123,12 @@ end
# Internal use only.
#
def find_executable0(bin, path = nil)
ext = config_string('EXEEXT')
exts = config_string('EXECUTABLE_EXTS') {|s| s.split} || config_string('EXEEXT') {|s| [s]}
if File.expand_path(bin) == bin
return bin if File.executable?(bin)
ext and File.executable?(file = bin + ext) and return file
if exts
exts.each {|ext| File.executable?(file = bin + ext) and return file}
end
return nil
end
if path ||= ENV['PATH']
@ -1137,7 +1139,9 @@ def find_executable0(bin, path = nil)
file = nil
path.each do |dir|
return file if File.executable?(file = File.join(dir, bin))
return file if ext and File.executable?(file << ext)
if exts
exts.each {|ext| File.executable?(ext = file + ext) and return ext}
end
end
nil
end

View File

@ -242,6 +242,7 @@ LIBRUBY_LDSHARED = $(LDSHARED)
LIBRUBY_DLDFLAGS = $(EXTLDFLAGS) -implib:dummy.lib -def:$(RUBYDEF)
EXEEXT = .exe
EXECUTABLE_EXTS = ".exe",".com",".cmd",".bat"
!if !defined(PROGRAM)
PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
!endif
@ -563,6 +564,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
#define DEFAULT_KCODE KCODE_NONE
#define LOAD_RELATIVE 1
#define DLEXT ".so"
#define EXECUTABLE_EXTS $(EXECUTABLE_EXTS)
#define RUBY_LIB_VERSION_STYLE 3 /* full */
#define RUBY_LIB_PREFIX "/lib/$(RUBY_BASE_NAME)"
#define RUBY_LIB RUBY_LIB_PREFIX"/"RUBY_LIB_VERSION
@ -662,6 +664,7 @@ s,@LIBOBJS@,$(LIBOBJS),;t t
s,@ALLOCA@,$(ALLOCA),;t t
s,@DEFAULT_KCODE@,$(DEFAULT_KCODE),;t t
s,@EXEEXT@,.exe,;t t
s,@EXECUTABLE_EXTS@,$(EXECUTABLE_EXTS),;t t
s,@OBJEXT@,$(OBJEXT),;t t
s,@XCFLAGS@,$(XCFLAGS),;t t
s,@XLDFLAGS@,$(XLDFLAGS),;t t