[vlc-commits] configure.ac: Bump required C++ version to 14

Hugo Beauzée-Luyssen git at videolan.org
Thu Apr 4 10:31:41 CEST 2019


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Apr  3 15:56:26 2019 +0200| [f799f9ced99d65df899d8c5ab3910fd2693dedeb] | committer: Hugo Beauzée-Luyssen

configure.ac: Bump required C++ version to 14

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f799f9ced99d65df899d8c5ab3910fd2693dedeb
---

 configure.ac                      |  2 +-
 m4/Makefile.am                    |  2 +-
 m4/{stdcxx_11.m4 => stdcxx_14.m4} | 93 +++++++++++++++++++++++----------------
 3 files changed, 58 insertions(+), 39 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3ff54e28ea..a6de02a446 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,7 +68,7 @@ dnl Check for compiler properties
 AC_C_CONST
 AC_C_INLINE
 AC_C_RESTRICT
-AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
+AX_CXX_COMPILE_STDCXX_14([noext], [mandatory])
 
 dnl Extend the --help string at the current spot.
 AC_DEFUN([EXTEND_HELP_STRING], [m4_divert_once([HELP_ENABLE], [$1])])
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 8b6e6aa92f..fa26587d1d 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -29,7 +29,7 @@ EXTRA_DIST = \
 	printf-posix.m4 \
 	progtest.m4 \
 	size_max.m4 \
-	stdcxx_11.m4 \
+	stdcxx_14.m4 \
 	stdint_h.m4 \
 	uintmax_t.m4 \
 	visibility.m4 \
diff --git a/m4/stdcxx_11.m4 b/m4/stdcxx_14.m4
similarity index 64%
rename from m4/stdcxx_11.m4
rename to m4/stdcxx_14.m4
index 59df0a0d11..f33253de12 100644
--- a/m4/stdcxx_11.m4
+++ b/m4/stdcxx_14.m4
@@ -1,26 +1,26 @@
 # ============================================================================
-#  http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
+# Based on http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
 # ============================================================================
 #
 # SYNOPSIS
 #
-#   AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
+#   AX_CXX_COMPILE_STDCXX_14([ext|noext],[mandatory|optional])
 #
 # DESCRIPTION
 #
-#   Check for baseline language coverage in the compiler for the C++11
+#   Check for baseline language coverage in the compiler for the C++14
 #   standard; if necessary, add switches to CXXFLAGS to enable support.
 #
 #   The first argument, if specified, indicates whether you insist on an
-#   extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
-#   -std=c++11).  If neither is specified, you get whatever works, with
+#   extended mode (e.g. -std=gnu++14) or a strict conformance mode (e.g.
+#   -std=c++14).  If neither is specified, you get whatever works, with
 #   preference for an extended mode.
 #
 #   The second argument, if specified 'mandatory' or if left unspecified,
-#   indicates that baseline C++11 support is required and that the macro
+#   indicates that baseline C++14 support is required and that the macro
 #   should error out if no mode with that support is found.  If specified
 #   'optional', then configuration proceeds regardless, after defining
-#   HAVE_CXX11 if and only if a supporting mode is found.
+#   HAVE_CXX14 if and only if a supporting mode is found.
 #
 # LICENSE
 #
@@ -29,7 +29,7 @@
 #   Copyright (c) 2013 Roy Stogner <roystgnr at ices.utexas.edu>
 #   Copyright (c) 2014 Alexey Sokolov <sokolov at google.com>
 #   Copyright (c) 2014, 2015 Google Inc.
-#   Copyright (c) 2015, 2016 VLC authors and VideoLAN
+#   Copyright (c) 2015, 2019 VLC authors and VideoLAN
 #
 #   Copying and distribution of this file, with or without modification, are
 #   permitted in any medium without royalty provided the copyright notice
@@ -38,7 +38,7 @@
 
 #serial 7
 
-m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
+m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody], [[
   template <typename T>
     struct check
     {
@@ -91,37 +91,56 @@ m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
     constexpr unsigned constant_lim = UINT_MAX;
     const char *constant_fmt = "%" PRIu64, *constant_scn = "%" SCNu64;
     constexpr size_t constant_align = alignof (std::max_align_t);
+
+    #include <memory>
+
+    namespace lambda_init_capture
+    {
+        void foo()
+        {
+            std::unique_ptr<int> ptr(new int);
+            auto lambda = [p = std::move(ptr)](){};
+            lambda();
+        }
+    }
+
+    #include <type_traits>
+
+    namespace traits_helper_types
+    {
+        static_assert( std::is_same<char, std::remove_pointer_t<char*>>::value, "plonk" );
+    }
 ]])
 
-AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
+AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [dnl
   m4_if([$1], [], [],
         [$1], [ext], [],
         [$1], [noext], [],
-        [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
-  m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
-        [$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
-        [$2], [optional], [ax_cxx_compile_cxx11_required=false],
-        [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])
+        [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_14])])dnl
+  m4_if([$2], [], [ax_cxx_compile_cxx14_required=true],
+        [$2], [mandatory], [ax_cxx_compile_cxx14_required=true],
+        [$2], [optional], [ax_cxx_compile_cxx14_required=false],
+        [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_14])])
   AC_LANG_PUSH([C++])dnl
   ac_success=no
-  AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
-  ax_cv_cxx_compile_cxx11,
-  [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
-    [ax_cv_cxx_compile_cxx11=yes],
-    [ax_cv_cxx_compile_cxx11=no])])
-  if test x$ax_cv_cxx_compile_cxx11 = xyes; then
+  AC_CACHE_CHECK(whether $CXX supports C++14 features by default,
+  ax_cv_cxx_compile_cxx14,
+  [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_14_testbody])],
+    [ax_cv_cxx_compile_cxx14=yes],
+    [ax_cv_cxx_compile_cxx14=no])])
+  if test x$ax_cv_cxx_compile_cxx14 = xyes; then
     ac_success=yes
   fi
 
   m4_if([$1], [noext], [], [dnl
   if test x$ac_success = xno; then
-    for switch in -std=gnu++11 -std=gnu++0x; do
-      cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
-      AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
+    for switch in -std=gnu++14 -std=gnu++1y; do
+      cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx14_$switch])
+      AC_CACHE_CHECK(whether $CXX supports C++14 features with $switch,
                      $cachevar,
         [ac_save_CXXFLAGS="$CXXFLAGS"
          CXXFLAGS="$CXXFLAGS $switch"
-         AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
+         AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_14_testbody])],
           [eval $cachevar=yes],
           [eval $cachevar=no])
          CXXFLAGS="$ac_save_CXXFLAGS"])
@@ -135,13 +154,13 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
 
   m4_if([$1], [ext], [], [dnl
   if test x$ac_success = xno; then
-    for switch in -std=c++11 -std=c++0x; do
-      cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
-      AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
+    for switch in -std=c++14 -std=c++1y; do
+      cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx14_$switch])
+      AC_CACHE_CHECK(whether $CXX supports C++14 features with $switch,
                      $cachevar,
         [ac_save_CXXFLAGS="$CXXFLAGS"
          CXXFLAGS="$CXXFLAGS $switch"
-         AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
+         AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_14_testbody])],
           [eval $cachevar=yes],
           [eval $cachevar=no])
          CXXFLAGS="$ac_save_CXXFLAGS"])
@@ -153,20 +172,20 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
     done
   fi])
   AC_LANG_POP([C++])
-  if test x$ax_cxx_compile_cxx11_required = xtrue; then
+  if test x$ax_cxx_compile_cxx14_required = xtrue; then
     if test x$ac_success = xno; then
-      AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
+      AC_MSG_ERROR([*** A compiler with support for C++14 language features is required.])
     fi
   else
     if test x$ac_success = xno; then
-      HAVE_CXX11=0
-      AC_MSG_NOTICE([No compiler with C++11 support was found])
+      HAVE_CXX14=0
+      AC_MSG_NOTICE([No compiler with C++14 support was found])
     else
-      HAVE_CXX11=1
-      AC_DEFINE(HAVE_CXX11,1,
-                [define if the compiler supports basic C++11 syntax])
+      HAVE_CXX14=1
+      AC_DEFINE(HAVE_CXX14,1,
+                [define if the compiler supports basic C++14 syntax])
     fi
 
-    AC_SUBST(HAVE_CXX11)
+    AC_SUBST(HAVE_CXX14)
   fi
 ])



More information about the vlc-commits mailing list