--- openssl-SNAP-20080606/apps/speed.c~	2007-11-16 18:00:10.000000000 +0100
+++ openssl-SNAP-20080606/apps/speed.c	2008-06-06 12:24:29.000000000 +0200
@@ -257,7 +257,7 @@
 #define START	0
 #define STOP	1
 
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(__MINGW64__)
 
 #define SIGALRM
 static unsigned int lapse,schlock;
--- openssl-SNAP-20080606/crypto/mem_dbg.c~	2008-05-26 14:00:10.000000000 +0200
+++ openssl-SNAP-20080606/crypto/mem_dbg.c	2008-06-06 12:10:01.000000000 +0200
@@ -315,10 +315,10 @@
 static int mem_cmp(const MEM *a, const MEM *b)
 	{
 #ifdef _WIN64
-	const char *a=(const char *)a->addr,
-		   *b=(const char *)b->addr;
-	if (a==b)	return 0;
-	else if (a>b)	return 1;
+	const char *a_=(const char *)a->addr,
+		   *b_=(const char *)b->addr;
+	if (a_==b_)	return 0;
+	else if (a_>b_)	return 1;
 	else		return -1;
 #else
 	return (const char *)a->addr - (const char *)b->addr;
--- openssl-SNAP-20080606/engines/e_aep.c~	2008-01-04 02:01:24.000000000 +0100
+++ openssl-SNAP-20080606/engines/e_aep.c	2008-06-06 12:20:17.000000000 +0200
@@ -62,8 +62,10 @@
 #include <unistd.h>
 #else
 #include <process.h>
+#ifndef __MINGW64__
 typedef int pid_t;
 #endif
+#endif
 
 #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB)
 #define getpid GetThreadID
--- openssl-SNAP-20080606/configure~	2008-05-01 21:00:04.000000000 +0200
+++ openssl-SNAP-20080606/Configure	2008-06-06 12:28:11.000000000 +0200
@@ -495,6 +495,7 @@
 
 # MinGW
 "mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::MINGW32:-lws2_32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin:.dll.a",
+"mingw-w64", "gcc:-DL_ENDIAN -DWIN32_LEAN_AND_MEAN -O3 -Wall:::MINGW32:-lws2_32 -lgdi32 -lcrypt32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK::.dll.a",
 
 # UWIN 
 "UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
@@ -967,7 +968,7 @@
 
 my $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
 
-$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw");
+$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw" || $target eq "mingw-w64");
 $exe_ext=".nlm" if ($target =~ /netware/);
 $exe_ext=".pm"  if ($target =~ /vos/);
 $openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
