Selaa lähdekoodia

ENH: Improved configure test implementations by using AC_TRY_COMPILE.

Brad King 23 vuotta sitten
vanhempi
sitoutus
2905892334
6 muutettua tiedostoa jossa 1077 lisäystä ja 452 poistoa
  1. 176 124
      Templates/cconfigure
  2. 25 16
      Templates/cconfigure.in
  3. 359 81
      Templates/cxxconfigure
  4. 122 80
      Templates/cxxconfigure.in
  5. 291 78
      configure
  6. 104 73
      configure.in

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 176 - 124
Templates/cconfigure


+ 25 - 16
Templates/cconfigure.in

@@ -595,22 +595,31 @@ CMAKE_ANSI_CFLAGS=""
 if test $ac_cv_prog_gcc = no; then
 case $system in
     HP-UX-*)
-        echo $ac_n "checking whether ${CC} accepts -Aa""... $ac_c" 1>&6
-        echo 'void f(){}' > conftest.c
-        if test -z "`${CC} -Aa -c conftest.c 2>&1`"; then
-          echo "$ac_t""yes" 1>&6
-          CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Aa"
-        else
-          echo "$ac_t""no" 1>&6
-        fi
-        echo $ac_n "checking whether ${CC} accepts -Ae""... $ac_c" 1>&6
-        if test -z "`${CC} -Ae -c conftest.c 2>&1`"; then
-          echo "$ac_t""yes" 1>&6
-          CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Ae"
-        else
-          echo "$ac_t""no" 1>&6
-        fi
-        rm -f conftest*
+        CFLAGS_ORIG="$FLAGS"
+        CFLAGS="-Aa $CFLAGS"
+        AC_MSG_CHECKING([whether ${CC} accepts -Aa])
+        AC_TRY_COMPILE([
+        void foo() {}
+        ],,[
+        AC_MSG_RESULT(yes)
+        CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Aa"
+        ],[
+        AC_MSG_RESULT(no)
+        ])
+        CFLAGS="$CFLAGS_ORIG"
+
+        CFLAGS_ORIG="$FLAGS"
+        CFLAGS="-Ae $CFLAGS"
+        AC_MSG_CHECKING([whether ${CC} accepts -Ae])
+        AC_TRY_COMPILE([
+        void foo() {}
+        ],,[
+        AC_MSG_RESULT(yes)
+        CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Ae"
+        ],[
+        AC_MSG_RESULT(no)
+        ])
+        CFLAGS="$CFLAGS_ORIG"
 	;;   
 esac
 fi

+ 359 - 81
Templates/cxxconfigure

@@ -705,16 +705,53 @@ CXXFLAGS=$save_CXXFLAGS
 
 CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION=""
 if test $ac_cv_prog_gxx = no; then
-    echo $ac_n "checking whether ${CXX} supports explicit instantiation""... $ac_c" 1>&6
-  echo 'template<class T>class x{};template class x<int>;' > conftest.cc
-  if test -z "`${CXX} -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-  else
-    echo "$ac_t""no" 1>&6
-    CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION="1"
-  fi
-  rm -f conftest*
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
+  echo $ac_n "checking whether ${CXX} supports explicit instantiation""... $ac_c" 1>&6
+echo "configure:712: checking whether ${CXX} supports explicit instantiation" >&5
+  
+  ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+  cat > conftest.$ac_ext <<EOF
+#line 722 "configure"
+#include "confdefs.h"
+
+  template<class T>class x{};template class x<int>;
+  
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+  echo "$ac_t""yes" 1>&6
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+  CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION=1
+  echo "$ac_t""no" 1>&6
+  
+fi
+rm -f conftest*
+  ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+  CXXFLAGS="$CXXFLAGS_ORIG"
 fi
+
 # if running on darwin no explicit template instantiations even though
 # syntax is supported.
 case $system in 
@@ -729,27 +766,100 @@ CMAKE_ANSI_CXXFLAGS=""
 if test $ac_cv_prog_gxx = no; then
 case $system in
      IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
+        CXXFLAGS_ORIG="$CXXFLAGS"
+        CXXFLAGS="-LANG:std $CXXFLAGS"
         echo $ac_n "checking whether ${CXX} accepts -LANG:std""... $ac_c" 1>&6
