]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Check for a couple more C++11 features.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Jun 2011 20:17:08 +0000 (20:17 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Jun 2011 20:17:08 +0000 (20:17 +0000)
git-svn-id: https://svn.dealii.org/trunk@23829 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/aclocal.m4
deal.II/configure

index c2077171e8e250e863992adf926887f97392f157..d45ce1fbd22d8bb9db087fdbe509af8133400a1e 100644 (file)
@@ -1006,14 +1006,14 @@ AC_DEFUN(DEAL_II_CHECK_CXX1X_COMPONENTS, dnl
   OLD_CXXFLAGS="$CXXFLAGS"
   CXXFLAGS="$1"
 
-  all_cxx1x_available=yes
+  all_cxx1x_classes_available=yes
 
   AC_MSG_CHECKING(for std::array)
   AC_TRY_COMPILE(
        [#include <array>],
        [ std::array<int,3> p; p[0];],
        [ AC_MSG_RESULT(yes) ],
-       [ AC_MSG_RESULT(no); all_cxx1x_available=no ]
+       [ AC_MSG_RESULT(no); all_cxx1x_classes_available=no ]
        )
 
   AC_MSG_CHECKING(for std::condition_variable)
@@ -1021,7 +1021,7 @@ AC_DEFUN(DEAL_II_CHECK_CXX1X_COMPONENTS, dnl
        [#include <condition_variable> ],
        [ std::condition_variable c; c.notify_all()],
        [ AC_MSG_RESULT(yes) ],
-       [ AC_MSG_RESULT(no); all_cxx1x_available=no ]
+       [ AC_MSG_RESULT(no); all_cxx1x_classes_available=no ]
        )
 
   AC_MSG_CHECKING(for std::function and std::bind)
@@ -1031,7 +1031,7 @@ AC_DEFUN(DEAL_II_CHECK_CXX1X_COMPONENTS, dnl
        [ std::function<void (int)>
             g = std::bind (f, std::placeholders::_1, 1.1) ;],
        [ AC_MSG_RESULT(yes) ],
-       [ AC_MSG_RESULT(no); all_cxx1x_available=no ]
+       [ AC_MSG_RESULT(no); all_cxx1x_classes_available=no ]
        )
 
   dnl Make sure we don't run into GCC bug 35569
@@ -1043,7 +1043,7 @@ AC_DEFUN(DEAL_II_CHECK_CXX1X_COMPONENTS, dnl
          using namespace std::placeholders;
          bind(multiplies<int>(),4,_1)(5); ;],
        [ AC_MSG_RESULT(yes) ],
-       [ AC_MSG_RESULT(no); all_cxx1x_available=no ]
+       [ AC_MSG_RESULT(no); all_cxx1x_classes_available=no ]
        )
 
   AC_MSG_CHECKING(for std::shared_ptr)
@@ -1051,7 +1051,7 @@ AC_DEFUN(DEAL_II_CHECK_CXX1X_COMPONENTS, dnl
        [#include <memory>],
        [ std::shared_ptr<int> p(new int(3))],
        [ AC_MSG_RESULT(yes) ],
-       [ AC_MSG_RESULT(no); all_cxx1x_available=no ]
+       [ AC_MSG_RESULT(no); all_cxx1x_classes_available=no ]
        )
 
   AC_MSG_CHECKING(for std::thread)
@@ -1060,7 +1060,7 @@ AC_DEFUN(DEAL_II_CHECK_CXX1X_COMPONENTS, dnl
         void f(int); ],
        [ std::thread t(f,1); t.join();],
        [ AC_MSG_RESULT(yes) ],
-       [ AC_MSG_RESULT(no); all_cxx1x_available=no ]
+       [ AC_MSG_RESULT(no); all_cxx1x_classes_available=no ]
        )
 
   dnl On some systems with gcc 4.5.0, we can compile the code
@@ -1076,7 +1076,7 @@ AC_DEFUN(DEAL_II_CHECK_CXX1X_COMPONENTS, dnl
         void f(int) {}
         int main() { std::thread t(f,1); t.join(); } ],
        [ AC_MSG_RESULT(yes) ],
-       [ AC_MSG_RESULT(no); all_cxx1x_available=no ]
+       [ AC_MSG_RESULT(no); all_cxx1x_classes_available=no ]
        )
   CXXFLAGS="$1"
 
@@ -1085,7 +1085,7 @@ AC_DEFUN(DEAL_II_CHECK_CXX1X_COMPONENTS, dnl
        [#include <mutex> ],
        [ std::mutex m; m.lock();],
        [ AC_MSG_RESULT(yes) ],
-       [ AC_MSG_RESULT(no); all_cxx1x_available=no ]
+       [ AC_MSG_RESULT(no); all_cxx1x_classes_available=no ]
        )
 
   AC_MSG_CHECKING(for std::tuple)
@@ -1093,7 +1093,7 @@ AC_DEFUN(DEAL_II_CHECK_CXX1X_COMPONENTS, dnl
        [#include <tuple>],
        [ std::tuple<int,double,char> p(1,1.1,'a')],
        [ AC_MSG_RESULT(yes) ],
-       [ AC_MSG_RESULT(no); all_cxx1x_available=no ]
+       [ AC_MSG_RESULT(no); all_cxx1x_classes_available=no ]
        )
 
   CXXFLAGS="${OLD_CXXFLAGS}"
@@ -1102,7 +1102,7 @@ AC_DEFUN(DEAL_II_CHECK_CXX1X_COMPONENTS, dnl
   dnl use the corresponding flag in CXXFLAGS* to switch on support and
   dnl correspondingly use the C++ classes instead of the BOOST classes
   AC_MSG_CHECKING(whether C++1x support is complete enough)
-  if test "x$all_cxx1x_available" = "xyes" ; then
+  if test "x$all_cxx1x_classes_available" = "xyes" ; then
     AC_MSG_RESULT(yes)
 
     CXXFLAGSG="$CXXFLAGSG $1"
@@ -1110,6 +1110,45 @@ AC_DEFUN(DEAL_II_CHECK_CXX1X_COMPONENTS, dnl
 
     AC_DEFINE(DEAL_II_CAN_USE_CXX1X, 1,
               [Defined if the compiler we use supports the upcoming C++1x standard.])
+
+
+    dnl Also test for a couple C++1x things that we don't use in the library
+    dnl but that users may want to use in their applications and that we
+    dnl might want to test in the testsuite
+    OLD_CXXFLAGS="$CXXFLAGS"
+    CXXFLAGS="$CXXFLAGSG"
+
+    extra_cxx1x_features_available=yes
+
+    AC_MSG_CHECKING(for auto typed variables)
+    AC_TRY_COMPILE(
+         [#include <vector>],
+         [
+           std::vector<int> v;
+          auto i = v.begin();
+          *i;
+         ],
+         [ AC_MSG_RESULT(yes) ],
+         [ AC_MSG_RESULT(no); extra_cxx1x_features_available=no ]
+         )
+
+    AC_MSG_CHECKING(for range-based for)
+    AC_TRY_COMPILE(
+         [#include <vector>],
+         [
+           std::vector<int> v;
+          for (std::vector<int>::iterator i : v)
+            *i;
+         ],
+         [ AC_MSG_RESULT(yes) ],
+         [ AC_MSG_RESULT(no); extra_cxx1x_features_available=no ]
+         )
+
+    CXXFLAGS="${OLD_CXXFLAGS}"
+
+    dnl Right now, do nothing with this information since we don't
+    dnl have any compiler that gets all this right (gcc 4.5 included)
+    dnl and that we could use to test these features.
   else
     AC_MSG_RESULT(no)
   fi
index 6c02220e8acf478fb7985310032421d3afd0ccac..d1f15ddb2c75d2324044496340af636d3a727289 100755 (executable)
@@ -4112,7 +4112,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   OLD_CXXFLAGS="$CXXFLAGS"
   CXXFLAGS=""-std=c++0x""
 
-  all_cxx1x_available=yes
+  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; }
@@ -4132,7 +4132,7 @@ if ac_fn_cxx_try_compile "$LINENO"; then :
 $as_echo "yes" >&6; }
 else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }; all_cxx1x_available=no
+$as_echo "no" >&6; }; all_cxx1x_classes_available=no
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -4155,7 +4155,7 @@ if ac_fn_cxx_try_compile "$LINENO"; then :
 $as_echo "yes" >&6; }
 else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }; all_cxx1x_available=no
+$as_echo "no" >&6; }; all_cxx1x_classes_available=no
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -4180,7 +4180,7 @@ if ac_fn_cxx_try_compile "$LINENO"; then :
 $as_echo "yes" >&6; }
 else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }; all_cxx1x_available=no
