File: rak_cxx.m4

package info (click to toggle)
libtorrent 0.13.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,956 kB
  • sloc: cpp: 32,196; makefile: 520; xml: 163; ansic: 153; sh: 45
file content (61 lines) | stat: -rw-r--r-- 1,793 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
AC_DEFUN([RAK_CHECK_CXX11], [
  AC_ARG_ENABLE([c++0x],
    AC_HELP_STRING([--enable-c++0x], [compile with C++0x (unsupported)]),
    [
      if test "$enableval" = "yes"; then
        AX_CXX_COMPILE_STDCXX_0X
      else
        AX_CXX_COMPILE_STDCXX_11(noext)
      fi
    ],[
      AX_CXX_COMPILE_STDCXX_11(noext)
    ]
  )
])

AC_DEFUN([RAK_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++)
])