-        echo 'void f(){}' > conftest.c
-        if test -z "`${CXX} -LANG:std -c conftest.c 2>&1`"; then
-          echo "$ac_t""yes" 1>&6
-	  CMAKE_ANSI_CXXFLAGS="-LANG:std"
-        else
-          echo "$ac_t""no" 1>&6
-        fi
-        rm -f conftest*
+echo "configure:773: checking whether ${CXX} accepts -LANG:std" >&5
+        
+        ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+        cat > conftest.$ac_ext <<EOF
+#line 783 "configure"
+#include "confdefs.h"
+
+        void foo() {}
+        
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:792: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+        echo "$ac_t""yes" 1>&6
+        CMAKE_ANSI_CXXFLAGS="-LANG:std"
+        
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+        echo "$ac_t""no" 1>&6
+        
+fi
+rm -f conftest*
+        ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+        CXXFLAGS="$CXXFLAGS_ORIG"
 	;;      
      OSF1-*)
+
+        CXXFLAGS_ORIG="$CXXFLAGS"
+        CXXFLAGS="-std strict_ansi -nopure_cname $CXXFLAGS"
         echo $ac_n "checking whether ${CXX} accepts -std strict_ansi -nopure_cname""... $ac_c" 1>&6
-        echo 'void f(){}' > conftest.c
-        if test -z "`${CXX} -std strict_ansi -nopure_cname -c conftest.c 2>&1`"; then
-          echo "$ac_t""yes" 1>&6
-          CMAKE_ANSI_CXXFLAGS="-std strict_ansi -nopure_cname"
-        else
-          echo "$ac_t""no" 1>&6
-        fi
-        rm -f conftest*
-        ;;
+echo "configure:821: checking whether ${CXX} accepts -std strict_ansi -nopure_cname" >&5
+        
+        ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+        cat > conftest.$ac_ext <<EOF
+#line 831 "configure"
+#include "confdefs.h"
+
+        void foo() {}
+        
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+        echo "$ac_t""yes" 1>&6
+        CMAKE_ANSI_CXXFLAGS="-std strict_ansi -nopure_cname"
+        
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+        echo "$ac_t""no" 1>&6
+        
+fi
+rm -f conftest*
+        ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+        CXXFLAGS="$CXXFLAGS_ORIG"
+	;;      
 esac
 fi
 
@@ -758,15 +868,51 @@ fi
 # to get the templates compiled correctly
 CMAKE_TEMPLATE_FLAGS=""
 if test $ac_cv_prog_gxx = no; then
-    echo $ac_n "checking whether ${CXX} accepts -ptused -no_prelink""... $ac_c" 1>&6
-  echo 'void f(){}' > conftest.cc
-  if test -z "`${CXX} -ptused -no_prelink -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-    CMAKE_TEMPLATE_FLAGS="-ptused -no_prelink"
-  else
-    echo "$ac_t""no" 1>&6
-  fi
-  rm -f conftest*
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS -ptused -no_prelink"
+  echo $ac_n "checking whether ${CXX} accepts -ptused -no_prelink""... $ac_c" 1>&6
+echo "configure:875: checking whether ${CXX} accepts -ptused -no_prelink" >&5
+  
+  ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+  cat > conftest.$ac_ext <<EOF
+#line 885 "configure"
+#include "confdefs.h"
+
+  void foo() {}
+  
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+  echo "$ac_t""yes" 1>&6
+  CMAKE_TEMPLATE_FLAGS="-ptused -no_prelink"
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+  echo "$ac_t""no" 1>&6
+  
+fi
+rm -f conftest*
+  ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+  CXXFLAGS="$CXXFLAGS_ORIG"
 fi
 
 
@@ -774,68 +920,200 @@ fi
 # check non-g++ compilers to see if they have the standard 
 # ansi stream files (without the .h)
 if test $ac_cv_prog_gxx = no; then
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
   echo $ac_n "checking ansi standard C++ stream headers ""... $ac_c" 1>&6
-echo "configure:779: checking ansi standard C++ stream headers " >&5 
-  rm -rf conftest.*
-  cat > conftest.cc <<!
-#include <iostream>
-!
-  if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-  else
-    CMAKE_NO_ANSI_STREAM_HEADERS="1"
-    echo "$ac_t""no" 1>&6
-  fi
+echo "configure:927: checking ansi standard C++ stream headers " >&5 
+  
+  ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+  cat > conftest.$ac_ext <<EOF
+#line 937 "configure"
+#include "confdefs.h"
+
+  #include <iostream>
+  
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:946: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+  echo "$ac_t""yes" 1>&6
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+  CMAKE_NO_ANSI_STREAM_HEADERS=1
+  echo "$ac_t""no" 1>&6
+  
+fi
+rm -f conftest*
+  ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+  CXXFLAGS="$CXXFLAGS_ORIG"
 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:795: checking for ansi standard C++ stringstream " >&5 
-rm -rf conftest.*
-cat > conftest.cc <<!
+CXXFLAGS_ORIG="$CXXFLAGS"
+CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
+echo $ac_n "checking for ansi standard C++ stringstream""... $ac_c" 1>&6
+echo "configure:976: checking for ansi standard C++ stringstream" >&5
+
+ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+cat > conftest.$ac_ext <<EOF
+#line 986 "configure"
+#include "confdefs.h"
+
 #include <sstream>
