Commit 2736fecc authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Move to C++14

parent 077b32e1
Pipeline #9 canceled with stage
...@@ -30,7 +30,7 @@ AC_DISABLE_STATIC ...@@ -30,7 +30,7 @@ AC_DISABLE_STATIC
LT_INIT LT_INIT
AC_PROG_INSTALL AC_PROG_INSTALL
AX_CXX_COMPILE_STDCXX_11([ext],[mandatory]) AX_CXX_COMPILE_STDCXX_14([ext],[mandatory])
dnl turn on warnings dnl turn on warnings
[CXXFLAGS="-Wall -Wextra -ftemplate-backtrace-limit=0 ${CXXFLAGS}"] [CXXFLAGS="-Wall -Wextra -ftemplate-backtrace-limit=0 ${CXXFLAGS}"]
......
# ============================================================================ # ============================================================================
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html # http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html
# ============================================================================ # ============================================================================
# #
# SYNOPSIS # SYNOPSIS
# #
# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional]) # AX_CXX_COMPILE_STDCXX_14([ext|noext],[mandatory|optional])
# #
# DESCRIPTION # 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. # standard; if necessary, add switches to CXXFLAGS to enable support.
# #
# The first argument, if specified, indicates whether you insist on an # 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. # extended mode (e.g. -std=gnu++14) or a strict conformance mode (e.g.
# -std=c++11). If neither is specified, you get whatever works, with # -std=c++14). If neither is specified, you get whatever works, with
# preference for an extended mode. # preference for an extended mode.
# #
# The second argument, if specified 'mandatory' or if left unspecified, # 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 # should error out if no mode with that support is found. If specified
# 'optional', then configuration proceeds regardless, after defining # '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 # LICENSE
# #
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
# and this notice are preserved. This file is offered as-is, without any # and this notice are preserved. This file is offered as-is, without any
# warranty. # warranty.
#serial 11 #serial 14
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[ m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody], [[
template <typename T> template <typename T>
struct check struct check
{ {
...@@ -86,35 +86,35 @@ m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[ ...@@ -86,35 +86,35 @@ m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
} }
]]) ]])
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [dnl
m4_if([$1], [], [], m4_if([$1], [], [],
[$1], [ext], [], [$1], [ext], [],
[$1], [noext], [], [$1], [noext], [],
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_14])])dnl
m4_if([$2], [], [ax_cxx_compile_cxx11_required=true], m4_if([$2], [], [ax_cxx_compile_cxx14_required=true],
[$2], [mandatory], [ax_cxx_compile_cxx11_required=true], [$2], [mandatory], [ax_cxx_compile_cxx14_required=true],
[$2], [optional], [ax_cxx_compile_cxx11_required=false], [$2], [optional], [ax_cxx_compile_cxx14_required=false],
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])]) [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_14])])
AC_LANG_PUSH([C++])dnl AC_LANG_PUSH([C++])dnl
ac_success=no ac_success=no
AC_CACHE_CHECK(whether $CXX supports C++11 features by default, AC_CACHE_CHECK(whether $CXX supports C++14 features by default,
ax_cv_cxx_compile_cxx11, ax_cv_cxx_compile_cxx14,
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_14_testbody])],
[ax_cv_cxx_compile_cxx11=yes], [ax_cv_cxx_compile_cxx14=yes],
[ax_cv_cxx_compile_cxx11=no])]) [ax_cv_cxx_compile_cxx14=no])])
if test x$ax_cv_cxx_compile_cxx11 = xyes; then if test x$ax_cv_cxx_compile_cxx14 = xyes; then
ac_success=yes ac_success=yes
fi fi
m4_if([$1], [noext], [], [dnl m4_if([$1], [noext], [], [dnl
if test x$ac_success = xno; then if test x$ac_success = xno; then
for switch in -std=gnu++11 -std=gnu++0x; do for switch in -std=gnu++14 -std=gnu++1y; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx14_$switch])
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, AC_CACHE_CHECK(whether $CXX supports C++14 features with $switch,
$cachevar, $cachevar,
[ac_save_CXXFLAGS="$CXXFLAGS" [ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $switch" 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=yes],
[eval $cachevar=no]) [eval $cachevar=no])
CXXFLAGS="$ac_save_CXXFLAGS"]) CXXFLAGS="$ac_save_CXXFLAGS"])
...@@ -128,15 +128,15 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl ...@@ -128,15 +128,15 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
m4_if([$1], [ext], [], [dnl m4_if([$1], [ext], [], [dnl
if test x$ac_success = xno; then if test x$ac_success = xno; then
dnl HP's aCC needs +std=c++11 according to: dnl HP's aCC needs +std=c++14 according to:
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
for switch in -std=c++11 -std=c++0x +std=c++11; do for switch in -std=c++14 -std=c++1y +std=c++14; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx14_$switch])
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, AC_CACHE_CHECK(whether $CXX supports C++14 features with $switch,
$cachevar, $cachevar,
[ac_save_CXXFLAGS="$CXXFLAGS" [ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $switch" 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=yes],
[eval $cachevar=no]) [eval $cachevar=no])
CXXFLAGS="$ac_save_CXXFLAGS"]) CXXFLAGS="$ac_save_CXXFLAGS"])
...@@ -148,20 +148,20 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl ...@@ -148,20 +148,20 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
done done
fi]) fi])
AC_LANG_POP([C++]) 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 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 fi
else else
if test x$ac_success = xno; then if test x$ac_success = xno; then
HAVE_CXX11=0 HAVE_CXX14=0
AC_MSG_NOTICE([No compiler with C++11 support was found]) AC_MSG_NOTICE([No compiler with C++14 support was found])
else else
HAVE_CXX11=1 HAVE_CXX14=1
AC_DEFINE(HAVE_CXX11,1, AC_DEFINE(HAVE_CXX14,1,
[define if the compiler supports basic C++11 syntax]) [define if the compiler supports basic C++14 syntax])
fi fi
AC_SUBST(HAVE_CXX11) AC_SUBST(HAVE_CXX14)
fi fi
]) ])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment