+## ##
+## Set defines for optional features conditionnals in the source code ##
+## ##
+
+AE_IF_FEATURE_DISABLED([sys-membarrier-fallback], [
+ AC_DEFINE([CONFIG_RCU_FORCE_SYS_MEMBARRIER], [1], [Require the operating system to support the membarrier system call for default and bulletproof flavors.])
+])
+
+AE_IF_FEATURE_ENABLED([compiler-tls], [
+ AC_DEFINE([CONFIG_RCU_TLS], [1], [Use compiler provided Thread Local Storage.])
+])
+
+AE_IF_FEATURE_ENABLED([smp-support], [
+ 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.])
+])
+
+AE_IF_FEATURE_ENABLED([rcu-debug], [
+ AC_DEFINE([CONFIG_RCU_DEBUG], [1], [Enable internal debugging self-checks. Introduces a performance penalty.])
+])
+
+AE_IF_FEATURE_ENABLED([cds-lfht-iter-debug], [
+ 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.])
+])
+
+AE_IF_FEATURE_ENABLED([compiler-atomic-builtins], [
+ AC_DEFINE([CONFIG_RCU_USE_ATOMIC_BUILTINS], [1], [Use compiler atomic builtins.])
+])
+
+AE_IF_FEATURE_ENABLED([legacy-mb], [
+ AC_DEFINE([CONFIG_RCU_EMIT_LEGACY_MB], [1], [Emit legacy memory barriers that were documented in the APIs.])
+])
+
+## ##
+## Set automake variables for optional feature conditionnals in Makefile.am ##
+## ##
+
+# Building the examples requires the shared libraries to be enabled
+AM_CONDITIONAL([ENABLE_EXAMPLES], AE_IS_FEATURE_ENABLED([shared]))
+
+
+## ##
+## Check for optional features dependencies ##
+## ##
+
+
+AE_IF_FEATURE_ENABLED([compiler-atomic-builtins], [
+ AS_IF([test "x$ae_cv_cc_atomic_builtins" != xyes], [
+ AC_MSG_ERROR([The compiler does not support atomic builtins.])
+ ])
+])
+
+## ##
+## Substitute variables for use in Makefile.am ##
+## ##
+
+# Library versions for libtool
+AC_SUBST([URCU_LIBRARY_VERSION], [urcu_lib_version])
+
+AC_SUBST(LT_NO_UNDEFINED)
+
+# The order in which the include folders are searched is important.
+# The top_builddir should always be searched first in the event that a build
+# time generated file is included.
+AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config.h"
+AC_SUBST(AM_CPPFLAGS)
+
+AM_CFLAGS="$WARN_CFLAGS $PTHREAD_CFLAGS"
+AC_SUBST(AM_CFLAGS)
+
+AM_CXXFLAGS="$WARN_CXXFLAGS $PTHREAD_CFLAGS"
+AC_SUBST(AM_CXXFLAGS)
+
+
+## ##
+## Output files generated by configure ##
+## ##