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="" ...@@ -595,22 +595,31 @@ CMAKE_ANSI_CFLAGS=""
if test $ac_cv_prog_gcc = no; then if test $ac_cv_prog_gcc = no; then
case $system in case $system in
HP-UX-*) HP-UX-*)
echo $ac_n "checking whether ${CC} accepts -Aa""... $ac_c" 1>&6 CFLAGS_ORIG="$FLAGS"
echo 'void f(){}' > conftest.c CFLAGS="-Aa $CFLAGS"
if test -z "`${CC} -Aa -c conftest.c 2>&1`"; then AC_MSG_CHECKING([whether ${CC} accepts -Aa])
echo "$ac_t""yes" 1>&6 AC_TRY_COMPILE([
CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Aa" void foo() {}
else ],,[
echo "$ac_t""no" 1>&6 AC_MSG_RESULT(yes)
fi CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Aa"
echo $ac_n "checking whether ${CC} accepts -Ae""... $ac_c" 1>&6 ],[
if test -z "`${CC} -Ae -c conftest.c 2>&1`"; then AC_MSG_RESULT(no)
echo "$ac_t""yes" 1>&6 ])
CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Ae" CFLAGS="$CFLAGS_ORIG"
else
echo "$ac_t""no" 1>&6 CFLAGS_ORIG="$FLAGS"
fi CFLAGS="-Ae $CFLAGS"
rm -f conftest* 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 esac
fi fi
......
This diff is collapsed.
...@@ -41,16 +41,23 @@ CXXFLAGS=$save_CXXFLAGS ...@@ -41,16 +41,23 @@ CXXFLAGS=$save_CXXFLAGS
CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION="" CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION=""
if test $ac_cv_prog_gxx = no; then if test $ac_cv_prog_gxx = no; then
echo $ac_n "checking whether ${CXX} supports explicit instantiation""... $ac_c" 1>&6 CXXFLAGS_ORIG="$CXXFLAGS"
echo 'template<class T>class x{};template class x<int>;' > conftest.cc CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
if test -z "`${CXX} -c conftest.cc 2>&1`"; then AC_MSG_CHECKING([whether ${CXX} supports explicit instantiation])
echo "$ac_t""yes" 1>&6 AC_LANG_SAVE
else AC_LANG_CPLUSPLUS
echo "$ac_t""no" 1>&6 AC_TRY_COMPILE([
CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION="1" template<class T>class x{};template class x<int>;
fi ],,[
rm -f conftest* AC_MSG_RESULT(yes)
],[
CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION=1
AC_MSG_RESULT(no)
])
AC_LANG_RESTORE
CXXFLAGS="$CXXFLAGS_ORIG"
fi fi
# if running on darwin no explicit template instantiations even though # if running on darwin no explicit template instantiations even though
# syntax is supported. # syntax is supported.
case $system in case $system in
...@@ -65,27 +72,40 @@ CMAKE_ANSI_CXXFLAGS="" ...@@ -65,27 +72,40 @@ CMAKE_ANSI_CXXFLAGS=""
if test $ac_cv_prog_gxx = no; then if test $ac_cv_prog_gxx = no; then
case $system in case $system in
IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*) IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
echo $ac_n "checking whether ${CXX} accepts -LANG:std""... $ac_c" 1>&6 CXXFLAGS_ORIG="$CXXFLAGS"
echo 'void f(){}' > conftest.c CXXFLAGS="-LANG:std $CXXFLAGS"
if test -z "`${CXX} -LANG:std -c conftest.c 2>&1`"; then AC_MSG_CHECKING([whether ${CXX} accepts -LANG:std])
echo "$ac_t""yes" 1>&6 AC_LANG_SAVE
CMAKE_ANSI_CXXFLAGS="-LANG:std" AC_LANG_CPLUSPLUS
else AC_TRY_COMPILE([
echo "$ac_t""no" 1>&6 void foo() {}
fi ],,[
rm -f conftest* AC_MSG_RESULT(yes)
CMAKE_ANSI_CXXFLAGS="-LANG:std"
],[
AC_MSG_RESULT(no)
])
AC_LANG_RESTORE
CXXFLAGS="$CXXFLAGS_ORIG"
;; ;;
OSF1-*) OSF1-*)
echo $ac_n "checking whether ${CXX} accepts -std strict_ansi -nopure_cname""... $ac_c" 1>&6
echo 'void f(){}' > conftest.c CXXFLAGS_ORIG="$CXXFLAGS"
if test -z "`${CXX} -std strict_ansi -nopure_cname -c conftest.c 2>&1`"; then CXXFLAGS="-std strict_ansi -nopure_cname $CXXFLAGS"
echo "$ac_t""yes" 1>&6 AC_MSG_CHECKING([whether ${CXX} accepts -std strict_ansi -nopure_cname])
CMAKE_ANSI_CXXFLAGS="-std strict_ansi -nopure_cname" AC_LANG_SAVE
else AC_LANG_CPLUSPLUS
echo "$ac_t""no" 1>&6 AC_TRY_COMPILE([
fi void foo() {}
rm -f conftest* ],,[
;; AC_MSG_RESULT(yes)
CMAKE_ANSI_CXXFLAGS="-std strict_ansi -nopure_cname"
],[
AC_MSG_RESULT(no)
])
AC_LANG_RESTORE
CXXFLAGS="$CXXFLAGS_ORIG"
;;
esac esac
fi fi
AC_SUBST(CMAKE_ANSI_CXXFLAGS) AC_SUBST(CMAKE_ANSI_CXXFLAGS)
...@@ -94,15 +114,21 @@ AC_SUBST(CMAKE_ANSI_CXXFLAGS) ...@@ -94,15 +114,21 @@ AC_SUBST(CMAKE_ANSI_CXXFLAGS)
# to get the templates compiled correctly # to get the templates compiled correctly
CMAKE_TEMPLATE_FLAGS="" CMAKE_TEMPLATE_FLAGS=""
if test $ac_cv_prog_gxx = no; then if test $ac_cv_prog_gxx = no; then
echo $ac_n "checking whether ${CXX} accepts -ptused -no_prelink""... $ac_c" 1>&6 CXXFLAGS_ORIG="$CXXFLAGS"
echo 'void f(){}' > conftest.cc CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS -ptused -no_prelink"
if test -z "`${CXX} -ptused -no_prelink -c conftest.cc 2>&1`"; then AC_MSG_CHECKING([whether ${CXX} accepts -ptused -no_prelink])
echo "$ac_t""yes" 1>&6 AC_LANG_SAVE
CMAKE_TEMPLATE_FLAGS="-ptused -no_prelink" AC_LANG_CPLUSPLUS
else AC_TRY_COMPILE([
echo "$ac_t""no" 1>&6 void foo() {}
fi ],,[
rm -f conftest* AC_MSG_RESULT(yes)
CMAKE_TEMPLATE_FLAGS="-ptused -no_prelink"
],[
AC_MSG_RESULT(no)
])
AC_LANG_RESTORE
CXXFLAGS="$CXXFLAGS_ORIG"
fi fi
AC_SUBST(CMAKE_TEMPLATE_FLAGS) AC_SUBST(CMAKE_TEMPLATE_FLAGS)
...@@ -110,64 +136,80 @@ 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 # check non-g++ compilers to see if they have the standard
# ansi stream files (without the .h) # ansi stream files (without the .h)
if test $ac_cv_prog_gxx = no; then 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_MSG_CHECKING( ansi standard C++ stream headers )
rm -rf conftest.* AC_LANG_SAVE
cat > conftest.cc <<! AC_LANG_CPLUSPLUS
#include <iostream> AC_TRY_COMPILE([
! #include <iostream>
if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then ],,[
echo "$ac_t""yes" 1>&6 AC_MSG_RESULT(yes)
else ],[
CMAKE_NO_ANSI_STREAM_HEADERS="1" CMAKE_NO_ANSI_STREAM_HEADERS=1
echo "$ac_t""no" 1>&6 AC_MSG_RESULT(no)
fi ])
AC_LANG_RESTORE
CXXFLAGS="$CXXFLAGS_ORIG"
fi fi
AC_SUBST(CMAKE_NO_ANSI_STREAM_HEADERS) 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
AC_MSG_CHECKING( for ansi standard C++ stringstream ) CXXFLAGS_ORIG="$CXXFLAGS"
rm -rf conftest.* CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
cat > conftest.cc <<! AC_MSG_CHECKING([for ansi standard C++ stringstream])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
#include <sstream> #include <sstream>
! ],,[
if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then AC_MSG_RESULT(yes)
echo "$ac_t""yes" 1>&6 ],[
else CMAKE_NO_ANSI_STRING_STREAM=1
CMAKE_NO_ANSI_STRING_STREAM="1" AC_MSG_RESULT(no)
echo "$ac_t""no" 1>&6 ])
fi AC_LANG_RESTORE
CXXFLAGS="$CXXFLAGS_ORIG"
AC_SUBST(CMAKE_NO_ANSI_STRING_STREAM) AC_SUBST(CMAKE_NO_ANSI_STRING_STREAM)
# check to see if stl is in the std namespace # check to see if stl is in the std namespace
if test $ac_cv_prog_gxx = no; then if test $ac_cv_prog_gxx = no; then
AC_MSG_CHECKING( ansi standard namespace support ) CXXFLAGS_ORIG="$CXXFLAGS"
rm -rf conftest.* CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
cat > conftest.cc <<! AC_MSG_CHECKING([whether the std namespace is supported])
#include <list> AC_LANG_SAVE
void foo() { std::list<int> l; } AC_LANG_CPLUSPLUS
! AC_TRY_COMPILE([
if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then #include <list>
echo "$ac_t""yes" 1>&6 void foo() { std::list<int>(); }
else ],,[
CMAKE_NO_STD_NAMESPACE="1" AC_MSG_RESULT(yes)
echo "$ac_t""no" 1>&6 ],[
fi CMAKE_NO_STD_NAMESPACE=1
AC_MSG_RESULT(no)
])
AC_LANG_RESTORE
CXXFLAGS="$CXXFLAGS_ORIG"
fi fi
AC_SUBST(CMAKE_NO_STD_NAMESPACE) AC_SUBST(CMAKE_NO_STD_NAMESPACE)
# check to see if for scoping is supported # check to see if for scoping is supported
if test $ac_cv_prog_gxx = no; then if test $ac_cv_prog_gxx = no; then
AC_MSG_CHECKING( ansi for scope support ) CXXFLAGS_ORIG="$CXXFLAGS"
rm -rf conftest.* CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
cat > conftest.cc <<! AC_MSG_CHECKING([ansi for scope support])
void foo() { for(int i;;); for(int i;;); } AC_LANG_SAVE
! AC_LANG_CPLUSPLUS
if test -z "`${CXX} ${CMAKE_ANSI_CXXFLAGS} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then AC_TRY_COMPILE([
echo "$ac_t""yes" 1>&6 void foo() { for(int i;;); for(int i;;); }
else ],,[
CMAKE_NO_ANSI_FOR_SCOPE="1" AC_MSG_RESULT(yes)
echo "$ac_t""no" 1>&6 ],[
fi CMAKE_NO_ANSI_FOR_SCOPE=1
AC_MSG_RESULT(no)
])
AC_LANG_RESTORE
CXXFLAGS="$CXXFLAGS_ORIG"
fi fi
AC_SUBST(CMAKE_NO_ANSI_FOR_SCOPE) AC_SUBST(CMAKE_NO_ANSI_FOR_SCOPE)
......
This diff is collapsed.
...@@ -67,39 +67,54 @@ CMAKE_ANSI_CXXFLAGS="" ...@@ -67,39 +67,54 @@ CMAKE_ANSI_CXXFLAGS=""
if test $ac_cv_prog_gxx = no; then if test $ac_cv_prog_gxx = no; then
case $system in case $system in
HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
echo $ac_n "checking whether ${CC} accepts -Aa""... $ac_c" 1>&6 CFLAGS_ORIG="$FLAGS"
echo 'void f(){}' > conftest.c CFLAGS="-Aa $CFLAGS"
if test -z "`${CC} -Aa -c conftest.c 2>&1`"; then AC_MSG_CHECKING([whether ${CC} accepts -Aa])
echo "$ac_t""yes" 1>&6 AC_TRY_COMPILE([
CMAKE_ANSI_CFLAGS="-Aa" void foo() {}
else ],,[
echo "$ac_t""no" 1>&6 AC_MSG_RESULT(yes)
fi CMAKE_ANSI_CFLAGS="$CMAKE_ANSI_CFLAGS -Aa"
rm -f conftest* ],[
AC_MSG_RESULT(no)
])
CFLAGS="$CFLAGS_ORIG"
;; ;;
IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*) IRIX-5* | IRIX-6* | IRIX64-6* | IRIX-64-6*)
echo $ac_n "checking whether ${CXX} accepts -LANG:std""... $ac_c" 1>&6 CXXFLAGS_ORIG="$CXXFLAGS"
echo 'void f(){}' > conftest.c CXXFLAGS="-LANG:std $CXXFLAGS"
if test -z "`${CXX} -LANG:std -c conftest.c 2>&1`"; then AC_MSG_CHECKING([whether ${CXX} accepts -LANG:std])
echo "$ac_t""yes" 1>&6 AC_LANG_SAVE
CMAKE_ANSI_CXXFLAGS="-LANG:std" AC_LANG_CPLUSPLUS
else AC_TRY_COMPILE([
echo "$ac_t""no" 1>&6 void foo() {}
fi ],,[
rm -f conftest* AC_MSG_RESULT(yes)
;; CMAKE_ANSI_CXXFLAGS="-LANG:std"
],[
AC_MSG_RESULT(no)
])
AC_LANG_RESTORE
CXXFLAGS="$CXXFLAGS_ORIG"
;;
OSF1-*) 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 esac
fi fi
AC_SUBST(CMAKE_ANSI_CFLAGS) AC_SUBST(CMAKE_ANSI_CFLAGS)
...@@ -108,61 +123,77 @@ AC_SUBST(CMAKE_ANSI_CXXFLAGS) ...@@ -108,61 +123,77 @@ AC_SUBST(CMAKE_ANSI_CXXFLAGS)
# check non-g++ compilers to see if they have the standard # check non-g++ compilers to see if they have the standard
# ansi stream files (without the .h) # ansi stream files (without the .h)
if test $ac_cv_prog_gxx = no; then 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_MSG_CHECKING( ansi standard C++ stream headers )
rm -rf conftest.* AC_LANG_SAVE
cat > conftest.cc <<! AC_LANG_CPLUSPLUS
#include <iostream> AC_TRY_COMPILE([
! #include <iostream>
if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then ],,[
echo "$ac_t""yes" 1>&6 AC_MSG_RESULT(yes)
else ],[
AC_DEFINE(CMAKE_NO_ANSI_STREAM_HEADERS) CMAKE_NO_ANSI_STREAM_HEADERS=1
echo "$ac_t""no" 1>&6 AC_MSG_RESULT(no)
fi ])
AC_LANG_RESTORE
CXXFLAGS="$CXXFLAGS_ORIG"
fi fi
# check non-g++ compilers to see if they have std::stringstream # check non-g++ compilers to see if they have std::stringstream
AC_MSG_CHECKING( for ansi standard C++ stringstream ) CXXFLAGS_ORIG="$CXXFLAGS"
rm -rf conftest.* CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
cat > conftest.cc <<! AC_MSG_CHECKING([for ansi standard C++ stringstream])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
#include <sstream> #include <sstream>
! ],,[
if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then AC_MSG_RESULT(yes)
echo "$ac_t""yes" 1>&6 ],[
else CMAKE_NO_ANSI_STRING_STREAM=1
AC_DEFINE(CMAKE_NO_ANSI_STRING_STREAM) AC_MSG_RESULT(no)
echo "$ac_t""no" 1>&6 ])
fi AC_LANG_RESTORE
CXXFLAGS="$CXXFLAGS_ORIG"
# check to see if stl is in the std namespace # check to see if stl is in the std namespace
if test $ac_cv_prog_gxx = no; then if test $ac_cv_prog_gxx = no; then
AC_MSG_CHECKING( ansi standard namespace support ) CXXFLAGS_ORIG="$CXXFLAGS"
rm -rf conftest.* CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
cat > conftest.cc <<! AC_MSG_CHECKING([whether the std namespace is supported])
#include <list> AC_LANG_SAVE
void foo() { std::list<int> l; } AC_LANG_CPLUSPLUS
! AC_TRY_COMPILE([
if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then #include <list>
echo "$ac_t""yes" 1>&6 void foo() { std::list<int>(); }
else ],,[
AC_DEFINE(CMAKE_NO_STD_NAMESPACE) AC_MSG_RESULT(yes)
echo "$ac_t""no" 1>&6 ],[
fi CMAKE_NO_STD_NAMESPACE=1
AC_MSG_RESULT(no)
])
AC_LANG_RESTORE
CXXFLAGS="$CXXFLAGS_ORIG"
fi fi
# check to see if for scoping is supported # check to see if for scoping is supported
if test $ac_cv_prog_gxx = no; then if test $ac_cv_prog_gxx = no; then
AC_MSG_CHECKING( ansi for scope support ) CXXFLAGS_ORIG="$CXXFLAGS"
rm -rf conftest.* CXXFLAGS="$CMAKE_ANSI_CXXFLAGS $CXXFLAGS"
cat > conftest.cc <<! AC_MSG_CHECKING([ansi for scope support])
void foo() { for(int i;;); for(int i;;); } AC_LANG_SAVE
! AC_LANG_CPLUSPLUS
if test -z "`${CXX} $CMAKE_ANSI_CXXFLAGS $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then AC_TRY_COMPILE([
echo "$ac_t""yes" 1>&6 void foo() { for(int i;;); for(int i;;); }
else ],,[
AC_DEFINE(CMAKE_NO_ANSI_FOR_SCOPE) AC_MSG_RESULT(yes)
echo "$ac_t""no" 1>&6 ],[
fi CMAKE_NO_ANSI_FOR_SCOPE=1
AC_MSG_RESULT(no)
])
AC_LANG_RESTORE
CXXFLAGS="$CXXFLAGS_ORIG"
fi fi
# find make to use to build cmake, prefer gmake # 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