X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=configure.ac;h=9a9adac32595a534294734299a66f3cdeb96a0b7;hb=3bcfbee1522c1824d19d911856486d590196931b;hp=8c1f806aab1c8f44c306239f88f7f78c4b4452a5;hpb=b52a5bef6fa56481a6d817f4c73cb91ed012fe2c;p=mirror_lxc.git diff --git a/configure.ac b/configure.ac index 8c1f806aa..9a9adac32 100644 --- a/configure.ac +++ b/configure.ac @@ -1,14 +1,14 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -m4_define([lxc_devel], 1) -m4_define([lxc_version_major], 2) -m4_define([lxc_version_minor], 1) +m4_define([lxc_devel], 0) +m4_define([lxc_version_major], 3) +m4_define([lxc_version_minor], 0) m4_define([lxc_version_micro], 0) m4_define([lxc_version_beta], []) m4_define([lxc_abi_major], 1) -m4_define([lxc_abi_minor], 3) +m4_define([lxc_abi_minor], 4) m4_define([lxc_abi_micro], 0) m4_define([lxc_abi], [lxc_abi_major.lxc_abi_minor.lxc_abi_micro]) @@ -45,6 +45,22 @@ AC_CANONICAL_HOST 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]) @@ -52,7 +68,7 @@ AC_SUBST([LIBTOOL_DEPS]) # Detect the distribution. This is used for the default configuration and # for some distro-specific build options. AC_MSG_CHECKING([host distribution]) -AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, oracle, centos, fedora, suse, gentoo, debian, arch, slackware, plamo, paldo, openmandriva, pardus, sparclinux, altlinux.])) +AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, redhatenterpriseserver, oracle, centos, fedora, suse, gentoo, debian, arch, slackware, plamo, paldo, openmandriva, pardus, sparclinux, altlinux.])) if type lsb_release >/dev/null 2>&1 && test "z$with_distro" = "z"; then with_distro=`lsb_release -is` fi @@ -89,7 +105,7 @@ case $with_distro in distroconf=default.conf.lxcbr distrosysconf="$sysconfdir/default" ;; - redhat|centos|fedora|oracle|oracleserver|sparclinux|altlinux|suse|opensuse*|plamo|pld) + redhat|redhatenterpriseserver|centos|fedora|oracle|oracleserver|sparclinux|altlinux|suse|opensuse*|plamo|pld) distroconf=default.conf.lxcbr distrosysconf="$sysconfdir/sysconfig" ;; @@ -116,7 +132,7 @@ case "$with_init_script" in fedora|altlinux|opensuse*) init_script=systemd ;; - redhat|oracle|oracleserver|sparclinux|plamo) + redhat|redhatenterpriseserver|oracle|oracleserver|sparclinux|plamo) init_script=sysvinit ;; centos) @@ -173,13 +189,6 @@ AC_ARG_ENABLE([werror], [do not treat warnings as errors])], [], [enable_werror=yes]) -# Allow enabling deprecated executables -AC_ARG_ENABLE([deprecated], - [AC_HELP_STRING([--enable-deprecated], - [enable deprecated executables [default=no]])], - [], [enable_deprecated=false]) -AM_CONDITIONAL([ENABLE_DEPRECATED], [test "x$enable_deprecated" = "xyes"]) - # Allow disabling rpath AC_ARG_ENABLE([rpath], [AC_HELP_STRING([--enable-rpath], [set rpath in executables [default=no]])], @@ -270,7 +279,7 @@ AM_CONDITIONAL([ENABLE_GNUTLS], [test "x$enable_gnutls" = "xyes"]) AM_COND_IF([ENABLE_GNUTLS], [AC_CHECK_HEADER([gnutls/gnutls.h],[],[AC_MSG_ERROR([You must install the GnuTLS development package in order to compile lxc])]) - AC_CHECK_LIB([gnutls], [gnutls_hash_fast],[],[AC_MSG_ERROR([You must install the GnuTLS development package in order to compile lxc])]) + AC_CHECK_LIB([gnutls], [gnutls_hash_fast],[true],[AC_MSG_ERROR([You must install the GnuTLS development package in order to compile lxc])]) AC_SUBST([GNUTLS_LIBS], [-lgnutls])]) # SELinux @@ -363,29 +372,6 @@ AC_ARG_ENABLE([examples], [], [enable_examples=yes]) AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"]) -# Python3 module and scripts -AC_ARG_ENABLE([python], - [AC_HELP_STRING([--enable-python], [enable python binding [default=auto]])], - [], [enable_python=auto]) - -if test "x$enable_python" = "xauto"; then - PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[enable_python=yes],[enable_python=no]) - if test "$CC" = "clang"; then - enable_python=no - fi -fi - -if test "x$enable_python" = "xyes" && test "$CC" = "clang"; then - AC_MSG_ERROR([Python3 is incompatible with the clang compiler]) -fi - -AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"]) - -AM_COND_IF([ENABLE_PYTHON], - [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])]) - PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[],[AC_MSG_ERROR([You must install python3-dev])]) - AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])]) - # Enable dumping stack traces AC_ARG_ENABLE([mutex-debugging], [AC_HELP_STRING([--enable-mutex-debugging], [Makes mutexes to report error and provide stack trace [default=no]])], @@ -497,7 +483,14 @@ AC_ARG_WITH([cgroup-pattern], [AC_HELP_STRING( [--with-cgroup-pattern=pattern], [pattern for container cgroups] - )], [], [with_cgroup_pattern=['lxc/%n']]) + )], [], [with_cgroup_pattern=['lxc.payload/%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]) @@ -545,6 +538,7 @@ AS_AC_EXPAND(LXCBINHOOKDIR, "$libexecdir/lxc/hooks") 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. @@ -617,7 +611,12 @@ AC_CHECK_DECLS([PR_SET_NO_NEW_PRIVS], [], [], [#include ]) AC_CHECK_DECLS([PR_GET_NO_NEW_PRIVS], [], [], [#include ]) # 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 @@ -625,11 +624,21 @@ 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) AC_CHECK_LIB(util, openpty) AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent utmpxname]) +AC_CHECK_FUNCS([getgrgid_r], + AM_CONDITIONAL(HAVE_GETGRGID_R, true) + AC_DEFINE(HAVE_GETGRGID_R,1,[Have getgrgid_r]), + AM_CONDITIONAL(HAVE_GETGRGID_R, false)) AC_CHECK_FUNCS([getline], AM_CONDITIONAL(HAVE_GETLINE, true) AC_DEFINE(HAVE_GETLINE,1,[Have getline]), @@ -642,6 +651,10 @@ AC_CHECK_FUNCS([fgetln], AM_CONDITIONAL(HAVE_FGETLN, true) AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]), AM_CONDITIONAL(HAVE_FGETLN, false)) +AC_CHECK_FUNCS([keyctl], + AM_CONDITIONAL(HAVE_KEYCTL, true) + AC_DEFINE(HAVE_KEYCTL,1,[Have keyctl]), + AM_CONDITIONAL(HAVE_KEYCTL, false)) AC_CHECK_FUNCS([prlimit], AM_CONDITIONAL(HAVE_PRLIMIT, true) AC_DEFINE(HAVE_PRLIMIT,1,[Have prlimit]), @@ -650,6 +663,21 @@ AC_CHECK_FUNCS([prlimit64], AM_CONDITIONAL(HAVE_PRLIMIT64, true) AC_DEFINE(HAVE_PRLIMIT64,1,[Have prlimit64]), AM_CONDITIONAL(HAVE_PRLIMIT64, false)) +AC_CHECK_FUNCS([pthread_setcancelstate], + AM_CONDITIONAL(HAVE_PTHREAD_SETCANCELSTATE, true) + AC_DEFINE(HAVE_PTHREAD_SETCANCELSTATE,1,[Have pthread_setcancelstate]), + AM_CONDITIONAL(HAVE_PTHREAD_SETCANCELSTATE, false)) +AC_CHECK_FUNCS([strlcpy], + 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)) + +# HAVE_STRUCT_RTNL_LINK_STATS64={0,1} +AC_CHECK_TYPES([struct rtnl_link_stats64], [], [], [[#include ]]) # Check for some libraries AX_PTHREAD @@ -662,13 +690,43 @@ AC_PROG_SED # 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 +AX_CHECK_COMPILE_FLAG([-fdiagnostics-color], [CFLAGS="$CFLAGS -fdiagnostics-color"],,[-Werror]) +AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough], [CFLAGS="$CFLAGS -Wimplicit-fallthrough"],,[-Werror]) +AX_CHECK_COMPILE_FLAG([-Wcast-align], [CFLAGS="$CFLAGS -Wcast-align"],,[-Werror]) +AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], [CFLAGS="$CFLAGS -Wstrict-prototypes"],,[-Werror]) +AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"],,[-Werror]) +AX_CHECK_COMPILE_FLAG([-fstack-clash-protection], [CFLAGS="$CFLAGS -fstack-clash-protection"],,[-Werror]) +AX_CHECK_COMPILE_FLAG([-fstack-protector-strong], [CFLAGS="$CFLAGS -fstack-protector-strong"],,[-Werror]) +AX_CHECK_COMPILE_FLAG([-g], [CFLAGS="$CFLAGS -g"],,[-Werror]) +AX_CHECK_COMPILE_FLAG([--mcet -fcf-protection], [CFLAGS="$CFLAGS --mcet -fcf-protection"],,[-Werror]) +AX_CHECK_COMPILE_FLAG([-Werror=implicit-function-declaration], [CFLAGS="$CFLAGS -Werror=implicit-function-declaration"],,[-Werror]) + +AX_CHECK_LINK_FLAG([-z relro], [LDLAGS="$LDLAGS -z relro"],,[]) +AX_CHECK_LINK_FLAG([-z now], [LDLAGS="$LDLAGS -z now"],,[]) + +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 @@ -677,6 +735,7 @@ AC_CONFIG_FILES([ config/Makefile config/apparmor/Makefile + config/apparmor/abstractions/start-container config/selinux/Makefile config/bash/Makefile config/bash/lxc @@ -696,44 +755,10 @@ AC_CONFIG_FILES([ config/init/upstart/Makefile config/etc/Makefile config/templates/Makefile - config/templates/alpine.common.conf - config/templates/alpine.userns.conf - config/templates/archlinux.common.conf - config/templates/archlinux.userns.conf - config/templates/centos.common.conf - config/templates/centos.userns.conf config/templates/common.conf config/templates/common.conf.d/Makefile - config/templates/debian.common.conf - config/templates/debian.userns.conf - config/templates/fedora.common.conf - config/templates/fedora.userns.conf - config/templates/gentoo.common.conf - config/templates/gentoo.moresecure.conf - config/templates/gentoo.userns.conf config/templates/nesting.conf config/templates/oci.common.conf - config/templates/opensuse.common.conf - config/templates/opensuse.userns.conf - config/templates/oracle.common.conf - config/templates/oracle.userns.conf - config/templates/plamo.common.conf - config/templates/plamo.userns.conf - config/templates/slackware.common.conf - config/templates/slackware.userns.conf - config/templates/ubuntu-cloud.common.conf - config/templates/ubuntu-cloud.lucid.conf - config/templates/ubuntu-cloud.userns.conf - config/templates/ubuntu.common.conf - config/templates/ubuntu.lucid.conf - config/templates/ubuntu.userns.conf - config/templates/openwrt.common.conf - config/templates/sparclinux.common.conf - config/templates/sparclinux.userns.conf - config/templates/voidlinux.common.conf - config/templates/voidlinux.userns.conf - config/templates/sabayon.common.conf - config/templates/sabayon.userns.conf config/templates/userns.conf config/yum/Makefile config/sysconfig/Makefile @@ -862,31 +887,10 @@ AC_CONFIG_FILES([ hooks/dhclient templates/Makefile - templates/lxc-alpine - templates/lxc-altlinux - templates/lxc-archlinux templates/lxc-busybox - templates/lxc-centos - templates/lxc-cirros - templates/lxc-debian templates/lxc-download - templates/lxc-fedora - templates/lxc-fedora-legacy - templates/lxc-gentoo templates/lxc-local templates/lxc-oci - templates/lxc-openmandriva - templates/lxc-opensuse - templates/lxc-oracle - templates/lxc-plamo - templates/lxc-pld - templates/lxc-slackware - templates/lxc-sshd - templates/lxc-ubuntu - templates/lxc-ubuntu-cloud - templates/lxc-sparclinux - templates/lxc-voidlinux - templates/lxc-sabayon src/Makefile src/lxc/Makefile @@ -894,7 +898,6 @@ AC_CONFIG_FILES([ src/lxc/cmd/lxc-checkconfig src/lxc/cmd/lxc-update-config src/lxc/version.h - src/python-lxc/Makefile src/tests/Makefile src/tests/lxc-test-usernic @@ -957,9 +960,6 @@ PAM: - PAM module: $enable_pam - cgroup PAM module: $pamdir -Bindings: - - python3: $enable_python - Documentation: - examples: $enable_examples - API documentation: $enable_api_docs @@ -971,4 +971,10 @@ Debugging: Paths: - Logs in configpath: $enable_configpath_log + +Thread-safety: + - enforce: $enable_thread_safety + +Dlog: + - enable: $enable_dlog EOF