## Automake base setup ##
## ##
-AM_INIT_AUTOMAKE([1.12 foreign dist-bzip2 no-dist-gzip tar-ustar nostdinc -Wall -Wno-portability -Werror])
+AM_INIT_AUTOMAKE([1.13 foreign dist-bzip2 no-dist-gzip tar-ustar nostdinc -Wall -Wno-portability -Werror])
AM_MAINTAINER_MODE([enable])
# Enable silent rules by default
AC_CHECK_PROGS([ASCIIDOC], [asciidoc])
AC_CHECK_PROGS([XMLTO], [xmlto])
-# set $IN_GIT_REPO if we're in the Git repository; the `bootstrap` file
-# is not distributed in tarballs
-AS_IF([test -f "$srcdir/bootstrap"], [in_git_repo=yes], [in_git_repo=no])
-AM_CONDITIONAL([IN_GIT_REPO], [test "x$in_git_repo" = "xyes"])
-
# check for bison
AC_PROG_YACC
AX_PROG_BISON_VERSION([2.5], [have_bison=yes])
AS_IF([test "x$have_bison" != "xyes"], [
- AS_IF([test "x$in_git_repo" = "xyes"], [
+ AE_IF_IN_GIT_REPO([
AC_MSG_FAILURE([dnl
-Bison >= 2.4 is required when building from the Git repository. You can
+Bison >= 2.5 is required when building from the Git repository. You can
set the YACC variable to override automatic detection.
])
], [
AC_MSG_WARN([dnl
-Missing Bison >= 2.4. Note that the parser files are already built in
+Missing Bison >= 2.5. Note that the parser files are already built in
this distribution tarball, so Bison is only needed if you intend to
modify their sources. You can set the YACC variable to override automatic
detection.
AX_PROG_FLEX_VERSION([2.5.35], [have_flex=yes])
AS_IF([test "x$have_flex" != "xyes"], [
- AS_IF([test "x$in_git_repo" = "xyes"], [
+ AE_IF_IN_GIT_REPO([
AC_MSG_FAILURE([dnl
Flex >= 2.5.35 is required when building from the Git repository. You can
set the LEX variable to override automatic detection.
# When given, build with AddressSanitizer.
AE_FEATURE_DEFAULT_DISABLE
AE_FEATURE([asan],[Build with AddressSanitizer.])
+AE_FEATURE([ubsan],[Build with UndefinedBehaviorSanitizer.])
## ##
## Check for conflicting features selection ##
AS_IF([test "x$have_python_dev" = xno], [
AC_MSG_ERROR([Cannot find a suitable python-config. You can override the python-config path with the PYTHON_CONFIG environment variable.])
])
+
+ AX_COMPARE_VERSION(["$PYTHON_VERSION"], [ge], ["3.12"], [
+ AC_MSG_CHECKING([for python setuptools])
+ AS_IF(["$PYTHON" -c "import setuptools" 2>/dev/null], [
+ AC_MSG_RESULT([yes])
+ ], [
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Python >= 3.12 removed 'distutils', the 'setuptools' module needs to be installed for the selected interpreter.])
+ ])
+ ])
])
AE_IF_FEATURE_ENABLED([python-bindings-doc],
# 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.)])
+ 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"
])
AE_IF_FEATURE_ENABLED([man-pages], [
AS_IF([test "x$ASCIIDOC" = "x" || test "x$XMLTO" = "x"], [
- AS_IF([test "x$in_git_repo" = "xyes"], [
+ AE_IF_IN_GIT_REPO([
# this is an error because we're in the Git repo, which
# means the man pages are not already generated for us,
# thus asciixmlto are required because we were asked
ASAN_LDFLAGS="-fsanitize=address"
])
-
+# If --enable-ubsan is used...
+AE_IF_FEATURE_ENABLED([ubsan], [
+ # ... add -fsanitize=undefined to the *FLAGS variables.
+ UBSAN_CFLAGS="-fsanitize=undefined"
+ UBSAN_CXXFLAGS="-fsanitize=undefined"
+ UBSAN_LDFLAGS="-fsanitize=undefined"
+])
# CFLAGS from libraries (the glib ones are needed for the following sizeof
# test).
-AM_CFLAGS="${PTHREAD_CFLAGS} ${GLIB_CFLAGS} ${ASAN_CFLAGS}"
-AM_CXXFLAGS="${PTHREAD_CFLAGS} ${GLIB_CFLAGS} ${ASAN_CXXFLAGS}"
-AM_LDFLAGS="${ASAN_LDFLAGS}"
+AM_CFLAGS="-fvisibility=hidden ${PTHREAD_CFLAGS} ${GLIB_CFLAGS} ${ASAN_CFLAGS} ${UBSAN_CFLAGS}"
+AM_CXXFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden ${PTHREAD_CFLAGS} ${GLIB_CFLAGS} ${ASAN_CXXFLAGS} ${UBSAN_CFLAGS}"
+AM_LDFLAGS="${ASAN_LDFLAGS} ${UBSAN_CFLAGS}"
# Check that the current size_t matches the size that glib thinks it should
# be. This catches problems on multi-arch where people try to do a 32-bit
-Wundef dnl
-Wredundant-decls dnl
-Wshadow dnl
+ dnl GCC's -Wshadow warns about constructor parameters shadowing fields, but
+ dnl Clang's does not. Enable Clang's `-Wshadow-field-in-constructor`, to make
+ dnl Clang warn about that.
+ -Wshadow-field-in-constructor dnl
+ -Wshadow-field dnl
-Wjump-misses-init dnl
-Wsuggest-attribute=format dnl
-Wtautological-constant-out-of-range-compare dnl
-Wduplicated-cond dnl
-Wduplicated-branches dnl
-Wlogical-op dnl
+ -Wsuggest-override dnl
-Wno-unused-parameter dnl
-Wno-sign-compare dnl
dnl
dnl Ref: https://github.com/swig/swig/issues/1259
-Wno-cast-function-type dnl
-Wno-missing-field-initializers dnl
+ -Wno-maybe-uninitialized dnl
])
# Pass -Werror as an extra flag during the test: this is needed to make the
src/bindings/python/Makefile
src/cli/Makefile
src/common/Makefile
+ src/cpp-common/Makefile
src/compat/Makefile
src/ctfser/Makefile
src/ctf-writer/Makefile
tests/lib/Makefile
tests/lib/test-plugin-plugins/Makefile
tests/lib/conds/Makefile
+ tests/lib/utils/Makefile
tests/Makefile
tests/param-validation/Makefile
tests/plugins/Makefile
# man pages build enabled/disabled
m4_pushdef([build_man_pages_msg], [Build and install man pages])
-AS_IF([test "x$enable_man_pages" != "xno"], [
- AS_IF([test "x$in_git_repo" = "xyes"], [
+AE_IF_FEATURE_ENABLED([man-pages], [
+ AE_IF_IN_GIT_REPO([
PPRINT_PROP_BOOL([build_man_pages_msg], 1)
], [
AS_IF([test "x$have_asciidoc_xmlto" = "xyes"], [