Commit 29058923 authored by Brad King's avatar Brad King

ENH: Improved configure test implementations by using AC_TRY_COMPILE.

parent 41628d26
This diff is collapsed.
......@@ -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
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"
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
],[
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"
else
echo "$ac_t""no" 1>&6
fi
rm -f conftest*
],[
AC_MSG_RESULT(no)
])
CFLAGS="$CFLAGS_ORIG"
;;
esac
fi
......
This diff is collapsed.
......@@ -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,26 +72,39 @@ 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
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"
else
echo "$ac_t""no" 1>&6
fi
rm -f conftest*
],[
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
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"
else
echo "$ac_t""no" 1>&6
fi
rm -f conftest*
],[
AC_MSG_RESULT(no)
])
AC_LANG_RESTORE
CXXFLAGS="$CXXFLAGS_ORIG"
;;
esac
fi
......@@ -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
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"
else
echo "$ac_t""no" 1>&6
fi
rm -f conftest*
],[
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)
......
This diff is collapsed.
......@@ -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
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"
else
echo "$ac_t""no" 1>&6
fi
rm -f conftest*
],[
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
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"
else
echo "$ac_t""no" 1>&6
fi
rm -f conftest*
],[
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment