configure.ac revision e827ff7e2f3c1c18e5823312482f0f45e03cb6a8
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina# -*- Autoconf -*-
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina# Process this file with autoconf to produce a configure script.
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAC_INIT([lxc], [0.9.0.alpha2])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAC_CONFIG_SRCDIR([configure.ac])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAC_CONFIG_AUX_DIR([config])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAM_CONFIG_HEADER([src/config.h])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAC_CANONICAL_HOST
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAM_PROG_CC_C_O
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina# Detect the distribution. This is used for the default configuration and
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina# for some distro-specific build options.
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAC_MSG_CHECKING([host distribution])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, oracle, fedora, suse, gentoo, debian, arch, slackware, paldo, mandriva or pardus.]))
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březinaif test "z$with_distro" = "z"; then
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina with_distro=`lsb_release -is`
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březinaif test "z$with_distro" = "z"; then
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle")
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora")
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
ca6dd8e7ac91c7f8e3b4d55206d4f39791ab7149Pavel Březina AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware")
ca6dd8e7ac91c7f8e3b4d55206d4f39791ab7149Pavel Březina AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="mandriva")
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_CHECK_FILE(/etc/mandriva-release,with_distro="mandriva")
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březinawith_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březinaif test "z$with_distro" = "z"; then
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina with_distro="unknown"
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březinacase $with_distro in
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina redhat|fedora|oracle|oracleserver)
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina echo -n "Linux distribution network config unknown, defaulting to lxc.network.type = empty"
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAC_MSG_RESULT([$with_distro])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu"])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina# Allow disabling rpath
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAC_ARG_ENABLE([rpath],
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina [AC_HELP_STRING([--disable-rpath], [do not set rpath in executables])],
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina [], [enable_rpath=yes])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina# Documentation (manpages)
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAC_ARG_ENABLE([doc],
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina [AC_HELP_STRING([--enable-doc], [make mans (require docbook2x-man installed) [default=auto]])],
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina [], [enable_doc=auto])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březinaif test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_MSG_CHECKING(for docbook2x-man)
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina for name in docbook2x-man db2x_docbook2man; do
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina if "$name" --help >/dev/null 2>&1; then
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina db2xman="$name"
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina if test -n "${db2xman}"; then
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_MSG_RESULT([${db2xman}])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_MSG_RESULT([no])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina if test "x$enable_doc" = "xyes"; then
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_MSG_ERROR([docbook2x-man required by man request, but not found])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_SUBST(db2xman)
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAC_ARG_ENABLE([apparmor],
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina [AC_HELP_STRING([--enable-apparmor], [enable apparmor])],
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina [], [enable_apparmor=check])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březinaif test "$enable_apparmor" = "check" ; then
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAM_COND_IF([ENABLE_APPARMOR],
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina [AC_CHECK_HEADER([sys/apparmor.h],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_CHECK_LIB([apparmor], [aa_change_profile],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_SUBST([APPARMOR_LIBS], [-lapparmor])])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina# Seccomp syscall filter
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAC_ARG_ENABLE([seccomp],
ca6dd8e7ac91c7f8e3b4d55206d4f39791ab7149Pavel Březina [AC_HELP_STRING([--enable-seccomp], [enable seccomp])],
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina [], [enable_seccomp=check])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březinaif test "$enable_seccomp" = "check" ; then
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAM_COND_IF([ENABLE_SECCOMP],
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina [AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
ca6dd8e7ac91c7f8e3b4d55206d4f39791ab7149Pavel Březina AC_SUBST([SECCOMP_LIBS], [-lseccomp])])
ca6dd8e7ac91c7f8e3b4d55206d4f39791ab7149Pavel Březina# HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel BřezinaAC_CHECK_TYPES([scmp_filter_ctx], [], [], [#include <seccomp.h>])
3a8f6b575f4019f21c9425a26f1b346c08a197aePavel Březina# Configuration examples
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_ARG_ENABLE([examples],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [AC_HELP_STRING([--disable-examples], [do not install configuration examples])],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [], [enable_examples=yes])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina# Python3 module and scripts
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_ARG_ENABLE([python],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [AC_HELP_STRING([--enable-python], [enable python binding])],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [enable_python=yes], [enable_python=no])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAM_COND_IF([ENABLE_PYTHON],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina AC_CHECK_HEADER([python$PYTHON_VERSION/Python.h],[],[AC_MSG_ERROR([You must install python3-dev])])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina# Optional test binaries
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_ARG_ENABLE([tests],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [AC_HELP_STRING([--enable-tests], [build test/example binaries])],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [enable_tests=yes], [enable_tests=no])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina# LXC container path, where the containers are actually stored
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_ARG_WITH([config-path],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [AC_HELP_STRING(
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [--with-config-path=dir],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [lxc configuration repository path]
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina )], [], [with_config_path=['${localstatedir}/lib/lxc']])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina# Rootfs path, where the container mount structure is assembled
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_ARG_WITH([rootfs-path],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [AC_HELP_STRING(
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [--with-rootfs-path=dir],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [lxc rootfs mount point]
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina# Expand some useful variables
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(PREFIX, "$prefix")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(LIBDIR, "$libdir")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(BINDIR, "$bindir")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(INCLUDEDIR, "$includedir")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(DATADIR, "$datadir")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(DOCDIR, "$docdir")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(LXC_CONFFILE, "$conffile")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(LXCPATH, "$with_config_path")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAS_AC_EXPAND(LXCINITDIR, "$libexecdir")
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina# Check for some standard kernel headers
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina AC_MSG_ERROR([Please install the Linux kernel headers.]),
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina# Check for libcap support
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_CHECK_HEADERS([sys/capability.h], [], AC_MSG_ERROR([Please install the libcap development files.]),
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_MSG_CHECKING([linux capabilities])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březinaif test "x$caplib" = "xyes" ; then
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina CAP_LIBS="-lcap"
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina AC_MSG_RESULT([$CAP_LIBS])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina AC_MSG_ERROR([not found])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_SUBST([CAP_LIBS])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina# Check for alternate C libraries
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_MSG_CHECKING(for bionic libc)
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_COMPILE_IFELSE([AC_LANG_PROGRAM(
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [[#ifndef __ANDROID__
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březinaerror: Not bionic!
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [is_bionic=yes],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina [is_bionic=no])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březinaif test "x$is_bionic" = "xyes"; then
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina AC_DEFINE([IS_BIONIC], 1, [bionic libc])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina AC_MSG_RESULT([yes])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina AC_MSG_RESULT([no])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina# Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina# Check for some headers
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina# Check for some functions
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_CHECK_FUNCS([openpty])
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_CHECK_FUNCS([getline],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina AM_CONDITIONAL(HAVE_GETLINE, true)
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina AM_CONDITIONAL(HAVE_GETLINE, false))
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_CHECK_FUNCS([fgetln],
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina AM_CONDITIONAL(HAVE_FGETLN, true)
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina AM_CONDITIONAL(HAVE_FGETLN, false))
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina# Check for some standard binaries
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_PROG_GCC_TRADITIONAL
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březinaif test "x$GCC" = "xyes"; then
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina CFLAGS="$CFLAGS -Wall -Werror"
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel Březina# Files requiring some variable expansion
10a28f461c25d788ff4dcffefa881e7aa724a25dPavel BřezinaAC_CONFIG_FILES([
AC_CHECK_PROG(SETCAP, setcap, yes, no, $PATH$PATH_SEPARATOR/sbin)