From 2a46176fce26ca9f48e1c970c01e133149ab2d91 Mon Sep 17 00:00:00 2001 From: Steve Hay Date: Thu, 18 Nov 2010 10:46:01 +0000 Subject: Support Visual C++ 2010 Also add a couple of things to win32/makefile.mk which were only previously applied to win32/Makefile --- README.win32 | 35 ++++++++++++-------------- makedef.pl | 2 +- win32/Makefile | 21 ++++++++++------ win32/include/sys/socket.h | 4 ++- win32/makefile.mk | 61 ++++++++++++++++++++++++++++++++++------------ 5 files changed, 79 insertions(+), 44 deletions(-) diff --git a/README.win32 b/README.win32 index c3aea936f8..b40dc49107 100644 --- a/README.win32 +++ b/README.win32 @@ -59,10 +59,10 @@ The Borland C++ and Microsoft Visual C++ compilers are also now being given away free. The Borland compiler is available as "Borland C++ Compiler Free Command Line Tools" and is the same compiler that ships with the full "Borland C++ Builder" product. The Microsoft compiler is available as -"Visual C++ Toolkit 2003" or "Visual C++ 2005/2008 Express Edition" (and also -as part of the ".NET Framework SDK") and is the same compiler that ships with -"Visual C++ .NET 2003 Professional" or "Visual C++ 2005/2008 Professional" -respectively. +"Visual C++ Toolkit 2003" or "Visual C++ 2005/2008/2010 Express Edition" (and +also as part of the ".NET Framework SDK") and is the same compiler that ships +with "Visual C++ .NET 2003 Professional" or "Visual C++ 2005/2008/2010 +Professional" respectively. This port can also be built on IA64/AMD64 using: @@ -146,31 +146,26 @@ and edit win32/config.vc to change "make=nmake" into "make=dmake". The latter step is only essential if you want to use dmake as your default make for building extensions using MakeMaker. -=item Microsoft Visual C++ 2008 Express Edition +=item Microsoft Visual C++ 2008/2010 Express Edition -This free version of Visual C++ 2008 Professional contains the same compiler -and linker that ship with the full version, and also contains everything -necessary to build Perl, rather than requiring a separate download of the -Windows SDK like previous versions did. +These free versions of Visual C++ 2008/2010 Professional contain the same +compilers and linkers that ship with the full versions, and also contain +everything necessary to build Perl, rather than requiring a separate download +of the Windows SDK like previous versions did. -This package can be downloaded by searching for "Visual Studio 2008 Express -Edition" in the Download Center at +These packages can be downloaded by searching in the Download Center at http://www.microsoft.com/downloads/search.aspx?displaylang=en. (Providing exact links to these packages has proven a pointless task because the links keep on changing so often.) -Install Visual C++ 2008, then setup your environment using +Install Visual C++ 2008/2010 Express, then setup your environment using, e.g. - C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat + C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat (assuming the default installation location was chosen). Perl should now build using the win32/Makefile. You will need to edit that -file to set - - CCTYPE = MSVC90FREE - -first. +file to set CCTYPE to MSVC90FREE or MSVC100FREE first. =item Microsoft Visual C++ 2005 Express Edition @@ -914,7 +909,7 @@ of O'Reilly and Associates, Inc. Used with permission. =item Jan Dubois Ejand@activestate.comE -=item Steve Hay Esteve.hay@uk.radan.comE +=item Steve Hay Esteve.m.hay@googlemail.comE =back @@ -943,6 +938,6 @@ Win9x support was added in 5.6 (Benjamin Stuhl). Support for 64-bit Windows added in 5.8 (ActiveState Corp). -Last updated: 6 August 2010 +Last updated: 18 November 2010 =cut diff --git a/makedef.pl b/makedef.pl index 58a00c6e68..61d3f08f07 100644 --- a/makedef.pl +++ b/makedef.pl @@ -193,7 +193,7 @@ if ($PLATFORM =~ /^win(?:32|ce)$/) { print "LIBRARY $dll\n"; # The DESCRIPTION module definition file statement is not supported # by VC7 onwards. - if ($CCTYPE !~ /^MSVC7/ && $CCTYPE !~ /^MSVC8/ && $CCTYPE !~ /^MSVC9/) { + if ($CCTYPE =~ /^(?:MSVC60|GCC|BORLAND)$/) { print "DESCRIPTION 'Perl interpreter'\n"; } print "EXPORTS\n"; diff --git a/win32/Makefile b/win32/Makefile index d55330cc9c..0c1ac8e28f 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -111,6 +111,10 @@ CCTYPE = MSVC60 #CCTYPE = MSVC90FREE # Visual C++ 2008 (aka Visual C++ 9.x) (full version) #CCTYPE = MSVC90 +# Visual C++ 2010 Express Edition (aka Visual C++ 10.x) (free version) +#CCTYPE = MSVC100FREE +# Visual C++ 2010 (aka Visual C++ 10.x) (full version) +#CCTYPE = MSVC100 # # uncomment next line if you want debug version of perl (big,slow) @@ -355,13 +359,14 @@ BUILDOPT = $(BUILDOPT) -DUSE_PERLIO ARCHNAME = $(ARCHNAME)-thread !ENDIF -# Visual C++ 98, .NET 2003, 2005 and 2008 specific. -# VC++ 6.x, 7.x, 8.x and 9.x can load DLL's on demand. Makes the test suite run +# Visual C++ 98, .NET 2003, 2005/2008/2010 specific. +# VC++ 6/7/8/9/10.x can load DLLs on demand. Makes the test suite run # in about 10% less time. (The free version of 7.x can't do this, but the free -# versions of 8.x and 9.x can.) +# versions of 8/9/10.x can.) !IF "$(CCTYPE)" == "MSVC60" || "$(CCTYPE)" == "MSVC70" || \ "$(CCTYPE)" == "MSVC80" || "$(CCTYPE)" == "MSVC80FREE" || \ - "$(CCTYPE)" == "MSVC90" || "$(CCTYPE)" == "MSVC90FREE" + "$(CCTYPE)" == "MSVC90" || "$(CCTYPE)" == "MSVC90FREE" || \ + "$(CCTYPE)" == "MSVC100" || "$(CCTYPE)" == "MSVC100FREE" DELAYLOAD = -DELAYLOAD:ws2_32.dll delayimp.lib !ENDIF @@ -445,10 +450,11 @@ DEFINES = $(DEFINES) -DWIN64 -DCONSERVATIVE OPTIMIZE = $(OPTIMIZE) -fp:precise !ENDIF -# For now, silence VC++ 8.x's and 9.x's warnings about "unsafe" CRT functions +# For now, silence VC++ 8/9/10.x's warnings about "unsafe" CRT functions # and POSIX CRT function names being deprecated. !IF "$(CCTYPE)" == "MSVC80" || "$(CCTYPE)" == "MSVC80FREE" || \ - "$(CCTYPE)" == "MSVC90" || "$(CCTYPE)" == "MSVC90FREE" + "$(CCTYPE)" == "MSVC90" || "$(CCTYPE)" == "MSVC90FREE" || \ + "$(CCTYPE)" == "MSVC100" || "$(CCTYPE)" == "MSVC100FREE" DEFINES = $(DEFINES) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE !ENDIF @@ -504,7 +510,8 @@ EXEOUT_FLAG = -Fe CFLAGS_O = $(CFLAGS) $(BUILDOPT) !IF "$(CCTYPE)" == "MSVC80" || "$(CCTYPE)" == "MSVC80FREE" || \ - "$(CCTYPE)" == "MSVC90" || "$(CCTYPE)" == "MSVC90FREE" + "$(CCTYPE)" == "MSVC90" || "$(CCTYPE)" == "MSVC90FREE" || \ + "$(CCTYPE)" == "MSVC100" || "$(CCTYPE)" == "MSVC100FREE" LINK_FLAGS = $(LINK_FLAGS) "/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'" !ELSE RSC_FLAGS = -DINCLUDE_MANIFEST diff --git a/win32/include/sys/socket.h b/win32/include/sys/socket.h index a3c53b0e88..03b60e2bb9 100644 --- a/win32/include/sys/socket.h +++ b/win32/include/sys/socket.h @@ -29,7 +29,9 @@ extern "C" { #include "win32.h" -#define ENOTSOCK WSAENOTSOCK +#ifndef ENOTSOCK +#define ENOTSOCK WSAENOTSOCK +#endif #ifdef USE_SOCKETS_AS_HANDLES diff --git a/win32/makefile.mk b/win32/makefile.mk index b1ac87b342..4257d92fe0 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -4,7 +4,7 @@ # Microsoft Visual C++ 6.0 or later # Borland C++ 5.02 or later # MinGW with gcc-3.2 or later -# Windows SDK 64-bit compiler and tools **experimental** +# Windows SDK 64-bit compiler and tools # # This is set up to build a perl.exe that runs off a shared library # (perl513.dll). Also makes individual DLLs for the XS extensions. @@ -103,6 +103,8 @@ USE_LARGE_FILES *= define #CCTYPE *= MSVC70FREE # Visual C++ .NET 2003 (aka Visual C++ 7.x) (full version) #CCTYPE *= MSVC70 +# Windows Server 2003 SP1 Platform SDK (April 2005) +#CCTYPE = SDK2003SP1 # Visual C++ 2005 Express Edition (aka Visual C++ 8.x) (free version) #CCTYPE *= MSVC80FREE # Visual C++ 2005 (aka Visual C++ 8.x) (full version) @@ -111,6 +113,10 @@ USE_LARGE_FILES *= define #CCTYPE *= MSVC90FREE # Visual C++ 2008 (aka Visual C++ 9.x) (full version) #CCTYPE *= MSVC90 +# Visual C++ 2010 Express Edition (aka Visual C++ 10.x) (free version) +#CCTYPE = MSVC100FREE +# Visual C++ 2010 (aka Visual C++ 10.x) (full version) +#CCTYPE = MSVC100 # Borland 5.02 or later #CCTYPE *= BORLAND # MinGW or mingw-w64 with gcc-3.2 or later @@ -360,6 +366,13 @@ WIN64 = undef .ENDIF .ENDIF +# Treat 64-bit MSVC60 (doesn't really exist) as SDK2003SP1 because +# both link against MSVCRT.dll (which is part of Windows itself) and +# not against a compiler specific versioned runtime. +.IF "$(WIN64)" == "define" && "$(CCTYPE)" == "MSVC60" +CCTYPE = SDK2003SP1 +.ENDIF + ARCHITECTURE = $(PROCESSOR_ARCHITECTURE) .IF "$(ARCHITECTURE)" == "AMD64" ARCHITECTURE = x64 @@ -382,13 +395,14 @@ ARCHNAME = MSWin32-$(ARCHITECTURE) ARCHNAME !:= $(ARCHNAME)-thread .ENDIF -# Visual C++ 98, .NET 2003, 2005 and 2008 specific. -# VC++ 6.x, 7.x, 8.x and 9.x can load DLL's on demand. Makes the test suite run +# Visual C++ 98, .NET 2003, 2005/2008/2010 specific. +# VC++ 6/7/8/9/10.x can load DLLs on demand. Makes the test suite run # in about 10% less time. (The free version of 7.x can't do this, but the free -# versions of 8.x and 9.x can.) +# versions of 8/9/10.x can.) .IF "$(CCTYPE)" == "MSVC60" || "$(CCTYPE)" == "MSVC70" || \ - "$(CCTYPE)" == "MSVC80" || "$(CCTYPE)" == "MSVC80FREE" || - "$(CCTYPE)" == "MSVC90" || "$(CCTYPE)" == "MSVC90FREE" + "$(CCTYPE)" == "MSVC80" || "$(CCTYPE)" == "MSVC80FREE" || \ + "$(CCTYPE)" == "MSVC90" || "$(CCTYPE)" == "MSVC90FREE" || \ + "$(CCTYPE)" == "MSVC100" || "$(CCTYPE)" == "MSVC100FREE" DELAYLOAD *= -DELAYLOAD:ws2_32.dll delayimp.lib .ENDIF @@ -566,7 +580,7 @@ CXX_FLAG = -TP -EHsc LIBC = msvcrt.lib .IF "$(CFG)" == "Debug" -OPTIMIZE = -O1 -MD -Zi -DDEBUGGING +OPTIMIZE = -Od -MD -Zi -DDEBUGGING LINK_DBG = -debug .ELSE OPTIMIZE = -MD -Zi -DNDEBUG @@ -591,16 +605,32 @@ OPTIMIZE += -O1 .IF "$(WIN64)" == "define" DEFINES += -DWIN64 -DCONSERVATIVE -OPTIMIZE += -Wp64 -fp:precise +OPTIMIZE += -fp:precise .ENDIF -# For now, silence VC++ 8.x's and 9.x's warnings about "unsafe" CRT functions +# For now, silence VC++ 8/9/10.x's warnings about "unsafe" CRT functions # and POSIX CRT function names being deprecated. .IF "$(CCTYPE)" == "MSVC80" || "$(CCTYPE)" == "MSVC80FREE" || \ - "$(CCTYPE)" == "MSVC90" || "$(CCTYPE)" == "MSVC90FREE" + "$(CCTYPE)" == "MSVC90" || "$(CCTYPE)" == "MSVC90FREE" || \ + "$(CCTYPE)" == "MSVC100" || "$(CCTYPE)" == "MSVC100FREE" DEFINES += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE .ENDIF +# In VS 2005 (VC++ 8.0) Microsoft changes time_t from 32-bit to +# 64-bit, even in 32-bit mode. It also provides the _USE_32BIT_TIME_T +# preprocessor option to revert back to the old functionality for +# backward compatibility. We define this symbol here for older 32-bit +# compilers only (which aren't using it at all) for the sole purpose +# of getting it into $Config{ccflags}. That way if someone builds +# Perl itself with e.g. VC6 but later installs an XS module using VC8 +# the time_t types will still be compatible. +.IF "$(WIN64)" == "undef" +.IF "$(CCTYPE)" == "MSVC60" || \ + "$(CCTYPE)" == "MSVC70" || "$(CCTYPE)" == "MSVC70FREE" +BUILDOPT += -D_USE_32BIT_TIME_T +.ENDIF +.ENDIF + # Use the MSVCRT read() fix only when using VC++ 6.x or earlier. Later # versions use MSVCR70.dll, MSVCR71.dll, etc, which do not require the # fix. @@ -614,11 +644,11 @@ LIBBASEFILES = $(CRYPT_LIB) \ netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib \ version.lib odbc32.lib odbccp32.lib comctl32.lib -# The 64 bit Platform SDK compilers contain a runtime library that doesn't -# include the buffer overrun verification code used by the /GS switch. +# The 64 bit Windows Server 2003 SP1 SDK compilers link against MSVCRT.dll, which +# doesn't include the buffer overrun verification code used by the /GS switch. # Since the code links against libraries that are compiled with /GS, this -# "security cookie verification" must be included via bufferoverlow.lib. -.IF "$(WIN64)" == "define" +# "security cookie verification" code must be included via bufferoverflow.lib. +.IF "$(WIN64)" == "define" && "$(CCTYPE)" == "SDK2003SP1" LIBBASEFILES += bufferoverflowU.lib .ENDIF @@ -640,7 +670,8 @@ LIBOUT_FLAG = /out: CFLAGS_O = $(CFLAGS) $(BUILDOPT) .IF "$(CCTYPE)" == "MSVC80" || "$(CCTYPE)" == "MSVC80FREE" || \ - "$(CCTYPE)" == "MSVC90" || "$(CCTYPE)" == "MSVC90FREE" + "$(CCTYPE)" == "MSVC90" || "$(CCTYPE)" == "MSVC90FREE" || \ + "$(CCTYPE)" == "MSVC100" || "$(CCTYPE)" == "MSVC100FREE" LINK_FLAGS += "/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'" .ELSE RSC_FLAGS = -DINCLUDE_MANIFEST -- cgit v1.2.1