Borland C++ version 5.02 or later
Microsoft Visual C++ version 2.0 or later
MinGW with gcc gcc version 2.95.2 or later
-
-The last of these is a high quality freeware compiler. Use version
-3.2.x or later for the best results with this compiler.
+ Gcc by mingw.org gcc version 2.95.2 or later
+ Gcc by mingw-w64.sf.net gcc version 4.4.3 or later
+
+Note that the last two of these are actually competing projects both
+delivering complete gcc toolchain for MS Windows:
+- http://mingw.org - delivers gcc toolchain targeting 32-bit Windows
+ platform.
+ Use version 3.2.x or later for the best results with this compiler.
+- http://mingw-w64.sf.net - delivers gcc toolchain targeting both 64-bit
+ Windows and 32-bit Windows platforms (despite the project name "mingw-w64"
+ they are not only 64-bit oriented). They deliver the native gcc compilers
+ + cross-compilers that are also supported by perl's makefile.
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
"Visual C++ .NET 2003 Professional" or "Visual C++ 2005/2008 Professional"
respectively.
-This port can also be built on the Intel IA64 using:
+This port can also be built on IA64/AMD64 using:
Microsoft Platform SDK Nov 2001 (64-bit compiler and tools)
+ MinGW64 compiler (gcc version 4.4.3 or later)
The MS Platform SDK can be downloaded from http://www.microsoft.com/.
+The MinGW64 compiler is available at http://sourceforge.net/projects/mingw-w64.
+The latter is actually a cross-compiler targeting Win64. There's also a trimmed
+down compiler (no java, or gfortran) suitable for building perl available at:
+http://svn.ali.as/cpan/users/kmx/strawberry_gcc-toolchain/
+
+NOTE: If you're using a 32-bit compiler to build perl on a 64-bit Windows
+operating system, then you should set the WIN64 environment variable to "undef".
This port fully supports MakeMaker (the set of modules that
is used to build extensions to perl). Therefore, you should be
Perl also compiles with earlier releases of gcc (2.95.2 and up). See below
for notes about using earlier versions of MinGW/gcc.
+And perl also compiles with gcc-4.3.0 and up, and perhaps even some of the
+earlier 4.x.x versions.
+
You also need dmake. See L</"Make"> above on how to get it.
=item MinGW release 1 with gcc
than the one being tested.
You will have to make sure that CCTYPE is set correctly and that
-CCHOME points to wherever you installed your compiler.
+CCHOME points to wherever you installed your compiler. If building with
+gcc-4.x.x, you'll also need to uncomment the assignment to GCC_4XX and
+uncomment the assignment to the appropriate GCCHELPERDLL in the makefile.mk.
+
+If building with the cross-compiler provided by
+mingw-w64.sourceforge.net you'll need to uncomment the line that sets
+GCCCROSS in the makefile.mk. Do this only if it's the cross-compiler - ie
+only if the bin folder doesn't contain a gcc.exe. (The cross-compiler
+does not provide a gcc.exe, g++.exe, ar.exe, etc. Instead, all of these
+executables are prefixed with 'x86_64-w64-mingw32-'.)
The default value for CCHOME in the makefiles for Visual C++
may not be correct for some versions. Make sure the default exists
# undef setservent
#endif /* NETWARE */
+/* to avoid warnings: "xyz" redefined */
+#ifdef WIN32
+# undef popen
+# undef pclose
+#endif /* WIN32 */
+
# undef socketpair
# define mkdir PerlDir_mkdir
$ENV{EMXSHELL} = 'sh'; # to run `commands`
my $BORLAND = $Config{'cc'} =~ /^bcc/i ? 1 : 0;
-my $GCC = $Config{'cc'} =~ /^gcc/i ? 1 : 0;
+my $GCC = $Config{'cc'} =~ /\bgcc$/i ? 1 : 0;
+my $DLLTOOL = $Config{'dlltool'} || 'dlltool';
=head2 Overridden methods
');
if ($GCC) {
push(@m,
- q{ dlltool --def $(EXPORT_LIST) --output-exp dll.exp
+ q{ }.$DLLTOOL.q{ --def $(EXPORT_LIST) --output-exp dll.exp
$(LD) -o $@ -Wl,--base-file -Wl,dll.base $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp
- dlltool --def $(EXPORT_LIST) --base-file dll.base --output-exp dll.exp
+ }.$DLLTOOL.q{ --def $(EXPORT_LIST) --base-file dll.base --output-exp dll.exp
$(LD) -o $@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp });
} elsif ($BORLAND) {
push(@m,
#define PERL_NO_GET_CONTEXT
+/* Workaround for mingw 32-bit compiler by mingw-w64.sf.net - has to come before any #include.
+ * It also defines USE_NO_MINGW_SETJMP_TWO_ARGS for the mingw.org 32-bit compilers ... but
+ * that's ok as that compiler makes no use of that symbol anyway */
+#if defined(WIN32) && defined(__MINGW32__) && !defined(__MINGW64__)
+# define USE_NO_MINGW_SETJMP_TWO_ARGS 1
+#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
/* Workaround for XSUB.h bug under WIN32 */
#ifdef WIN32
# undef setjmp
-# if !defined(__BORLANDC__)
+# if defined(USE_NO_MINGW_SETJMP_TWO_ARGS) || (!defined(__BORLANDC__) && !defined(__MINGW64__))
# define setjmp(x) _setjmp(x)
# endif
#endif
# define INT64_C(c) CAT2(c,L)
# define UINT64_C(c) CAT2(c,UL)
# else
-# define INT64_C(c) ((I64TYPE)(c))
-# define UINT64_C(c) ((U64TYPE)(c))
+# if defined(_WIN64) && defined(_MSC_VER)
+# define INT64_C(c) CAT2(c,I64)
+# define UINT64_C(c) CAT2(c,UI64)
+# else
+# define INT64_C(c) ((I64TYPE)(c))
+# define UINT64_C(c) ((U64TYPE)(c))
+# endif
# endif
# endif
# endif
if (PL_madskills) {
if (strEQ(name, "import")) {
PL_formfeed = MUTABLE_SV(cv);
- Perl_warner(aTHX_ packWARN(WARN_VOID), "%lx\n", (long)cv);
+ Perl_warner(aTHX_ packWARN(WARN_VOID), UVxf"\n", (UV)cv);
}
}
GvCVGEN(gv) = 0;
# define DO_BO_UNPACK_PC(var) DO_BO_UNPACK_PTR(var, i, int, char)
# define DO_BO_PACK_PC(var) DO_BO_PACK_PTR(var, i, int, char)
# elif PTRSIZE == LONGSIZE
-# define DO_BO_UNPACK_P(var) DO_BO_UNPACK_PTR(var, l, long, void)
-# define DO_BO_PACK_P(var) DO_BO_PACK_PTR(var, l, long, void)
-# define DO_BO_UNPACK_PC(var) DO_BO_UNPACK_PTR(var, l, long, char)
-# define DO_BO_PACK_PC(var) DO_BO_PACK_PTR(var, l, long, char)
+# if LONGSIZE < IVSIZE && IVSIZE == 8
+# define DO_BO_UNPACK_P(var) DO_BO_UNPACK_PTR(var, 64, IV, void)
+# define DO_BO_PACK_P(var) DO_BO_PACK_PTR(var, 64, IV, void)
+# define DO_BO_UNPACK_PC(var) DO_BO_UNPACK_PTR(var, 64, IV, char)
+# define DO_BO_PACK_PC(var) DO_BO_PACK_PTR(var, 64, IV, char)
+# else
+# define DO_BO_UNPACK_P(var) DO_BO_UNPACK_PTR(var, l, IV, void)
+# define DO_BO_PACK_P(var) DO_BO_PACK_PTR(var, l, IV, void)
+# define DO_BO_UNPACK_PC(var) DO_BO_UNPACK_PTR(var, l, IV, char)
+# define DO_BO_PACK_PC(var) DO_BO_PACK_PTR(var, l, IV, char)
+# endif
# elif PTRSIZE == IVSIZE
# define DO_BO_UNPACK_P(var) DO_BO_UNPACK_PTR(var, l, IV, void)
# define DO_BO_PACK_P(var) DO_BO_PACK_PTR(var, l, IV, void)
* help. Sum in another random number that will
* fill in the low bits. */
myseed +=
- (UV)(Drand01() * (NV)((1 << ((UVSIZE * 8 - RANDBITS))) - 1));
+ (UV)(Drand01() * (NV)((((UV)1) << ((UVSIZE * 8 - RANDBITS))) - 1));
#endif /* RANDBITS < (UVSIZE * 8) */
if (myseed == 0) { /* Superparanoia. */
myseed = (UV)(Drand01() * (NV)UV_MAX); /* One more chance. */
#CCTYPE *= MSVC90
# Borland 5.02 or later
#CCTYPE *= BORLAND
-# MinGW with gcc-2.95.2 or later
+# MinGW or mingw-w64 with gcc-2.95.2 or later
CCTYPE *= GCC
#
CCLIBDIR *= $(CCHOME)\lib
#
+# If building with gcc-4.x.x (or x86_64-w64-mingw32-gcc-4.x.x), then
+# uncomment the following assignment to GCC_4XX, make sure that CCHOME
+# has been set correctly above, and uncomment the appropriate
+# GCCHELPERDLL line.
+# The name of the dll can change, depending upon which vendor has supplied
+# your 4.x.x compiler, and upon the values of "x".
+# (The dll will be in your mingw/bin folder, so check there if you're
+# unsure about the correct name.)
+# Without these corrections, the op/taint.t test script will fail.
+#
+#GCC_4XX *= define
+#GCCHELPERDLL *= $(CCHOME)\bin\libgcc_s_sjlj-1.dll
+#GCCHELPERDLL *= $(CCHOME)\bin\libgcc_s_dw2-1.dll
+#GCCHELPERDLL *= $(CCHOME)\bin\libgcc_s_1.dll
+
+#
+# uncomment this if you are using x86_64-w64-mingw32 cross-compiler
+# ie if your gcc executable is called 'x86_64-w64-mingw32-gcc'
+# instead of the usual 'gcc'.
+#
+#GCCCROSS *= define
+
+#
# Additional compiler flags can be specified here.
#
BUILDOPT *= $(BUILDOPTEXTRA)
.ELIF "$(CCTYPE)" == "GCC"
-CC = gcc
-LINK32 = g++
-LIB32 = ar rc
-IMPLIB = dlltool
-RSC = windres
+.IF "$(GCCCROSS)" == "define"
+ARCHPREFIX = x86_64-w64-mingw32-
+.ENDIF
+
+CC = $(ARCHPREFIX)gcc
+LINK32 = $(ARCHPREFIX)g++
+LIB32 = $(ARCHPREFIX)ar rc
+IMPLIB = $(ARCHPREFIX)dlltool
+RSC = $(ARCHPREFIX)windres
i = .i
o = .o
INCLUDES = -I.\include -I. -I.. -I$(COREDIR)
DEFINES = -DWIN32 $(CRYPT_FLAG)
+.IF "$(WIN64)" == "define"
+DEFINES += -DWIN64 -DCONSERVATIVE
+.ENDIF
LOCDEFS = -DPERLDLL -DPERL_CORE
SUBSYS = console
CXX_FLAG = -xc++
.ELIF "$(CCTYPE)" == "GCC"
+.IF "$(WIN64)" == "define"
+.IF "$(GCCCROSS)" == "define"
+CFGSH_TMPL = config.gc64
+CFGH_TMPL = config_H.gc64
+.ELSE
+CFGSH_TMPL = config.gc64nox
+CFGH_TMPL = config_H.gc64nox
+.ENDIF
+.ELSE
CFGSH_TMPL = config.gc
CFGH_TMPL = config_H.gc
+.ENDIF
PERLIMPLIB = ..\libperl511$(a)
PERLSTATICLIB = ..\libperl511s$(a)
$(mktmp $(LKPRE) $(PERLDLL_OBJ) \
$(shell @type Extensions_static) \
$(LIBFILES) $(LKPOST))
- dlltool --output-lib $(PERLIMPLIB) \
+ $(IMPLIB) --output-lib $(PERLIMPLIB) \
--dllname $(PERLDLL:b).dll \
--def perldll.def \
--base-file perl.base \
.ELSE
$(XCOPY) $(GLOBEXE) ..\t\$(NULL)
.ENDIF
+.IF "$(CCTYPE)" == "GCC"
+.IF "$(GCC_4XX)" == "define"
+ $(XCOPY) $(GCCHELPERDLL) ..\t\$(NULL)
+.ENDIF
+.ENDIF
test : $(RIGHTMAKE) test-prep
cd ..\t && $(PERLEXE) -I..\lib harness $(TEST_SWITCHES) $(TEST_FILES)
parent_message_hwnd = w32_message_hwnd;
w32_message_hwnd = win32_create_message_window();
if (parent_message_hwnd != NULL)
- PostMessage(parent_message_hwnd, WM_USER_MESSAGE, w32_pseudo_id, (LONG)w32_message_hwnd);
+ PostMessage(parent_message_hwnd, WM_USER_MESSAGE, w32_pseudo_id, (LPARAM)w32_message_hwnd);
/* push a zero on the stack (we are the child) */
{
GetSystemInfo(&info);
#if (defined(__BORLANDC__)&&(__BORLANDC__<=0x520)) \
- || (defined(__MINGW32__) && !defined(_ANONYMOUS_UNION))
+ || (defined(__MINGW32__) && !defined(_ANONYMOUS_UNION) && !defined(__MINGW_EXTENSION))
procarch = info.u.s.wProcessorArchitecture;
#else
procarch = info.wProcessorArchitecture;
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+/*
+ * Bug in winbase.h in mingw-w64 4.4.0-1 at least... they
+ * do #define GetEnvironmentStringsA GetEnvironmentStrings and fail
+ * to declare GetEnvironmentStringsA.
+ */
+#if defined(__MINGW64__) && defined(GetEnvironmentStringsA) && !defined(UNICODE)
+#ifdef __cplusplus
+extern "C" {
+#endif
+#undef GetEnvironmentStringsA
+WINBASEAPI LPCH WINAPI GetEnvironmentStringsA(VOID);
+#define GetEnvironmentStrings GetEnvironmentStringsA
+#ifdef __cplusplus
+}
+#endif
+#endif
+
#ifdef WIN32_LEAN_AND_MEAN /* C file is NOT a Perl5 original. */
#define CONTEXT PERL_CONTEXT /* Avoid conflict of CONTEXT defs. */
#endif /*WIN32_LEAN_AND_MEAN */