From: bangerth Date: Sun, 6 Nov 2011 18:29:57 +0000 (+0000) Subject: Make Intel icc also use C++0x and thereby also avoid a problem with configuring and... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=046f9427e328fa168829c84bd7881e91bc7995a9;p=dealii-svn.git Make Intel icc also use C++0x and thereby also avoid a problem with configuring and working with BOOST (see the mailing list thread today). git-svn-id: https://svn.dealii.org/trunk@24733 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index 42d79c5b89..6f5ec23313 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -425,24 +425,8 @@ AC_DEFUN(DEAL_II_SET_CXX_FLAGS, dnl CXXFLAGSG="$CXXFLAGSG -Wno-long-long" dnl See whether the gcc we use already has a flag for C++2011 features. - AC_MSG_CHECKING(whether compiler has a flag to support C++2011) + DEAL_II_CHECK_CXX1X - OLD_CXXFLAGS="$CXXFLAGS" - CXXFLAGS=-std=c++0x - AC_TRY_COMPILE([], [;], - [ - AC_MSG_RESULT(yes) - test_cxx1x=yes - ], - [ - AC_MSG_RESULT(no) - test_cxx1x=no - ]) - CXXFLAGS="${OLD_CXXFLAGS}" - - if test "x$test_cxx1x" = "xyes" ; then - DEAL_II_CHECK_CXX1X_COMPONENTS("-std=c++0x") - fi dnl On some gcc 4.3 snapshots, a 'const' qualifier on a return type triggers a dnl warning. This is unfortunate, since we happen to stumble on this @@ -808,6 +792,9 @@ AC_DEFUN(DEAL_II_SET_CXX_FLAGS, dnl esac ;; esac + + dnl Finally, see if the compiler supports C++0x + DEAL_II_CHECK_CXX1X ;; compaq_cxx) @@ -1062,6 +1049,38 @@ AC_DEFUN(DEAL_II_SET_CXX_DEBUG_FLAG, dnl +dnl ------------------------------------------------------------- +dnl See if there is a compiler flag to enable C++1x features +dnl +dnl Usage: DEAL_II_CHECK_CXX1X +dnl +dnl ------------------------------------------------------------- +AC_DEFUN(DEAL_II_CHECK_CXX1X, dnl +[ + AC_MSG_CHECKING(whether compiler has a flag to support C++2011) + + dnl See if -std=c++0x exists + OLD_CXXFLAGS="$CXXFLAGS" + CXXFLAGS=-std=c++0x + AC_TRY_COMPILE([], [;], + [ + AC_MSG_RESULT(yes) + test_cxx1x=yes + ], + [ + AC_MSG_RESULT(no) + test_cxx1x=no + ]) + CXXFLAGS="${OLD_CXXFLAGS}" + + dnl If the flag above works, then see if the compiler is complete + dnl enough in this area + if test "x$test_cxx1x" = "xyes" ; then + DEAL_II_CHECK_CXX1X_COMPONENTS("-std=c++0x") + fi +]) + + dnl ------------------------------------------------------------- dnl Given the command line flag specified as argument to this macro, dnl test whether all components that we need from the C++1X diff --git a/deal.II/configure b/deal.II/configure index 3ecc6dd836..46f4266466 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -4131,12 +4131,13 @@ rm -f core conftest.err conftest.$ac_objext \ CXXFLAGSG="$CXXFLAGSG -Wno-long-long" - OLD_CXXFLAGS="$CXXFLAGS" - CXXFLAGS=-std=c++0x - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler has a flag to support C++1x" >&5 -$as_echo_n "checking whether compiler has a flag to support C++1x... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler has a flag to support C++2011" >&5 +$as_echo_n "checking whether compiler has a flag to support C++2011... " >&6; } + + OLD_CXXFLAGS="$CXXFLAGS" + CXXFLAGS=-std=c++0x + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -4149,21 +4150,21 @@ main () _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - test_cxx1x=yes + test_cxx1x=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - test_cxx1x=no + test_cxx1x=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CXXFLAGS="${OLD_CXXFLAGS}" + CXXFLAGS="${OLD_CXXFLAGS}" - if test "x$test_cxx1x" = "xyes" ; then + if test "x$test_cxx1x" = "xyes" ; then OLD_CXXFLAGS="$CXXFLAGS" CXXFLAGS=""-std=c++0x"" @@ -4471,7 +4472,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext $as_echo "no" >&6; } fi - fi + fi + + CXXFLAGS="-Wreturn-type -Werror" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether qualifiers in return types lead to a warning" >&5 @@ -4855,6 +4858,350 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext esac ;; esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler has a flag to support C++2011" >&5 +$as_echo_n "checking whether compiler has a flag to support C++2011... " >&6; } + + OLD_CXXFLAGS="$CXXFLAGS" + CXXFLAGS=-std=c++0x + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + test_cxx1x=yes + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + test_cxx1x=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CXXFLAGS="${OLD_CXXFLAGS}" + + if test "x$test_cxx1x" = "xyes" ; then + + OLD_CXXFLAGS="$CXXFLAGS" + CXXFLAGS=""-std=c++0x"" + + all_cxx1x_classes_available=yes + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::array" >&5 +$as_echo_n "checking for std::array... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + std::array p; p[0]; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; all_cxx1x_classes_available=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::condition_variable" >&5 +$as_echo_n "checking for std::condition_variable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + std::condition_variable c; c.notify_all() + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; all_cxx1x_classes_available=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::function and std::bind" >&5 +$as_echo_n "checking for std::function and std::bind... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + void f(int, double); +int +main () +{ + std::function + g = std::bind (f, std::placeholders::_1, 1.1) ; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; all_cxx1x_classes_available=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::bind works with rvalues" >&5 +$as_echo_n "checking for std::bind works with rvalues... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + void f(int); +int +main () +{ + using namespace std; + using namespace std::placeholders; + bind(multiplies(),4,_1)(5); ; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; all_cxx1x_classes_available=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::shared_ptr" >&5 +$as_echo_n "checking for std::shared_ptr... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + std::shared_ptr p(new int(3)) + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; all_cxx1x_classes_available=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::thread" >&5 +$as_echo_n "checking for std::thread... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + void f(int); +int +main () +{ + std::thread t(f,1); t.join(); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; all_cxx1x_classes_available=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + CXXFLAGS=""-std=c++0x" -lpthread" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether std::thread actually works" >&5 +$as_echo_n "checking whether std::thread actually works... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + void f(int) {} + int main() { std::thread t(f,1); t.join(); } +_ACEOF +if ac_fn_cxx_try_run "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; all_cxx1x_classes_available=no + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + CXXFLAGS=""-std=c++0x"" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::mutex" >&5 +$as_echo_n "checking for std::mutex... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + std::mutex m; m.lock(); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; all_cxx1x_classes_available=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for std::tuple" >&5 +$as_echo_n "checking for std::tuple... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + std::tuple p(1,1.1,'a') + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; all_cxx1x_classes_available=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + CXXFLAGS="${OLD_CXXFLAGS}" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++1x support is complete enough" >&5 +$as_echo_n "checking whether C++1x support is complete enough... " >&6; } + if test "x$all_cxx1x_classes_available" = "xyes" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + CXXFLAGSG="$CXXFLAGSG "-std=c++0x"" + CXXFLAGSO="$CXXFLAGSO "-std=c++0x"" + + +$as_echo "#define DEAL_II_CAN_USE_CXX1X 1" >>confdefs.h + + + + OLD_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGSG" + + extra_cxx1x_features_available=yes + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for auto typed variables" >&5 +$as_echo_n "checking for auto typed variables... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + std::vector v; + auto i = v.begin(); + *i; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; extra_cxx1x_features_available=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for range-based for" >&5 +$as_echo_n "checking for range-based for... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + std::vector v; + for (std::vector::iterator i : v) + *i; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; extra_cxx1x_features_available=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + CXXFLAGS="${OLD_CXXFLAGS}" + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + fi + ;; compaq_cxx) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 2570604967..c39d3e4bc9 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -34,6 +34,13 @@ inconvenience this causes.

General

    +
  1. Fixed: Intel ICC 12.1 gets into trouble with BOOST because BOOST +believes that the compiler supports C++0x but one then still has to +specify the corresponding flag on the command line to avoid compiler +errors. This is now fixed. +
    +(Wolfgang Bangerth, 2011/11/06) +
  2. Fixed: On some systems, mpiCC turns out to alias the C compiler, not the C++ compiler as expected. Consequently, try to use mpic++ or mpicxx before mpiCC as