From f6f6568adfdafc8fe522c065c4bdeff106f93f90 Mon Sep 17 00:00:00 2001
From: Volker Ruppert <Volker.Ruppert@t-online.de>
Date: Wed, 11 Aug 2004 11:09:01 +0000
Subject: [PATCH] - configure / compile fixes for Solaris SunPro (patch from
 Robin Kay)

---
 bochs/CHANGES          |  2 ++
 bochs/configure        | 66 ++++++++++++++++++++++--------------------
 bochs/configure.in     |  8 +++--
 bochs/iodev/harddrv.cc |  6 ++--
 bochs/iodev/sb16.h     |  4 ++-
 bochs/iodev/vmware3.h  |  2 ++
 bochs/plugin.cc        |  6 ++--
 7 files changed, 55 insertions(+), 39 deletions(-)

diff --git a/bochs/CHANGES b/bochs/CHANGES
index a3d9b07af..edd118dcd 100644
--- a/bochs/CHANGES
+++ b/bochs/CHANGES
@@ -50,6 +50,7 @@ Changes to next release:
   - serial
     - multiple serial port support added (4 ports now available)
     - partial raw serial support on win32 (transmit data)
+    - serial port i/o mode option added (modes: null, file, term, raw)
   - parallel
     - multiple parallel port support added (2 ports now available)
   - vga
@@ -88,6 +89,7 @@ Changes to next release:
   - --enable-ignore-bad-msr (ignore bad MSR references) option is enabled 
     by default
   - --enable-mmx enabled by default only if cpu-level > 4
+  - fixes for Solaris SunPro (Robin Kay)
 
 - SF patches applied
   [894595] MSR_APICBASE always returns APIC ADDRESS 0 by Kangmo Kim
diff --git a/bochs/configure b/bochs/configure
index 2da5870f9..3929f3ec1 100755
--- a/bochs/configure
+++ b/bochs/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Id: configure.in,v 1.255 2004/06/09 20:55:57 vruppert Exp .
+# From configure.in Id: configure.in,v 1.259 2004/08/11 11:05:10 vruppert Exp .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.57.
 #
@@ -1708,6 +1708,10 @@ case "$target" in
   *-amigaos* | *-morphos*)
     DEFAULT_GUI=amigaos               # amigaos or morphos defaults to amigaos gui
     ;;
+  *-solaris*)
+    ADD_FLAGS="-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__"      # required for correct function prototypes
+    DEFAULT_GUI=x11
+    ;;
   *)
     DEFAULT_GUI=x11
     ;;
@@ -1715,7 +1719,7 @@ esac
 if test "${ADD_FLAGS:+set}" = set; then
       CFLAGS="$CFLAGS $ADD_FLAGS"
       CXXFLAGS="$CXXFLAGS $ADD_FLAGS"
-	  CPPFLAGS="$CPPFLAGS $ADD_FLAGS"
+      CPPFLAGS="$CPPFLAGS $ADD_FLAGS"
 fi
 
 echo "$as_me:$LINENO: checking for standard CFLAGS on this platform" >&5
@@ -3533,7 +3537,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 3536 "configure"' > conftest.$ac_ext
+  echo '#line 3540 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -4608,7 +4612,7 @@ fi
 
 
 # Provide some information about the compiler.
-echo "$as_me:4611:" \
+echo "$as_me:4615:" \
      "checking for Fortran 77 compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -5624,11 +5628,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:5627: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:5631: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:5631: \$? = $ac_status" >&5
+   echo "$as_me:5635: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -5857,11 +5861,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:5860: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:5864: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:5864: \$? = $ac_status" >&5
+   echo "$as_me:5868: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -5924,11 +5928,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:5927: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:5931: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:5931: \$? = $ac_status" >&5
+   echo "$as_me:5935: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -7984,7 +7988,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 7987 "configure"
+#line 7991 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -8082,7 +8086,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 8085 "configure"
+#line 8089 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10241,11 +10245,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:10244: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:10248: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:10248: \$? = $ac_status" >&5
+   echo "$as_me:10252: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -10308,11 +10312,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:10311: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:10315: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:10315: \$? = $ac_status" >&5
+   echo "$as_me:10319: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -11565,7 +11569,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 11568 "configure"
+#line 11572 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11663,7 +11667,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 11666 "configure"
+#line 11670 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12486,11 +12490,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12489: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12493: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:12493: \$? = $ac_status" >&5
+   echo "$as_me:12497: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -12553,11 +12557,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12556: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12560: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:12560: \$? = $ac_status" >&5
+   echo "$as_me:12564: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -14547,11 +14551,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14550: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14554: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14554: \$? = $ac_status" >&5
+   echo "$as_me:14558: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -14780,11 +14784,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14783: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14787: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14787: \$? = $ac_status" >&5
+   echo "$as_me:14791: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -14847,11 +14851,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14850: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14854: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14854: \$? = $ac_status" >&5
+   echo "$as_me:14858: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -16907,7 +16911,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 16910 "configure"
+#line 16914 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17005,7 +17009,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 17008 "configure"
+#line 17012 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19162,7 +19166,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 19165 "configure"
+#line 19169 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/bochs/configure.in b/bochs/configure.in
index aa8220c57..99458e186 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.258 2004-08-06 15:49:52 vruppert Exp $]])
+AC_REVISION([[$Id: configure.in,v 1.259 2004-08-11 11:05:10 vruppert Exp $]])
 AC_CONFIG_HEADER(config.h)
 AC_CONFIG_HEADER(ltdlconf.h)
 
@@ -73,6 +73,10 @@ case "$target" in
   *-amigaos* | *-morphos*)
     DEFAULT_GUI=amigaos               # amigaos or morphos defaults to amigaos gui
     ;;
+  *-solaris*)
+    ADD_FLAGS="-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__"      # required for correct function prototypes
+    DEFAULT_GUI=x11
+    ;;
   *)
     DEFAULT_GUI=x11
     ;;
@@ -80,7 +84,7 @@ esac
 if test "${ADD_FLAGS:+set}" = set; then
       CFLAGS="$CFLAGS $ADD_FLAGS"
       CXXFLAGS="$CXXFLAGS $ADD_FLAGS"
-	  CPPFLAGS="$CPPFLAGS $ADD_FLAGS"
+      CPPFLAGS="$CPPFLAGS $ADD_FLAGS"
 fi
 
 AC_MSG_CHECKING(for standard CFLAGS on this platform)
diff --git a/bochs/iodev/harddrv.cc b/bochs/iodev/harddrv.cc
index 254f9c5c0..a1a36528e 100644
--- a/bochs/iodev/harddrv.cc
+++ b/bochs/iodev/harddrv.cc
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////
-// $Id: harddrv.cc,v 1.121 2004-06-19 15:20:12 sshwarts Exp $
+// $Id: harddrv.cc,v 1.122 2004-08-11 11:05:11 vruppert Exp $
 /////////////////////////////////////////////////////////////////////////
 //
 //  Copyright (C) 2002  MandrakeSoft S.A.
@@ -161,7 +161,7 @@ bx_hard_drive_c::init(void)
   char  string[5];
   char  sbtext[8];
 
-  BX_DEBUG(("Init $Id: harddrv.cc,v 1.121 2004-06-19 15:20:12 sshwarts Exp $"));
+  BX_DEBUG(("Init $Id: harddrv.cc,v 1.122 2004-08-11 11:05:11 vruppert Exp $"));
 
   for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
     if (bx_options.ata[channel].Opresent->get() == 1) {
@@ -3730,7 +3730,7 @@ inline off_t sparse_image_t::get_physical_offset()
  return physical_offset;
 }
 
-inline void sparse_image_t::set_virtual_page(uint32 new_virtual_page)
+void sparse_image_t::set_virtual_page(uint32 new_virtual_page)
 {
  position_virtual_page = new_virtual_page;
 
diff --git a/bochs/iodev/sb16.h b/bochs/iodev/sb16.h
index e7000f180..99695a50c 100644
--- a/bochs/iodev/sb16.h
+++ b/bochs/iodev/sb16.h
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////
-// $Id: sb16.h,v 1.17 2004-02-09 22:23:48 danielg4 Exp $
+// $Id: sb16.h,v 1.18 2004-08-11 11:05:11 vruppert Exp $
 /////////////////////////////////////////////////////////////////////////
 //
 //  Copyright (C) 2001  MandrakeSoft S.A.
@@ -258,6 +258,8 @@ private:
   enum bx_sb16_fm_mode {single, adlib, dual, opl3, fminit};
 
   // the variables common to all FM emulations
+  struct bx_sb16_opl_struct;
+  friend struct bx_sb16_opl_struct;
   struct bx_sb16_opl_struct {
     bx_sb16_fm_mode mode;
     // modes: single: one OPL2 (OPL3 disabled), 
diff --git a/bochs/iodev/vmware3.h b/bochs/iodev/vmware3.h
index a0685a86e..02ed24c16 100644
--- a/bochs/iodev/vmware3.h
+++ b/bochs/iodev/vmware3.h
@@ -85,6 +85,8 @@ class vmware3_image_t : public device_image_t
 #pragma options align=reset
 #endif
 
+      struct COW_Image;
+      friend struct COW_Image;
       struct COW_Image {
           int fd;
           COW_Header header;
diff --git a/bochs/plugin.cc b/bochs/plugin.cc
index a40d5244e..6654013b3 100644
--- a/bochs/plugin.cc
+++ b/bochs/plugin.cc
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////
-// $Id: plugin.cc,v 1.12 2004-07-06 19:59:10 vruppert Exp $
+// $Id: plugin.cc,v 1.13 2004-08-11 11:05:10 vruppert Exp $
 /////////////////////////////////////////////////////////////////////////
 //
 // This file defines the plugin and plugin-device registration functions and
@@ -28,7 +28,7 @@
 #define PLUGIN_FILENAME_FORMAT "bx_%s.dll"
 #endif
 
-
+extern "C" {
 
 void  (*pluginRegisterIRQ)(unsigned irq, const char* name) = 0;
 void  (*pluginUnregisterIRQ)(unsigned irq, const char* name) = 0;
@@ -632,3 +632,5 @@ void bx_reset_plugins(unsigned signal)
       }
     }
 }
+
+}