fi
AC_PROG_GCC_TRADITIONAL
+AC_PROG_CXX
AC_ENABLE_SHARED
AC_ENABLE_STATIC
# Check binaries
[AS_HELP_STRING([--disable-werror], [do not treat warnings as errors])],
[enable_werror=$enableval], [enable_werror=yes])
+AC_ARG_ENABLE([no_undefined],
+ [AS_HELP_STRING([--disable-no-undefined], [do not pass -Wl,--no-undefined])],
+ [enable_no_undefined=$enableval], [enable_no_undefined=yes])
+AM_CONDITIONAL([ENABLE_NO_UNDEFINED], [test "x$enable_no_undefined" = "xyes"])
+
+AC_ARG_ENABLE([fuzzers],
+ [AS_HELP_STRING([--enable-fuzzers], [compile with fuzzers])],
+ [enable_fuzzers=$enableval], [enable_fuzzers=no])
+AM_CONDITIONAL([ENABLE_FUZZERS], [test "x$enable_fuzzers" = "xyes"])
+
+AM_CONDITIONAL([OSS_FUZZ], [test "x$LIB_FUZZING_ENGINE" != x])
+
# Allow disabling rpath
AC_ARG_ENABLE([rpath],
[AS_HELP_STRING([--enable-rpath], [set rpath in executables [default=no]])],
[enable_static_binaries=$enableval], [enable_static_binaries=no])
AM_CONDITIONAL([ENABLE_STATIC_BINARIES], [test "x$enable_static_binaries" = "xyes"])
-# Build with ASAN commands
-AC_ARG_ENABLE([asan],
- [AS_HELP_STRING([--enable-asan], [build with address sanitizer enabled [default=no]])],
- [enable_asan=$enableval], [enable_asan=no])
-AM_CONDITIONAL([ENABLE_ASAN], [test "x$enable_asan" = "xyes"])
+AC_ARG_ENABLE([sanitizers],
+ [AS_HELP_STRING([--enable-sanitizers], [build with sanitizers enabled [default=no]])],
+ [enable_sanitizers=$enableval], [enable_sanitizers=no])
+AM_CONDITIONAL([ENABLE_SANITIZERS], [test "x$enable_sanitizers" = "xyes"])
+if test "x$enable_sanitizers" = "xyes"; then
+ AC_DEFINE([ENABLE_SANITIZERS], 1, [build with sanitizers enabled])
-# Build with UBSAN commands
-AC_ARG_ENABLE([ubsan],
- [AS_HELP_STRING([--enable-ubsan], [build with ubsan sanitizer enabled [default=no]])],
- [enable_asan=$enableval], [enable_ubsan=no])
-AM_CONDITIONAL([ENABLE_UBSAN], [test "x$enable_ubsan" = "xyes"])
+ CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[ \
+ -fsanitize=address \
+ -fsanitize=undefined \
+ -fno-optimize-sibling-calls \
+ -fno-omit-frame-pointer])
+ AC_SUBST(AM_CFLAGS)
+
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
+
+if test "x$enable_fuzzers" = "xyes"; then
+ if test "x$LIB_FUZZING_ENGINE" = x; then
+ CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[ \
+ -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION \
+ -DRUN_ON_OSS_FUZZ=0 \
+ -fsanitize=fuzzer-no-link])
+ else
+ CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[ \
+ -DRUN_ON_OSS_FUZZ=1])
+ fi
+else
+ CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[-flto=thin])
+fi
+AC_SUBST(AM_CFLAGS)
# Optional test binaries
AC_ARG_ENABLE([tests],
AC_DEFINE(HAVE_IFADDRS_H, 1, [Have ifaddrs.h]),
AM_CONDITIONAL(HAVE_IFADDRS_H, false))
+AC_ARG_ENABLE([liburing],
+ [AS_HELP_STRING([--enable-liburing], [enable liburing support [default=auto]])],
+ [enable_liburing=$enableval], [enable_liburing=auto])
+
+if test "x$enable_liburing" = "auto"; then
+ AC_CHECK_LIB([uring],[__io_uring_sqring_wait],[enable_liburing=yes],[enable_liburing=no])
+fi
+
+AM_CONDITIONAL([ENABLE_LIBURING], [test "x$enable_liburing" = "xyes"])
+
+AM_COND_IF([ENABLE_LIBURING],
+ [AC_CHECK_HEADER([liburing.h],[],[AC_MSG_ERROR([You must install the liburing development package in order to compile lxc])])
+ # We use __io_uring_sqring_wait as an indicator whether liburing is new enough to support poll.
+ AC_CHECK_LIB([uring],[__io_uring_sqring_wait],[],[AC_MSG_ERROR([The liburing development package in order to compile lxc])])
+ AC_SUBST([LIBURING_LIBS], [-luring])])
+
# lookup major()/minor()/makedev()
AC_HEADER_MAJOR
# Check for some syscalls functions
-AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat gettid memfd_create move_mount open_tree execveat clone3 fsopen fspick fsconfig fsmount, openat2, close_range, statvfs])
+AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat gettid memfd_create move_mount open_tree execveat clone3 fsopen fspick fsconfig fsmount openat2 close_range statvfs mount_setattr])
AC_CHECK_TYPES([__aligned_u64], [], [], [[#include <linux/types.h>]])
+AC_CHECK_TYPES([struct mount_attr], [], [], [[#include <linux/mount.h>]])
AC_CHECK_TYPES([struct open_how], [], [], [[#include <linux/openat2.h>]])
AC_CHECK_TYPES([struct clone_args], [], [], [[#include <linux/sched.h>]])
AC_CHECK_MEMBERS([struct clone_args.set_tid],[],[],[[#include <linux/sched.h>]])
AM_CONDITIONAL(HAVE_STRLCAT, true)
AC_DEFINE(HAVE_STRLCAT,1,[Have strlcat]),
AM_CONDITIONAL(HAVE_STRLCAT, false))
+AC_CHECK_FUNCS([strchrnul],
+ AM_CONDITIONAL(HAVE_STRCHRNUL, true)
+ AC_DEFINE(HAVE_STRCHRNUL,1,[Have strchnul]),
+ AM_CONDITIONAL(HAVE_STRCHRNUL, false))
AC_CHECK_FUNCS([fmemopen],
AM_CONDITIONAL(HAVE_FMEMOPEN, true)
AC_DEFINE(HAVE_FMEMOPEN,1,[Have fmemopen]),
-Warray-bounds \
-Wrestrict \
-Wreturn-local-addr \
- -flto=thin \
-fsanitize=cfi \
-Wstringop-overflow])
AC_SUBST(AM_CFLAGS)
CC_CHECK_FLAGS_APPEND([AM_LDFLAGS],[LDFLAGS],[ \
-Wl,--as-needed \
- -Wl,--no-undefined \
-Wl,--gc-sections \
-Wl,-z,relro \
-Wl,-z,now \
-pie \
-Wl,-fuse-ld=gold])
+
+AM_COND_IF([ENABLE_NO_UNDEFINED],
+ [CC_CHECK_FLAGS_APPEND([AM_LDFLAGS],[LDFLAGS],[-Wl,--no-undefined])])
+
AC_SUBST(AM_LDFLAGS)
CFLAGS="$CFLAGS -Wvla -std=gnu11 -fms-extensions"
- user documentation: $enable_doc
Debugging:
- - ASAN: $enable_asan
+ - Sanitizers: $enable_sanitizers
- Coverity: $enable_coverity_build
- mutex debugging: $enable_mutex_debugging
- tests: $enable_tests
+ - fuzzers: $enable_fuzzers
Paths:
- Logs in configpath: $enable_configpath_log