From 91ac899439fb6c65d3ec7af8c81d88a49dc40836 Mon Sep 17 00:00:00 2001
From: Volker Ruppert <Volker.Ruppert@t-online.de>
Date: Wed, 18 Aug 2004 11:52:25 +0000
Subject: [PATCH] - applied SF patch #867045 from m_suzu_abc@yahoo.co.jp   *
 fixed compiler errors to build on VC++   * removed /GX from CXXFLAGS since
 C++ exception is not used

---
 bochs/.conf.win32-vcpp |  6 +++++-
 bochs/CHANGES          |  1 +
 bochs/configure        | 18 +++++++++++++++---
 bochs/configure.in     | 18 +++++++++++++++---
 4 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/bochs/.conf.win32-vcpp b/bochs/.conf.win32-vcpp
index 47b5d1ac8..a11272037 100755
--- a/bochs/.conf.win32-vcpp
+++ b/bochs/.conf.win32-vcpp
@@ -2,6 +2,9 @@
 
 set echo
 
+export CC=cl
+export CXX=cl
+
 #./configure --with-win32-vcpp --enable-port-e9-hack
 #./configure --with-win32-vcpp --enable-debugger --enable-disasm --enable-instrumentation="instrument/example0"
 #./configure --with-win32-vcpp --enable-debugger --enable-disasm
@@ -13,7 +16,8 @@ set echo
 	    --enable-vbe \
 	    --enable-all-optimizations \
 	    --disable-readline \
-	    --enable-sb16=win
+	    --enable-sb16=win \
+	    --without-x
 
 unset echo
 
diff --git a/bochs/CHANGES b/bochs/CHANGES
index e36813bb9..4d9401960 100644
--- a/bochs/CHANGES
+++ b/bochs/CHANGES
@@ -108,6 +108,7 @@ Changes to next release:
   [950905] Do not PANIC on rare, bad input from user-mode by h.johansson
   [924428] ET bit mismatch between CR0 and MSW
   [869822] a real SVGA implementation by m_suzu
+  [867045] fix for compiler errors on VC++ by m_suzu
 
 - these S.F. bugs were closed 
   #522111 Host os SIGILL, booting grub from hd
diff --git a/bochs/configure b/bochs/configure
index 60f8a0907..7556c9347 100755
--- a/bochs/configure
+++ b/bochs/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Id: configure.in,v 1.260 2004/08/16 08:02:14 vruppert Exp .
+# From configure.in Id: configure.in,v 1.261 2004/08/18 11:48:56 vruppert Exp .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.57.
 #
@@ -34116,7 +34116,14 @@ _ACEOF
 
          echo "$as_me:$LINENO: result: win" >&5
 echo "${ECHO_T}win" >&6
+         case $target in
+           *-pc-windows*)
+                 DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS winmm.lib"
+                 ;;
+           *)
 		 DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS -lwinmm"
+                 ;;
+         esac
          ;;
        osx)
          SOUNDLOW_OBJS='soundosx.o'
@@ -35078,7 +35085,7 @@ _ACEOF
     CXX="$CC"
     #C_OPT="/Zi"   # for debugging
     C_OPT="/Ox"   # optimize for speed
-    CFLAGS="/nologo /G6 /MT /W3 /GX /DNDEBUG /DWIN32 /D_WINDOWS $C_OPT"
+    CFLAGS="/nologo /G6 /MT /W3 /GX- /DNDEBUG /DWIN32 /D_WINDOWS $C_OPT"
     CXXFLAGS="$CFLAGS"
     DASH="/"
     SLASH="\\"
@@ -35751,7 +35758,12 @@ fi
 if test "$with_rfb" = yes; then
   # we need the socket function
   case $target in
-    *-pc-windows* | *-pc-winnt* | *-pc-cygwin* | *-pc-mingw32*)
+    *-pc-windows*)
+      # is this okay without a check ?
+      RFB_LIBS="$RFB_LIBS wsock32.lib"
+      have_socket=yes
+      ;;
+    *-pc-winnt* | *-pc-cygwin* | *-pc-mingw32*)
       # is this okay without a check ?
       RFB_LIBS="$RFB_LIBS -lwsock32"
       have_socket=yes
diff --git a/bochs/configure.in b/bochs/configure.in
index 56238203b..94f6efc78 100644
--- a/bochs/configure.in
+++ b/bochs/configure.in
@@ -2,7 +2,7 @@ dnl // Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.50)
 AC_INIT(bochs.h)
-AC_REVISION([[$Id: configure.in,v 1.260 2004-08-16 08:02:14 vruppert Exp $]])
+AC_REVISION([[$Id: configure.in,v 1.261 2004-08-18 11:48:56 vruppert Exp $]])
 AC_CONFIG_HEADER(config.h)
 AC_CONFIG_HEADER(ltdlconf.h)
 
@@ -1751,7 +1751,14 @@ AC_ARG_ENABLE(sb16,
          SOUNDLOW_OBJS='soundwin.o'
          AC_DEFINE(BX_SOUND_OUTPUT_C, bx_sound_windows_c)
          AC_MSG_RESULT(win)
+         case $target in
+           *-pc-windows*)
+                 DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS winmm.lib"
+                 ;;
+           *)
 		 DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS -lwinmm"
+                 ;;
+         esac
          ;;
        osx)
          SOUNDLOW_OBJS='soundosx.o'
@@ -2296,7 +2303,7 @@ case "$target" in
     CXX="$CC"
     #C_OPT="/Zi"   # for debugging
     C_OPT="/Ox"   # optimize for speed
-    CFLAGS="/nologo /G6 /MT /W3 /GX /DNDEBUG /DWIN32 /D_WINDOWS $C_OPT"
+    CFLAGS="/nologo /G6 /MT /W3 /GX- /DNDEBUG /DWIN32 /D_WINDOWS $C_OPT"
     CXXFLAGS="$CFLAGS"
     DASH="/"
     SLASH="\\"
@@ -2381,7 +2388,12 @@ fi
 if test "$with_rfb" = yes; then
   # we need the socket function
   case $target in
-    *-pc-windows* | *-pc-winnt* | *-pc-cygwin* | *-pc-mingw32*)
+    *-pc-windows*)
+      # is this okay without a check ?
+      RFB_LIBS="$RFB_LIBS wsock32.lib"
+      have_socket=yes
+      ;;
+    *-pc-winnt* | *-pc-cygwin* | *-pc-mingw32*)
       # is this okay without a check ?
       RFB_LIBS="$RFB_LIBS -lwsock32"
       have_socket=yes