]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Import the latest C++ 2011 detection macro 2478/head
authorPieter Lexis <pieter.lexis@powerdns.com>
Thu, 30 Apr 2015 07:36:56 +0000 (09:36 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Thu, 30 Apr 2015 07:36:56 +0000 (09:36 +0200)
m4/ax_cxx_compile_stdcxx_11.m4

index a10a1b32b7602d89f34418df0de2839a2a18bcac..a9a8f584fd827a0dce714501af6af5da52286478 100644 (file)
 #   Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
 #   Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
 #   Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
-#   Copyright (c) 2014 Alexey Sokolov <sokolov@google.com>
+#   Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
 #
 #   Copying and distribution of this file, with or without modification, are
 #   permitted in any medium without royalty provided the copyright notice
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 4
+#serial 10
 
 m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
-  #include <thread>
-  #include "pdns/ext/luawrapper/include/LuaContext.hpp"
   template <typename T>
     struct check
     {
@@ -63,6 +61,29 @@ m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
 
     auto d = a;
     auto l = [](){};
+    // Prevent Clang error: unused variable 'l' [-Werror,-Wunused-variable]
+    struct use_l { use_l() { l(); } };
+
+    // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
+    // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function because of this
+    namespace test_template_alias_sfinae {
+        struct foo {};
+
+        template<typename T>
+        using member = typename T::member_type;
+
+        template<typename T>
+        void func(...) {}
+
+        template<typename T>
+        void func(member<T>*) {}
+
+        void test();
+
+        void test() {
+            func<foo>(0);
+        }
+    }
 ]])
 
 AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
@@ -92,7 +113,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
       AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
                      $cachevar,
         [ac_save_CXXFLAGS="$CXXFLAGS"
-         CXXFLAGS="$LUA_CFLAGS $CXXFLAGS $switch"
+         CXXFLAGS="$CXXFLAGS $switch"
          AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
           [eval $cachevar=yes],
           [eval $cachevar=no])
@@ -112,7 +133,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
       AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
                      $cachevar,
         [ac_save_CXXFLAGS="$CXXFLAGS"
-         CXXFLAGS="$CXXFLAGS $LUA_CFLAGS $switch"
+         CXXFLAGS="$CXXFLAGS $switch"
          AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
           [eval $cachevar=yes],
           [eval $cachevar=no])