mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-14 14:12:31 +00:00
C++11 compatibility fixes.
This commit is contained in:
+66
-12
@@ -377,24 +377,78 @@ AC_DEFUN([TORRENT_CHECK_TR1], [
|
||||
|
||||
AC_DEFUN([TORRENT_CHECK_CXX11], [
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_MSG_CHECKING(for C++11 support)
|
||||
AC_MSG_CHECKING(C++11 support)
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
class Foo;
|
||||
typedef std::unordered_map<Foo*, int> Bar;
|
||||
|
||||
#include <vector>
|
||||
class Foo; typedef std::vector<Foo*> Bar;
|
||||
union test { Bar b1; };
|
||||
])],
|
||||
[
|
||||
])
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_CXX11, 1, Define to 1 if your C++ compiler has support for C++11.)
|
||||
],
|
||||
[
|
||||
], [
|
||||
CXXFLAGS="$CXXFLAGS -std=c++11"
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
#include <vector>
|
||||
class Foo; typedef std::vector<Foo*> Bar;
|
||||
union test { Bar b1; };
|
||||
])
|
||||
], [
|
||||
AC_MSG_RESULT([with -std=c++11])
|
||||
AC_DEFINE(HAVE_CXX11, 1, Define to 1 if your C++ compiler has support for C++11.)
|
||||
], [
|
||||
AC_MSG_ERROR([No support for C++11 found.])
|
||||
])
|
||||
])
|
||||
|
||||
AC_LANG_POP(C++)
|
||||
])
|
||||
|
||||
AC_DEFUN([TORRENT_CHECK_TR1_LIB], [
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_MSG_CHECKING(should use TR1 headers)
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
#include <unordered_map>
|
||||
class Foo; typedef std::unordered_map<Foo*, int> Bar;
|
||||
Bar b1;
|
||||
])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
]
|
||||
)
|
||||
AC_DEFINE(USE_TR1_LIB, 0, Define to 1 if you need to use TR1 containers.)
|
||||
|
||||
AC_DEFINE([lt_tr1_array], [<array>], [TR1 array])
|
||||
AC_DEFINE([lt_tr1_functional], [<functional>], [TR1 functional])
|
||||
AC_DEFINE([lt_tr1_memory], [<memory>], [TR1 memory])
|
||||
AC_DEFINE([lt_tr1_unordered_map], [<unordered_map>], [TR1 unordered_map])
|
||||
|
||||
], [
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
#include <tr1/unordered_map>
|
||||
class Foo; typedef std::tr1::unordered_map<Foo*, int> Bar;
|
||||
Bar b1;
|
||||
])
|
||||
], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(USE_TR1_LIB, 1, Define to 1 if you need to use TR1 containers.)
|
||||
|
||||
AC_DEFINE([lt_tr1_array], [<tr1/array>], [TR1 array])
|
||||
AC_DEFINE([lt_tr1_functional], [<tr1/functional>], [TR1 functional])
|
||||
AC_DEFINE([lt_tr1_memory], [<tr1/memory>], [TR1 memory])
|
||||
AC_DEFINE([lt_tr1_unordered_map], [<tr1/unordered_map>], [TR1 unordered_map])
|
||||
|
||||
], [
|
||||
AC_MSG_ERROR([No support for C++11 standard library nor TR1 extensions found.])
|
||||
])
|
||||
])
|
||||
|
||||
AH_VERBATIM(lt_tr1_zzz, [
|
||||
#if USE_TR1_LIB == 1
|
||||
namespace std { namespace tr1 {} using namespace tr1; }
|
||||
#endif
|
||||
])
|
||||
|
||||
AC_LANG_POP(C++)
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user