-!
-if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
-  echo "$ac_t""yes" 1>&6
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:995: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+echo "$ac_t""yes" 1>&6
+
 else
-  CMAKE_NO_ANSI_STRING_STREAM="1"
-  echo "$ac_t""no" 1>&6
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+CMAKE_NO_ANSI_STRING_STREAM=1
+echo "$ac_t""no" 1>&6
+
 fi
+rm -f conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+CXXFLAGS="$CXXFLAGS_ORIG"
 
 
 # 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:811: checking ansi standard namespace support " >&5 
-  rm -rf conftest.*
-  cat > conftest.cc <<!
-#include <list>
-void foo() { std::list<int> l; }
-!
-  if test -z "`${CXX}  ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-  else
-    CMAKE_NO_STD_NAMESPACE="1"
-    echo "$ac_t""no" 1>&6
-  fi
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
+  echo $ac_n "checking whether the std namespace is supported""... $ac_c" 1>&6
+echo "configure:1025: checking whether the std namespace is supported" >&5
+  
+  ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+  cat > conftest.$ac_ext <<EOF
+#line 1035 "configure"
+#include "confdefs.h"
+
+  #include <list>
+  void foo() { std::list<int>(); }
+  
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1045: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+  echo "$ac_t""yes" 1>&6
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+  CMAKE_NO_STD_NAMESPACE=1
+  echo "$ac_t""no" 1>&6
+  
+fi
+rm -f conftest*
+  ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+  CXXFLAGS="$CXXFLAGS_ORIG"
 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:829: checking ansi for scope support " >&5 
-  rm -rf conftest.*
-  cat > conftest.cc <<!
-void foo() { for(int i;;); for(int i;;); }
-!
-  if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-  else
-    CMAKE_NO_ANSI_FOR_SCOPE="1"
-    echo "$ac_t""no" 1>&6
-  fi
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
+  echo $ac_n "checking ansi for scope support""... $ac_c" 1>&6
+echo "configure:1076: checking ansi for scope support" >&5
+  
+  ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+  cat > conftest.$ac_ext <<EOF
+#line 1086 "configure"
+#include "confdefs.h"
+
+  void foo() { for(int i;;); for(int i;;); }
+  
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+  echo "$ac_t""yes" 1>&6
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+  CMAKE_NO_ANSI_FOR_SCOPE=1
+  echo "$ac_t""no" 1>&6
+  
+fi
+rm -f conftest*
+  ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+  CXXFLAGS="$CXXFLAGS_ORIG"
 fi
 
 
@@ -846,7 +1124,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:850: checking for $ac_word" >&5
+echo "configure:1128: 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

+ 122 - 80
Templates/cxxconfigure.in

@@ -41,16 +41,23 @@ CXXFLAGS=$save_CXXFLAGS
 
 CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION=""
 if test $ac_cv_prog_gxx = no; then
-    echo $ac_n "checking whether ${CXX} supports explicit instantiation""... $ac_c" 1>&6
-  echo 'template<class T>class x{};template class x<int>;' > conftest.cc
-  if test -z "`${CXX} -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-  else
-    echo "$ac_t""no" 1>&6
-    CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION="1"
-  fi
-  rm -f conftest*
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
+  AC_MSG_CHECKING([whether ${CXX} supports explicit instantiation])
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([
+  template<class T>class x{};template class x<int>;
+  ],,[
+  AC_MSG_RESULT(yes)
+  ],[
+  CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION=1
+  AC_MSG_RESULT(no)
+  ])
+  AC_LANG_RESTORE
+  CXXFLAGS="$CXXFLAGS_ORIG"
 fi
+
 # if running on darwin no explicit template instantiations even though
 # syntax is supported.
 case $system in 
@@ -65,27 +72,40 @@ CMAKE_ANSI_CXXFLAGS=""
 if test $ac_cv_prog_gxx = no; then
 case $system in
      IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
-        echo $ac_n "checking whether ${CXX} accepts -LANG:std""... $ac_c" 1>&6
-        echo 'void f(){}' > conftest.c
-        if test -z "`${CXX} -LANG:std -c conftest.c 2>&1`"; then
-          echo "$ac_t""yes" 1>&6
-	  CMAKE_ANSI_CXXFLAGS="-LANG:std"
-        else
-          echo "$ac_t""no" 1>&6
-        fi
-        rm -f conftest*
+        CXXFLAGS_ORIG="$CXXFLAGS"
+        CXXFLAGS="-LANG:std $CXXFLAGS"
+        AC_MSG_CHECKING([whether ${CXX} accepts -LANG:std])
+        AC_LANG_SAVE
+        AC_LANG_CPLUSPLUS
+        AC_TRY_COMPILE([
+        void foo() {}
+        ],,[
+        AC_MSG_RESULT(yes)
+        CMAKE_ANSI_CXXFLAGS="-LANG:std"
+        ],[
+        AC_MSG_RESULT(no)
+        ])
+        AC_LANG_RESTORE
+        CXXFLAGS="$CXXFLAGS_ORIG"
 	;;      
      OSF1-*)
