Basic support for building Windows vncviewer using MinGW. This patch
includes non-intrusive changes, more tweaks will follow. Details:

* Defining WINVER and _WIN32_IE in both common and win modules. 

* Need to build CFTMsgWriter and CFTMsgReader. 

* Added configure script and Makefiles. 



git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3326 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/configure.ac b/common/configure.ac
index 25aa5f0..d590e05 100644
--- a/common/configure.ac
+++ b/common/configure.ac
@@ -25,6 +25,12 @@
   ;;
 esac
 
+case "$host_os" in
+    mingw*)
+        CPPFLAGS="$CPPFLAGS -DWINVER=0x0500 -D_WIN32_IE=0x0500"
+        ;;
+esac
+
 dnl FIXME: Remove duplication between this script and ../unix/configure.in
 if test "$GCC" = yes; then
   CFLAGS="$CFLAGS -Wall"
diff --git a/common/rfb/Makefile.am b/common/rfb/Makefile.am
index 29ffc95..25df000 100644
--- a/common/rfb/Makefile.am
+++ b/common/rfb/Makefile.am
@@ -26,7 +26,7 @@
 	VNCServer.h VNCServerST.h zrleDecode.h ZRLEDecoder.h zrleEncode.h \
 	ZRLEEncoder.h
 
-librfb_la_SOURCES = $(HDRS) Blacklist.cxx CConnection.cxx CMsgHandler.cxx \
+librfb_la_SOURCES = $(HDRS) Blacklist.cxx CConnection.cxx CFTMsgReader.cxx CFTMsgWriter.cxx CMsgHandler.cxx \
 	CMsgReader.cxx CMsgReaderV3.cxx CMsgWriter.cxx CMsgWriterV3.cxx \
 	CSecurityVncAuth.cxx CapsContainer.cxx CapsList.cxx \
 	ComparingUpdateTracker.cxx Configuration.cxx ConnParams.cxx \
@@ -46,7 +46,7 @@
 	VNCServerST.cxx ZRLEEncoder.cxx ZRLEDecoder.cxx encodings.cxx \
 	secTypes.cxx util.cxx
 
-librfb_la_CPPFLAGS = -I$(top_srcdir)
+librfb_la_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/../win
 librfb_la_LIBADD =
 
 if IRIX_COMPRESS
