Add an option to enable C++14.
* configure.ac: add an option --enable-c++14. * NEWS: mention the new option.
This commit is contained in:
parent
878649c823
commit
05f8333e76
2 changed files with 72 additions and 10 deletions
5
NEWS
5
NEWS
|
|
@ -19,6 +19,11 @@ New in spot 2.2.1.dev (Not yet released)
|
||||||
* If the system has an installed libltdl library, use it instead of
|
* If the system has an installed libltdl library, use it instead of
|
||||||
the one we distribute.
|
the one we distribute.
|
||||||
|
|
||||||
|
* The configure script has a new option --enable-c++14, to compile in
|
||||||
|
C++14 mode. Obviously you need a compiler that supports it. This allows
|
||||||
|
to check that nothing breaks when we will switch to C++14. This option
|
||||||
|
is also available in the configure script of buddy.
|
||||||
|
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
|
|
||||||
* scc_filter() had a left-over print statement that would print
|
* scc_filter() had a left-over print statement that would print
|
||||||
|
|
|
||||||
77
configure.ac
77
configure.ac
|
|
@ -44,8 +44,18 @@ AC_PROG_CXX
|
||||||
AM_PROG_LEX
|
AM_PROG_LEX
|
||||||
adl_CHECK_BISON
|
adl_CHECK_BISON
|
||||||
|
|
||||||
|
# Option to activate C/C++14
|
||||||
|
AC_ARG_ENABLE([c++14],
|
||||||
|
[AC_HELP_STRING([--enable-c++14],
|
||||||
|
[Use C++14.])],
|
||||||
|
[enable_14=yes], [enable_14=no])
|
||||||
|
|
||||||
# Activate at C11 for gnulib tests
|
# Activate at C11 for gnulib tests
|
||||||
AX_CHECK_COMPILE_FLAG([-std=c11], [CFLAGS="$CFLAGS -std=c11"])
|
if test x"${enable_14}" = xyes; then
|
||||||
|
AX_CHECK_COMPILE_FLAG([-std=c14], [CFLAGS="$CFLAGS -std=c14"])
|
||||||
|
else
|
||||||
|
AX_CHECK_COMPILE_FLAG([-std=c11], [CFLAGS="$CFLAGS -std=c11"])
|
||||||
|
fi
|
||||||
|
|
||||||
gl_INIT
|
gl_INIT
|
||||||
|
|
||||||
|
|
@ -67,7 +77,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody],
|
||||||
#include <chrono> // fails with some installation of clang
|
#include <chrono> // fails with some installation of clang
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct check
|
struct check
|
||||||
{
|
{
|
||||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||||
|
|
@ -93,14 +103,61 @@ m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody],
|
||||||
}
|
}
|
||||||
])])
|
])])
|
||||||
|
|
||||||
for f in -std=c++11 '-std=c++11 -stdlib=libc++' -std=c++0x
|
# Turn on C++14 support
|
||||||
do
|
# This is currently a copy of the above code for C++11, feel free to add
|
||||||
AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [],
|
# further tests here when necessary.
|
||||||
[_AX_CXX_COMPILE_STDCXX_11_testbody])
|
m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody],
|
||||||
${stdpass-false} && break
|
[AC_LANG_SOURCE([#include <memory>
|
||||||
done
|
#include <string>
|
||||||
if ! "${stdpass-false}"; then
|
#include <chrono> // fails with some installation of clang
|
||||||
AC_ERROR([unable to turn on C++11 mode with this compiler])
|
#include <map>
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct check
|
||||||
|
{
|
||||||
|
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef check<check<bool>> right_angle_brackets;
|
||||||
|
|
||||||
|
auto f = std::make_shared<std::string>("shared_ptr");
|
||||||
|
|
||||||
|
int a;
|
||||||
|
decltype(a) b;
|
||||||
|
|
||||||
|
typedef check<int> check_type;
|
||||||
|
check_type c;
|
||||||
|
check_type&& cr = static_cast<check_type&&>(c);
|
||||||
|
|
||||||
|
auto d = a;
|
||||||
|
|
||||||
|
void test_emplace()
|
||||||
|
{
|
||||||
|
std::map<int, int> m;
|
||||||
|
m.emplace(1, 2); // fails with g++ 4.6
|
||||||
|
}
|
||||||
|
])])
|
||||||
|
|
||||||
|
if test x"${enable_14}" = xyes; then
|
||||||
|
for f in -std=c++14 '-std=c++14 -stdlib=libc++' -std=c++1y
|
||||||
|
do
|
||||||
|
AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [],
|
||||||
|
[_AX_CXX_COMPILE_STDCXX_14_testbody])
|
||||||
|
${stdpass-false} && break
|
||||||
|
done
|
||||||
|
if ! "${stdpass-false}"; then
|
||||||
|
AC_ERROR([unable to turn on C++14 mode with this compiler])
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
for f in -std=c++11 '-std=c++11 -stdlib=libc++' -std=c++0x
|
||||||
|
do
|
||||||
|
AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [],
|
||||||
|
[_AX_CXX_COMPILE_STDCXX_11_testbody])
|
||||||
|
${stdpass-false} && break
|
||||||
|
done
|
||||||
|
if ! "${stdpass-false}"; then
|
||||||
|
AC_ERROR([unable to turn on C++11 mode with this compiler])
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AX_CHECK_BUDDY
|
AX_CHECK_BUDDY
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue