File: ax_allocator.m4

package info (click to toggle)
quickfix 1.15.1%2Bdfsg-4
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 42,080 kB
  • sloc: cpp: 631,686; python: 129,549; ruby: 106,716; xml: 43,737; ansic: 7,668; java: 1,826; cs: 816; makefile: 544; sh: 462; sql: 313
file content (137 lines) | stat: -rw-r--r-- 3,742 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
AC_DEFUN([AX_ALLOCATOR],
[
AC_ARG_WITH(allocator,
    [  --with-allocator=<type> selected allocator, one of 'std' (default),'new','debug','mt','pool','bitmap','boost_fast','boost','tbb'], 
    [if test $withval == "no"
     then
       has_allocator=false
     else
       has_allocator=true
     fi],
    has_allocator=false
)
ALLOCATOR=$with_allocator

AC_LANG_CPLUSPLUS

# check for debug allocator
if test "x$with_allocator" == "xdebug"
then
	AC_MSG_CHECKING(for __gnu_cxx::debug_allocator)
	AC_TRY_COMPILE(
		[#include <ext/debug_allocator.h>
		 #include<vector>],
		[std::vector<int, __gnu_cxx::debug_allocator<int> > x;],
		AC_MSG_RESULT(yes)
		AC_DEFINE(ENABLE_DEBUG_ALLOCATOR, 1,
		__gnu_cxx::debug_allocator exists)
		AC_DEFINE(HAVE_ALLOCATOR_CONFIG, 1,
		custom allocator configured),
		AC_MSG_ERROR(no))
fi

# check for new allocator
if test "x$with_allocator" == "xnew"
then
	AC_MSG_CHECKING(for __gnu_cxx::new_allocator)
	AC_TRY_COMPILE(
		[#include <ext/new_allocator.h>
		 #include<vector>],
		[std::vector<int, __gnu_cxx::new_allocator<int> > x;],
		AC_MSG_RESULT(yes)
		AC_DEFINE(ENABLE_NEW_ALLOCATOR, 1,
		__gnu_cxx::new_allocator exists)
		AC_DEFINE(HAVE_ALLOCATOR_CONFIG, 1),
		AC_MSG_ERROR(no))
fi

# check for boost::pool_allocator
if test "x$with_allocator" == "xboost"
then
	AC_MSG_CHECKING(for boost::pool_allocator)
	AC_TRY_COMPILE(
		[#include <boost/pool/pool_alloc.hpp>
		 #include<vector>],
		[std::vector<int, boost::pool_allocator<int> > x;],
		AC_MSG_RESULT(yes)
		AC_DEFINE(ENABLE_BOOST_POOL_ALLOCATOR, 1,
		boost::pool_allocator exists)
		AC_DEFINE(HAVE_ALLOCATOR_CONFIG, 1),
		AC_MSG_ERROR(no))
fi

# check for boost::fast_pool_allocator
if test "x$with_allocator" == "xboost_fast"
then
	AC_MSG_CHECKING(for boost::fast_pool_allocator)
	AC_TRY_COMPILE(
		[#include <boost/pool/pool_alloc.hpp>
		 #include<vector>],
		[std::vector<int, boost::fast_pool_allocator<int> > x;],
		AC_MSG_RESULT(yes)
		AC_DEFINE(ENABLE_BOOST_FAST_POOL_ALLOCATOR, 1,
		boost::fast_pool_allocator exists)
		AC_DEFINE(HAVE_ALLOCATOR_CONFIG, 1),
		AC_MSG_ERROR(no))	
fi

# check for __gnu_cxx::__pool_alloc
if test "x$with_allocator" == "xpool"
then
	AC_MSG_CHECKING(for __gnu_cxx::__pool_alloc)
	AC_TRY_COMPILE(
		[#include <ext/pool_allocator.h>
		 #include<vector>],
		[std::vector<int, __gnu_cxx::__pool_alloc<int> > x;],
		AC_MSG_RESULT(yes)
		AC_DEFINE(ENABLE_POOL_ALLOCATOR, 1,
		__gnu_cxx::pool_allocator exists)
		AC_DEFINE(HAVE_ALLOCATOR_CONFIG, 1),
		AC_MSG_ERROR(no))
fi

# check for __gnu_cxx::__mt_alloc
if test "x$with_allocator" == "xmt"
then
	AC_MSG_CHECKING(for __gnu_cxx::__mt_alloc)
	AC_TRY_COMPILE(
		[#include <ext/mt_allocator.h>
		 #include<vector>],
		[std::vector<int, __gnu_cxx::__mt_alloc<int> > x;],
		AC_MSG_RESULT(yes)
		AC_DEFINE(ENABLE_MT_ALLOCATOR, 1,
		__gnu_cxx::mt_allocator exists)
		AC_DEFINE(HAVE_ALLOCATOR_CONFIG, 1),
		AC_MSG_ERROR(no))
fi

# check for __gnu_cxx::bitmap_allocator
if test "x$with_allocator" == "xbitmap"
then
	AC_MSG_CHECKING(for __gnu_cxx::bitmap_allocator)
	AC_TRY_COMPILE(
		[#include <ext/bitmap_allocator.h>
		 #include<vector>],
		[std::vector<int, __gnu_cxx::bitmap_allocator<int> > x;],
		AC_MSG_RESULT(yes)
		AC_DEFINE(ENABLE_BITMAP_ALLOCATOR, 1,
		__gnu_cxx::bitmap_allocator exists)
		AC_DEFINE(HAVE_ALLOCATOR_CONFIG, 1),
		AC_MSG_ERROR(no))
fi

# check for tbb::scalable_allocator
if test "x$with_allocator" == "xtbb"
then
	AC_MSG_CHECKING(for tbb::scalable_allocator)
	AC_TRY_COMPILE(
		[#include <tbb/scalable_allocator.h>
		 #include<vector>],
		[std::vector<int, tbb::scalable_allocator<int> > x;],
		AC_MSG_RESULT(yes)
		AC_DEFINE(ENABLE_TBB_ALLOCATOR, 1,
		tbb::scalable_allocator exists)
		AC_DEFINE(HAVE_ALLOCATOR_CONFIG, 1),
		AC_MSG_ERROR(no))
fi
])