From ce557d0508a59c1bc6716ab727160f19c5e2e2d2 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 13 Apr 2005 11:24:44 +0000 Subject: [PATCH] * configure.in (mingw32): use actual runtime DLL name as ruby DLL name and default load path. * win32/Makefile.sub, win32/setup.mak: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 25 ++++++++++------ configure.in | 17 +++++++++-- win32/Makefile.sub | 6 ++-- win32/setup.mak | 71 +++++++++++++++++++++++++++++++++++++++++----- 4 files changed, 99 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index f404d28dbd..23e62bd7ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,19 @@ +Wed Apr 13 20:24:30 2005 Nobuyoshi Nakada + + * configure.in (mingw32): use actual runtime DLL name as ruby DLL + name and default load path. + + * win32/Makefile.sub, win32/setup.mak: ditto. + Tue Apr 12 15:33:09 2005 Hidetoshi NAGAI - * ext/tcltklib/tcltklib.c (ip_finalize): better modification than the + * ext/tcltklib/tcltklib.c (ip_finalize): better modification than the previous commit [ruby-dev:26029]. Tue Apr 12 12:38:06 2005 Hidetoshi NAGAI * ext/tcltklib/tcltklib.c (ip_finalize): fix SEGV when Tcl_GlobalEval() - modifies the argument string to eval. + modifies the argument string to eval. Tue Apr 12 02:21:55 2005 Hidetoshi NAGAI @@ -15,10 +22,10 @@ Tue Apr 12 02:21:55 2005 Hidetoshi NAGAI Mon Apr 11 23:47:21 2005 Masatoshi SEKI - * lib/drb/drb.r: [druby-ja:123] fix: When reference of my object is - loaded, the object is tainted. + * lib/drb/drb.r: [druby-ja:123] fix: When reference of my object is + loaded, the object is tainted. - * test/drb/test_drb.rb: ditto. + * test/drb/test_drb.rb: ditto. Mon Apr 11 22:18:23 2005 WATANABE Hirofumi @@ -26,7 +33,7 @@ Mon Apr 11 22:18:23 2005 WATANABE Hirofumi Mon Apr 11 20:11:06 2005 Hidetoshi NAGAI - * ext/tcltklib/tcltklib.c (ip_finalize): adhoc patch to avoid SEGV + * ext/tcltklib/tcltklib.c (ip_finalize): adhoc patch to avoid SEGV when exit on Tcl/Tk8.3.x. Mon Apr 11 15:26:25 2005 NAKAMURA Usaku @@ -45,7 +52,7 @@ Sun Apr 10 10:12:42 2005 Masaki Suketa * ext/win32ole/win32ole.c(ole_invoke): retry after converting Qnil to VT_EMPTY. - * ext/win32ole/win32ole/tests/testWIN32OLE.rb: correct error + * ext/win32ole/win32ole/tests/testWIN32OLE.rb: correct error message string "Unknown" => "unknown". Sat Apr 9 18:20:31 2005 Hidetoshi NAGAI @@ -102,13 +109,13 @@ Sat Apr 9 11:59:57 2005 Kouhei Sutou * lib/rss/parser.rb: added class name registry for complex model elements. (ex. have childlen elements, have some attributes and a child element and so on.) - + * lib/rss/dublincore.rb: supported multiple Dublin Core items. * lib/rss/maker/dublincore.rb: ditto. * lib/rss/maker/image.rb: supproted new Dublin Core API. - + * lib/rss/maker/base.rb: added default current_element implementation. diff --git a/configure.in b/configure.in index 2d19328c48..99bed3096f 100644 --- a/configure.in +++ b/configure.in @@ -174,6 +174,19 @@ cygwin*|mingw*) AC_CHECK_TOOL(WINDRES, windres) AC_CHECK_TOOL(DLLWRAP, dllwrap) target_cpu=`echo $target_cpu | sed s/i.86/i386/` + case "$target_os" in + mingw*) + test "$rb_cv_msvcrt" = "" && unset rb_cv_msvcrt + AC_CHECK_TOOL(OBJDUMP, objdump) + AC_CACHE_CHECK(for mingw32 runtime DLL, rb_cv_msvcrt, [ + AC_TRY_LINK([#include ], + [FILE* volatile f = stdin; return 0;], + [rb_cv_msvcrt=`$OBJDUMP -p conftest$ac_exeext | + sed -n '/^[[ ]]*DLL Name: /{s///p;q;}' | + tr A-Z a-z | sed 's/\.dll$//'`], + [rb_cv_msvcrt=msvcrt])]) + test "$rb_cv_msvcrt" = "" && AC_MSG_ERROR([must be linked to DLL]) + esac : ${enable_shared=yes} ;; aix*) @@ -1318,7 +1331,7 @@ case "$target_os" in AC_LIBOBJ([strftime]) ;; mingw*) - RUBY_SO_NAME=msvcrt-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR} + RUBY_SO_NAME=${rb_cv_msvcrt}-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR} if test x"$enable_shared" = xyes; then LIBRUBY_SO='$(RUBY_SO_NAME)'.dll LIBRUBY='lib$(LIBRUBY_SO).a' @@ -1449,7 +1462,7 @@ else fi case "$target_os" in - mingw*) sitearch="i386-msvcrt" ;; + mingw*) sitearch="i386-$rb_cv_msvcrt" ;; *) sitearch="${arch}" ;; esac diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 3af99a14ed..bb99e88a08 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -69,9 +69,11 @@ DEBUGFLAGS = -Zi !if !defined(OPTFLAGS) OPTFLAGS = -O2b2xg- !endif -!if !defined(OS) || !defined(RT) +!if !defined(OS) OS = mswin32 -RT = msvcrt +!endif +!if !defined(RT) +!error RT not defined. Retry from configure pass. !endif !ifndef RUBY_SO_NAME diff --git a/win32/setup.mak b/win32/setup.mak index fa0c260001..a8ba23586e 100644 --- a/win32/setup.mak +++ b/win32/setup.mak @@ -13,8 +13,7 @@ srcdir = $(WIN32DIR)/.. prefix = /usr !endif OS = mswin32 -RT = msvcrt -INCLUDE = !include +BANG = ! APPEND = echo>>$(MAKEFILE) !ifdef MAKEFILE MAKE = $(MAKE) -f $(MAKEFILE) @@ -23,7 +22,8 @@ MAKEFILE = Makefile !endif ARCH = PROCESSOR_ARCHITECTURE CPU = PROCESSOR_LEVEL -CPP = cl -nologo -EP +CC = cl -nologo +CPP = $(CC) -EP all: -prologue- -generic- -epilogue- i386-$(OS): -prologue- -i386- -epilogue- @@ -32,7 +32,9 @@ i586-$(OS): -prologue- -i586- -epilogue- i686-$(OS): -prologue- -i686- -epilogue- alpha-$(OS): -prologue- -alpha- -epilogue- --prologue-: nul +-prologue-: -basic-vars- -system-vars- -version- + +-basic-vars-: nul @type << > $(MAKEFILE) ### Makefile for ruby $(OS) ### srcdir = $(srcdir:\=/) @@ -42,7 +44,63 @@ EXTSTATIC = $(EXTSTATIC) RDOCTARGET = $(RDOCTARGET) !endif << - @$(CPP) -I$(srcdir) -DRUBY_EXTERN="//" <<"Creating $(MAKEFILE)" >> $(MAKEFILE) + +-system-vars-: -osname- -runtime- + +-osname-: nul + @echo OS = mswin32 >>$(MAKEFILE) + +-runtime-: nul + @$(CC) -MD < nul +#include +#include +#include +#include +#include +#ifndef MAXPATHLEN +# define MAXPATHLEN 1024 +#endif + +int +runtime_name() +{ + char libpath[MAXPATHLEN+1]; + char *p, *base = NULL; + HMODULE msvcrt = NULL; + MEMORY_BASIC_INFORMATION m; + + memset(&m, 0, sizeof(m)); + if (VirtualQuery(stdin, &m, sizeof(m)) && m.State == MEM_COMMIT) + msvcrt = (HMODULE)m.AllocationBase; + GetModuleFileName(msvcrt, libpath, sizeof libpath); + + libpath[sizeof(libpath) - 1] = '\0'; + for (p = libpath; *p; p = CharNext(p)) { + if (*p == '\\') { + base = ++p; + } + } + if (!base) return 0; + if (p = strchr(base, '.')) *p = '\0'; + for (p = base; *p; p = CharNext(p)) { + if (isascii(*p) && isupper(*p)) + *p = tolower(*p); + } + printf("RT = %s\n", base); + return 1; +} + +int main(int argc, char **argv) +{ + if (!runtime_name()) return EXIT_FAILURE; + return EXIT_SUCCESS; +} +<< + @.\rtname >>$(MAKEFILE) + @del rtname.* + +-version-: nul + @$(CPP) -I$(srcdir) -DRUBY_EXTERN="//" <<"Creating $(MAKEFILE)" | findstr /v /r ^^$$ >>$(MAKEFILE) #include "version.h" MAJOR = RUBY_VERSION_MAJOR MINOR = RUBY_VERSION_MINOR @@ -79,7 +137,6 @@ $(CPU) = $(PROCESSOR_LEVEL) -epilogue-: nul @type << >>$(MAKEFILE) # OS = $(OS) -# RT = $(RT) # RUBY_INSTALL_NAME = ruby # RUBY_SO_NAME = $$(RT)-$$(RUBY_INSTALL_NAME)$$(MAJOR)$$(MINOR) # CFLAGS = -nologo -MD $$(DEBUGFLAGS) $$(OPTFLAGS) $$(PROCESSOR_FLAG) @@ -90,7 +147,7 @@ $(CPU) = $(PROCESSOR_LEVEL) # RFLAGS = -r # EXTLIBS = -$(INCLUDE) $$(srcdir)/win32/Makefile.sub +$(BANG)include $$(srcdir)/win32/Makefile.sub << @$(srcdir:/=\)\win32\rm.bat config.h config.status @echo type `$(MAKE)' to make ruby for $(OS).