Enable WinVNC build with MinGW and MinGW64


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4723 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ebf2e53..15394d6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,11 +66,7 @@
 add_definitions(-D__BUILD__="${BUILD}")
 
 if(NOT DEFINED BUILD_WINVNC)
-  if(MSVC)
-    set(BUILD_WINVNC 1)
-  else()
-    set(BUILD_WINVNC 0)
-  endif()
+  set(BUILD_WINVNC 1)
 endif()
 
 if(MSVC)
@@ -168,6 +164,14 @@
     "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -o <OBJECT> --output-format=coff <SOURCE>")
 endif()
 
+# MinGW64 has header support but no library support for IActiveDesktop, so we
+# need to check for both the header and library and use our own implementation
+# in common/os if either doesn't exist.  MSVC should have both.
+if(WIN32)
+  check_c_source_compiles("#include <windows.h>\n#include <wininet.h>\n#include <shlobj.h>\nint main(int c, char** v) {IActiveDesktop iad; return 0;}" HAVE_ACTIVE_DESKTOP_H)
+  check_c_source_compiles("#include <windows.h>\n#include <wininet.h>\n#include <shlobj.h>\nint main(int c, char** v) {GUID i = CLSID_ActiveDesktop; return 0;}" HAVE_ACTIVE_DESKTOP_L)
+endif()
+
 # X11 stuff. It's in a if() so that we can say REQUIRED
 if(UNIX AND NOT APPLE)
   find_package(X11 REQUIRED)