+AS_IF([test x$enable_bin_lttng_consumerd != xno],
+ [
+ build_lib_consumer=yes
+ build_lib_sessiond_comm=yes
+ build_lib_index=yes
+ build_lib_health=yes
+ build_lib_testpoint=yes
+ ]
+)
+
+AS_IF([test x$enable_bin_lttng_crash != xno],
+ # Do nothing since libconfig and libcommon are built by default.
+ []
+)
+
+AS_IF([test x$enable_bin_lttng_relayd != xno],
+ [
+ build_lib_lttng_ctl=yes
+ build_lib_sessiond_comm=yes
+ build_lib_hashtable=yes
+ build_lib_compat=yes
+ build_lib_index=yes
+ build_lib_health=yes
+ build_lib_testpoint=yes
+ build_lib_fd_tracker=yes
+ ]
+)
+AS_IF([test x$enable_bin_lttng_sessiond != xno],
+ [
+ build_lib_lttng_ctl=yes
+ build_lib_sessiond_comm=yes
+ build_lib_kernel_ctl=yes
+ build_lib_hashtable=yes
+ build_lib_compat=yes
+ build_lib_relayd=yes
+ build_lib_testpoint=yes
+ build_lib_health=yes
+ ]
+)
+
+# Libraries dependencies enabling
+AS_IF([test x$build_lib_lttng_ctl = xyes],
+ [
+ build_lib_sessiond_comm=yes
+ build_lib_hashtable=yes
+ ]
+)
+
+AS_IF([test x$build_lib_consumer = xyes],
+ [
+ build_lib_sessiond_comm=yes
+ build_lib_kernel_consumer=yes
+ build_lib_hashtable=yes
+ build_lib_compat=yes
+ build_lib_relayd=yes
+ AS_IF([test "x$with_lttng_ust" = "xyes"], [build_lib_ust_consumer=yes])
+ ]
+)
+
+AS_IF([test x$build_lib_kernel_consumer = xyes],
+ [
+ build_lib_kernel_ctl=yes
+ build_lib_relayd=yes
+ ]
+)
+
+AS_IF([test x$build_lib_relayd = xyes],
+ [
+ build_lib_sessiond_comm=yes
+ ]
+)
+
+# Find arch type
+AS_CASE([$host_cpu],
+ [k1om], [ARCHTYPE="x86"],
+ [i386], [ARCHTYPE="x86"],
+ [i486], [ARCHTYPE="x86"],
+ [i586], [ARCHTYPE="x86"],
+ [i686], [ARCHTYPE="x86"],
+ [amd64], [ARCHTYPE="x86"],
+ [x86_64], [ARCHTYPE="x86"],
+ [powerpc], [ARCHTYPE="ppc"],
+ [ppc64], [ARCHTYPE="ppc"],
+ [powerpc64], [ARCHTYPE="ppc"],
+ [powerpc64le], [ARCHTYPE="ppc"],
+ [ppc], [ARCHTYPE="ppc"],
+ [s390], [ARCHTYPE="s390"],
+ [s390x], [ARCHTYPE="s390"],
+ [sparc], [ARCHTYPE="sparc64"],
+ [sparc64], [ARCHTYPE="sparc64"],
+ [alpha*], [ARCHTYPE="alpha"],
+ [ia64], [ARCHTYPE="ia64"],
+ [arm*], [ARCHTYPE="arm"],
+ [aarch64*], [ARCHTYPE="aarch64"],
+ [mips*], [ARCHTYPE="mips"],
+ [nios2*], [ARCHTYPE="nios2"],
+ [tile*], [ARCHTYPE="tile"],
+ [hppa*], [ARCHTYPE="hppa"],
+ [m68k], [ARCHTYPE="m68k"],
+ [riscv*], [ARCHTYPE="riscv"],
+ [ARCHTYPE="unknown"]
+)
+
+AC_SUBST(ARCHTYPE)
+
+AH_TEMPLATE([HAVE_MODULES_USERSPACE_CALLSTACK_CONTEXT], [Define if you have LTTng-modules userspace callstack tracing support])
+AC_MSG_CHECKING([for architecture support of userspace callstack tracing from the kernel])
+AS_IF([test "x$ARCHTYPE" = "xx86"],[
+ # Userspace callstack capture is only supported by the Linux kernel on x86.
+ AC_MSG_RESULT([yes])
+ have_modules_userspace_callstack_context=yes
+ AC_DEFINE([HAVE_MODULES_USERSPACE_CALLSTACK_CONTEXT], [1])
+], [
+ AC_MSG_RESULT([no])
+ have_modules_userspace_callstack_context=no
+])
+AM_CONDITIONAL([HAVE_MODULES_USERSPACE_CALLSTACK_CONTEXT], [test x$have_modules_userspace_callstack_context != xno])
+
+# Export binaries build conditions.
+AM_CONDITIONAL([BUILD_BIN_LTTNG], [test x$enable_bin_lttng != xno])
+AM_CONDITIONAL([BUILD_BIN_LTTNG_CONSUMERD], [test x$enable_bin_lttng_consumerd != xno])
+AM_CONDITIONAL([BUILD_BIN_LTTNG_CRASH], [test x$enable_bin_lttng_crash != xno])
+AM_CONDITIONAL([BUILD_BIN_LTTNG_RELAYD], [test x$enable_bin_lttng_relayd != xno])
+AM_CONDITIONAL([BUILD_BIN_LTTNG_SESSIOND], [test x$enable_bin_lttng_sessiond != xno])
+
+# Export the tests and extras build conditions.
+AS_IF([\
+test "x$enable_bin_lttng" != "xno" && \
+test "x$enable_bin_lttng_consumerd" != "xno" && \
+test "x$enable_bin_lttng_crash" != "xno" && \
+test "x$enable_bin_lttng_relayd" != "xno" && \
+test "x$enable_bin_lttng_sessiond" != "xno"],
+[build_tests=yes],
+[build_tests=no]
+)
+
+AM_CONDITIONAL([BUILD_TESTS], [test x$build_tests = xyes])
+AM_CONDITIONAL([BUILD_EXTRAS], [test x$enable_extras != xno])
+
+# Export libraries build conditions.
+AM_CONDITIONAL([BUILD_LIB_COMPAT], [test x$build_lib_compat = xyes])
+AM_CONDITIONAL([BUILD_LIB_CONFIG], [test x$build_lib_config = xyes])
+AM_CONDITIONAL([BUILD_LIB_CONSUMER], [test x$build_lib_consumer = xyes])
+AM_CONDITIONAL([BUILD_LIB_HASHTABLE], [test x$build_lib_hashtable = xyes])
+AM_CONDITIONAL([BUILD_LIB_HEALTH], [test x$build_lib_health = xyes])
+AM_CONDITIONAL([BUILD_LIB_INDEX], [test x$build_lib_index = xyes])
+AM_CONDITIONAL([BUILD_LIB_KERNEL_CONSUMER], [test x$build_lib_kernel_consumer = xyes])
+AM_CONDITIONAL([BUILD_LIB_KERNEL_CTL], [test x$build_lib_kernel_ctl = xyes])
+AM_CONDITIONAL([BUILD_LIB_LTTNG_CTL], [test x$build_lib_lttng_ctl = xyes])
+AM_CONDITIONAL([BUILD_LIB_RELAYD], [test x$build_lib_relayd = xyes])
+AM_CONDITIONAL([BUILD_LIB_FD_TRACKER], [test x$build_lib_fd_tracker = xyes])
+AM_CONDITIONAL([BUILD_LIB_SESSIOND_COMM], [test x$build_lib_sessiond_comm = xyes])
+AM_CONDITIONAL([BUILD_LIB_TESTPOINT], [test x$build_lib_testpoint = xyes])
+AM_CONDITIONAL([BUILD_LIB_UST_CONSUMER], [test x$build_lib_ust_consumer = xyes])
+
+AM_CFLAGS="-Wall -fno-strict-aliasing $PTHREAD_CFLAGS"
+AC_SUBST(AM_CFLAGS)
+
+# 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. An example of this is the "version.i" file.
+# In a scenario where lttng-tools is built from a distribution tarball and in a
+# out-of-tree manner, the generated "version.i" has priority on the one from
+# the source (distribution tarball) and must be found first.
+AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -I\$(top_srcdir)/src -include config.h $AM_CPPFLAGS"
+AC_SUBST(AM_CPPFLAGS)
+
+lttngincludedir="${includedir}/lttng"