+# Always check for python, we will fail later if some features require it and
+# it's unavailable.
+AM_PATH_PYTHON([3.0], [
+ AE_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
+
+ # If no PYTHON_CONFIG was specified by the user, try to find it, starting
+ # with the one specific to the configured python version.
+ AS_IF([test "x$PYTHON_CONFIG" = "x"], [
+ AC_CHECK_PROGS([PYTHON_CONFIG], [python$PYTHON_VERSION-config python-config])
+ ])
+
+ # If PYTHON_CONFIG is set use it to get the includes and ld flags, unless
+ # they were specified by the user.
+ AS_IF([test "x$PYTHON_CONFIG" != "x" ], [
+ AS_IF([test "x$PYTHON_INCLUDE" = "x"], [
+ AC_MSG_CHECKING([Python include flags])
+ PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
+ AC_MSG_RESULT([$PYTHON_INCLUDE])
+ ])
+
+ AS_IF([test "x$PYTHON_LDFLAGS" = "x"], [
+ AC_MSG_CHECKING([Python library flags])
+ # Python 3.8+ requires that we pass --embed to get the -lpython3.x flag.
+ AS_IF([! PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags --embed`], [
+ PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
+ ])
+ AC_MSG_RESULT([$PYTHON_LDFLAGS])
+ ])
+ ])
+], [:])
+
+# Initialize and configure libtool
+LT_INIT([win32-dll])
+
-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_man_pages 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])
-AM_CONDITIONAL([ENABLE_PYTHON_COMMON_DEPS], [test "x$enable_python_bindings" = xyes || test "x$enable_python_plugins" = xyes])
-
-# Set defines for optionnal features conditionnals in the source code
-
-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])]
-)
+AE_FEATURE_DEFAULT_ENABLE
+AE_FEATURE([man-pages],[Do not build and install man pages (already built in a distributed tarball])
-AS_IF([test "x$enable_python_plugins" = xyes],
- [
- AS_IF([test "x$enable_python_bindings" = xunspecified],
- [
- # --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.
- enable_python_bindings=yes
- ],
- [
- AS_IF([test "x$enable_python_bindings" = xno],
- [
- # --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)
- ]
- )
- ]
- )
- ]
-)
+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)
+ ])
+ ])
+])
-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"
- ]
-)
+AE_IF_FEATURE_ENABLED([debug-info], [
+ # Check if libelf and libdw are present
+ PKG_CHECK_MODULES([ELFUTILS], [libelf >= 0.154 libdw >= 0.154],
+ [
+ dnl PKG_CHECK_MODULES defines ELFUTILS_LIBS
+ ],
+ [
+ AC_MSG_WARN([pkg-config was unable to find a valid .pc for libelf/libdw. Set PKG_CONFIG_PATH to specify the pkg-config configuration file location.])
+
+ # Turns out SLES12 doesn't bother shipping .pc file for libelf
+ AC_MSG_WARN([Finding libelf without pkg-config.])
+ 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.)])
+ AE_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"
+ ])
+])
+m4_define([WARN_FLAGS_LIST], [ dnl
+ -Wall dnl
+ -Wextra dnl
+ -Wmissing-prototypes dnl
+ -Wmissing-declarations dnl
+ -Wnull-dereference dnl
+ -Wundef dnl
+ -Wredundant-decls dnl
+ -Wshadow dnl
+ -Wjump-misses-init dnl
+ -Wsuggest-attribute=format dnl
+ -Wtautological-constant-out-of-range-compare dnl
+ -Wnested-externs dnl
+ -Wwrite-strings dnl
+ -Wformat=2 dnl
+ -Wstrict-aliasing dnl
+ -Wmissing-noreturn dnl
+ -Winit-self dnl
+ -Wduplicated-cond dnl
+ -Wduplicated-branches dnl
+ -Wlogical-op dnl
+ -Wno-unused-parameter dnl
+ -Wno-sign-compare dnl
+ dnl
+ dnl Some versions of SWIG (like 3.0.12) generate code that produces
+ dnl -Wcast-function-type warnings. This warning is present in gcc >= 8. This
+ dnl combo happens on RHEL/Centos 8, for example. Later versions of SWIG (like
+ dnl 4.0.1) have the correct function signatures to not produce this warning.
+ dnl It's simpler to just disable the warning globally.
+ dnl
+ dnl Note that the Debian/Ubuntu SWIG package 3.0.12-2 contains a local patch to
+ dnl fix this (python-fix-function-cast-warnings.patch), so you won't be able to
+ dnl reproduce the warning using that package.
+ dnl
+ dnl Ref: https://github.com/swig/swig/issues/1259
+ -Wno-cast-function-type dnl
+ -Wno-missing-field-initializers dnl
+])
+
-AX_APPEND_COMPILE_FLAGS([ dnl
- -Wall dnl
- -Wextra dnl
- -Wmissing-prototypes dnl
- -Wmissing-declarations dnl
- -Wnull-dereference dnl
- -Wundef dnl
- -Wredundant-decls dnl
- -Wshadow dnl
- -Wjump-misses-init dnl
- -Wsuggest-attribute=format dnl
- -Wtautological-constant-out-of-range-compare dnl
- -Wnested-externs dnl
- -Wwrite-strings dnl
- -Wformat=2 dnl
- -Wstrict-aliasing dnl
- -Wmissing-noreturn dnl
- -Winit-self dnl
- -Wduplicated-cond dnl
- -Wduplicated-branches dnl
- -Wlogical-op dnl
- -Wno-unused-parameter dnl
- -Wno-sign-compare dnl
- dnl
- dnl Some versions of SWIG (like 3.0.12) generate code that produces
- dnl -Wcast-function-type warnings. This warning is present in gcc >= 8. This
- dnl combo happens on RHEL/Centos 8, for example. Later versions of SWIG (like
- dnl 4.0.1) have the correct function signatures to not produce this warning.
- dnl It's simpler to just disable the warning globally.
- dnl
- dnl Note that the Debian/Ubuntu SWIG package 3.0.12-2 contains a local patch to
- dnl fix this (python-fix-function-cast-warnings.patch), so you won't be able to
- dnl reproduce the warning using that package.
- dnl
- dnl Ref: https://github.com/swig/swig/issues/1259
- -Wno-cast-function-type dnl
- -Wno-missing-field-initializers dnl
- ],
- [WARN_CFLAGS],
- [-Werror])
-
-# When given, add -Werror to WARN_CFLAGS.
-AC_ARG_ENABLE([Werror],
- [AS_HELP_STRING([--enable-Werror], [Treat compiler warnings as errors.])]
-)
-AS_IF([test "x$enable_Werror" = "xyes"],
- [WARN_CFLAGS="${WARN_CFLAGS} -Werror"]
-)
+AC_LANG([C++])
+AX_APPEND_COMPILE_FLAGS([WARN_FLAGS_LIST], [WARN_CXXFLAGS], [-Werror])
+AC_LANG([C])
+AX_APPEND_COMPILE_FLAGS([WARN_FLAGS_LIST], [WARN_CFLAGS], [-Werror])
+
+AE_IF_FEATURE_ENABLED([Werror], [WARN_CXXFLAGS="${WARN_CXXFLAGS} -Werror"])
+AE_IF_FEATURE_ENABLED([Werror], [WARN_CFLAGS="${WARN_CFLAGS} -Werror"])
- doc/api/Makefile
- doc/api/libbabeltrace2/Doxyfile
- doc/api/libbabeltrace2/Makefile
- doc/bindings/Makefile
- doc/bindings/python/Makefile
- doc/contributing-images/Makefile
- doc/Makefile
- doc/man/asciidoc-attrs.conf
- doc/man/Makefile
- include/Makefile
- Makefile
- src/argpar/Makefile
- src/autodisc/Makefile
- src/babeltrace2-ctf-writer.pc
- src/babeltrace2.pc
- src/bindings/Makefile
- src/bindings/python/bt2/bt2/version.py
- src/bindings/python/bt2/Makefile
- src/bindings/python/bt2/setup.py
- src/bindings/python/Makefile
- src/cli/Makefile
- src/common/Makefile
- src/compat/Makefile
- src/ctfser/Makefile
- src/ctf-writer/Makefile
- src/fd-cache/Makefile
- src/lib/graph/Makefile
- src/lib/graph/message/Makefile
- src/lib/Makefile
- src/lib/plugin/Makefile
- src/lib/prio-heap/Makefile
- src/lib/trace-ir/Makefile
- src/logging/Makefile
- src/Makefile
- src/plugins/common/Makefile
- src/plugins/common/muxing/Makefile
- src/plugins/common/param-validation/Makefile
- src/plugins/ctf/common/bfcr/Makefile
- src/plugins/ctf/common/Makefile
- src/plugins/ctf/common/metadata/Makefile
- src/plugins/ctf/common/msg-iter/Makefile
- src/plugins/ctf/fs-sink/Makefile
- src/plugins/ctf/fs-src/Makefile
- src/plugins/ctf/lttng-live/Makefile
- src/plugins/ctf/Makefile
- src/plugins/lttng-utils/debug-info/Makefile
- src/plugins/lttng-utils/Makefile
- src/plugins/Makefile
- src/plugins/text/dmesg/Makefile
- src/plugins/text/Makefile
- src/plugins/text/pretty/Makefile
- src/plugins/text/details/Makefile
- src/plugins/utils/counter/Makefile
- src/plugins/utils/dummy/Makefile
- src/plugins/utils/Makefile
- src/plugins/utils/muxer/Makefile
- src/plugins/utils/trimmer/Makefile
- src/py-common/Makefile
- src/python-plugin-provider/Makefile
- src/param-parse/Makefile
- src/string-format/Makefile
- tests/bitfield/Makefile
- tests/ctf-writer/Makefile
- tests/lib/Makefile
- tests/lib/test-plugin-plugins/Makefile
- tests/lib/conds/Makefile
- tests/Makefile
- tests/param-validation/Makefile
- tests/plugins/Makefile
- tests/plugins/src.ctf.fs/Makefile
- tests/plugins/src.ctf.fs/succeed/Makefile
- tests/plugins/sink.ctf.fs/Makefile
- tests/plugins/sink.ctf.fs/succeed/Makefile
- tests/plugins/flt.lttng-utils.debug-info/Makefile
- tests/plugins/flt.utils.muxer/Makefile
- tests/plugins/flt.utils.muxer/succeed/Makefile
- tests/plugins/flt.utils.trimmer/Makefile
- tests/plugins/sink.text.pretty/Makefile
- tests/utils/Makefile
- tests/utils/tap/Makefile
+ doc/api/Makefile
+ doc/api/libbabeltrace2/Doxyfile
+ doc/api/libbabeltrace2/Makefile
+ doc/bindings/Makefile
+ doc/bindings/python/Makefile
+ doc/contributing-images/Makefile
+ doc/Makefile
+ doc/man/asciidoc-attrs.conf
+ doc/man/Makefile
+ include/Makefile
+ Makefile
+ src/argpar/Makefile
+ src/autodisc/Makefile
+ src/babeltrace2-ctf-writer.pc
+ src/babeltrace2.pc
+ src/bindings/Makefile
+ src/bindings/python/bt2/bt2/version.py
+ src/bindings/python/bt2/Makefile
+ src/bindings/python/bt2/setup.py
+ src/bindings/python/Makefile
+ src/cli/Makefile
+ src/common/Makefile
+ src/compat/Makefile
+ src/ctfser/Makefile
+ src/ctf-writer/Makefile
+ src/fd-cache/Makefile
+ src/lib/graph/Makefile
+ src/lib/graph/message/Makefile
+ src/lib/Makefile
+ src/lib/plugin/Makefile
+ src/lib/prio-heap/Makefile
+ src/lib/trace-ir/Makefile
+ src/logging/Makefile
+ src/Makefile
+ src/plugins/common/Makefile
+ src/plugins/common/muxing/Makefile
+ src/plugins/common/param-validation/Makefile
+ src/plugins/ctf/common/bfcr/Makefile
+ src/plugins/ctf/common/Makefile
+ src/plugins/ctf/common/metadata/Makefile
+ src/plugins/ctf/common/msg-iter/Makefile
+ src/plugins/ctf/fs-sink/Makefile
+ src/plugins/ctf/fs-src/Makefile
+ src/plugins/ctf/lttng-live/Makefile
+ src/plugins/ctf/Makefile
+ src/plugins/lttng-utils/debug-info/Makefile
+ src/plugins/lttng-utils/Makefile
+ src/plugins/Makefile
+ src/plugins/text/dmesg/Makefile
+ src/plugins/text/Makefile
+ src/plugins/text/pretty/Makefile
+ src/plugins/text/details/Makefile
+ src/plugins/utils/counter/Makefile
+ src/plugins/utils/dummy/Makefile
+ src/plugins/utils/Makefile
+ src/plugins/utils/muxer/Makefile
+ src/plugins/utils/trimmer/Makefile
+ src/py-common/Makefile
+ src/python-plugin-provider/Makefile
+ src/param-parse/Makefile
+ src/string-format/Makefile
+ tests/bitfield/Makefile
+ tests/ctf-writer/Makefile
+ tests/lib/Makefile
+ tests/lib/test-plugin-plugins/Makefile
+ tests/lib/conds/Makefile
+ tests/Makefile
+ tests/param-validation/Makefile
+ tests/plugins/Makefile
+ tests/plugins/src.ctf.fs/Makefile
+ tests/plugins/src.ctf.fs/succeed/Makefile
+ tests/plugins/sink.ctf.fs/Makefile
+ tests/plugins/sink.ctf.fs/succeed/Makefile
+ tests/plugins/flt.lttng-utils.debug-info/Makefile
+ tests/plugins/flt.utils.muxer/Makefile
+ tests/plugins/flt.utils.muxer/succeed/Makefile
+ tests/plugins/flt.utils.trimmer/Makefile
+ tests/plugins/sink.text.pretty/Makefile
+ tests/utils/Makefile
+ tests/utils/tap/Makefile