configure.ac: Use AX_CXX_COMPILE_STDCXX to enable C++11 support in old compilers

This commit enables use of the AX_CXX_COMPILE_STDCXX macro from the
autoconf-archive (added in the previous commit), which automatically
adds needed flags to the CXX variable to enable C++11 support. This only
works and is only required on compilers that are both new enough to have
C++11 support and old enough to not enable it by default.

We call it with "noext" as the second argument (so that we get the "std"
C++11 variant on GCC) and "mandatory" as the third argument, since we
now rely on C++11 features as of 83c59e705f461cc08e5844d62514dff27c33a74f.

Note that this macro is only called when we are building the compiler
(i.e., without --disable-protoc) so that the library can still be built
on ancient C compilers.
This commit is contained in:
Robert Edmonds 2018-08-13 22:25:41 -04:00
parent 42612b4ba4
commit 9becc1b66f

View File

@ -76,6 +76,8 @@ AC_ARG_ENABLE([protoc],
if test "x$enable_protoc" != "xno"; then
AC_LANG_PUSH([C++])
AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
PKG_CHECK_MODULES([protobuf], [protobuf >= 3.0.0],
[proto3_supported=yes],
[PKG_CHECK_MODULES([protobuf], [protobuf >= 2.6.0])]