Skip to content

Commit 943f19f

Browse files
theunistr4d
authored andcommitted
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 0bcd85b commit 943f19f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Diff for: build-aux/m4/ax_cxx_compile_stdcxx.m4

+7-1
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

Diff for: configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ case $host in
5656
;;
5757
esac
5858
dnl Require C++11 compiler (no GNU extensions)
59-
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
59+
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory], [nodefault])
6060
dnl Check if -latomic is required for <std::atomic>
6161
CHECK_ATOMIC
6262

0 commit comments

Comments
 (0)