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], [13])
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)
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])
50 ## OS and Arch specific defaults ##
54 [*-cygwin*], [LT_NO_UNDEFINED="-no-undefined"]
59 ## C compiler checks ##
62 # Choose the C compiler
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])
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])])
70 # Enable available system extensions and LFS support
71 AC_USE_SYSTEM_EXTENSIONS
74 # Make sure the C compiler supports __attribute__
76 AS_IF([test "x$ax_cv___attribute__" != "xyes"],
77 [AC_MSG_ERROR([The compiler does not support __attribute__ extensions])])
79 # Make sure we have pthread support
80 AX_PTHREAD([], [AC_MSG_ERROR([Could not configure pthread support])])
82 # Make sure the C compiler supports weak symbols
84 AS_IF([test "x$ax_cv_sys_weak_alias" = "xno"],
85 [AC_MSG_ERROR([Your platform doesn't support weak symbols.])])
87 # Checks for typedefs, structures, and compiler characteristics.
99 # Detect warning flags supported by the C compiler and append them to
101 m4_define([WARN_FLAGS_LIST], [ dnl
104 -Wmissing-prototypes dnl
105 -Wmissing-declarations dnl
106 -Wnull-dereference dnl
109 -Wjump-misses-init dnl
110 -Wsuggest-attribute=format dnl
111 -Wtautological-constant-out-of-range-compare dnl
115 -Wstrict-aliasing dnl
116 -Wmissing-noreturn dnl
118 -Wduplicated-cond dnl
119 -Wduplicated-branches dnl
122 dnl-Wredundant-decls dnl
123 -Wno-null-dereference dnl
126 # Pass -Werror as an extra flag during the test: this is needed to make the
127 # -Wunknown-warning-option diagnostic fatal with clang.
129 AX_APPEND_COMPILE_FLAGS([WARN_FLAGS_LIST], [WARN_CFLAGS], [-Werror])
147 ## Programs checks ##
153 AC_CHECK_PROGS(NPROC, [nproc gnproc])
154 AC_CHECK_PROGS(GETCONF, [getconf])
155 AS_IF([test "x$NPROC" != "x"],
157 [AS_IF([test "x$GETCONF" != "x"],
158 [NPROC_CMD="$GETCONF _NPROCESSORS_ONLN"],
162 AC_SUBST([NPROC_CMD], [$NPROC_CMD])
164 # Initialize and configure libtool
172 # Checks for library functions.
191 # AC_FUNC_MALLOC causes problems when cross-compiling.
194 # Search for clock_gettime() in -lrt
195 AC_SEARCH_LIBS([clock_gettime], [rt], [
196 AC_DEFINE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [1], [clock_gettime() is detected.])
201 ## Optionnal features selection ##
204 # Allow to fallback to FIXME if the membarrier syscall is unavailable on the
205 # running kernel, when disabled, abort if the syscall is unavailable. Applies
206 # to default and bulletproof flavors.
208 AE_FEATURE_DEFAULT_ENABLE
209 AE_FEATURE([sys-membarrier-fallback], [Abort if sys-membarrier is needed but not available rather than using a fallback.])
211 # Use compiler Thread Local Storage, when disabled use pthread_getspecific() to emulate TLS.
213 AE_FEATURE_DEFAULT_ENABLE
214 AE_FEATURE([compiler-tls], [Use pthread_getspecific() to emulate Thread Local Storage (TLS) variables.])
216 # smp-support configure option
218 AE_FEATURE_DEFAULT_ENABLE
219 AE_FEATURE([smp-support], [Disable SMP support. Warning: only use this on uniprocessor systems.])
221 # RCU debugging option
222 # Disabled by default
223 AE_FEATURE_DEFAULT_DISABLE
224 AE_FEATURE([rcu-debug], [Enable internal debugging self-checks. Introduces a performance penalty.])
226 # rculfhash iterator debugging
227 # Disabled by default
228 AE_FEATURE_DEFAULT_DISABLE
229 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.])
233 ## Set defines for optional features conditionnals in the source code ##
236 AE_IF_FEATURE_DISABLED([sys-membarrier-fallback], [
237 AC_DEFINE([CONFIG_RCU_FORCE_SYS_MEMBARRIER], [1], [Require the operating system to support the membarrier system call for default and bulletproof flavors.])
240 AE_IF_FEATURE_ENABLED([compiler-tls], [
241 AC_DEFINE([CONFIG_RCU_TLS], [1], [Use compiler provided Thread Local Storage.])
244 AE_IF_FEATURE_ENABLED([smp-support], [
245 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.])
248 AE_IF_FEATURE_ENABLED([rcu-debug], [
249 AC_DEFINE([CONFIG_RCU_DEBUG], [1], [Enable internal debugging self-checks. Introduces a performance penalty.])
252 AE_IF_FEATURE_ENABLED([cds-lfht-iter-debug], [
253 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.])
258 ## Set automake variables for optional feature conditionnals in Makefile.am ##
261 # Building the examples requires the shared libraries to be enabled
262 AM_CONDITIONAL([ENABLE_EXAMPLES], AE_IS_FEATURE_ENABLED([shared]))
266 ## Substitute variables for use in Makefile.am ##
269 # Library versions for libtool
270 AC_SUBST([URCU_LIBRARY_VERSION], [urcu_lib_version])
272 AC_SUBST(LT_NO_UNDEFINED)
274 # The order in which the include folders are searched is important.
275 # The top_builddir should always be searched first in the event that a build
276 # time generated file is included.
277 AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config.h"
278 AC_SUBST(AM_CPPFLAGS)
280 AM_CFLAGS="$WARN_CFLAGS $PTHREAD_CFLAGS"
285 ## Output files generated by configure ##
291 doc/examples/Makefile
295 tests/common/Makefile
297 tests/benchmark/Makefile
298 tests/regression/Makefile
305 src/liburcu-signal.pc
308 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_perf_global.tap], [chmod +x tests/regression/rcutorture_urcu_bp_perf_global.tap])
309 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_perf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_bp_perf_percpu.tap])
310 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_perf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_bp_perf_perthread.tap])
311 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_rperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_bp_rperf_global.tap])
312 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_rperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_bp_rperf_percpu.tap])
313 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_rperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_bp_rperf_perthread.tap])
314 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_stress_global.tap], [chmod +x tests/regression/rcutorture_urcu_bp_stress_global.tap])
315 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_stress_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_bp_stress_percpu.tap])
316 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_stress_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_bp_stress_perthread.tap])
317 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_uperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_bp_uperf_global.tap])
318 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_uperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_bp_uperf_percpu.tap])
319 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_bp_uperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_bp_uperf_perthread.tap])
320 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_perf_global.tap], [chmod +x tests/regression/rcutorture_urcu_mb_perf_global.tap])
321 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_perf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_mb_perf_percpu.tap])
322 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_perf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_mb_perf_perthread.tap])
323 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_rperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_mb_rperf_global.tap])
324 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_rperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_mb_rperf_percpu.tap])
325 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_rperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_mb_rperf_perthread.tap])
326 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_stress_global.tap], [chmod +x tests/regression/rcutorture_urcu_mb_stress_global.tap])
327 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_stress_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_mb_stress_percpu.tap])
328 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_stress_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_mb_stress_perthread.tap])
329 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_uperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_mb_uperf_global.tap])
330 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_uperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_mb_uperf_percpu.tap])
331 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_mb_uperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_mb_uperf_perthread.tap])
332 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_perf_global.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_perf_global.tap])
333 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_perf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_perf_percpu.tap])
334 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_perf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_perf_perthread.tap])
335 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_rperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_rperf_global.tap])
336 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_rperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_rperf_percpu.tap])
337 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_rperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_rperf_perthread.tap])
338 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_stress_global.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_stress_global.tap])
339 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_stress_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_stress_percpu.tap])
340 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_stress_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_stress_perthread.tap])
341 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_uperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_uperf_global.tap])
342 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_uperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_uperf_percpu.tap])
343 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_membarrier_uperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_membarrier_uperf_perthread.tap])
344 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_perf_global.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_perf_global.tap])
345 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_perf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_perf_percpu.tap])
346 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_perf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_perf_perthread.tap])
347 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_rperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_rperf_global.tap])
348 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_rperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_rperf_percpu.tap])
349 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_rperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_rperf_perthread.tap])
350 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_stress_global.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_stress_global.tap])
351 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_stress_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_stress_percpu.tap])
352 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_stress_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_stress_perthread.tap])
353 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_uperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_uperf_global.tap])
354 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_uperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_uperf_percpu.tap])
355 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_qsbr_uperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_qsbr_uperf_perthread.tap])
356 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_perf_global.tap], [chmod +x tests/regression/rcutorture_urcu_signal_perf_global.tap])
357 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_perf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_signal_perf_percpu.tap])
358 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_perf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_signal_perf_perthread.tap])
359 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_rperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_signal_rperf_global.tap])
360 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_rperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_signal_rperf_percpu.tap])
361 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_rperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_signal_rperf_perthread.tap])
362 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_stress_global.tap], [chmod +x tests/regression/rcutorture_urcu_signal_stress_global.tap])
363 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_stress_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_signal_stress_percpu.tap])
364 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_stress_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_signal_stress_perthread.tap])
365 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_uperf_global.tap], [chmod +x tests/regression/rcutorture_urcu_signal_uperf_global.tap])
366 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_uperf_percpu.tap], [chmod +x tests/regression/rcutorture_urcu_signal_uperf_percpu.tap])
367 AC_CONFIG_FILES([tests/regression/rcutorture_urcu_signal_uperf_perthread.tap], [chmod +x tests/regression/rcutorture_urcu_signal_uperf_perthread.tap])
373 # Mini-report on what will be built.
381 AS_ECHO("${PPRINT_COLOR_BLDBLU}Userspace-RCU $PACKAGE_VERSION${PPRINT_COLOR_RST}")
384 PPRINT_SUBTITLE([Features])
386 PPRINT_PROP_STRING([Target architecture], $host_cpu)
388 # SMP support enabled/disabled
389 AE_IS_FEATURE_ENABLED([smp-support]) && value=1 || value=0
390 PPRINT_PROP_BOOL([SMP support], $value)
393 AE_IS_FEATURE_ENABLED([compiler-tls]) && value="compiler TLS" || value="pthread_getspecific()"
394 PPRINT_PROP_STRING([Thread Local Storage (TLS)], [$value])
396 # clock_gettime() available
397 test "x$ac_cv_search_function_clock_gettime" != "xno" && value=1 || value=0
398 PPRINT_PROP_BOOL([clock_gettime()], $value)
401 AE_IS_FEATURE_ENABLED([sys-membarrier-fallback]) && value=0 || value=1
402 PPRINT_PROP_BOOL([Require membarrier], $value)
404 # RCU debug enabled/disabled
405 AE_IS_FEATURE_ENABLED([rcu-debug]) && value=1 || value=0
406 PPRINT_PROP_BOOL([Internal debugging], $value)
408 # rculfhash iterator debug enabled/disabled
409 AE_IS_FEATURE_ENABLED([cds-lfht-iter-debug]) && value=1 || value=0
410 PPRINT_PROP_BOOL([Lock-free HT iterator debugging], $value)
412 PPRINT_PROP_BOOL([Multi-flavor support], 1)
414 report_bindir="`eval eval echo $bindir`"
415 report_libdir="`eval eval echo $libdir`"
417 # Print the bindir and libdir this 'make install' will install into.
419 PPRINT_SUBTITLE([Install directories])
420 PPRINT_PROP_STRING([Binaries], [$report_bindir])
421 PPRINT_PROP_STRING([Libraries], [$report_libdir])