-        echo $ac_n "checking whether ${CXX} accepts -std strict_ansi -nopure_cname""... $ac_c" 1>&6
-        echo 'void f(){}' > conftest.c
-        if test -z "`${CXX} -std strict_ansi -nopure_cname -c conftest.c 2>&1`"; then
-          echo "$ac_t""yes" 1>&6
-          CMAKE_ANSI_CXXFLAGS="-std strict_ansi -nopure_cname"
-        else
-          echo "$ac_t""no" 1>&6
-        fi
-        rm -f conftest*
-        ;;
+
+        CXXFLAGS_ORIG="$CXXFLAGS"
+        CXXFLAGS="-std strict_ansi -nopure_cname $CXXFLAGS"
+        AC_MSG_CHECKING([whether ${CXX} accepts -std strict_ansi -nopure_cname])
+        AC_LANG_SAVE
+        AC_LANG_CPLUSPLUS
+        AC_TRY_COMPILE([
+        void foo() {}
+        ],,[
+        AC_MSG_RESULT(yes)
+        CMAKE_ANSI_CXXFLAGS="-std strict_ansi -nopure_cname"
+        ],[
+        AC_MSG_RESULT(no)
+        ])
+        AC_LANG_RESTORE
+        CXXFLAGS="$CXXFLAGS_ORIG"
+	;;      
 esac
 fi
 AC_SUBST(CMAKE_ANSI_CXXFLAGS)
@@ -94,15 +114,21 @@ AC_SUBST(CMAKE_ANSI_CXXFLAGS)
 # to get the templates compiled correctly
 CMAKE_TEMPLATE_FLAGS=""
 if test $ac_cv_prog_gxx = no; then
-    echo $ac_n "checking whether ${CXX} accepts -ptused -no_prelink""... $ac_c" 1>&6
-  echo 'void f(){}' > conftest.cc
-  if test -z "`${CXX} -ptused -no_prelink -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-    CMAKE_TEMPLATE_FLAGS="-ptused -no_prelink"
-  else
-    echo "$ac_t""no" 1>&6
-  fi
-  rm -f conftest*
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS -ptused -no_prelink"
+  AC_MSG_CHECKING([whether ${CXX} accepts -ptused -no_prelink])
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([
+  void foo() {}
+  ],,[
+  AC_MSG_RESULT(yes)
+  CMAKE_TEMPLATE_FLAGS="-ptused -no_prelink"
+  ],[
+  AC_MSG_RESULT(no)
+  ])
+  AC_LANG_RESTORE
+  CXXFLAGS="$CXXFLAGS_ORIG"
 fi
 AC_SUBST(CMAKE_TEMPLATE_FLAGS)
 
@@ -110,64 +136,80 @@ AC_SUBST(CMAKE_TEMPLATE_FLAGS)
 # check non-g++ compilers to see if they have the standard 
 # ansi stream files (without the .h)
 if test $ac_cv_prog_gxx = no; then
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
   AC_MSG_CHECKING( ansi standard C++ stream headers ) 
-  rm -rf conftest.*
-  cat > conftest.cc <<!
-#include <iostream>
-!
-  if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-  else
-    CMAKE_NO_ANSI_STREAM_HEADERS="1"
-    echo "$ac_t""no" 1>&6
-  fi
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([
+  #include <iostream>
+  ],,[
+  AC_MSG_RESULT(yes)
+  ],[
+  CMAKE_NO_ANSI_STREAM_HEADERS=1
+  AC_MSG_RESULT(no)
+  ])
+  AC_LANG_RESTORE
+  CXXFLAGS="$CXXFLAGS_ORIG"
 fi
 AC_SUBST(CMAKE_NO_ANSI_STREAM_HEADERS)
 
 # check compilers to see if they have std::stringstream
