+# API documentation
+# Disabled by default
+AC_ARG_ENABLE([api-doc],
+ [AC_HELP_STRING([--enable-api-doc], [build the HTML API documentation])],
+ [enable_api_doc=$enableval],
+ [enable_api_doc=no]
+)
+
+# Built-in plugins
+# Disabled by default
+AC_ARG_ENABLE([built-in-plugins],
+ [AC_HELP_STRING([--enable-built-in-plugins], [Statically-link in-tree plug-ins into the babeltrace binary])],
+ [], dnl AC_ARG_ENABLE will fill enable_built_in_plugins with the user choice
+ [enable_built_in_plugins=no]
+)
+
+# Built-in python plugin support
+# Disabled by default
+AC_ARG_ENABLE([built-in-python-plugin-support],
+ [AC_HELP_STRING([--enable-built-in-python-plugin-support], [Statically-link Python plugin support into the babeltrace library])],
+ [], dnl AC_ARG_ENABLE will fill enable_built_in_python_plugin_support with the user choice
+ [enable_built_in_python_plugin_support=no]
+)
+
+# Man pages
+# Enabled by default
+AC_ARG_ENABLE([man-pages],
+ [AS_HELP_STRING([--disable-man-pages], [Do not build and install man pages (already built in a distributed tarball])],
+ [], dnl AC_ARG_ENABLE will fill enable_built_in_plugins with the user choice
+ [enable_man_pages=yes]
+)
+
+
+# Set automake variables for optionnal feature conditionnals in Makefile.am
+AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS], [test "x$enable_python_bindings" = xyes])
+AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS_DOC], [test "x$enable_python_bindings_doc" = xyes])
+AM_CONDITIONAL([ENABLE_PYTHON_PLUGINS], [test "x$enable_python_plugins" = xyes])
+AM_CONDITIONAL([ENABLE_DEBUG_INFO], [test "x$enable_debug_info" = xyes])
+AM_CONDITIONAL([ENABLE_API_DOC], [test "x$enable_api_doc" = xyes])
+AM_CONDITIONAL([ENABLE_BUILT_IN_PLUGINS], [test "x$enable_built_in_plugins" = xyes])
+AM_CONDITIONAL([ENABLE_BUILT_IN_PYTHON_PLUGIN_SUPPORT], [test "x$enable_built_in_python_plugin_support" = xyes])
+AM_CONDITIONAL([ENABLE_MAN_PAGES], [test "x$enable_man_pages" = xyes])
+
+
+# Set defines for optionnal features conditionnals in the source code
+
+## jgalar: still used?
+AS_IF([test "x$enable_python_plugins" = xyes],
+ [AC_DEFINE([PYTHON_PLUGINS], [1], [Python plugin support.])]
+)
+
+AS_IF([test "x$enable_debug_info" = xyes],
+ [AC_DEFINE([ENABLE_DEBUG_INFO], [1], [Define to 1 if you enable the 'debug info' feature])]
+)
+
+AS_IF([test "x$enable_built_in_plugins" = xyes],
+ [AC_DEFINE([BT_BUILT_IN_PLUGINS], [1], [Define to 1 to register plug-in attributes in static executable sections])]
+)
+
+AS_IF([test "x$enable_built_in_python_plugin_support" = xyes],
+ [AC_DEFINE([BT_BUILT_IN_PYTHON_PLUGIN_SUPPORT], [1], [Define to 1 to register plug-in attributes in static executable sections])]
+)
+
+AS_IF([test "x$enable_debug_info" = xyes],
+ [ENABLE_DEBUG_INFO_VAL=1],
+ [ENABLE_DEBUG_INFO_VAL=0]
+)
+
+AC_SUBST([ENABLE_DEBUG_INFO_VAL])
+
+
+# Check for conflicting optional features user choices
+
+AS_IF([test "x$enable_python_bindings" = xno],
+ [
+ AS_IF([test "x$enable_python_bindings_doc" = xyes], [AC_MSG_ERROR([--enable-python-bindings-doc was specified without --enable-python-bindings])])
+ ]
+)
+
+AS_IF([test "x$enable_built_in_plugins" = xyes],
+ [
+ # Built-in plug-ins are only available when the --disable-shared --enable-static options are used.
+ AS_IF([test "x$enable_static" != xyes], [AC_MSG_ERROR(--enable-static must be used to bundle plug-ins in the babeltrace executable)])
+ AS_IF([test "x$enable_shared" = xyes], [AC_MSG_ERROR(--disable-shared must be used to bundle plug-ins in the babeltrace executable)])
+ ]
+)
+
+AS_IF([test "x$enable_built_in_python_plugin_support" = xyes],
+ [
+ AS_IF([test "x$enable_python_plugins" = xno], [AC_MSG_ERROR([--enable-python-plugins must be used to bundle Python plugin support in the babeltrace executable])])
+ # Built-in plug-ins are only available when the --disable-shared --enable-static options are used.
+ AS_IF([test "x$enable_static" != xyes], [AC_MSG_ERROR(--enable-static must be used to bundle Python plugin support in the babeltrace executable)])
+ AS_IF([test "x$enable_shared" = xyes], [AC_MSG_ERROR(--disable-shared must be used to bundle Python plugin support in the babeltrace executable)])
+ ]
+)
+
+
+# Check for optionnal features dependencies
+
+AS_IF([test "x$enable_python_bindings" = xyes],
+ [AX_PKG_SWIG(2.0.0, [], [AC_MSG_ERROR([SWIG 2.0.0 or newer is required to build the python bindings])])]
+)
+
+AS_IF([test "x$enable_python_bindings" = xyes || test "x$enable_python_plugins" = xyes],
+ [
+ AM_PATH_PYTHON([3.0], [], [AC_MSG_ERROR(Python 3 is not available or is not the default Python interpreter on your system. See the README file to learn how to override your distribution's default Python interpreter.)])
+
+ AM_PATH_PYTHON_MODULES([PYTHON])
+ # pythondir is the path where extra modules are to be installed
+ pythondir=$PYTHON_PREFIX/$PYTHON_MODULES_PATH
+ # pyexecdir is the path that contains shared objects used by the extra modules
+ pyexecdir=$PYTHON_EXEC_PREFIX/$PYTHON_MODULES_PATH
+ AS_IF([test -z "$PYTHON_INCLUDE"], [
+ AS_IF([test -z "$PYTHON_CONFIG"], [
+ AC_PATH_PROGS([PYTHON_CONFIG],
+ [python$PYTHON_VERSION-config python-config],
+ [no],
+ [`dirname $PYTHON`])
+ AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON. Is python-dev installed?])])
+ ])
+ AC_MSG_CHECKING([Python include flags])
+ PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
+ AC_MSG_RESULT([$PYTHON_INCLUDE])
+ ])
+ AS_IF([test -z "$PYTHON_LIBS"], [
+ AS_IF([test -z "$PYTHON_CONFIG"], [
+ AC_PATH_PROGS([PYTHON_CONFIG],
+ [python$PYTHON_VERSION-config python-config],
+ [no],
+ [`dirname $PYTHON`])
+ AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON. Is python-dev installed?])])
+ ])
+ AC_MSG_CHECKING([Python library flags])
+ PYTHON_LIBS=`$PYTHON_CONFIG --libs`
+ AC_MSG_RESULT([$PYTHON_LIBS])
+ ])
+ ]
+)
+
+AS_IF([test "x$enable_python_bindings_doc" = xyes],
+ [
+ AM_CHECK_PYTHON_SPHINX([PYTHON])
+ AS_IF([test "x$PYTHON_SPHINX_EXISTS" = xno],
+ [AC_MSG_ERROR([The Sphinx package for Python 3 is required to build the Python bindings documentation])]
+ )
+ ]
+)
+
+AS_IF([test "x$enable_debug_info" = xyes],
+ [
+ # Check if libelf and libdw are present
+ AC_CHECK_LIB([elf], [elf_version], [:], [AC_MSG_ERROR(Missing libelf (from elfutils >= 0.154) which is required by debug info. You can disable this feature using --disable-debug-info.)])
+ AC_CHECK_LIB([dw], [dwarf_begin], [:], [AC_MSG_ERROR(Missing libdw (from elfutils >= 0.154) which is required by debug info. You can disable this feature using --disable-debug-info.)])
+ BT_LIB_ELFUTILS([0], [154], [:], [AC_MSG_ERROR(elfutils >= 0.154 is required to use the debug info feature. You can disable this feature using --disable-debug-info.)])
+ ELFUTILS_LIBS="-lelf -ldw"
+ ]
+)
+AC_SUBST([ELFUTILS_LIBS])
+
+AS_IF([test "x$enable_api_doc" = "xyes"],
+ [
+ DX_DOXYGEN_FEATURE(ON)
+ DX_DOT_FEATURE(OFF)
+ DX_HTML_FEATURE(ON)
+ DX_CHM_FEATURE(OFF)
+ DX_CHI_FEATURE(OFF)
+ DX_MAN_FEATURE(OFF)
+ DX_RTF_FEATURE(OFF)
+ DX_XML_FEATURE(OFF)
+ DX_PDF_FEATURE(OFF)
+ DX_PS_FEATURE(OFF)
+ DX_INIT_DOXYGEN([Babeltrace], [$(srcdir)/Doxyfile], [output])
+ AS_IF([test -z "$DX_DOXYGEN"],
+ [AC_MSG_ERROR([You need doxygen to enable the API documentation])]
+ )
+ ]
+)