Complete removal of urcu-signal flavor
[userspace-rcu.git] / configure.ac
1 dnl SPDX-License-Identifier: LGPL-2.1-only
2 dnl
3 dnl Copyright (C) 2021 EfficiOS, Inc.
4 dnl
5 dnl Process this file with autoconf to produce a configure script.
6
7 # Project version information
8 m4_define([urcu_version_major], [0])
9 m4_define([urcu_version_minor], [15])
10 m4_define([urcu_version_patch], [0])
11 m4_define([urcu_version_dev_stage], [-pre])
12 m4_define([urcu_version], urcu_version_major[.]urcu_version_minor[.]urcu_version_patch[]urcu_version_dev_stage)
13
14 # Library version information of "liburcu"
15 # Following the numbering scheme proposed by libtool for the library version
16 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
17 m4_define([urcu_lib_version_current], [9])
18 m4_define([urcu_lib_version_revision], [0])
19 m4_define([urcu_lib_version_age], [1])
20 m4_define([urcu_lib_version], urcu_lib_version_current[:]urcu_lib_version_revision[:]urcu_lib_version_age)
21
22
23 ## ##
24 ## Autoconf base setup ##
25 ## ##
26
27 AC_PREREQ([2.69])
28 AC_INIT([userspace-rcu],[urcu_version],[mathieu dot desnoyers at efficios dot com],[],[http://liburcu.org/])
29
30 AC_CONFIG_HEADERS([include/config.h include/urcu/config.h])
31 AC_CONFIG_AUX_DIR([config])
32 AC_CONFIG_MACRO_DIR([m4])
33
34 AC_CANONICAL_TARGET
35 AC_CANONICAL_HOST
36
37
38 ## ##
39 ## Automake base setup ##
40 ## ##
41
42 AM_INIT_AUTOMAKE([1.12 foreign dist-bzip2 no-dist-gzip nostdinc -Wall -Wno-portability -Werror])
43 AM_MAINTAINER_MODE([enable])
44
45 # Enable silent rules by default
46 AM_SILENT_RULES([yes])
47
48
49 ## ##
50 ## OS and Arch specific defaults ##
51 ## ##
52
53 AS_CASE([$host],
54 [*-cygwin* | *-msys*], [LT_NO_UNDEFINED="-no-undefined"]
55 )
56
57
58 ## ##
59 ## C compiler checks ##
60 ## ##
61
62 # Choose the C compiler
63 AC_PROG_CC
64 # AC_PROG_CC_STDC was merged in AC_PROG_CC in autoconf 2.70
65 m4_version_prereq([2.70], [], [AC_PROG_CC_STDC])
66
67 # Make sure the C compiler supports C99
68 AS_IF([test "$ac_cv_prog_cc_c99" = "no"], [AC_MSG_ERROR([The compiler does not support C99])])
69
70 # Enable available system extensions and LFS support
71 AC_USE_SYSTEM_EXTENSIONS
72 AC_SYS_LARGEFILE
73
74 # Check if the selected C compiler supports atomic builtins
75 AE_CC_ATOMIC_BUILTINS
76
77
78 ## ##
79 ## C++ compiler checks ##
80 ## ##
81
82 # Require a C++11 compiler without GNU extensions (-std=c++11)
83 AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
84
85 # Make sure the C compiler supports __attribute__
86 AX_C___ATTRIBUTE__
87 AS_IF([test "x$ax_cv___attribute__" != "xyes"],
88 [AC_MSG_ERROR([The compiler does not support __attribute__ extensions])])
89
90 # Make sure we have pthread support
91 AX_PTHREAD([], [AC_MSG_ERROR([Could not configure pthread support])])
92
93 # Checks for typedefs, structures, and compiler characteristics.
94 AC_C_INLINE
95 AC_C_TYPEOF
96 AC_TYPE_INT32_T
97 AC_TYPE_PID_T
98 AC_TYPE_SIZE_T
99 AC_TYPE_SSIZE_T
100 AC_TYPE_UINT16_T
101 AC_TYPE_UINT32_T
102 AC_TYPE_UINT64_T
103 AC_TYPE_UINT8_T
104
105 # Detect warning flags supported by the C compiler and append them to
106 # WARN_CFLAGS.
107 m4_define([WARN_FLAGS_LIST], [ dnl
108 -Wall dnl
109 -Wextra dnl
110 -Wmissing-prototypes dnl
111 -Wmissing-declarations dnl
112 -Wnull-dereference dnl
113 -Wundef dnl
114 -Wshadow dnl
115 -Wjump-misses-init dnl
116 -Wsuggest-attribute=format dnl
117 -Wtautological-constant-out-of-range-compare dnl
118 -Wnested-externs dnl
119 -Wwrite-strings dnl
120 -Wformat=2 dnl
121 -Wstrict-aliasing dnl
122 -Wmissing-noreturn dnl
123 -Winit-self dnl
124 -Wduplicated-cond dnl
125 -Wduplicated-branches dnl
126 -Wlogical-op dnl
127 dnl
128 dnl-Wredundant-decls dnl
129 -Wno-null-dereference dnl
130 ])
131
132 # Pass -Werror as an extra flag during the test: this is needed to make the
133 # -Wunknown-warning-option diagnostic fatal with clang.
134 AC_LANG_PUSH([C])
135 AX_APPEND_COMPILE_FLAGS([WARN_FLAGS_LIST], [WARN_CFLAGS], [-Werror])
136 AC_LANG_POP([C])
137
138 AC_LANG_PUSH([C++])
139 AX_APPEND_COMPILE_FLAGS([WARN_FLAGS_LIST], [WARN_CXXFLAGS], [-Werror])
140 AC_LANG_POP([C++])
141
142 AE_IF_FEATURE_ENABLED([Werror], [WARN_CFLAGS="${WARN_CFLAGS} -Werror"])
143 AE_IF_FEATURE_ENABLED([Werror], [WARN_CXXFLAGS="${WARN_CXXFLAGS} -Werror"])
144
145
146 ## ##
147 ## Header checks ##
148 ## ##
149
150 AC_HEADER_STDBOOL
151 AC_CHECK_HEADERS([ \
152 limits.h \
153 stddef.h \
154 sys/param.h \
155 sys/time.h \
156 ])
157
158
159 ## ##
160 ## Programs checks ##
161 ## ##
162
163 AC_PROG_AWK
164 AC_PROG_GREP
165 AC_PROG_MAKE_SET
166 AC_CHECK_PROGS(NPROC, [nproc gnproc])
167 AC_CHECK_PROGS(GETCONF, [getconf])
168 AC_CHECK_PROGS(TIME, [time])
169
170 # Initialize and configure libtool
171 LT_INIT
172
173
174 ## ##
175 ## Library checks ##
176 ## ##
177
178 # Checks for library functions.
179 AC_FUNC_MMAP
180 AC_FUNC_FORK
181 AC_CHECK_FUNCS([ \
182 atexit \
183 getcpuid \
184 gettid \
185 gettimeofday \
186 memeset \
187 memset \
188 munmap \
189 rand_r \
190 sched_getcpu \
191 sched_setaffinity \
192 strerror \
193 strtoul \
194 sysconf \
195 ])
196
197 # AC_FUNC_MALLOC causes problems when cross-compiling.
198 #AC_FUNC_MALLOC
199
200 # Search for clock_gettime() in -lrt
201 AC_SEARCH_LIBS([clock_gettime], [rt], [
202 AC_DEFINE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [1], [clock_gettime() is detected.])
203 ])
204
205
206 ## ##
207 ## Optional features selection ##
208 ## ##
209
210 # Allow to fallback to FIXME if the membarrier syscall is unavailable on the
211 # running kernel, when disabled, abort if the syscall is unavailable. Applies
212 # to default and bulletproof flavors.
213 # Enabled by default
214 AE_FEATURE_DEFAULT_ENABLE
215 AE_FEATURE([sys-membarrier-fallback], [Abort if sys-membarrier is needed but not available rather than using a fallback.])
216
217 # Use compiler Thread Local Storage, when disabled use pthread_getspecific() to emulate TLS.
218 # Enabled by default
219 AE_FEATURE_DEFAULT_ENABLE
220 AE_FEATURE([compiler-tls], [Use pthread_getspecific() to emulate Thread Local Storage (TLS) variables.])
221
222 # smp-support configure option
223 # Enabled by default
224 AE_FEATURE_DEFAULT_ENABLE
225 AE_FEATURE([smp-support], [Disable SMP support. Warning: only use this on uniprocessor systems.])
226
227 # RCU debugging option
228 # Disabled by default
229 AE_FEATURE_DEFAULT_DISABLE
230 AE_FEATURE([rcu-debug], [Enable internal debugging self-checks. Introduces a performance penalty.])
231
232 # rculfhash iterator debugging
233 # Disabled by default
234 AE_FEATURE_DEFAULT_DISABLE
235 AE_FEATURE([cds-lfht-iter-debug], [Enable extra debugging checks for lock-free hash table iterator traversal. Alters the rculfhash ABI. Make sure to compile both library and application with matching configuration.])
236
237 # Use compiler atomic builtins, when disabled use our legacy uatomic implementation.
238 # Disabled by default
239 AE_FEATURE_DEFAULT_DISABLE
240 AE_FEATURE([compiler-atomic-builtins], [Enable the use of compiler atomic builtins.])
241
242 # emit legacy memory barriers
243 # Enable by default
244 AE_FEATURE_DEFAULT_ENABLE
245 AE_FEATURE([legacy-mb], [Disable legacy memory barriers.])
246
247 # When given, add -Werror to WARN_CFLAGS and WARN_CXXFLAGS.
248 # Disabled by default
249 AE_FEATURE_DEFAULT_DISABLE
250 AE_FEATURE([Werror],[Treat compiler warnings as errors.])
251
252 ## ##
253 ## Set defines for optional features conditionnals in the source code ##
254 ## ##
255
256 AE_IF_FEATURE_DISABLED([sys-membarrier-fallback], [
257 AC_DEFINE([CONFIG_RCU_FORCE_SYS_MEMBARRIER], [1], [Require the operating system to support the membarrier system call for default and bulletproof flavors.])
258 ])
259
260 AE_IF_FEATURE_ENABLED([compiler-tls], [
261 AC_DEFINE([CONFIG_RCU_TLS], [1], [Use compiler provided Thread Local Storage.])
262 ])
263
264 AE_IF_FEATURE_ENABLED([smp-support], [
265 AC_DEFINE([CONFIG_RCU_SMP], [1], [Enable SMP support. With SMP support enabled, uniprocessors are also supported. With SMP support disabled, UP systems work fine, but the behavior of SMP systems is undefined.])
266 ])
267
268 AE_IF_FEATURE_ENABLED([rcu-debug], [
269 AC_DEFINE([CONFIG_RCU_DEBUG], [1], [Enable internal debugging self-checks. Introduces a performance penalty.])
270 ])
271
272 AE_IF_FEATURE_ENABLED([cds-lfht-iter-debug], [
273 AC_DEFINE([CONFIG_CDS_LFHT_ITER_DEBUG], [1], [Enable extra debugging checks for lock-free hash table iterator traversal. Alters the rculfhash ABI. Make sure to compile both library and application with matching configuration.])
274 ])
275
276 AE_IF_FEATURE_ENABLED([compiler-atomic-builtins], [
277 AC_DEFINE([CONFIG_RCU_USE_ATOMIC_BUILTINS], [1], [Use compiler atomic builtins.])
278 ])
279
280 AE_IF_FEATURE_ENABLED([legacy-mb], [
281 AC_DEFINE([CONFIG_RCU_EMIT_LEGACY_MB], [1], [Emit legacy memory barriers that were documented in the APIs.])
282 ])
283
284 ## ##
285 ## Set automake variables for optional feature conditionnals in Makefile.am ##
286 ## ##
287
288 # Building the examples requires the shared libraries to be enabled
289 AM_CONDITIONAL([ENABLE_EXAMPLES], AE_IS_FEATURE_ENABLED([shared]))
290
291
292 ## ##
293 ## Check for optional features dependencies ##
294 ## ##
295
296
297 AE_IF_FEATURE_ENABLED([compiler-atomic-builtins], [
298 AS_IF([test "x$ae_cv_cc_atomic_builtins" != xyes], [
299 AC_MSG_ERROR([The compiler does not support atomic builtins.])
300 ])
301 ])
302
303 ## ##
304 ## Substitute variables for use in Makefile.am ##
305 ## ##
306
307 # Library versions for libtool
308 AC_SUBST([URCU_LIBRARY_VERSION], [urcu_lib_version])
309
310 AC_SUBST(LT_NO_UNDEFINED)
311
312 # The order in which the include folders are searched is important.
313 # The top_builddir should always be searched first in the event that a build
314 # time generated file is included.
315 AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config.h"
316 AC_SUBST(AM_CPPFLAGS)
317
318 AM_CFLAGS="$WARN_CFLAGS $PTHREAD_CFLAGS"
319 AC_SUBST(AM_CFLAGS)
320
321 AM_CXXFLAGS="$WARN_CXXFLAGS $PTHREAD_CFLAGS"
322 AC_SUBST(AM_CXXFLAGS)
323
324
325 ## ##
326 ## Output files generated by configure ##
327 ## ##
328
329 AC_CONFIG_FILES([
330 Makefile
331 doc/Makefile
332 doc/examples/Makefile
333 extras/Makefile
334 include/Makefile
335 src/Makefile
336 tests/Makefile
337 tests/common/Makefile
338 tests/unit/Makefile
339 tests/benchmark/Makefile
340 tests/regression/Makefile
341 tests/utils/Makefile
342 src/liburcu.pc
343 src/liburcu-bp.pc
344 src/liburcu-cds.pc
345 src/liburcu-qsbr.pc
346 src/liburcu-mb.pc
347 src/liburcu-memb.pc
348 ])
349
350 AC_CONFIG_FILES([tests/utils/env.sh],[chmod +x tests/utils/env.sh])
351
352
353 AC_OUTPUT
354
355 #
356 # Mini-report on what will be built.
357 #
358
359 AE_PPRINT_INIT
360 AE_PPRINT_SET_INDENT(1)
361 AE_PPRINT_SET_TS(38)
362
363 AS_ECHO
364 AS_ECHO("${AE_PPRINT_COLOR_BLDBLU}Userspace-RCU $PACKAGE_VERSION${AE_PPRINT_COLOR_RST}")
365 AS_ECHO
366
367 AE_PPRINT_SUBTITLE([Features])
368
369 AE_PPRINT_PROP_STRING([Target architecture], $host_cpu)
370
371 # SMP support enabled/disabled
372 AE_IS_FEATURE_ENABLED([smp-support]) && value=1 || value=0
373 AE_PPRINT_PROP_BOOL([SMP support], $value)
374
375 # TLS
376 AE_IS_FEATURE_ENABLED([compiler-tls]) && value="compiler TLS" || value="pthread_getspecific()"
377 AE_PPRINT_PROP_STRING([Thread Local Storage (TLS)], [$value])
378
379 # clock_gettime() available
380 test "x$ac_cv_search_function_clock_gettime" != "xno" && value=1 || value=0
381 AE_PPRINT_PROP_BOOL([clock_gettime()], $value)
382
383 # Require membarrier
384 AE_IS_FEATURE_ENABLED([sys-membarrier-fallback]) && value=0 || value=1
385 AE_PPRINT_PROP_BOOL([Require membarrier], $value)
386
387 # RCU debug enabled/disabled
388 AE_IS_FEATURE_ENABLED([rcu-debug]) && value=1 || value=0
389 AE_PPRINT_PROP_BOOL([Internal debugging], $value)
390
391 # rculfhash iterator debug enabled/disabled
392 AE_IS_FEATURE_ENABLED([cds-lfht-iter-debug]) && value=1 || value=0
393 AE_PPRINT_PROP_BOOL([Lock-free HT iterator debugging], $value)
394
395 AE_PPRINT_PROP_BOOL([Multi-flavor support], 1)
396
397 # atomic builtins enabled/disabled
398 AE_IS_FEATURE_ENABLED([compiler-atomic-builtins]) && value=1 || value=0
399 AE_PPRINT_PROP_BOOL([Use compiler atomic builtins], $value)
400
401 # legacy memory barriers
402 AE_IS_FEATURE_ENABLED([legacy-mb]) && value=1 || value=0
403 AE_PPRINT_PROP_BOOL([Emit legacy memory barriers], $value)
404
405 report_bindir="`eval eval echo $bindir`"
406 report_libdir="`eval eval echo $libdir`"
407
408 # Print the bindir and libdir this 'make install' will install into.
409 AS_ECHO
410 AE_PPRINT_SUBTITLE([Install directories])
411 AE_PPRINT_PROP_STRING([Binaries], [$report_bindir])
412 AE_PPRINT_PROP_STRING([Libraries], [$report_libdir])
413
This page took 0.037756 seconds and 5 git commands to generate.