From 61ec323b6a1c4e5a44331014447e3d1d31dc1b6b Mon Sep 17 00:00:00 2001
From: Bill Hoffman <bill.hoffman@kitware.com>
Date: Tue, 7 Aug 2001 15:49:57 -0400
Subject: ENH: compile with broken 720 SGI C++ compiler

---
 Source/cmStandardIncludes.h | 40 ++++++++++++++++++++++++++++++++++++++++
 Source/cmSystemTools.cxx    | 10 ++++++++--
 2 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index 21ca91c..dded33b 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -89,4 +89,44 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #endif
 
 
+// check for the 720 compiler on the SGI
+// which has some strange properties that I don't think are worth
+// checking for in a general way in configure
+#if defined(__sgi) && !defined(__GNUC__)
+#  if   (_COMPILER_VERSION >= 730)
+#   define CM_SGI_CC_730
+#  elif (_COMPILER_VERSION >= 720)
+#   define CM_SGI_CC_720
+#  endif
+#endif
+
+
+# ifdef CM_SGI_CC_720
+// the 720 sgi compiler has std:: but not for the stream library,
+// so we have to bring it into the std namespace by hand.
+namespace std {
+using ::ostream;
+using ::istream;
+using ::ios;
+using ::cout;
+using ::cerr;
+using ::cin;
+using ::ifstream;
+using ::ofstream;
+using ::strstream;
+using ::endl;
+using ::ends;
+using ::flush;
+}
+// The string class is missing these operators so add them
+inline bool operator!=(std::string const& a, const char* b)
+{ return !(a==std::string(b)); }
+
+inline bool operator==(std::string const& a, const char* b)
+{ return (a==std::string(b)); }
+// for scoping is not ISO, so use the for hack
+#define for if(false) {} else for
+
+# endif
+
 #endif
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 136728e..9755aca 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -710,14 +710,20 @@ void cmSystemTools::cmCopyFile(const char* source,
   const int buffer_length = 4096;
   char buffer[buffer_length];
   std::ifstream fin(source,
-                    std::ios::binary | std::ios::in);
+#ifdef _WIN32                    
+                    std::ios::binary | 
+#endif                    
+                    std::ios::in);
   if(!fin)
     {
     cmSystemTools::Error("CopyFile failed to open input file \"",
                          source, "\"");
     }
   std::ofstream fout(destination,
-                     std::ios::binary | std::ios::out | std::ios::trunc);
+#ifdef _WIN32                     
+                     std::ios::binary | 
+#endif                     
+                     std::ios::out | std::ios::trunc);
   if(!fout)
     {
     cmSystemTools::Error("CopyFile failed to open output file \"",
-- 
cgit v0.12