diff --git a/win/Makefile.am b/win/Makefile.am
new file mode 100644
index 0000000..5ab34c9
--- /dev/null
+++ b/win/Makefile.am
@@ -0,0 +1,4 @@
+SUBDIRS = ../common rfb_win32 vncviewer
+
+ACLOCAL_AMFLAGS = -I m4
+
diff --git a/win/configure.ac b/win/configure.ac
new file mode 100644
index 0000000..b3c4e47
--- /dev/null
+++ b/win/configure.ac
@@ -0,0 +1,30 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_PREREQ([2.61])
+AC_INIT([tightvnc], [1.5.0a1], [http://www.tightvnc.com/bugs.html])
+AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
+
+AC_SUBST([COMMON_DIR], ['$(top_srcdir)/../common'])
+
+AC_CONFIG_SUBDIRS([../common])
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_LIBTOOL
+AC_LANG([C++])
+
+if test "$GCC" = yes; then
+  CFLAGS="$CFLAGS -Wall"
+fi
+if test "$GXX" = yes; then
+  CXXFLAGS="$CXXFLAGS -Wall"
+fi
+
+CPPFLAGS="$CPPFLAGS -DWINVER=0x0500 -D_WIN32_IE=0x0500"
+
+AC_PATH_XTRA
+
+AC_OUTPUT(Makefile
+         vncviewer/Makefile
+	 rfb_win32/Makefile
+)
diff --git a/win/rfb_win32/Makefile.am b/win/rfb_win32/Makefile.am
new file mode 100644
index 0000000..9ba8e4b
--- /dev/null
+++ b/win/rfb_win32/Makefile.am
@@ -0,0 +1,109 @@
+noinst_LTLIBRARIES = librfb_win32.la
+
+HDRS = \
+  AboutDialog.h \
+  BitmapInfo.h \
+  CKeyboard.h \
+  CleanDesktop.h \
+  Clipboard.h \
+  CompatibleBitmap.h \
+  ComputerName.h \
+  CPointer.h \
+  CurrentUser.h \
+  DeviceContext.h \
+  DeviceFrameBuffer.h \
+  Dialog.h \
+  DIBSectionBuffer.h \
+  DynamicFn.h \
+  EventManager.h \
+  FolderManager.h \
+  Handle.h \
+  IconInfo.h \
+  IntervalTimer.h \
+  keymap.h \
+  LaunchProcess.h \
+  ListViewControl.h \
+  LocalMem.h \
+  LogicalPalette.h \
+  LowLevelKeyEvents.h \
+  ModuleFileName.h \
+  MonitorInfo.h \
+  MsgBox.h \
+  MsgWindow.h \
+  OSVersion.h \
+  ProgressControl.h \
+  RegConfig.h \
+  Registry.h \
+  ScaledDIBSectionBuffer.h \
+  SDisplayCoreDriver.h \
+  SDisplayCorePolling.h \
+  SDisplayCoreWMHooks.h \
+  SDisplay.h \
+  Security.h \
+  Service.h \
+  SFileTransferManagerWin32.h \
+  SFileTransferWin32.h \
+  SInput.h \
+  SocketManager.h \
+  TCharArray.h \
+  Threading.h \
+  ToolBar.h \
+  TrayIcon.h \
+  TsSessions.h \
+  Win32Util.h \
+  WMCursor.h \
+  WMHooks.h \
+  WMNotifier.h \
+  WMPoller.h \
+  WMShatter.h \
+  WMWindowCopyRect.h
+
+
+##  CleanDesktop.cxx not built - MinGW does not provide COM
+
+librfb_win32_la_SOURCES = $(HDRS) \
+  AboutDialog.cxx \
+  CKeyboard.cxx \
+  Clipboard.cxx \
+  CPointer.cxx \
+  CurrentUser.cxx \
+  DeviceContext.cxx \
+  DeviceFrameBuffer.cxx \
+  Dialog.cxx \
+  DIBSectionBuffer.cxx \
+  DynamicFn.cxx \
+  EventManager.cxx \
+  FolderManager.cxx \
+  LaunchProcess.cxx \
+  ListViewControl.cxx \
+  LowLevelKeyEvents.cxx \
+  MonitorInfo.cxx \
+  MsgWindow.cxx \
+  OSVersion.cxx \
+  ProgressControl.cxx \
+  RegConfig.cxx \
+  Registry.cxx \
+  ScaledDIBSectionBuffer.cxx \
+  SDisplayCorePolling.cxx \
+  SDisplayCoreWMHooks.cxx \
+  SDisplay.cxx \
+  Security.cxx \
+  Service.cxx \
+  SFileTransferManagerWin32.cxx \
+  SFileTransferWin32.cxx \
+  SInput.cxx \
+  SocketManager.cxx \
+  TCharArray.cxx \
+  Threading.cxx \
+  ToolBar.cxx \
+  TsSessions.cxx \
+  Win32Util.cxx \
+  WMCursor.cxx \
+  WMHooks.cxx \
+  WMNotifier.cxx \
+  WMPoller.cxx \
+  WMShatter.cxx \
+  WMWindowCopyRect.cxx
+
+librfb_win32_la_CPPFLAGS = -I$(top_srcdir) -I$(COMMON_DIR)
+librfb_win32_la_LIBADD =
diff --git a/win/vncviewer/Makefile.am b/win/vncviewer/Makefile.am
new file mode 100644
index 0000000..ff6a6d6
--- /dev/null
+++ b/win/vncviewer/Makefile.am
@@ -0,0 +1,50 @@
+bin_PROGRAMS = vncviewer
+
+HDRS = \
+  CConn.h \
+  CConnOptions.h \
+  CConnThread.h \
+  ConnectingDialog.h \
+  ConnectionDialog.h \
+  DesktopWindow.h \
+  FileTransfer.h \
+  FTBrowseDlg.h \
+  FTDialog.h \
+  FTListView.h \
+  FTProgress.h \
+  InfoDialog.h \
+  ListenServer.h \
+  ListenTrayIcon.h \
+  MRU.h \
+  OptionsDialog.h \
+  resource.h \
+  UserPasswdDialog.h \
+  ViewerToolBar.h 
+
+vncviewer_SOURCES = $(HDRS) \
+  buildTime.cxx \
+  CConn.cxx \
+  CConnOptions.cxx \
+  CConnThread.cxx \
+  ConnectingDialog.cxx \
+  ConnectionDialog.cxx \
+  DesktopWindow.cxx \
+  FileTransfer.cxx \
+  FTBrowseDlg.cxx \
+  FTDialog.cxx \
+  FTListView.cxx \
+  FTProgress.cxx \
+  InfoDialog.cxx \
+  OptionsDialog.cxx \
+  UserPasswdDialog.cxx \
+  ViewerToolBar.cxx \
+  vncviewer.cxx
+
+vncviewer_CPPFLAGS = -I$(COMMON_DIR) -I$(top_srcdir)
+
+vncviewer_LDADD = $(COMMON_DIR)/rfb/librfb.la $(top_srcdir)/rfb_win32/librfb_win32.la $(COMMON_DIR)/Xregion/libXregion.la \
+	$(COMMON_DIR)/network/libnetwork.la $(COMMON_DIR)/rdr/librdr.la -lws2_32 -lgdi32 -luser32 -lcomctl32 -lversion -lcomdlg32
+
+vncviewer_LDFLAGS = -I$(top_srcdir)/win 
+
+