+$as_echo "no" >&6; }; all_cxx1x_classes_available=no
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -4206,7 +4206,7 @@ if ac_fn_cxx_try_compile "$LINENO"; then :
 $as_echo "yes" >&6; }
 else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }; all_cxx1x_available=no
+$as_echo "no" >&6; }; all_cxx1x_classes_available=no
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -4229,7 +4229,7 @@ if ac_fn_cxx_try_compile "$LINENO"; then :
 $as_echo "yes" >&6; }
 else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }; all_cxx1x_available=no
+$as_echo "no" >&6; }; all_cxx1x_classes_available=no
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -4253,7 +4253,7 @@ if ac_fn_cxx_try_compile "$LINENO"; then :
 $as_echo "yes" >&6; }
 else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }; all_cxx1x_available=no
+$as_echo "no" >&6; }; all_cxx1x_classes_available=no
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -4278,7 +4278,7 @@ if ac_fn_cxx_try_run "$LINENO"; then :
 $as_echo "yes" >&6; }
 else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }; all_cxx1x_available=no
+$as_echo "no" >&6; }; all_cxx1x_classes_available=no
 
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
@@ -4305,7 +4305,7 @@ if ac_fn_cxx_try_compile "$LINENO"; then :
 $as_echo "yes" >&6; }
 else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }; all_cxx1x_available=no
+$as_echo "no" >&6; }; all_cxx1x_classes_available=no
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -4328,16 +4328,16 @@ if ac_fn_cxx_try_compile "$LINENO"; then :
 $as_echo "yes" >&6; }
 else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }; all_cxx1x_available=no
+$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 "$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_available" = "xyes" ; then
+  if test "x$all_cxx1x_classes_available" = "xyes" ; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
@@ -4347,6 +4347,68 @@ $as_echo "yes" >&6; }
 
 $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 <vector>
+int
+main ()
+{
+
+           std::vector<int> 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 <vector>
+int
+main ()
+{
+
+           std::vector<int> v;
+          for (std::vector<int>::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; }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.