a tweaked version of:
authorDouglas Lankshear <doug@lankshear.net>
Wed, 17 Jun 1998 20:25:51 +0000 (13:25 -0700)
committerGurusamy Sarathy <gsar@cpan.org>
Sun, 21 Jun 1998 00:43:06 +0000 (00:43 +0000)
Subject: [PATCH 5.004_67] Win32 using PerlCRT.dll
Message-ID: <001b01bd9a68$cb752410$a32fa8c0@tau.Active>

p4raw-id: //depot/perl@1170

lib/ExtUtils/MM_Win32.pm
win32/Makefile
win32/makefile.mk

index fd4b28d..7ec474e 100644 (file)
@@ -163,12 +163,12 @@ sub init_others
   {
    $self->{'LDLOADLIBS'}
       ||= ( $BORLAND
-            ? 'import32.lib cw32mti.lib '
+            ? 'import32.lib'
             : # compiler adds msvcrtd?.lib according to debug switches
                'oldnames.lib kernel32.lib comdlg32.lib winspool.lib gdi32.lib '
              .'advapi32.lib user32.lib shell32.lib netapi32.lib ole32.lib '
-             .'oleaut32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib '
-       ) . ' odbc32.lib odbccp32.lib';
+             .'oleaut32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib'
+       ) . ' $(LIBC) odbc32.lib odbccp32.lib';
   }
  $self->{'DEV_NULL'} = '> NUL';
  # $self->{'NOECHO'} = ''; # till we have it working
index 60eda26..a38e2d9 100644 (file)
@@ -1,17 +1,22 @@
-# Makefile to build perl on Windowns NT using Microsoft NMAKE.
-# Works with MS command line compilers from VC++ etc.
+#
+# Makefile to build perl on Windows NT using Microsoft NMAKE.
 #
 # This is set up to build a perl.exe that runs off a shared library
 # (perl.dll).  Also makes individual DLLs for the XS extensions.
-# NB: Miniperl has a different set of objects it depends on than
-# perl.exe
-# Also, Miniperl will not build with -DPERL_OBJECT defined
+#
+
+##
+## Build configuration.  Edit the values below to suit your needs.
+##
+
 #
 # Set these to wherever you want "nmake install" to put your
 # newly built perl.
+#
 INST_DRV       = c:
 INST_TOP       = $(INST_DRV)\perl
 
+#
 # Comment this out if you DON'T want your perl installation to be versioned.
 # This means that the new installation will overwrite any files from the
 # old installation at the same INST_TOP location.  Leaving it enabled is
@@ -19,35 +24,49 @@ INST_TOP    = $(INST_DRV)\perl
 # locations it installs files to.  If you disable it, an alternative
 # versioned installation can be obtained by setting INST_TOP above to a
 # path that includes an arbitrary version string.
+#
 INST_VER       = \5.00467
 
 #
 # uncomment to enable threads-capabilities
+#
 #USE_THREADS   = define
 
 #
 # uncomment next line if you are using Visual C++ 2.x
+#
 #CCTYPE                = MSVC20
 
 #
 # uncomment next line if you want to use the perl object
 # Currently, this cannot be enabled if you ask for threads above
+#
 #OBJECT                = -DPERL_OBJECT
 
 #
 # uncomment next line if you want debug version of perl (big,slow)
+#
 #CFG           = Debug
 
 #
+# uncomment to enable use of PerlCRT.DLL.  Highly recommended.  It has
+# patches that fix known bugs in MSCVRT.DLL.  You will need to download it
+# from: <TBD> and follow the directions in the package to install.
+#
+#USE_PERLCRT   = define
+
+#
 # if you have the source for des_fcrypt(), uncomment this and make sure the
 # file exists (see README.win32).  File should be located at the perl
 # top level directory.
+#
 #CRYPT_SRC     = des_fcrypt.c
 
 #
 # if you didn't set CRYPT_SRC and if you have des_fcrypt() available in a
 # library, uncomment this, and make sure the library exists (see README.win32)
 # Specify the full pathname of the library.