-AC_MSG_CHECKING( for ansi standard C++ stringstream ) 
-rm -rf conftest.*
-cat > conftest.cc <<!
+CXXFLAGS_ORIG="$CXXFLAGS"
+CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
+AC_MSG_CHECKING([for ansi standard C++ stringstream])
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+AC_TRY_COMPILE([
 #include <sstream>
-!
-if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
-  echo "$ac_t""yes" 1>&6
-else
-  CMAKE_NO_ANSI_STRING_STREAM="1"
-  echo "$ac_t""no" 1>&6
-fi
+],,[
+AC_MSG_RESULT(yes)
+],[
+CMAKE_NO_ANSI_STRING_STREAM=1
+AC_MSG_RESULT(no)
+])
+AC_LANG_RESTORE
+CXXFLAGS="$CXXFLAGS_ORIG"
 AC_SUBST(CMAKE_NO_ANSI_STRING_STREAM)
 
 # check to see if stl is in the std namespace
 if test $ac_cv_prog_gxx = no; then
-  AC_MSG_CHECKING( ansi standard namespace support ) 
-  rm -rf conftest.*
-  cat > conftest.cc <<!
-#include <list>
-void foo() { std::list<int> l; }
-!
-  if test -z "`${CXX}  ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-  else
-    CMAKE_NO_STD_NAMESPACE="1"
-    echo "$ac_t""no" 1>&6
-  fi
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
+  AC_MSG_CHECKING([whether the std namespace is supported])
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([
+  #include <list>
+  void foo() { std::list<int>(); }
+  ],,[
+  AC_MSG_RESULT(yes)
+  ],[
+  CMAKE_NO_STD_NAMESPACE=1
+  AC_MSG_RESULT(no)
+  ])
+  AC_LANG_RESTORE
+  CXXFLAGS="$CXXFLAGS_ORIG"
 fi
 AC_SUBST(CMAKE_NO_STD_NAMESPACE)
 
 # check to see if for scoping is supported
 if test $ac_cv_prog_gxx = no; then
-  AC_MSG_CHECKING( ansi for scope support ) 
-  rm -rf conftest.*
-  cat > conftest.cc <<!
-void foo() { for(int i;;); for(int i;;); }
-!
-  if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-  else
-    CMAKE_NO_ANSI_FOR_SCOPE="1"
-    echo "$ac_t""no" 1>&6
-  fi
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
+  AC_MSG_CHECKING([ansi for scope support])
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([
+  void foo() { for(int i;;); for(int i;;); }
+  ],,[
+  AC_MSG_RESULT(yes)
+  ],[
+  CMAKE_NO_ANSI_FOR_SCOPE=1
+  AC_MSG_RESULT(no)
+  ])
+  AC_LANG_RESTORE
+  CXXFLAGS="$CXXFLAGS_ORIG"
 fi
 AC_SUBST(CMAKE_NO_ANSI_FOR_SCOPE)
 

+ 291 - 78
configure

@@ -952,39 +952,132 @@ CMAKE_ANSI_CXXFLAGS=""
 if test $ac_cv_prog_gxx = no; then
 case $system in
     HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
+        CFLAGS_ORIG="$FLAGS"
+        CFLAGS="-Aa $CFLAGS"
         echo $ac_n "checking whether ${CC} accepts -Aa""... $ac_c" 1>&6
-        echo 'void f(){}' > conftest.c
-        if test -z "`${CC} -Aa -c conftest.c 2>&1`"; then
-          echo "$ac_t""yes" 1>&6
-          CMAKE_ANSI_CFLAGS="-Aa"
-        else
-          echo "$ac_t""no" 1>&6
-        fi
-        rm -f conftest*
+echo "configure:959: checking whether ${CC} accepts -Aa" >&5
+        cat > conftest.$ac_ext <<EOF
+#line 961 "configure"
+#include "confdefs.h"
+
+        void foo() {}
+        
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+        echo "$ac_t""yes" 1>&6
+        CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Aa"
+        
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+        echo "$ac_t""no" 1>&6
+        
+fi
+rm -f conftest*
+        CFLAGS="$CFLAGS_ORIG"
 	;;  
-    IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
+     IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
+        CXXFLAGS_ORIG="$CXXFLAGS"
+        CXXFLAGS="-LANG:std $CXXFLAGS"
         echo $ac_n "checking whether ${CXX} accepts -LANG:std""... $ac_c" 1>&6
-        echo 'void f(){}' > conftest.c
-        if test -z "`${CXX} -LANG:std -c conftest.c 2>&1`"; then
-          echo "$ac_t""yes" 1>&6
-	  CMAKE_ANSI_CXXFLAGS="-LANG:std"
-        else
-          echo "$ac_t""no" 1>&6
-        fi
-        rm -f conftest*
-	;;     
+echo "configure:991: checking whether ${CXX} accepts -LANG:std" >&5
+        
+        ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+        cat > conftest.$ac_ext <<EOF
+#line 1001 "configure"
+#include "confdefs.h"
+
+        void foo() {}
+        
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1010: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+        echo "$ac_t""yes" 1>&6
+        CMAKE_ANSI_CXXFLAGS="-LANG:std"
+        
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+        echo "$ac_t""no" 1>&6
+        
+fi
+rm -f conftest*
+        ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+        CXXFLAGS="$CXXFLAGS_ORIG"
+	;;
      OSF1-*)
