From 7b5ea0ec2f6c4f016e14cf6b61544f9e58d07beb Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 30 Nov 2009 07:54:26 +0000 Subject: * 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 --- ChangeLog | 8 ++++++++ configure.in | 6 ++++++ dln.c | 2 +- lib/mkmf.rb | 10 +++++++--- win32/Makefile.sub | 3 +++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91ceb5fb74..cfeb9c79d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Mon Nov 30 16:54:22 2009 Nobuyoshi Nakada + + * 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 * parse.y (parser_yylex): suppress an extra error message after diff --git a/configure.in b/configure.in index 0552f02dbb..0c6f2fcde9 100644 --- a/configure.in +++ b/configure.in @@ -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 { diff --git a/dln.c b/dln.c index a5c7615df4..7409ce30e3 100644 --- a/dln.c +++ b/dln.c @@ -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; diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 7635b4b7a3..895bca0bee 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -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 diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 55651bc1ac..a27cfba707 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -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 -- cgit v1.2.3