+#
 #CRYPT_LIB     = des_fcrypt.lib
 
 #
@@ -56,6 +75,7 @@ INST_VER      = \5.00467
 # you may have compiled with/without it.  Be prepared to recompile all extensions
 # if you change the default.  Currently, this cannot be enabled if you ask for
 # PERL_OBJECT above.
+#
 #PERL_MALLOC   = define
 
 #
@@ -74,8 +94,13 @@ EXTRALIBDIRS =
 #
 # set this to your email address (perl will guess a value from
 # from your loginname and your hostname, which may not be right)
+#
 #EMAIL         = 
 
+##
+## Build configuration ends.
+##
+
 ##################### CHANGE THESE ONLY IF YOU MUST #####################
 
 !IF "$(CRYPT_SRC)$(CRYPT_LIB)" == ""
@@ -135,8 +160,22 @@ LOCDEFS            = -DPERLDLL -DPERL_CORE
 SUBSYS         = console
 CXX_FLAG       = -TP -GX
 
+!IF "$(USE_PERLCRT)" == ""
+!   IF  "$(CFG)" == "Debug"
+PERLCRTLIBC    = msvcrtd.lib
+!   ELSE
+PERLCRTLIBC    = msvcrt.lib
+!   ENDIF
+!ELSE
+!   IF  "$(CFG)" == "Debug"
+PERLCRTLIBC    = PerlCRTD.lib
+!   ELSE
+PERLCRTLIBC    = PerlCRT.lib
+!   ENDIF
+!ENDIF
+
 !IF "$(RUNTIME)" == "-MD"
-LIBC           = msvcrt.lib
+LIBC           = $(PERLCRTLIBC)
 !ELSE
 LIBC           = libcmt.lib
 !ENDIF
@@ -161,15 +200,17 @@ LINK_DBG  = -release
 OPTIMIZE       = $(OPTIMIZE) $(CXX_FLAG)
 !ENDIF
 
-# we don't add LIBC here, the compiler does it based on -MD/-MT
-LIBFILES       = $(CRYPT_LIB) oldnames.lib kernel32.lib user32.lib gdi32.lib \
+LIBBASEFILES   = $(CRYPT_LIB) oldnames.lib kernel32.lib user32.lib gdi32.lib \
                winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib \
                oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \
                version.lib odbc32.lib odbccp32.lib
 
+# we add LIBC here, since we may be using PerlCRT.dll
+LIBFILES       = $(LIBBASEFILES) $(LIBC)
+
 CFLAGS         = -nologo -Gf -W3 $(INCLUDES) $(DEFINES) $(LOCDEFS) \
                $(PCHFLAGS) $(OPTIMIZE)
-LINK_FLAGS     = -nologo $(LINK_DBG) -machine:$(PROCESSOR_ARCHITECTURE)
+LINK_FLAGS     = -nologo -nodefaultlib $(LINK_DBG) -machine:$(PROCESSOR_ARCHITECTURE)
 OBJOUT_FLAG    = -Fo
 EXEOUT_FLAG    = -Fe
 
@@ -257,7 +298,10 @@ MAKE               = nmake -nologo
 
 CFGSH_TMPL     = config.vc
 CFGH_TMPL      = config_H.vc
+
+!IF "$(USE_PERLCRT)" == ""
 PERL95EXE      = ..\perl95.exe
+!ENDIF
 
 XCOPY          = xcopy /f /r /i /d
 RCOPY          = xcopy /f /r /i /e /d
@@ -606,6 +650,8 @@ $(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ)
        copy splittree.pl .. 
        $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR)
 
+!IF "$(USE_PERLCRT)" == ""
+
 perl95.c : runperl.c 
        copy runperl.c perl95.c
 
@@ -626,7 +672,9 @@ DynaLoadmt$(o) : $(DYNALOADER).c
 
 $(PERL95EXE): $(PERLDLL) $(CONFIGPM) $(PERL95_OBJ)
        $(LINK32) -subsystem:console -nodefaultlib -out:$@ $(LINK_FLAGS) \
