Skip to content

Commit

Permalink
build: force a c++ standard to be specified
Browse files Browse the repository at this point in the history
Newer compilers may switch to newer standards by default. For example, gcc6
uses std=gnu++14 by default.

Github-Pull: #9831
Rebased-From: 9829c54
  • Loading branch information
theuni authored and laanwj committed Feb 23, 2017
1 parent 05e906d commit 99fd85c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion build-aux/m4/ax_cxx_compile_stdcxx.m4
Expand Up @@ -57,16 +57,22 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
[$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
[$3], [optional], [ax_cxx_compile_cxx$1_required=false],
[m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
m4_if([$4], [], [ax_cxx_compile_cxx$1_try_default=true],
[$4], [default], [ax_cxx_compile_cxx$1_try_default=true],
[$4], [nodefault], [ax_cxx_compile_cxx$1_try_default=false],
[m4_fatal([invalid fourth argument `$4' to AX_CXX_COMPILE_STDCXX])])
AC_LANG_PUSH([C++])dnl
ac_success=no
m4_if([$4], [nodefault], [], [dnl
AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
ax_cv_cxx_compile_cxx$1,
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[ax_cv_cxx_compile_cxx$1=yes],
[ax_cv_cxx_compile_cxx$1=no])])
if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
ac_success=yes
fi
fi])
m4_if([$2], [noext], [], [dnl
if test x$ac_success = xno; then
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -55,7 +55,7 @@ case $host in
;;
esac
dnl Require C++11 compiler (no GNU extensions)
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory], [nodefault])
dnl Check if -latomic is required for <std::atomic>
CHECK_ATOMIC

Expand Down

0 comments on commit 99fd85c

Please sign in to comment.