Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Spot
Spot
Commits
878649c8
Commit
878649c8
authored
Dec 13, 2016
by
Maximilien Colange
Browse files
[buddy] Add an option to enable C++14.
* configure.ac: add an option --enable-c++14.
parent
114f7f12
Changes
1
Hide whitespace changes
Inline
Side-by-side
buddy/configure.ac
View file @
878649c8
...
@@ -18,6 +18,12 @@ AC_PROG_YACC
...
@@ -18,6 +18,12 @@ AC_PROG_YACC
AC_PROG_CXX
AC_PROG_CXX
# 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])
LT_INIT([win32-dll])
LT_INIT([win32-dll])
AX_BSYMBOLIC
AX_BSYMBOLIC
...
@@ -49,8 +55,10 @@ AC_LANG(C++)
...
@@ -49,8 +55,10 @@ AC_LANG(C++)
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody],
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody],
[AC_LANG_SOURCE([#include <memory>
[AC_LANG_SOURCE([#include <memory>
#include <string>
#include <string>
#include <chrono> // fails with some installation of clang
#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");
...
@@ -68,16 +76,69 @@ m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody],
...
@@ -68,16 +76,69 @@ m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody],
check_type&& cr = static_cast<check_type&&>(c);
check_type&& cr = static_cast<check_type&&>(c);
auto d = a;
auto d = a;
void test_emplace()
{
std::map<int, int> m;
m.emplace(1, 2); // fails with g++ 4.6
}
])])
# Turn on C++14 support
# This is currently a copy of the above code for C++11, feel free to add
# further tests here when necessary.
m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody],
[AC_LANG_SOURCE([#include <memory>
#include <string>
#include <chrono> // fails with some installation of clang
#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
}
])])
])])
for f in -std=c++11 '-std=c++11 -stdlib=libc++' -std=c++0x
if test x"${enable_14}" = xyes; then
do
for f in -std=c++14 '-std=c++14 -stdlib=libc++' -std=c++1y
AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [],
do
[_AX_CXX_COMPILE_STDCXX_11_testbody])
AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [],
${stdpass-false} && break
[_AX_CXX_COMPILE_STDCXX_14_testbody])
done
${stdpass-false} && break
if ! "${stdpass-false}"; then
done
AC_ERROR([unable to turn on C++11 mode with this compiler])
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
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_HEADERS([config.h])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment