Skip to content

Commit 9829c54

Browse files
committed
build: force a c++ standard to be specified
Newer compilers may switch to newer standards by default. For example, gcc6 uses std=gnu++14 by default.
1 parent 5f0556d commit 9829c54

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

build-aux/m4/ax_cxx_compile_stdcxx.m4

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,22 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
5757
[$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
5858
[$3], [optional], [ax_cxx_compile_cxx$1_required=false],
5959
[m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
60+
m4_if([$4], [], [ax_cxx_compile_cxx$1_try_default=true],
61+
[$4], [default], [ax_cxx_compile_cxx$1_try_default=true],
62+
[$4], [nodefault], [ax_cxx_compile_cxx$1_try_default=false],
63+
[m4_fatal([invalid fourth argument `$4' to AX_CXX_COMPILE_STDCXX])])
6064
AC_LANG_PUSH([C++])dnl
6165
ac_success=no
66+
67+
m4_if([$4], [nodefault], [], [dnl
6268
AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
6369
ax_cv_cxx_compile_cxx$1,
6470
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
6571
[ax_cv_cxx_compile_cxx$1=yes],
6672
[ax_cv_cxx_compile_cxx$1=no])])
6773
if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
6874
ac_success=yes
69-
fi
75+
fi])
7076
7177
m4_if([$2], [noext], [], [dnl
7278
if test x$ac_success = xno; then

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ case $host in
5555
;;
5656
esac
5757
dnl Require C++11 compiler (no GNU extensions)
58-
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
58+
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory], [nodefault])
5959
dnl Check if -latomic is required for <std::atomic>
6060
CHECK_ATOMIC
6161

0 commit comments

Comments
 (0)