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
7f427827
Commit
7f427827
authored
Aug 22, 2017
by
Alexandre Duret-Lutz
Browse files
[buddy] switch to C++14 compilation
* configure.ac: Here. Rename --enable-c++14 into --enable-c++17.
parent
b7d54c8b
Changes
1
Hide whitespace changes
Inline
Side-by-side
buddy/configure.ac
View file @
7f427827
...
...
@@ -18,11 +18,11 @@ AC_PROG_YACC
AC_PROG_CXX
# Option to activate
C/
C++1
4
AC_ARG_ENABLE([c++1
4
],
[AC_HELP_STRING([--enable-c++1
4
],
[
Use C++14
.])],
[enable_1
4
=yes], [enable_1
4
=no])
# Option to activate C++1
7
AC_ARG_ENABLE([c++1
7
],
[AC_HELP_STRING([--enable-c++1
7
],
[
Compile in C++17 mode
.])],
[enable_1
7
=yes], [enable_1
7
=no])
LT_INIT([win32-dll])
AX_BSYMBOLIC
...
...
@@ -50,47 +50,12 @@ if test x$enable_warnings = xyes; then
CF_GCC_WARNINGS
fi
# Turn on C++11 support
AC_LANG(C++)
m4_define([_AX_CXX_COMPILE_STDCXX_11_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
}
])])
# 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.
AC_LANG(C++)
m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody],
[AC_LANG_SOURCE([#include <memory>
#include <string>
#include <chrono> //
fails
with some installation of clang
#include <chrono> //
used to fail in C++11
with some installation of clang
#include <map>
template <typename T>
...
...
@@ -101,7 +66,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody],
typedef check<check<bool>> right_angle_brackets;
auto f = std::make_
shared
<std::string>("
shared
_ptr");
auto f = std::make_
unique
<std::string>("
uniq
_ptr");
int a;
decltype(a) b;
...
...
@@ -111,33 +76,27 @@ m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody],
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_1
4
}" = xyes; then
for f in -std=c++1
4
'-std=c++1
4
-stdlib=libc++' -std=c++1
y
if test x"${enable_1
7
}" = xyes; then
for f in -std=c++1
7
'-std=c++1
7
-stdlib=libc++' -std=c++1
z
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++1
4
mode with this compiler])
AC_ERROR([unable to turn on C++1
7
mode with this compiler])
fi
else
for f in -std=c++1
1
'-std=c++1
1
-stdlib=libc++' -std=c++
0x
for f in -std=c++1
4
'-std=c++1
4
-stdlib=libc++' -std=c++
1y
do
AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [],
[_AX_CXX_COMPILE_STDCXX_1
1
_testbody])
[_AX_CXX_COMPILE_STDCXX_1
4
_testbody])
${stdpass-false} && break
done
if ! "${stdpass-false}"; then
AC_ERROR([unable to turn on C++1
1
mode with this compiler])
AC_ERROR([unable to turn on C++1
4
mode with this compiler])
fi
fi
...
...
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