From b5cff36fb7b5e432c423771ef7e41e925eb9d94f Mon Sep 17 00:00:00 2001
From: Bill Hoffman <bill.hoffman@kitware.com>
Date: Thu, 22 Aug 2002 11:38:06 -0400
Subject: [PATCH] BUG: fix for OSF compiler to use ansi mode for streams

---
 Templates/cxxconfigure    | 23 +++++++++++++++++------
 Templates/cxxconfigure.in | 13 ++++++++++++-
 configure                 | 24 ++++++++++++++++++------
 configure.in              | 14 +++++++++++++-
 4 files changed, 60 insertions(+), 14 deletions(-)

diff --git a/Templates/cxxconfigure b/Templates/cxxconfigure
index f9c47fad40..c6045561ca 100755
--- a/Templates/cxxconfigure
+++ b/Templates/cxxconfigure
@@ -738,7 +738,18 @@ case $system in
           echo "$ac_t""no" 1>&6
         fi
         rm -f conftest*
-	;;  
+	;;      
+     OSF1-*)
+        echo $ac_n "checking whether ${CXX} accepts -std strict_ansi""... $ac_c" 1>&6
+        echo 'void f(){}' > conftest.c
+        if test -z "`${CXX} -std strict_ansi -c conftest.c 2>&1`"; then
+          echo "$ac_t""yes" 1>&6
+          CMAKE_ANSI_CXXFLAGS="-std strict_ansi"
+        else
+          echo "$ac_t""no" 1>&6
+        fi
+        rm -f conftest*
+        ;;
 esac
 fi
 
@@ -764,7 +775,7 @@ fi
 # ansi stream files (without the .h)
 if test $ac_cv_prog_gxx = no; then
   echo $ac_n "checking ansi standard C++ stream headers ""... $ac_c" 1>&6
-echo "configure:768: checking ansi standard C++ stream headers " >&5 
+echo "configure:779: checking ansi standard C++ stream headers " >&5 
   rm -rf conftest.*
   cat > conftest.cc <<!
 #include <iostream>
@@ -780,7 +791,7 @@ fi
 
 # check compilers to see if they have std::stringstream
 echo $ac_n "checking for ansi standard C++ stringstream ""... $ac_c" 1>&6
-echo "configure:784: checking for ansi standard C++ stringstream " >&5 
+echo "configure:795: checking for ansi standard C++ stringstream " >&5 
 rm -rf conftest.*
 cat > conftest.cc <<!
 #include <sstream>
@@ -796,7 +807,7 @@ fi
 # check to see if stl is in the std namespace
 if test $ac_cv_prog_gxx = no; then
   echo $ac_n "checking ansi standard namespace support ""... $ac_c" 1>&6
-echo "configure:800: checking ansi standard namespace support " >&5 
+echo "configure:811: checking ansi standard namespace support " >&5 
   rm -rf conftest.*
   cat > conftest.cc <<!
 #include <list>
@@ -814,7 +825,7 @@ fi
 # check to see if for scoping is supported
 if test $ac_cv_prog_gxx = no; then
   echo $ac_n "checking ansi for scope support ""... $ac_c" 1>&6
-echo "configure:818: checking ansi for scope support " >&5 
+echo "configure:829: checking ansi for scope support " >&5 
   rm -rf conftest.*
   cat > conftest.cc <<!
 void foo() { for(int i;;); for(int i;;); }
@@ -835,7 +846,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:839: checking for $ac_word" >&5
+echo "configure:850: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_CMAKE_AR_TMP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
diff --git a/Templates/cxxconfigure.in b/Templates/cxxconfigure.in
index 9aafc86c9b..e23d4da37c 100644
--- a/Templates/cxxconfigure.in
+++ b/Templates/cxxconfigure.in
@@ -74,7 +74,18 @@ case $system in
           echo "$ac_t""no" 1>&6
         fi
         rm -f conftest*
-	;;  
+	;;      
+     OSF1-*)
+        echo $ac_n "checking whether ${CXX} accepts -std strict_ansi""... $ac_c" 1>&6
+        echo 'void f(){}' > conftest.c
+        if test -z "`${CXX} -std strict_ansi -c conftest.c 2>&1`"; then
+          echo "$ac_t""yes" 1>&6
+          CMAKE_ANSI_CXXFLAGS="-std strict_ansi"
+        else
+          echo "$ac_t""no" 1>&6
+        fi
+        rm -f conftest*
+        ;;
 esac
 fi
 AC_SUBST(CMAKE_ANSI_CXXFLAGS)
diff --git a/configure b/configure
index 241b6cda32..050c6817cb 100755
--- a/configure
+++ b/configure
@@ -972,7 +972,19 @@ case $system in
           echo "$ac_t""no" 1>&6
         fi
         rm -f conftest*
-	;;  
+	;;     
+     OSF1-*)
+        echo $ac_n "checking whether ${CXX} accepts -std strict_ansi""... $ac_c" 1>&6
+        echo 'void f(){}' > conftest.c
+        if test -z "`${CXX} -std strict_ansi -c conftest.c 2>&1`"; then
+          echo "$ac_t""yes" 1>&6
+          CMAKE_ANSI_CXXFLAGS="-std strict_ansi"
+        else
+          echo "$ac_t""no" 1>&6
+        fi
+        rm -f conftest*
+        ;;  
+
 esac
 fi
 
@@ -982,7 +994,7 @@ fi
 # ansi stream files (without the .h)
 if test $ac_cv_prog_gxx = no; then
   echo $ac_n "checking ansi standard C++ stream headers ""... $ac_c" 1>&6
-echo "configure:986: checking ansi standard C++ stream headers " >&5 
+echo "configure:998: checking ansi standard C++ stream headers " >&5 
   rm -rf conftest.*
   cat > conftest.cc <<!
 #include <iostream>
@@ -1000,7 +1012,7 @@ fi
 
 # check non-g++ compilers to see if they have std::stringstream
 echo $ac_n "checking for ansi standard C++ stringstream ""... $ac_c" 1>&6
-echo "configure:1004: checking for ansi standard C++ stringstream " >&5 
+echo "configure:1016: checking for ansi standard C++ stringstream " >&5 
 rm -rf conftest.*
 cat > conftest.cc <<!
 #include <sstream>
@@ -1018,7 +1030,7 @@ fi
 # check to see if stl is in the std namespace
 if test $ac_cv_prog_gxx = no; then
   echo $ac_n "checking ansi standard namespace support ""... $ac_c" 1>&6
-echo "configure:1022: checking ansi standard namespace support " >&5 
+echo "configure:1034: checking ansi standard namespace support " >&5 
   rm -rf conftest.*
   cat > conftest.cc <<!
 #include <list>
@@ -1038,7 +1050,7 @@ fi
 # check to see if for scoping is supported
 if test $ac_cv_prog_gxx = no; then
   echo $ac_n "checking ansi for scope support ""... $ac_c" 1>&6
-echo "configure:1042: checking ansi for scope support " >&5 
+echo "configure:1054: checking ansi for scope support " >&5 
   rm -rf conftest.*
   cat > conftest.cc <<!
 void foo() { for(int i;;); for(int i;;); }
@@ -1060,7 +1072,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1064: checking for $ac_word" >&5
+echo "configure:1076: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_RUNMAKE'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
diff --git a/configure.in b/configure.in
index 5b084e2271..a464534eb7 100644
--- a/configure.in
+++ b/configure.in
@@ -87,7 +87,19 @@ case $system in
           echo "$ac_t""no" 1>&6
         fi
         rm -f conftest*
-	;;  
+	;;     
+     OSF1-*)
+        echo $ac_n "checking whether ${CXX} accepts -std strict_ansi""... $ac_c" 1>&6
+        echo 'void f(){}' > conftest.c
+        if test -z "`${CXX} -std strict_ansi -c conftest.c 2>&1`"; then
+          echo "$ac_t""yes" 1>&6
+          CMAKE_ANSI_CXXFLAGS="-std strict_ansi"
+        else
+          echo "$ac_t""no" 1>&6
+        fi
+        rm -f conftest*
+        ;;  
+
 esac
 fi
 AC_SUBST(CMAKE_ANSI_CFLAGS)
-- 
GitLab