/
ucs.m4
220 lines (190 loc) · 6.53 KB
/
ucs.m4
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#
# Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
# Copyright (C) UT-Battelle, LLC. 2015. ALL RIGHTS RESERVED.
# Copyright (C) ARM, Ltd. 2016. ALL RIGHTS RESERVED.
# See file LICENSE for terms.
#
#
# Internal profiling support.
# This option may affect perofrmance so it is off by default.
#
AC_ARG_ENABLE([profiling],
AS_HELP_STRING([--enable-profiling], [Enable profiling support, default: NO]),
[],
[enable_profiling=no])
AS_IF([test "x$enable_profiling" = xyes],
[AS_MESSAGE([enabling profiling])
AC_DEFINE([HAVE_PROFILING], [1], [Enable profiling])
HAVE_PROFILING=yes]
[:]
)
AM_CONDITIONAL([HAVE_PROFILING],[test "x$HAVE_PROFILING" = "xyes"])
#
# Detailed backtrace with debug information.
# This option requires binutils-devel package.
#
AC_ARG_ENABLE([backtrace-detail],
AS_HELP_STRING([--disable-backtrace-detail], [Disable detailed backtrace support, default: NO]),
[],
[enable_backtrace_detail=yes])
AS_IF([test "x$enable_backtrace_detail" = xyes],
[
BT=1
AC_CHECK_HEADER([bfd.h], [], [AC_MSG_WARN([binutils headers not found])]; BT=0)
AC_CHECK_LIB(bfd, bfd_openr, LIBS="$LIBS -lbfd", [AC_MSG_WARN([bfd library not found])];BT=0)
AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl", [AC_MSG_WARN([dl library not found])];BT=0)
AC_CHECK_LIB(intl, main, LIBS="$LIBS -lintl", [AC_MSG_WARN([intl library not found])])
AC_CHECK_TYPES([struct dl_phdr_info], [], [AC_MSG_WARN([struct dl_phdr_info not defined])];BT=0,
[#define _GNU_SOURCE 1
#include <link.h>])
if test "x$BT" = "x1"; then
AC_CHECK_FUNCS([cplus_demangle])
AC_DEFINE([HAVE_DETAILED_BACKTRACE], 1, [Enable detailed backtrace])
case ${host} in
aarch64*) CFLAGS="$CFLAGS -funwind-tables" ;;
esac
else
AC_MSG_WARN([detailed backtrace is not supported])
fi
]
)
#
# Enable statistics and counters
#
AC_ARG_ENABLE([stats],
AS_HELP_STRING([--enable-stats],
[Enable statistics, useful for profiling, default: NO]),
[],
[enable_stats=no])
AS_IF([test "x$enable_stats" = xyes],
[AS_MESSAGE([enabling statistics])
AC_DEFINE([ENABLE_STATS], [1], [Enable statistics])
HAVE_STATS=yes],
[:]
)
AM_CONDITIONAL([HAVE_STATS],[test "x$HAVE_STATS" = "xyes"])
#
# Enable tuning params at runtime
#
AC_ARG_ENABLE([tuning],
AS_HELP_STRING([--enable-tuning],
[Enable parameter tuning in run-time, default: NO]),
[],
[enable_tuning=no])
AS_IF([test "x$enable_tuning" = xyes],
[AS_MESSAGE([enabling tuning])
AC_DEFINE([ENABLE_TUNING], [1], [Enable tuning])
HAVE_TUNING=yes],
[:]
)
AM_CONDITIONAL([HAVE_TUNING],[test "x$HAVE_TUNING" = "xyes"])
#
# Enable memory tracking
#
AC_ARG_ENABLE([memtrack],
AS_HELP_STRING([--enable-memtrack],
[Enable memory tracking, useful for profiling, default: NO]),
[],
[enable_memtrack=no])
AS_IF([test "x$enable_memtrack" = xyes],
[AS_MESSAGE([enabling memory tracking])
AC_DEFINE([ENABLE_MEMTRACK], [1], [Enable memory tracking])
HAVE_MEMTRACK=yes],
[:]
)
AM_CONDITIONAL([HAVE_MEMTRACK],[test "x$HAVE_MEMTRACK" = "xyes"])
#
# Disable logging levels below INFO
#
AC_ARG_ENABLE([logging],
AS_HELP_STRING([--enable-logging],
[Enable debug logging, default: YES])
)
AS_IF([test "x$enable_logging" != xno],
[AC_DEFINE([UCS_MAX_LOG_LEVEL], [UCS_LOG_LEVEL_TRACE_POLL], [Highest log level])],
[AC_DEFINE([UCS_MAX_LOG_LEVEL], [UCS_LOG_LEVEL_INFO], [Highest log level])]
)
#
# Disable assertions
#
AC_ARG_ENABLE([assertions],
AS_HELP_STRING([--disable-assertions],
[Disable code assertions, default: NO])
)
AS_IF([test "x$enable_assertions" != xno],
AC_DEFINE([ENABLE_ASSERT], [1], [Enable assertions])
)
#
# Check if __attribute__((constructor)) works
#
AC_MSG_CHECKING([__attribute__((constructor))])
CHECK_CROSS_COMP([AC_LANG_SOURCE([static int rc = 1;
static void constructor_test() __attribute__((constructor));
static void constructor_test() { rc = 0; }
int main() { return rc; }])],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([Cannot continue. Please use compiler that
supports __attribute__((constructor))])]
)
#
# Manual configuration of cacheline size
#
AC_ARG_WITH([cache-line-size],
[AC_HELP_STRING([--with-cache-line-size=SIZE],
[Build UCX with cache line size defined by user. This parameter
overwrites default cache line sizes defines in
UCX (x86-64: 64, Power: 128, ARMv8: 64/128). The supported values are: 64, 128])],
[],
[with_cache_line_size=no])
AS_IF([test "x$with_cache_line_size" != xno],[
case ${with_cache_line_size} in
64)
AC_MSG_RESULT(The cache line size is set to 64B)
AC_DEFINE([HAVE_CACHE_LINE_SIZE], 64, [user defined cache line size])
;;
128)
AC_MSG_RESULT(The cache line size is set to 128B)
AC_DEFINE([HAVE_CACHE_LINE_SIZE], 128, [user defined cache line size])
;;
@<:@0-9@:>@*)
AC_MSG_WARN(Unusual cache cache line size was specified: [$with_cache_line_size])
AC_DEFINE_UNQUOTED([HAVE_CACHE_LINE_SIZE], [$with_cache_line_size], [user defined cache line size])
;;
*)
AC_MSG_ERROR(Cannot continue. Unsupported cache line size [$with_cache_line_size].)
;;
esac],
[])
#
# Architecture specific checks
#
case ${host} in
aarch64*)
AC_MSG_CHECKING([support for CNTVCT_EL0 on aarch64])
AC_RUN_IFELSE([AC_LANG_PROGRAM(
[[#include <stdint.h>]],
[[uint64_t tmp; asm volatile("mrs %0, cntvct_el0" : "=r" (tmp));]])],
[AC_MSG_RESULT([yes])]
[AC_DEFINE([HAVE_HW_TIMER], [1], [high-resolution hardware timer enabled])],
[AC_MSG_RESULT([no])]
[AC_DEFINE([HAVE_HW_TIMER], [0], [high-resolution hardware timer disabled])]
);;
*)
# HW timer is supported for all other architectures
AC_DEFINE([HAVE_HW_TIMER], [1], [high-resolution hardware timer disabled])
esac
#
# Enable built-in memcpy
#
AC_ARG_ENABLE([builtin-memcpy],
AS_HELP_STRING([--enable-builtin-memcpy],
[Enable builtin memcpy routine, default: YES]),
[],
[enable_builtin_memcpy=yes])
AS_IF([test "x$enable_builtin_memcpy" != xno],
[AS_MESSAGE([enabling builtin memcpy])
AC_DEFINE([ENABLE_BUILTIN_MEMCPY], [1], [Enable builtin memcpy])],
[AC_DEFINE([ENABLE_BUILTIN_MEMCPY], [0], [Enable builtin memcpy])]
)
AC_CHECK_FUNCS([__clear_cache], [], [])
AC_CHECK_FUNCS([__aarch64_sync_cache_range], [], [])