+
+        CXXFLAGS_ORIG="$CXXFLAGS"
+        CXXFLAGS="-std strict_ansi -nopure_cname $CXXFLAGS"
         echo $ac_n "checking whether ${CXX} accepts -std strict_ansi -nopure_cname""... $ac_c" 1>&6
-        echo 'void f(){}' > conftest.c
-        if test -z "`${CXX} -std strict_ansi -nopure_cname -c conftest.c 2>&1`"; then
-          echo "$ac_t""yes" 1>&6
-          CMAKE_ANSI_CXXFLAGS="-std strict_ansi -nopure_cname"
-        else
-          echo "$ac_t""no" 1>&6
-        fi
-        rm -f conftest*
-        ;;  
+echo "configure:1039: checking whether ${CXX} accepts -std strict_ansi -nopure_cname" >&5
+        
+        ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
 
+        cat > conftest.$ac_ext <<EOF
+#line 1049 "configure"
+#include "confdefs.h"
+
+        void foo() {}
+        
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1058: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+        echo "$ac_t""yes" 1>&6
+        CMAKE_ANSI_CXXFLAGS="-std strict_ansi -nopure_cname"
+        
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+        echo "$ac_t""no" 1>&6
+        
+fi
+rm -f conftest*
+        ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+        CXXFLAGS="$CXXFLAGS_ORIG"
+	;;
 esac
 fi
 
@@ -993,77 +1086,197 @@ fi
 # check non-g++ compilers to see if they have the standard 
 # ansi stream files (without the .h)
 if test $ac_cv_prog_gxx = no; then
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
   echo $ac_n "checking ansi standard C++ stream headers ""... $ac_c" 1>&6
-echo "configure:998: checking ansi standard C++ stream headers " >&5 
-  rm -rf conftest.*
-  cat > conftest.cc <<!
-#include <iostream>
-!
-  if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS  -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-  else
-    cat >> confdefs.h <<\EOF
-#define CMAKE_NO_ANSI_STREAM_HEADERS 1
+echo "configure:1093: checking ansi standard C++ stream headers " >&5 
+  
+  ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+  cat > conftest.$ac_ext <<EOF
+#line 1103 "configure"
+#include "confdefs.h"
+
+  #include <iostream>
+  
+int main() {
+
+; return 0; }
 EOF
