1 dnl SPDX-License-Identifier: LGPL-2.1-only
3 dnl Copyright (C) 2021 EfficiOS, Inc.
5 dnl Process this file with autoconf to produce a configure script.
7 # Project version information
8 m4_define([urcu_version_major], [0])
9 m4_define([urcu_version_minor], [12])
10 m4_define([urcu_version_patch], [0])
11 m4_define([urcu_version_dev_stage], [])
12 m4_define([urcu_version], urcu_version_major[.]urcu_version_minor[.]urcu_version_patch[]urcu_version_dev_stage)
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], [7])
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)
24 ## Autoconf base setup ##
28 AC_INIT([userspace-rcu],[urcu_version],[mathieu dot desnoyers at efficios dot com],[],[http://liburcu.org/])
30 AC_CONFIG_HEADERS([include/config.h include/urcu/config.h])
31 AC_CONFIG_AUX_DIR([config])
32 AC_CONFIG_MACRO_DIR([m4])
39 ## Automake base setup ##
42 AM_INIT_AUTOMAKE([1.12 foreign dist-bzip2 no-dist-gzip nostdinc -Wall -Wno-portability -Werror])
43 AM_MAINTAINER_MODE([enable])
45 # Enable silent rules by default
46 AM_SILENT_RULES([yes])
48 AH_TEMPLATE([CONFIG_RCU_SMP], [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.])
49 AH_TEMPLATE([CONFIG_RCU_TLS], [TLS provided by the compiler.])
50 AH_TEMPLATE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [clock_gettime() is detected.])
51 AH_TEMPLATE([CONFIG_RCU_FORCE_SYS_MEMBARRIER], [Require the operating system to support the membarrier system call for default and bulletproof flavors.])
52 AH_TEMPLATE([CONFIG_RCU_DEBUG], [Enable internal debugging self-checks. Introduces a performance penalty.])
53 AH_TEMPLATE([CONFIG_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.])
55 # Allow requiring the operating system to support the membarrier system
56 # call. Applies to default and bulletproof flavors.
57 AC_ARG_ENABLE([sys-membarrier-fallback],
58 AS_HELP_STRING([--disable-sys-membarrier-fallback], [Abort if sys-membarrier is needed but not available rather than using a fallback.]),
59 [def_sys_membarrier_fallback=$enableval],
60 [def_sys_membarrier_fallback="yes"])
61 AS_IF([test "x$def_sys_membarrier_fallback" != "xyes"], [AC_DEFINE([CONFIG_RCU_FORCE_SYS_MEMBARRIER], [1])])
63 # Allow overriding storage used for TLS variables.
64 AC_ARG_ENABLE([compiler-tls],
65 AS_HELP_STRING([--disable-compiler-tls], [Use pthread_getspecific() to emulate Thread Local Storage (TLS) variables.]),
66 [def_compiler_tls=$enableval],
67 [def_compiler_tls="yes"])
69 # Checks for C compiler
70 AC_USE_SYSTEM_EXTENSIONS
72 # AC_PROG_CC_STDC was merged in AC_PROG_CC in autoconf 2.70
73 m4_version_prereq([2.70], [], [AC_PROG_CC_STDC])
74 AS_IF([test "x$def_compiler_tls" = "xyes"], AC_DEFINE([CONFIG_RCU_TLS], [1]), [:])
76 # Checks for programs.
79 AC_CHECK_PROGS(NPROC, [nproc gnproc])
80 AC_CHECK_PROGS(GETCONF, [getconf])
81 AS_IF([test "x$NPROC" != "x"],
83 [AS_IF([test "x$GETCONF" != "x"],
84 [NPROC_CMD="$GETCONF _NPROCESSORS_ONLN"],
88 AC_SUBST([NPROC_CMD], [$NPROC_CMD])
92 # Checks for typedefs, structures, and compiler characteristics.
104 AS_IF([test "x$ax_cv___attribute__" = "xyes"],
106 [AC_MSG_ERROR([The compiler does not support __attribute__ extensions])])
108 AX_PTHREAD(,[AC_MSG_ERROR([Could not configure pthreads support])])
110 AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
112 # Checks for library functions.
130 # AC_FUNC_MALLOC causes problems when cross-compiling.
142 AS_CASE([$host],[*-cygwin*],
143 [AM_CONDITIONAL(USE_CYGWIN, true)],
144 [AM_CONDITIONAL(USE_CYGWIN, false)]
147 # Search for clock_gettime
148 AC_SEARCH_LIBS([clock_gettime], [rt], [
149 AC_DEFINE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [1])
150 config_rcu_have_clock_gettime=yes
153 AM_CONDITIONAL([NO_SHARED], [test "x$enable_shared" = "xno"])
155 # smp-support configure option
156 AC_ARG_ENABLE([smp-support],
157 AS_HELP_STRING([--disable-smp-support], [Disable SMP support. Warning: only use this on uniprocessor systems. [default=enabled]]),
158 [def_smp_support=$enableval],
159 [def_smp_support="yes"])
160 AS_IF([test "x$def_smp_support" = "xyes"], [AC_DEFINE([CONFIG_RCU_SMP], [1])])
162 # RCU debugging option
163 AC_ARG_ENABLE([rcu-debug],
164 AS_HELP_STRING([--enable-rcu-debug], [Enable internal debugging
165 self-checks. Introduces a performance penalty.]))
166 AS_IF([test "x$enable_rcu_debug" = "xyes"], [
167 AC_DEFINE([CONFIG_RCU_DEBUG], [1])
170 # rculfhash iterator debugging
171 AC_ARG_ENABLE([cds-lfht-iter-debug],
172 AS_HELP_STRING([--enable-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.]))
173 AS_IF([test "x$enable_cds_lfht_iter_debug" = "xyes"], [
174 AC_DEFINE([CONFIG_CDS_LFHT_ITER_DEBUG], [1])
177 # From the sched_setaffinity(2)'s man page:
179 # The CPU affinity system calls were introduced in Linux kernel 2.5.8.
180 # The library interfaces were introduced in glibc 2.3. Initially, the
181 # glibc interfaces included a cpusetsize argument. In glibc 2.3.3,
182 # the cpuset size argument was removed, but this argument was
183 # restored in glibc 2.3.4.
186 # In addition to that, some vendors ported the system call to 2.4
189 # Furthermore, when the function first appeared, the MASK argument was
190 # an unsigned long pointer, while later it was made into a cpu_set_t
191 # pointer. Systems that have the cpu_set_t version also should have
192 # the CPU_ZERO, CPU_SET, etc. macros.
194 # All this mess means we have to cater for at least 3 different
195 # sched_setaffinity prototypes:
198 # int sched_setaffinity (pid_t pid, unsigned int len, unsigned long *mask);
199 # int sched_setaffinity (pid_t __pid, size_t __cpusetsize, const cpu_set_t *__cpuset);
200 # int sched_setaffinity (pid_t __pid, const cpu_set_t *__mask);
203 AC_CHECK_TYPES([cpu_set_t],
204 [have_cpu_set_t="yes"],
205 [have_cpu_set_t="no"],
206 [#include <sched.h>])
208 # Confirm that we have CPU_ZERO, and it actually works.
209 AC_MSG_CHECKING([whether CPU_ZERO works])
210 AH_TEMPLATE([HAVE_CPU_ZERO], [Defined to 1 if we have CPU_ZERO and it works])
211 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
215 cpu_set_t foo; CPU_ZERO(&foo);
220 AC_DEFINE(HAVE_CPU_ZERO, 1)
226 # Confirm that we have CPU_SET, and it actually works.
227 AC_MSG_CHECKING([whether CPU_SET works])
228 AH_TEMPLATE([HAVE_CPU_SET], [Defined to 1 if we have CPU_SET and it works])
229 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
233 cpu_set_t foo; CPU_SET(0, &foo);
238 AC_DEFINE(HAVE_CPU_SET, 1)
244 # First check if the function is available at all.
245 AC_CHECK_FUNCS([sched_setaffinity],[
246 # Okay, we have it. Check if also have cpu_set_t. If we don't,
247 # then we have the first version using unsigned long, and no
248 # CPU_ZERO, etc. macros. If we do have cpu_set_t, we may have the
249 # version with 2 or 3 arguments. In that case, CPU_ZERO, etc.,
250 # should also be present, but we confirm nonetheless.
252 AS_IF([test "x$have_cpu_set_t" = "xyes"], [
254 # Check how many arguments does sched_setaffinity take.
256 AC_MSG_CHECKING([how many arguments sched_setaffinity takes])
257 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
262 sched_setaffinity(0, sizeof (foo), &foo);
267 [sched_set_affinity_args=3],
268 [sched_set_affinity_args=2])
269 AC_DEFINE_UNQUOTED(SCHED_SETAFFINITY_ARGS,
270 $sched_set_affinity_args,
271 [Defined to sched_setaffinity's number of arguments.])
272 AC_MSG_RESULT([$sched_set_affinity_args])
274 # No cpu_set_t, always 3 args.
275 AC_DEFINE(SCHED_SETAFFINITY_ARGS, 3)
280 ## Substitute variables for use in Makefile.am ##
283 # Library versions for libtool
284 AC_SUBST([URCU_LIBRARY_VERSION], [urcu_lib_version])
286 AM_CPPFLAGS="-include config.h"
287 AC_SUBST(AM_CPPFLAGS)
289 AM_CFLAGS="-Wall -Wextra -Wno-unused-parameter $AM_CFLAGS"
295 doc/examples/Makefile
299 tests/common/Makefile
301 tests/benchmark/Makefile
302 tests/regression/Makefile
309 src/liburcu-signal.pc
312 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_perf_global.tap], [chmod +x tests/regression/rcutorture_urcu_bp_perf_global.tap])
313 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_perf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_bp_perf_percpu.tap])
314 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_perf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_bp_perf_perthread.tap])
315 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_rperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_bp_rperf_global.tap])
316 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_rperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_bp_rperf_percpu.tap])
317 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_rperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_bp_rperf_perthread.tap])
318 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_stress_global.tap], [chmod +x tests/regression/rcutorture_urcu_bp_stress_global.tap])
319 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_stress_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_bp_stress_percpu.tap])
320 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_stress_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_bp_stress_perthread.tap])
321 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_uperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_bp_uperf_global.tap])
322 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_uperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_bp_uperf_percpu.tap])
323 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_uperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_bp_uperf_perthread.tap])
324 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_perf_global.tap], [chmod +x tests/regression/rcutorture_urcu_mb_perf_global.tap])
325 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_perf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_mb_perf_percpu.tap])
326 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_perf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_mb_perf_perthread.tap])
327 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_rperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_mb_rperf_global.tap])
328 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_rperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_mb_rperf_percpu.tap])
329 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_rperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_mb_rperf_perthread.tap])
330 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_stress_global.tap], [chmod +x tests/regression/rcutorture_urcu_mb_stress_global.tap])
331 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_stress_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_mb_stress_percpu.tap])
332 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_stress_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_mb_stress_perthread.tap])
333 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_uperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_mb_uperf_global.tap])
334 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_uperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_mb_uperf_percpu.tap])
335 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_uperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_mb_uperf_perthread.tap])
336 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_perf_global.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_perf_global.tap])
337 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_perf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_perf_percpu.tap])
338 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_perf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_perf_perthread.tap])
339 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_rperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_rperf_global.tap])
340 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_rperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_rperf_percpu.tap])
341 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_rperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_rperf_perthread.tap])
342 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_stress_global.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_stress_global.tap])
343 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_stress_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_stress_percpu.tap])
344 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_stress_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_stress_perthread.tap])
345 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_uperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_uperf_global.tap])
346 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_uperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_uperf_percpu.tap])
347 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_uperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_uperf_perthread.tap])
348 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_perf_global.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_perf_global.tap])
349 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_perf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_perf_percpu.tap])
350 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_perf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_perf_perthread.tap])
351 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_rperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_rperf_global.tap])
352 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_rperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_rperf_percpu.tap])
353 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_rperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_rperf_perthread.tap])
354 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_stress_global.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_stress_global.tap])
355 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_stress_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_stress_percpu.tap])
356 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_stress_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_stress_perthread.tap])
357 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_uperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_uperf_global.tap])
358 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_uperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_uperf_percpu.tap])
359 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_uperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_uperf_perthread.tap])
360 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_perf_global.tap], [chmod +x tests/regression/rcutorture_urcu_signal_perf_global.tap])
361 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_perf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_signal_perf_percpu.tap])
362 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_perf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_signal_perf_perthread.tap])
363 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_rperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_signal_rperf_global.tap])
364 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_rperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_signal_rperf_percpu.tap])
365 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_rperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_signal_rperf_perthread.tap])
366 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_stress_global.tap], [chmod +x tests/regression/rcutorture_urcu_signal_stress_global.tap])
367 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_stress_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_signal_stress_percpu.tap])
368 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_stress_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_signal_stress_perthread.tap])
369 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_uperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_signal_uperf_global.tap])
370 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_uperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_signal_uperf_percpu.tap])
371 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_uperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_signal_uperf_perthread.tap])
377 # Mini-report on what will be built.
385 AS_ECHO("${PPRINT_COLOR_BLDBLU}Userspace-RCU $PACKAGE_VERSION${PPRINT_COLOR_RST}")
388 PPRINT_SUBTITLE([Features])
390 PPRINT_PROP_STRING([Target architecture], $host_cpu)
392 # SMP support enabled/disabled
393 test "x$def_smp_support" = "xyes" && value=1 || value=0
394 PPRINT_PROP_BOOL([SMP support], $value)
397 test "x$def_compiler_tls" = "xyes" && value="compiler TLS" || value="pthread_getspecific()"
398 PPRINT_PROP_STRING([Thread Local Storage (TLS)], [$value])
400 # clock_gettime() available
401 test "x$config_rcu_have_clock_gettime" = "xyes" && value=1 || value=0
402 PPRINT_PROP_BOOL([clock_gettime()], $value)
405 test "x$def_sys_membarrier_fallback" != "xyes" && value=1 || value=0
406 PPRINT_PROP_BOOL([Require membarrier], $value)
408 # RCU debug enabled/disabled
409 test "x$enable_rcu_debug" = "xyes" && value=1 || value=0
410 PPRINT_PROP_BOOL([Internal debugging], $value)
412 # rculfhash iterator debug enabled/disabled
413 test "x$enable_cds_lfht_iter_debug" = "xyes" && value=1 || value=0
414 PPRINT_PROP_BOOL([Lock-free hash table iterator debugging], $value)
416 PPRINT_PROP_BOOL([Multi-flavor support], 1)
418 report_bindir="`eval eval echo $bindir`"
419 report_libdir="`eval eval echo $libdir`"
421 # Print the bindir and libdir this `make install' will install into.
423 PPRINT_SUBTITLE([Install directories])
424 PPRINT_PROP_STRING([Binaries], [$report_bindir])
425 PPRINT_PROP_STRING([Libraries], [$report_libdir])