-           $(LIBFILES) $(PERL95_OBJ) $(PERLIMPLIB) libcmt.lib
+           $(LIBBASEFILES) $(PERL95_OBJ) $(PERLIMPLIB) libcmt.lib
+
+!ENDIF
 
 $(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
        if not exist $(AUTODIR) mkdir $(AUTODIR)
@@ -760,7 +808,9 @@ install : all installbare installhtml
 
 installbare : utils
        $(PERLEXE) ..\installperl
+!IF "$(USE_PERLCRT)" == ""
        $(XCOPY) $(PERL95EXE) $(INST_BIN)\*.*
+!ENDIF
        $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
        $(XCOPY) bin\*.bat $(INST_SCRIPT)\*.*
        $(XCOPY) bin\network.pl $(INST_LIB)\*.*
index 68f2180..b5650a8 100644 (file)
@@ -1,20 +1,26 @@
 #
-# Makefile to build perl on Windowns NT using DMAKE.
+# Makefile to build perl on Windows NT using DMAKE.
 # Supported compilers:
 #      Visual C++ 2.0 thro 5.0
 #      Borland C++ 5.02
-#      Mingw32-0.1.4 with gcc-2.7.2
+#      Mingw32 with gcc-2.8.1 or egcs-1.0.2
 #
 # This is set up to build a perl.exe that runs off a shared library
 # (perl.dll).  Also makes individual DLLs for the XS extensions.
 #
 
+##
+## Build configuration.  Edit the values below to suit your needs.
+##
+
 #
 # Set these to wherever you want "nmake install" to put your
 # newly built perl.
+#
 INST_DRV       *= c:
 INST_TOP       *= $(INST_DRV)\perl
 
+#
 # Comment this out if you DON'T want your perl installation to be versioned.
 # This means that the new installation will overwrite any files from the
 # old installation at the same INST_TOP location.  Leaving it enabled is
@@ -22,14 +28,17 @@ INST_TOP    *= $(INST_DRV)\perl
 # locations it installs files to.  If you disable it, an alternative
 # versioned installation can be obtained by setting INST_TOP above to a
 # path that includes an arbitrary version string.
+#
 INST_VER       *= \5.00467
 
 #
 # uncomment to enable threads-capabilities
+#
 #USE_THREADS   *= define
 
 #
 # uncomment one
+#
 #CCTYPE                *= MSVC20
 #CCTYPE                *= MSVC
 CCTYPE         *= BORLAND
@@ -38,22 +47,33 @@ CCTYPE              *= BORLAND
 #
 # uncomment next line if you want to use the perl object
 # Currently, this cannot be enabled if you ask for threads above
+#
 #OBJECT                *= -DPERL_OBJECT
 
 #
 # uncomment next line if you want debug version of perl (big,slow)
+#
 #CFG           *= Debug
 
 #
+# uncomment to enable use of PerlCRT.DLL.  Highly recommended.  It has
+# patches that fix known bugs in MSCVRT.DLL.  You will need to download it
+# from: <TBD> and follow the directions in the package to install.
+#
+#USE_PERLCRT   *= define
+
+#
 # if you have the source for des_fcrypt(), uncomment this and make sure the
 # file exists (see README.win32).  File should be located at the perl
 # top level directory.
+#
 #CRYPT_SRC     *= des_fcrypt.c
 
 #
 # if you didn't set CRYPT_SRC and if you have des_fcrypt() available in a
 # library, uncomment this, and make sure the library exists (see README.win32)
 # Specify the full pathname of the library.
+#
 #CRYPT_LIB     *= des_fcrypt.lib
 
 #
@@ -62,6 +82,7 @@ CCTYPE                *= BORLAND
 # you may have compiled with/without it.  Be prepared to recompile all extensions
 # if you change the default.  Currently, this cannot be enabled if you ask for
 # PERL_OBJECT above.
+#
 #PERL_MALLOC   *= define
 
 #
@@ -81,13 +102,19 @@ EXTRALIBDIRS       *=
 #
 # set this to point to cmd.exe (only needed if you use some
 # alternate shell that doesn't grok cmd.exe style commands)
+#
 #SHELL         *= g:\winnt\system32\cmd.exe
 
 #
 # set this to your email address (perl will guess a value from
 # from your loginname and your hostname, which may not be right)
+#
 #EMAIL         *= 
 
+##
+## Build configuration ends.
+##
+
 ##################### CHANGE THESE ONLY IF YOU MUST #####################
 
 .IF "$(CRYPT_SRC)$(CRYPT_LIB)" == ""
@@ -221,8 +248,22 @@ LOCDEFS            = -DPERLDLL -DPERL_CORE
 SUBSYS         = console
 CXX_FLAG       = -TP -GX
 
+.IF "$(USE_PERLCRT)" == ""
+.IF  "$(CFG)" == "Debug"
+PERLCRTLIBC    = msvcrtd.lib
+.ELSE
+PERLCRTLIBC    = msvcrt.lib
+.ENDIF
+.ELSE
+.IF  "$(CFG)" == "Debug"
+PERLCRTLIBC    = PerlCRTD.lib
+.ELSE
+PERLCRTLIBC    = PerlCRT.lib
+.ENDIF
+.ENDIF
+
 .IF "$(RUNTIME)" == "-MD"
-LIBC           = msvcrt.lib
+LIBC           = $(PERLCRTLIBC)
 .ELSE
 LIBC           = libcmt.lib
 .ENDIF
@@ -243,15 +284,17 @@ OPTIMIZE  = -Od $(RUNTIME) -DNDEBUG
 LINK_DBG       = -release
 .ENDIF
 
-# we don't add LIBC here, the compiler does it based on -MD/-MT
-LIBFILES       = $(CRYPT_LIB) oldnames.lib kernel32.lib user32.lib gdi32.lib \
+LIBBASEFILES   = $(CRYPT_LIB) oldnames.lib kernel32.lib user32.lib gdi32.lib \
                winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib \
                oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \
                version.lib odbc32.lib odbccp32.lib
 
+# we add LIBC here, since we may be using PerlCRT.dll
+LIBFILES       = $(LIBBASEFILES) $(LIBC)
+
 CFLAGS         = -nologo -Gf -W3 $(INCLUDES) $(DEFINES) $(LOCDEFS) \
                $(PCHFLAGS) $(OPTIMIZE)
-LINK_FLAGS     = -nologo $(LINK_DBG) -machine:$(PROCESSOR_ARCHITECTURE)
+LINK_FLAGS     = -nologo -nodefaultlib $(LINK_DBG) -machine:$(PROCESSOR_ARCHITECTURE)
 OBJOUT_FLAG    = -Fo
 EXEOUT_FLAG    = -Fe
 LIBOUT_FLAG    = /out:
@@ -359,7 +402,9 @@ PERLIMPLIB  *= ..\libperl$(a)
 
 CFGSH_TMPL     = config.vc
 CFGH_TMPL      = config_H.vc
+.IF "$(USE_PERLCRT)" == ""
 PERL95EXE      = ..\perl95.exe
+.ENDIF
 
 .ENDIF
 
@@ -769,6 +814,7 @@ $(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ)
 
 .IF "$(CCTYPE)" != "BORLAND"
 .IF "$(CCTYPE)" != "GCC"
+.IF "$(USE_PERLCRT)" == ""
 
 perl95.c : runperl.c 
        copy runperl.c perl95.c
@@ -790,10 +836,11 @@ DynaLoadmt$(o) : $(DYNALOADER).c
 
 $(PERL95EXE): $(PERLDLL) $(CONFIGPM) $(PERL95_OBJ)
        $(LINK32) -subsystem:console -nodefaultlib -out:$@ $(LINK_FLAGS) \
-           $(LIBFILES) $(PERL95_OBJ) $(PERLIMPLIB) libcmt.lib
+           $(LIBBASEFILES) $(PERL95_OBJ) $(PERLIMPLIB) libcmt.lib
 
 .ENDIF
 .ENDIF
+.ENDIF
 
 $(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
        if not exist $(AUTODIR) mkdir $(AUTODIR)