1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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/trunk@8314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-04-13 10:25:41 +00:00
parent bea190a1fc
commit f091f36035
4 changed files with 90 additions and 11 deletions

View file

@ -1,3 +1,10 @@
Wed Apr 13 19:25:31 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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 19:30:36 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/optparse.rb (OptionParser#make_switch, OptionParser#order!):

View file

@ -169,6 +169,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 <stdio.h>],
[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*)
@ -1298,7 +1311,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'
@ -1429,7 +1442,7 @@ else
fi
case "$target_os" in
mingw*) sitearch="i386-msvcrt" ;;
mingw*) sitearch="i386-$rb_cv_msvcrt" ;;
*) sitearch="${arch}" ;;
esac

View file

@ -70,9 +70,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

View file

@ -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 <<rtname.c user32.lib > nul
#include <windows.h>
#include <memory.h>
#include <string.h>
#include <stddef.h>
#include <stdio.h>
#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).