AM_PROG_CC_C_O
AC_GNU_SOURCE
+# Test if we have a new enough compiler.
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#define GCC_VERSION \
+ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+
+#define CLANG_VERSION \
+ (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
+
+#if GCC_VERSION < 40700 && CLANG_VERSION < 10000
+#error Sorry, your compiler is too old - please upgrade it
+#endif
+ ]])], [valid_compiler=yes], [valid_compiler=no])
+if test "x$valid_compiler" = "xno"; then
+ AC_MSG_ERROR([Sorry, your compiler is too old - please upgrade it])
+fi
+
# libtool
LT_INIT
AC_SUBST([LIBTOOL_DEPS])
[pattern for container cgroups]
)], [], [with_cgroup_pattern=['lxc/%n']])
+# The path for the apparmor_parser's cache for generated apparmor profiles
+AC_ARG_WITH([apparmor-cache-dir],
+ [AC_HELP_STRING(
+ [--with-apparmor-cache-dir=dir],
+ [path for apparmor_parser cache]
+ )], [], [with_apparmor_cache_dir=['${localstatedir}/cache/lxc/apparmor']])
+
# Container log path. By default, use $lxcpath.
AC_MSG_CHECKING([Whether to place logfiles in container config path])
AC_ARG_ENABLE([configpath-log],
AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
AS_AC_EXPAND(LOGPATH, "$with_log_path")
AS_AC_EXPAND(RUNTIME_PATH, "$with_runtime_path")
+AS_AC_EXPAND(APPARMOR_CACHE_DIR, "$with_apparmor_cache_dir")
AC_SUBST(DEFAULT_CGROUP_PATTERN, ["$with_cgroup_pattern"])
# We need the install path so criu knows where to reference the hook scripts.
AC_CHECK_DECLS([PR_GET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
# Check for some headers
-AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/memfd.h sys/personality.h utmpx.h sys/timerfd.h sys/resource.h])
+AC_CHECK_HEADERS([pty.h sys/memfd.h sys/personality.h sys/resource.h sys/signalfd.h sys/timerfd.h utmpx.h])
+
+AC_CHECK_HEADER([ifaddrs.h],
+ AM_CONDITIONAL(HAVE_IFADDRS_H, true)
+ AC_DEFINE(HAVE_IFADDRS_H, 1, [Have ifaddrs.h]),
+ AM_CONDITIONAL(HAVE_IFADDRS_H, false))
# 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])
+# Check for strerror_r() support. Defines:
+# - HAVE_STRERROR_R if available
+# - HAVE_DECL_STRERROR_R if defined
+# - STRERROR_R_CHAR_P if it returns char *
+AC_FUNC_STRERROR_R
+
# Check for some functions
AC_CHECK_LIB(pthread, main)
AC_CHECK_FUNCS(statvfs)
AM_CONDITIONAL(HAVE_STRLCPY, true)
AC_DEFINE(HAVE_STRLCPY,1,[Have strlcpy]),
AM_CONDITIONAL(HAVE_STRLCPY, false))
+AC_CHECK_FUNCS([strlcat],
+ AM_CONDITIONAL(HAVE_STRLCAT, true)
+ AC_DEFINE(HAVE_STRLCAT,1,[Have strlcat]),
+ AM_CONDITIONAL(HAVE_STRLCAT, false))
# Check for some libraries
AX_PTHREAD
# See if we support thread-local storage.
LXC_CHECK_TLS
-if test "x$GCC" = "xyes"; then
- CFLAGS="$CFLAGS -Wall"
- if test "x$enable_werror" = "xyes"; then
- CFLAGS="$CFLAGS -Werror"
- fi
+CFLAGS="$CFLAGS -Wvla -std=gnu11"
+if test "x$enable_werror" = "xyes"; then
+ CFLAGS="$CFLAGS -Werror"
fi
+AC_ARG_ENABLE([thread-safety],
+ [AC_HELP_STRING([--enable-thread-safety], [enforce thread-safety otherwise fail the build [default=yes]])],
+ [], [enable_thread_safety=yes])
+AM_CONDITIONAL([ENFORCE_THREAD_SAFETY], [test "x$enable_thread_safety" = "xyes"])
+
+AC_ARG_ENABLE([dlog],
+ [AC_HELP_STRING([--enable-dlog], [enable dlog support [default=no]])],
+ [], [enable_dlog=no])
+AM_CONDITIONAL([ENABLE_DLOG], [test "x$enable_dlog" = "xyes"])
+
+AM_COND_IF([ENABLE_DLOG],
+ [PKG_CHECK_MODULES([DLOG],[dlog],[],[
+ AC_CHECK_HEADER([dlog.h],[],[AC_MSG_ERROR([You must install the dlog development package in order to compile lxc])])
+ AC_CHECK_LIB([dlog], [dlog_print],[],[AC_MSG_ERROR([You must install the dlog development package in order to compile lxc])])
+ AC_SUBST([DLOG_LIBS], [-ldlog])
+ ])
+ ])
+
# Files requiring some variable expansion
AC_CONFIG_FILES([
Makefile
Paths:
- Logs in configpath: $enable_configpath_log
+
+Thread-safety:
+ - enforce: $enable_thread_safety
+
+Dlog:
+ - enable: $enable_dlog
EOF