Trac 53 minw update

http://libwebsockets.org/trac/libwebsockets/ticket/53
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 595d972..c591149 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -310,7 +310,11 @@
 
 
 if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
+    if (UNIX)
 	set( CMAKE_C_FLAGS "-Wall -Werror -O4 -fvisibility=hidden ${CMAKE_C_FLAGS}" )
+    else(UNIX)
+	set( CMAKE_C_FLAGS "-Wall -O4 -fvisibility=hidden ${CMAKE_C_FLAGS}" )
+    endif(UNIX)
 endif ()
 
 source_group("Headers Private"  FILES ${HDR_PRIVATE})
diff --git a/cross-ming.cmake b/cross-ming.cmake
new file mode 100644
index 0000000..94989f2
--- /dev/null
+++ b/cross-ming.cmake
@@ -0,0 +1,31 @@
+#
+# CMake Toolchain file for crosscompiling on MingW.
+#
+# This can be used when running cmake in the following way:
+#  cd build/
+#  cmake .. -DCMAKE_TOOLCHAIN_FILE=../cross-ming.cmake
+#
+
+set(CROSS_PATH /usr/bin)
+
+# Target operating system name.
+set(CMAKE_SYSTEM_NAME Windows)
+set(BUILD_SHARED_LIBS OFF)
+
+# Name of C compiler.
+set(CMAKE_C_COMPILER "${CROSS_PATH}/x86_64-w64-mingw32-gcc")
+#set(CMAKE_CXX_COMPILER "${CROSS_PATH}/x86_64-w64-mingw32-g++")
+set(CMAKE_RC_COMPILER "${CROSS_PATH}/x86_64-w64-mingw32-windres")
+set(CMAKE_C_FLAGS "-Wno-error")
+
+# Where to look for the target environment. (More paths can be added here)
+set(CMAKE_FIND_ROOT_PATH "${CROSS_PATH}")
+
+# Adjust the default behavior of the FIND_XXX() commands:
+# search programs in the host environment only.
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+
+# Search headers and libraries in the target environment only.
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h
index e4e8e23..f957e54 100644
--- a/lib/libwebsockets.h
+++ b/lib/libwebsockets.h
@@ -35,7 +35,7 @@
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #include <stddef.h>
-#include <BaseTsd.h>
+#include <basetsd.h>
 #include "websock-w32.h"
 
 #include "gettimeofday.h"
diff --git a/win32port/zlib/gzio.c b/win32port/zlib/gzio.c
index 26f2da1..a57352e 100644
--- a/win32port/zlib/gzio.c
+++ b/win32port/zlib/gzio.c
@@ -10,6 +10,7 @@
 #include <stdio.h>

 

 #include "zutil.h"

+#include "gzguts.h"

 

 #ifdef NO_DEFLATE       /* for compatiblity with old definition */

 #  define NO_GZCOMPRESS

@@ -977,7 +978,7 @@
     *errnum = s->z_err;

     if (*errnum == Z_OK) return (const char*)"";

 

-    m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);

+    m = (char*)(*errnum == Z_ERRNO ? zstrerror() : s->stream.msg);

 

     if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);