+if { (eval echo configure:1112: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+  echo "$ac_t""yes" 1>&6
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+  CMAKE_NO_ANSI_STREAM_HEADERS=1
+  echo "$ac_t""no" 1>&6
+  
+fi
+rm -f conftest*
+  ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
 
-    echo "$ac_t""no" 1>&6
-  fi
+  CXXFLAGS="$CXXFLAGS_ORIG"
 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:1016: checking for ansi standard C++ stringstream " >&5 
-rm -rf conftest.*
-cat > conftest.cc <<!
+CXXFLAGS_ORIG="$CXXFLAGS"
+CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
+echo $ac_n "checking for ansi standard C++ stringstream""... $ac_c" 1>&6
+echo "configure:1141: checking for ansi standard C++ stringstream" >&5
+
+ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+cat > conftest.$ac_ext <<EOF
+#line 1151 "configure"
+#include "confdefs.h"
+
 #include <sstream>
-!
-if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS  -c conftest.cc 2>&1`"; then
-  echo "$ac_t""yes" 1>&6
-else
-  cat >> confdefs.h <<\EOF
-#define CMAKE_NO_ANSI_STRING_STREAM 1
+
+int main() {
+
+; return 0; }
 EOF
+if { (eval echo configure:1160: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+echo "$ac_t""yes" 1>&6
+
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+CMAKE_NO_ANSI_STRING_STREAM=1
+echo "$ac_t""no" 1>&6
 
-  echo "$ac_t""no" 1>&6
 fi
+rm -f conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+CXXFLAGS="$CXXFLAGS_ORIG"
 
 # 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:1034: checking ansi standard namespace support " >&5 
-  rm -rf conftest.*
-  cat > conftest.cc <<!
-#include <list>
-void foo() { std::list<int> l; }
-!
-  if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-  else
-    cat >> confdefs.h <<\EOF
-#define CMAKE_NO_STD_NAMESPACE 1
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
+  echo $ac_n "checking whether the std namespace is supported""... $ac_c" 1>&6
+echo "configure:1189: checking whether the std namespace is supported" >&5
+  
+  ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+  cat > conftest.$ac_ext <<EOF
+#line 1199 "configure"
+#include "confdefs.h"
+
+  #include <list>
+  void foo() { std::list<int>(); }
+  
+int main() {
+
+; return 0; }
 EOF
+if { (eval echo configure:1209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+  echo "$ac_t""yes" 1>&6
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+  CMAKE_NO_STD_NAMESPACE=1
+  echo "$ac_t""no" 1>&6
+  
+fi
+rm -f conftest*
+  ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
 
-    echo "$ac_t""no" 1>&6
-  fi
+  CXXFLAGS="$CXXFLAGS_ORIG"
 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:1054: checking ansi for scope support " >&5 
-  rm -rf conftest.*
-  cat > conftest.cc <<!
-void foo() { for(int i;;); for(int i;;); }
-!
-  if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-  else
-    cat >> confdefs.h <<\EOF
-#define CMAKE_NO_ANSI_FOR_SCOPE 1
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
+  echo $ac_n "checking ansi for scope support""... $ac_c" 1>&6
+echo "configure:1239: checking ansi for scope support" >&5
+  
+  ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+  cat > conftest.$ac_ext <<EOF
+#line 1249 "configure"
+#include "confdefs.h"
+
+  void foo() { for(int i;;); for(int i;;); }
+  
+int main() {
+
+; return 0; }
 EOF
+if { (eval echo configure:1258: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
+  echo "$ac_t""yes" 1>&6
+  
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+  CMAKE_NO_ANSI_FOR_SCOPE=1
+  echo "$ac_t""no" 1>&6
+  
+fi
+rm -f conftest*
+  ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
 
-    echo "$ac_t""no" 1>&6
-  fi
+  CXXFLAGS="$CXXFLAGS_ORIG"
 fi
 
 # find make to use to build cmake, prefer gmake
@@ -1072,7 +1285,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:1076: checking for $ac_word" >&5
+echo "configure:1289: 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

+ 104 - 73
configure.in

@@ -67,39 +67,54 @@ CMAKE_ANSI_CXXFLAGS=""
 if test $ac_cv_prog_gxx = no; then
 case $system in
     HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
-        echo $ac_n "checking whether ${CC} accepts -Aa""... $ac_c" 1>&6
-        echo 'void f(){}' > conftest.c
-        if test -z "`${CC} -Aa -c conftest.c 2>&1`"; then
-          echo "$ac_t""yes" 1>&6
-          CMAKE_ANSI_CFLAGS="-Aa"
-        else
-          echo "$ac_t""no" 1>&6
-        fi
-        rm -f conftest*
+        CFLAGS_ORIG="$FLAGS"
+        CFLAGS="-Aa $CFLAGS"
+        AC_MSG_CHECKING([whether ${CC} accepts -Aa])
+        AC_TRY_COMPILE([
+        void foo() {}
+        ],,[
+        AC_MSG_RESULT(yes)
+        CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Aa"
+        ],[
+        AC_MSG_RESULT(no)
+        ])
+        CFLAGS="$CFLAGS_ORIG"
 	;;  
-    IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
-        echo $ac_n "checking whether ${CXX} accepts -LANG:std""... $ac_c" 1>&6
-        echo 'void f(){}' > conftest.c
-        if test -z "`${CXX} -LANG:std -c conftest.c 2>&1`"; then
-          echo "$ac_t""yes" 1>&6
-	  CMAKE_ANSI_CXXFLAGS="-LANG:std"
-        else
-          echo "$ac_t""no" 1>&6
-        fi
-        rm -f conftest*
-	;;     
+     IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
+        CXXFLAGS_ORIG="$CXXFLAGS"
+        CXXFLAGS="-LANG:std $CXXFLAGS"
+        AC_MSG_CHECKING([whether ${CXX} accepts -LANG:std])
+        AC_LANG_SAVE
+        AC_LANG_CPLUSPLUS
+        AC_TRY_COMPILE([
+        void foo() {}
+        ],,[
+        AC_MSG_RESULT(yes)
+        CMAKE_ANSI_CXXFLAGS="-LANG:std"
+        ],[
+        AC_MSG_RESULT(no)
+        ])
+        AC_LANG_RESTORE
+        CXXFLAGS="$CXXFLAGS_ORIG"
+	;;
      OSF1-*)
-        echo $ac_n "checking whether ${CXX} accepts -std strict_ansi -nopure_cname""... $ac_c" 1>&6
-        echo 'void f(){}' > conftest.c
-        if test -z "`${CXX} -std strict_ansi -nopure_cname -c conftest.c 2>&1`"; then
-          echo "$ac_t""yes" 1>&6
-          CMAKE_ANSI_CXXFLAGS="-std strict_ansi -nopure_cname"
-        else
-          echo "$ac_t""no" 1>&6
-        fi
-        rm -f conftest*
-        ;;  
 
+        CXXFLAGS_ORIG="$CXXFLAGS"
+        CXXFLAGS="-std strict_ansi -nopure_cname $CXXFLAGS"
+        AC_MSG_CHECKING([whether ${CXX} accepts -std strict_ansi -nopure_cname])
+        AC_LANG_SAVE
+        AC_LANG_CPLUSPLUS
+        AC_TRY_COMPILE([
+        void foo() {}
+        ],,[
+        AC_MSG_RESULT(yes)
+        CMAKE_ANSI_CXXFLAGS="-std strict_ansi -nopure_cname"
+        ],[
+        AC_MSG_RESULT(no)
+        ])
+        AC_LANG_RESTORE
+        CXXFLAGS="$CXXFLAGS_ORIG"
+	;;
 esac
 fi
 AC_SUBST(CMAKE_ANSI_CFLAGS)
@@ -108,61 +123,77 @@ AC_SUBST(CMAKE_ANSI_CXXFLAGS)
 # check non-g++ compilers to see if they have the standard 
 # ansi stream files (without the .h)
 if test $ac_cv_prog_gxx = no; then
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
   AC_MSG_CHECKING( ansi standard C++ stream headers ) 
-  rm -rf conftest.*
-  cat > conftest.cc <<!
-#include <iostream>
-!
-  if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS  -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-  else
-    AC_DEFINE(CMAKE_NO_ANSI_STREAM_HEADERS)
-    echo "$ac_t""no" 1>&6
-  fi
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([
+  #include <iostream>
+  ],,[
+  AC_MSG_RESULT(yes)
+  ],[
+  CMAKE_NO_ANSI_STREAM_HEADERS=1
+  AC_MSG_RESULT(no)
+  ])
+  AC_LANG_RESTORE
+  CXXFLAGS="$CXXFLAGS_ORIG"
 fi
 
 # check non-g++ compilers to see if they have std::stringstream
-AC_MSG_CHECKING( for ansi standard C++ stringstream ) 
-rm -rf conftest.*
-cat > conftest.cc <<!
+CXXFLAGS_ORIG="$CXXFLAGS"
+CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
+AC_MSG_CHECKING([for ansi standard C++ stringstream])
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+AC_TRY_COMPILE([
 #include <sstream>
-!
-if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS  -c conftest.cc 2>&1`"; then
-  echo "$ac_t""yes" 1>&6
-else
-  AC_DEFINE(CMAKE_NO_ANSI_STRING_STREAM)
-  echo "$ac_t""no" 1>&6
-fi
+],,[
+AC_MSG_RESULT(yes)
+],[
+CMAKE_NO_ANSI_STRING_STREAM=1
+AC_MSG_RESULT(no)
+])
+AC_LANG_RESTORE
+CXXFLAGS="$CXXFLAGS_ORIG"
 
 # check to see if stl is in the std namespace
 if test $ac_cv_prog_gxx = no; then
-  AC_MSG_CHECKING( ansi standard namespace support ) 
-  rm -rf conftest.*
-  cat > conftest.cc <<!
-#include <list>
-void foo() { std::list<int> l; }
-!
-  if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-  else
-    AC_DEFINE(CMAKE_NO_STD_NAMESPACE)
-    echo "$ac_t""no" 1>&6
-  fi
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
+  AC_MSG_CHECKING([whether the std namespace is supported])
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([
+  #include <list>
+  void foo() { std::list<int>(); }
+  ],,[
+  AC_MSG_RESULT(yes)
+  ],[
+  CMAKE_NO_STD_NAMESPACE=1
+  AC_MSG_RESULT(no)
+  ])
+  AC_LANG_RESTORE
+  CXXFLAGS="$CXXFLAGS_ORIG"
 fi
 
 # check to see if for scoping is supported
 if test $ac_cv_prog_gxx = no; then
-  AC_MSG_CHECKING( ansi for scope support ) 
-  rm -rf conftest.*
-  cat > conftest.cc <<!
-void foo() { for(int i;;); for(int i;;); }
-!
-  if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
-    echo "$ac_t""yes" 1>&6
-  else
-    AC_DEFINE(CMAKE_NO_ANSI_FOR_SCOPE)
-    echo "$ac_t""no" 1>&6
-  fi
+  CXXFLAGS_ORIG="$CXXFLAGS"
+  CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
+  AC_MSG_CHECKING([ansi for scope support])
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([
+  void foo() { for(int i;;); for(int i;;); }
+  ],,[
+  AC_MSG_RESULT(yes)
+  ],[
+  CMAKE_NO_ANSI_FOR_SCOPE=1
+  AC_MSG_RESULT(no)
+  ])
+  AC_LANG_RESTORE
+  CXXFLAGS="$CXXFLAGS_ORIG"
 fi
 
 # find make to use to build cmake, prefer gmake

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä