+AC_DEFINE_UNQUOTED([BT_MINIMAL_LOG_LEVEL], [BT_LOG_$BABELTRACE_MINIMAL_LOG_LEVEL], [Minimal log level])
+
+# BABELTRACE_DEV_MODE:
+AC_ARG_VAR([BABELTRACE_DEV_MODE], [Set to 1 to enable the Babeltrace developer mode (enables run-time checks for plugin developers)])
+AS_IF([test "x$BABELTRACE_DEV_MODE" = x1], [
+ AC_DEFINE([BT_DEV_MODE], 1, [Babeltrace developer mode])
+], [BABELTRACE_DEV_MODE=0])
+AM_CONDITIONAL([DEV_MODE], [test "x$BABELTRACE_DEV_MODE" = x1])
+
+# BABELTRACE_DEBUG_MODE:
+AC_ARG_VAR([BABELTRACE_DEBUG_MODE], [Set to 1 to enable the Babeltrace debug mode (enables internal assertions for Babeltrace maintainers)])
+AS_IF([test "x$BABELTRACE_DEBUG_MODE" = x1], [
+ AC_DEFINE([BT_DEBUG_MODE], 1, [Babeltrace debug mode])
+], [BABELTRACE_DEBUG_MODE=0])
+
+
+## ##
+## Optionnal features selection ##
+## ##
+
+# Python bindings
+# Disabled by default
+AE_FEATURE_DEFAULT_DISABLE
+AE_FEATURE([python-bindings],[build the Python bindings])
+
+# Python bindings documentation
+# Disabled by default
+AE_FEATURE_DEFAULT_DISABLE
+AE_FEATURE([python-bindings-doc],[build the Python bindings documentation])
+
+# Python plugins
+# Disabled by default
+AE_FEATURE_DEFAULT_DISABLE
+AE_FEATURE([python-plugins],[enable the Python plugins support for the library and converter])
+
+# Debug info
+# Enabled by default, except on some platforms
+AE_FEATURE_DEFAULT_ENABLE
+AE_FEATURE([debug-info],[disable the debug info support (default on macOS, Solaris and Windows)])
+
+# API documentation
+# Disabled by default
+AE_FEATURE_DEFAULT_DISABLE
+AE_FEATURE([api-doc],[build the HTML API documentation])
+
+# Built-in plugins
+# Disabled by default
+AE_FEATURE_DEFAULT_DISABLE
+AE_FEATURE([built-in-plugins],[Statically-link in-tree plug-ins into the babeltrace2 executable])
+
+# Built-in python plugin support
+# Disabled by default
+AE_FEATURE_DEFAULT_DISABLE
+AE_FEATURE([built-in-python-plugin-support],[Statically-link Python plugin support into the babeltrace library])
+
+# Man pages
+# Enabled by default
+AE_FEATURE_DEFAULT_ENABLE
+AE_FEATURE([man-pages],[Do not build and install man pages (already built in a distributed tarball])
+
+# When given, add -Werror to WARN_CFLAGS and WARN_CXXFLAGS.
+# Disabled by default
+AE_FEATURE_DEFAULT_DISABLE
+AE_FEATURE([Werror],[Treat compiler warnings as errors.])
+
+
+## ##
+## Check for conflicting features selection ##
+## ##
+
+# Check for conflicting Python related features user choices.
+AE_IF_FEATURE_ENABLED([python-plugins], [
+ AE_IF_FEATURE_UNDEF([python-bindings], [
+ # --enable-python-plugins was provided but --enable-python-bindings was
+ # omitted. Turn the Python bindings ON anyway because it's needed to
+ # use the Python plugins.
+ AE_FEATURE_ENABLE([python-bindings])
+ ], [
+ AE_IF_FEATURE_DISABLED([python-bindings], [
+ # --enable-python-plugins _and_ --disable-python-bindings were
+ # used. This is invalid because Python plugins need the Python
+ # bindings to be useful.
+ AC_MSG_ERROR(--enable-python-bindings must be used to support Python plugins)
+ ])
+ ])
+])
+
+# Check for conflicting optional features user choices
+AE_IF_FEATURE_ENABLED([built-in-plugins], [
+ # Built-in plug-ins are only available when the --disable-shared --enable-static options are used.
+ AE_IF_FEATURE_NOT_ENABLED([static], [AC_MSG_ERROR(--enable-static must be used to bundle plug-ins in the babeltrace2 executable)])
+ AE_IF_FEATURE_ENABLED([shared], [AC_MSG_ERROR(--disable-shared must be used to bundle plug-ins in the babeltrace2 executable)])
+])
+
+AE_IF_FEATURE_ENABLED([built-in-python-plugin-support], [
+ AE_IF_FEATURE_NOT_ENABLED([python-plugins], [AC_MSG_ERROR([--enable-python-plugins must be used to bundle Python plugin support in the babeltrace2 executable])])
+ # Built-in plug-ins are only available when the --disable-shared --enable-static options are used.
+ AE_IF_FEATURE_NOT_ENABLED([static], [AC_MSG_ERROR(--enable-static must be used to bundle Python plugin support in the babeltrace2 executable)])
+ AE_IF_FEATURE_ENABLED([shared], [AC_MSG_ERROR(--disable-shared must be used to bundle Python plugin support in the babeltrace2 executable)])
+])
+
+
+## ##
+## Set automake variables for optionnal feature conditionnals in Makefile.am ##
+## ##
+
+AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS], AE_IS_FEATURE_ENABLED([python-bindings]))
+AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS_DOC], AE_IS_FEATURE_ENABLED([python-bindings-doc]))
+AM_CONDITIONAL([ENABLE_PYTHON_PLUGINS], AE_IS_FEATURE_ENABLED([python-plugins]))
+AM_CONDITIONAL([ENABLE_DEBUG_INFO], AE_IS_FEATURE_ENABLED([debug-info]))
+AM_CONDITIONAL([ENABLE_API_DOC], AE_IS_FEATURE_ENABLED([api-doc]))
+AM_CONDITIONAL([ENABLE_BUILT_IN_PLUGINS], AE_IS_FEATURE_ENABLED([built-in-plugins]))
+AM_CONDITIONAL([ENABLE_BUILT_IN_PYTHON_PLUGIN_SUPPORT], AE_IS_FEATURE_ENABLED([built-in-python-plugin-support]))
+AM_CONDITIONAL([ENABLE_MAN_PAGES], AE_IS_FEATURE_ENABLED([man-pages]))
+AM_CONDITIONAL([ENABLE_PYTHON_COMMON_DEPS], AE_IS_FEATURE_ENABLED([python-bindings]) || AE_IS_FEATURE_ENABLED([python-plugins]))