now uses TryCompile

This commit is contained in:
Ken Martin 2002-09-13 11:09:07 -04:00
parent 9e64895812
commit 9d59d651a1
3 changed files with 10 additions and 89 deletions

View File

@ -78,9 +78,6 @@ SET (CMAKE_CXX_FLAGS "@CXXFLAGS@" CACHE STRING
SET (CMAKE_TEMPLATE_FLAGS "@CMAKE_TEMPLATE_FLAGS@" CACHE STRING SET (CMAKE_TEMPLATE_FLAGS "@CMAKE_TEMPLATE_FLAGS@" CACHE STRING
"CXX template flags used by compiler.") "CXX template flags used by compiler.")
SET (CMAKE_NO_ANSI_STREAM_HEADERS @CMAKE_NO_ANSI_STREAM_HEADERS@ CACHE INTERNAL
"Does the compiler support headers like iostream.")
SET (CMAKE_NO_ANSI_STRING_STREAM @CMAKE_NO_ANSI_STRING_STREAM@ CACHE INTERNAL SET (CMAKE_NO_ANSI_STRING_STREAM @CMAKE_NO_ANSI_STRING_STREAM@ CACHE INTERNAL
"Does the compiler support the ansi stringstream class.") "Does the compiler support the ansi stringstream class.")
@ -106,7 +103,6 @@ CMAKE_CXX_COMPILER
CMAKE_CXX_AR CMAKE_CXX_AR
CMAKE_CXX_AR_ARGS CMAKE_CXX_AR_ARGS
CMAKE_TEMPLATE_FLAGS CMAKE_TEMPLATE_FLAGS
CMAKE_NO_ANSI_STREAM_HEADERS
CMAKE_NO_ANSI_FOR_SCOPE CMAKE_NO_ANSI_FOR_SCOPE
CMAKE_NO_STD_NAMESPACE CMAKE_NO_STD_NAMESPACE
CMAKE_COMPILER_IS_GNUCXX CMAKE_COMPILER_IS_GNUCXX

View File

@ -916,63 +916,11 @@ cross_compiling=$ac_cv_prog_cc_cross
fi 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: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 # check compilers to see if they have std::stringstream
CXXFLAGS_ORIG="$CXXFLAGS" CXXFLAGS_ORIG="$CXXFLAGS"
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS" CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
echo $ac_n "checking for ansi standard C++ stringstream""... $ac_c" 1>&6 echo $ac_n "checking for ansi standard C++ stringstream""... $ac_c" 1>&6
echo "configure:976: checking for ansi standard C++ stringstream" >&5 echo "configure:924: checking for ansi standard C++ stringstream" >&5
ac_ext=C ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -982,7 +930,7 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 986 "configure" #line 934 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sstream> #include <sstream>
@ -991,7 +939,7 @@ int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:995: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:943: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
@ -1021,7 +969,7 @@ if test $ac_cv_prog_gxx = no; then
CXXFLAGS_ORIG="$CXXFLAGS" CXXFLAGS_ORIG="$CXXFLAGS"
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS" CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
echo $ac_n "checking whether the std namespace is supported""... $ac_c" 1>&6 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 echo "configure:973: checking whether the std namespace is supported" >&5
ac_ext=C ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -1031,7 +979,7 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1035 "configure" #line 983 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <list> #include <list>
@ -1041,7 +989,7 @@ int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1045: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:993: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
@ -1072,7 +1020,7 @@ if test $ac_cv_prog_gxx = no; then
CXXFLAGS_ORIG="$CXXFLAGS" CXXFLAGS_ORIG="$CXXFLAGS"
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS" CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
echo $ac_n "checking ansi for scope support""... $ac_c" 1>&6 echo $ac_n "checking ansi for scope support""... $ac_c" 1>&6
echo "configure:1076: checking ansi for scope support" >&5 echo "configure:1024: checking ansi for scope support" >&5
ac_ext=C ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -1082,7 +1030,7 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1086 "configure" #line 1034 "configure"
#include "confdefs.h" #include "confdefs.h"
void foo() { for(int i;;); for(int i;;); } void foo() { for(int i;;); for(int i;;); }
@ -1091,7 +1039,7 @@ int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1043: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
@ -1124,7 +1072,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args. # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2 set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1128: checking for $ac_word" >&5 echo "configure:1076: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_CMAKE_AR_TMP'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_path_CMAKE_AR_TMP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -1367,7 +1315,6 @@ s%@CXX@%$CXX%g
s%@CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION@%$CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION%g s%@CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION@%$CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION%g
s%@CMAKE_ANSI_CXXFLAGS@%$CMAKE_ANSI_CXXFLAGS%g s%@CMAKE_ANSI_CXXFLAGS@%$CMAKE_ANSI_CXXFLAGS%g
s%@CMAKE_TEMPLATE_FLAGS@%$CMAKE_TEMPLATE_FLAGS%g s%@CMAKE_TEMPLATE_FLAGS@%$CMAKE_TEMPLATE_FLAGS%g
s%@CMAKE_NO_ANSI_STREAM_HEADERS@%$CMAKE_NO_ANSI_STREAM_HEADERS%g
s%@CMAKE_NO_ANSI_STRING_STREAM@%$CMAKE_NO_ANSI_STRING_STREAM%g s%@CMAKE_NO_ANSI_STRING_STREAM@%$CMAKE_NO_ANSI_STRING_STREAM%g
s%@CMAKE_NO_STD_NAMESPACE@%$CMAKE_NO_STD_NAMESPACE%g s%@CMAKE_NO_STD_NAMESPACE@%$CMAKE_NO_STD_NAMESPACE%g
s%@CMAKE_NO_ANSI_FOR_SCOPE@%$CMAKE_NO_ANSI_FOR_SCOPE%g s%@CMAKE_NO_ANSI_FOR_SCOPE@%$CMAKE_NO_ANSI_FOR_SCOPE%g

View File

@ -132,28 +132,6 @@ if test $ac_cv_prog_gxx = no; then
fi fi
AC_SUBST(CMAKE_TEMPLATE_FLAGS) 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 )
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 # check compilers to see if they have std::stringstream
CXXFLAGS_ORIG="$CXXFLAGS" CXXFLAGS_ORIG="$CXXFLAGS"
CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS" CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"