From: bangerth Date: Mon, 25 Oct 2010 16:41:24 +0000 (+0000) Subject: Don't just test for the existence of std::thread but also whether it works. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55aef9bff494554a28265a391b40101ebda69cae;p=dealii-svn.git Don't just test for the existence of std::thread but also whether it works. git-svn-id: https://svn.dealii.org/trunk@22475 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index 9256e092d2..20dc46cd99 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -1054,6 +1054,18 @@ AC_DEFUN(DEAL_II_CHECK_CXX1X_COMPONENTS, dnl [ AC_MSG_RESULT(no); all_cxx1x_available=no ] ) + dnl On some systems with gcc 4.5.0, we can compile the code + dnl above but it will throw an exception when run. So test + dnl that as well. + AC_MSG_CHECKING(whether std::thread actually works) + AC_TRY_RUN( + [#include + void f(int); ], + [ std::thread t(f,1); t.join();], + [ AC_MSG_RESULT(yes) ], + [ AC_MSG_RESULT(no); all_cxx1x_available=no ] + ) + AC_MSG_CHECKING(for std::mutex) AC_TRY_COMPILE( [#include ], diff --git a/deal.II/configure b/deal.II/configure index 24a3e88df1..34246213ea 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 22430 . +# From configure.in Revision: 22448 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.63 for deal.II 6.4.pre. # @@ -4376,6 +4376,60 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:$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:$LINENO: result: no" >&5 +$as_echo "no" >&6; }; all_cxx1x_available=no + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + void f(int); +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + std::thread t(f,1); t.join(); +else + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + { $as_echo "$as_me:$LINENO: checking for std::mutex" >&5 $as_echo_n "checking for std::mutex... " >&6; } cat >conftest.$ac_ext <<_ACEOF