2 # Process this file with autoconf to produce a configure script.
4 m4_define([lxc_devel], 1)
5 m4_define([lxc_version_major], 3)
6 m4_define([lxc_version_minor], 1)
7 m4_define([lxc_version_micro], 0)
8 m4_define([lxc_version_beta], [])
10 m4_define([lxc_abi_major], 1)
11 m4_define([lxc_abi_minor], 5)
12 m4_define([lxc_abi_micro], 0)
13 m4_define([lxc_abi], [lxc_abi_major.lxc_abi_minor.lxc_abi_micro])
15 m4_define([lxc_version_base], [lxc_version_major.lxc_version_minor.lxc_version_micro])
16 m4_define([lxc_version],
18 ifelse(lxc_version_beta, [], [lxc_version_base], [lxc_version_base.lxc_version_beta])-devel,
19 ifelse(lxc_version_beta, [], [lxc_version_base], [lxc_version_base.lxc_version_beta]))])
21 AC_INIT([lxc], [lxc_version])
26 AC_SUBST(LXC_VERSION_BASE, lxc_version_base)
27 AC_SUBST(LXC_VERSION_BETA, lxc_version_beta)
29 AC_SUBST([LXC_VERSION_MAJOR], [lxc_version_major])
30 AC_SUBST([LXC_VERSION_MINOR], [lxc_version_minor])
31 AC_SUBST([LXC_VERSION_MICRO], [lxc_version_micro])
32 AC_SUBST([LXC_VERSION], [lxc_version])
33 AC_SUBST([LXC_DEVEL], [lxc_devel])
35 AC_SUBST([LXC_ABI_MAJOR], [lxc_abi_major])
36 AC_SUBST([LXC_ABI_MINOR], [lxc_abi_minor])
37 AC_SUBST([LXC_ABI_MICRO], [lxc_abi_micro])
38 AC_SUBST([LXC_ABI], [lxc_abi])
40 AC_CONFIG_SRCDIR([configure.ac])
41 AC_CONFIG_AUX_DIR([config])
42 AC_CONFIG_HEADERS([src/config.h])
43 AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects])
48 # Test if we have a new enough compiler.
49 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
51 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
53 #define CLANG_VERSION \
54 (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
56 #if GCC_VERSION < 40700 && CLANG_VERSION < 10000
57 #error Sorry, your compiler is too old - please upgrade it
59 ]])], [valid_compiler=yes], [valid_compiler=no])
60 if test "x$valid_compiler" = "xno"; then
61 AC_MSG_ERROR([Sorry, your compiler is too old - please upgrade it])
66 AC_SUBST([LIBTOOL_DEPS])
68 # Detect the distribution. This is used for the default configuration and
69 # for some distro-specific build options.
70 AC_MSG_CHECKING([host distribution])
71 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.]))
72 if type lsb_release >/dev/null 2>&1 && test "z$with_distro" = "z"; then
73 with_distro=`lsb_release -is`
75 if test "z$with_distro" = "z"; then
76 AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
77 AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle")
78 AC_CHECK_FILE(/etc/sparclinux-release,with_distro="sparclinux")
79 AC_CHECK_FILE(/etc/centos-release,with_distro="centos")
80 AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora")
81 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
82 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
83 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
84 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
85 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
86 AC_CHECK_FILE(/etc/plamo-version,with_distro="plamo")
87 AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware")
88 AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="openmandriva")
89 AC_CHECK_FILE(/etc/mandriva-release,with_distro="openmandriva")
90 AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
91 AC_CHECK_FILE(/etc/altlinux-release,with_distro="altlinux")
92 AC_CHECK_FILE(/etc/pld-release,with_distro="pld")
94 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
96 if test "z$with_distro" = "zforsparc"; then
97 with_distro="sparclinux"
100 if test "z$with_distro" = "z"; then
101 with_distro="unknown"
105 distroconf=default.conf.lxcbr
106 distrosysconf="$sysconfdir/default"
108 redhat|redhatenterpriseserver|centos|fedora|oracle|oracleserver|sparclinux|altlinux|suse|opensuse*|plamo|pld)
109 distroconf=default.conf.lxcbr
110 distrosysconf="$sysconfdir/sysconfig"
113 distroconf=default.conf.unknown
114 distrosysconf="$sysconfdir/default"
117 AC_MSG_RESULT([$with_distro])
118 AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu" -o x"$with_distro" = "xraspbian"])
119 AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
121 AC_CONFIG_LINKS([config/etc/default.conf:config/etc/${distroconf}])
123 # Check for init system type
124 AC_MSG_CHECKING([for init system type])
125 AC_ARG_WITH([init-script],
126 [AC_HELP_STRING([--with-init-script@<:@=TYPE@<:@,TYPE,...@:>@@:>@],
127 [Type(s) of init script to install: sysvinit, systemd, upstart,
128 distro @<:@default=distro@:>@])],[],[with_init_script=distro])
129 case "$with_init_script" in
132 fedora|altlinux|opensuse*)
135 redhat|redhatenterpriseserver|oracle|oracleserver|sparclinux|plamo)
139 init_script=sysvinit,systemd
141 debian|raspbian|ubuntu)
142 init_script=upstart,systemd
145 init_script=sysvinit,upstart,systemd
148 echo -n "Linux distribution init system unknown."
154 init_script=$with_init_script
158 # Check valid init systems were given, run in subshell so we don't mess up IFS
159 (IFS="," ; for init_sys in $init_script;
162 none|sysvinit|systemd|upstart)
168 done) || AC_MSG_ERROR([Unknown init system type in $init_script])
170 AM_CONDITIONAL([INIT_SCRIPT_SYSV], [echo "$init_script" |grep -q "sysvinit"])
171 AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], [echo "$init_script" |grep -q "systemd"])
172 AM_CONDITIONAL([INIT_SCRIPT_UPSTART], [echo "$init_script" |grep -q "upstart"])
173 AC_MSG_RESULT($init_script)
176 AC_ARG_WITH([systemdsystemunitdir],
177 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
179 [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
180 if test -z "$with_systemdsystemunitdir"; then
181 with_systemdsystemunitdir=/lib/systemd/system
183 if test "x$with_systemdsystemunitdir" != "xno"; then
184 AC_SUBST([SYSTEMD_UNIT_DIR], [$with_systemdsystemunitdir])
187 AC_ARG_ENABLE([werror],
188 [AC_HELP_STRING([--disable-werror],
189 [do not treat warnings as errors])],
190 [], [enable_werror=yes])
192 # Allow disabling rpath
193 AC_ARG_ENABLE([rpath],
194 [AC_HELP_STRING([--enable-rpath], [set rpath in executables [default=no]])],
195 [], [enable_rpath=no])
196 AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
198 # Documentation (manpages)
200 [AC_HELP_STRING([--enable-doc], [make man pages [default=auto]])],
201 [], [enable_doc=auto])
203 if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
205 dbparsers="docbook2X2man docbook2x-man db2x_docbook2man docbook2man docbook-to-man"
207 AC_MSG_CHECKING(for docbook2x-man)
208 for name in ${dbparsers}; do
209 if "$name" --help >/dev/null 2>&1; then
215 if test -n "${db2xman}"; then
216 AC_MSG_RESULT([${db2xman}])
220 if test "x$enable_doc" = "xyes"; then
221 AC_MSG_ERROR([docbook2x-man is required, but could not be found])
228 AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
229 AM_CONDITIONAL([USE_DOCBOOK2X], [test "x$db2xman" != "xdocbook2man"])
231 if test "x$db2xman" = "xdocbook2man"; then
232 docdtd="\"-//Davenport//DTD DocBook V3.0//EN\""
234 docdtd="\"-//OASIS//DTD DocBook XML\" \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""
238 # Documentation (API)
239 AC_ARG_ENABLE([api-docs],
240 [AC_HELP_STRING([--enable-api-docs],
241 [make API documentation [default=auto]])],
242 [], [enable_api_docs=auto])
244 if test "x$enable_api_docs" = "xyes" -o "x$enable_api_docs" = "xauto"; then
245 AC_CHECK_PROGS([HAVE_DOXYGEN],[doxygen])
246 AC_SUBST([HAVE_DOXYGEN])
248 if test "x$HAVE_DOXYGEN" != "x"; then
249 enable_api_docs="yes"
251 if test "x$enable_api_docs" = "xyes"; then
252 AC_MSG_ERROR([doxygen is required, but could not be found])
258 AM_CONDITIONAL([ENABLE_API_DOCS], [test "x$HAVE_DOXYGEN" != "x"])
260 AC_CONFIG_MACRO_DIRS([config])
263 AC_ARG_ENABLE([apparmor],
264 [AC_HELP_STRING([--enable-apparmor], [enable apparmor support [default=auto]])],
265 [], [enable_apparmor=auto])
267 if test "$enable_apparmor" = "auto" ; then
268 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
270 AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
274 AC_ARG_ENABLE([openssl],
275 [AC_HELP_STRING([--enable-openssl], [enable OpenSSL support [default=auto]])],
276 [], [enable_openssl=auto])
278 if test "$enable_openssl" = "auto" ; then
279 AC_CHECK_LIB([ssl], [OPENSSL_init_ssl], [enable_openssl=yes], [enable_openssl=no])
282 AM_CONDITIONAL([ENABLE_OPENSSL], [test "x$enable_openssl" = "xyes"])
284 AM_COND_IF([ENABLE_OPENSSL],
285 [AC_CHECK_HEADER([openssl/engine.h],[],[AC_MSG_ERROR([You must install the OpenSSL development package in order to compile lxc])])
286 AC_SUBST([OPENSSL_LIBS], '-lssl -lcrypto')])
289 AC_ARG_ENABLE([selinux],
290 [AC_HELP_STRING([--enable-selinux], [enable SELinux support [default=auto]])],
291 [], [enable_selinux=auto])
293 if test "x$enable_selinux" = xauto; then
294 AC_CHECK_LIB([selinux],[setexeccon_raw],[enable_selinux=yes],[enable_selinux=no])
296 AM_CONDITIONAL([ENABLE_SELINUX], [test "x$enable_selinux" = "xyes"])
297 AM_COND_IF([ENABLE_SELINUX],
298 [AC_CHECK_HEADER([selinux/selinux.h],[],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
299 AC_CHECK_LIB([selinux], [setexeccon_raw],[true],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
300 AC_SUBST([SELINUX_LIBS], [-lselinux])])
302 # Seccomp syscall filter
303 AC_ARG_ENABLE([seccomp],
304 [AC_HELP_STRING([--enable-seccomp], [enable seccomp support [default=auto]])],
305 [], [enable_seccomp=auto])
307 if test "x$enable_seccomp" = "xauto" ; then
308 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
310 AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
312 AM_COND_IF([ENABLE_SECCOMP],
313 [PKG_CHECK_MODULES([SECCOMP],[libseccomp],[],[
314 AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
315 AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
316 AC_SUBST([SECCOMP_LIBS], [-lseccomp])
320 AC_MSG_CHECKING(for static libcap)
321 # Check for static libcap, make sure the function checked for differs from the
322 # the one checked below so the cache doesn't give a wrong answer
324 OLD_CPPFLAGS="$CPPFLAGS"
325 OLD_LDFLAGS="$LDFLAGS"
333 [[int main() { return 0; }]]
334 )],[have_static_libcap=yes],[have_static_libcap=no])
335 AM_CONDITIONAL([HAVE_STATIC_LIBCAP], [test "x$have_static_libcap" = "xyes"])
336 if test "x$have_static_libcap" = "xyes"; then
337 AC_DEFINE([HAVE_STATIC_LIBCAP], 1, [Have static libcap])
342 CPPFLAGS="$OLD_CPPFLAGS"
344 LDFLAGS="$OLD_LDFLAGS"
349 AC_ARG_ENABLE([capabilities],
350 [AC_HELP_STRING([--enable-capabilities], [enable kernel capabilities support [default=auto]])],
351 [], [enable_capabilities=auto])
353 if test "x$enable_capabilities" = "xauto"; then
354 AC_CHECK_LIB([cap],[cap_set_proc],[enable_capabilities=yes],[enable_capabilities=no])
356 AM_CONDITIONAL([ENABLE_CAP], [test "x$enable_capabilities" = "xyes"])
358 AM_COND_IF([ENABLE_CAP],
359 [AC_CHECK_HEADER([sys/capability.h],[],[AC_MSG_ERROR([You must install the libcap development package in order to compile lxc])])
360 AC_CHECK_LIB(cap,cap_set_proc,[],[AC_MSG_ERROR([You must install the libcap development package in order to compile lxc])])
361 # Test whether we support getting file capabilities via cap_get_file().
362 AC_CHECK_LIB(cap,cap_get_file, AC_DEFINE(LIBCAP_SUPPORTS_FILE_CAPABILITIES,1,[Have cap_get_file]),[],[])
363 AC_SUBST([CAP_LIBS], [-lcap])])
365 # HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
367 CFLAGS="$CFLAGS $SECCOMP_CFLAGS"
368 AC_CHECK_TYPES([scmp_filter_ctx], [], [], [[#include <seccomp.h>]])
369 AC_CHECK_DECLS([seccomp_notify_fd], [], [], [[#include <seccomp.h>]])
370 AC_CHECK_DECLS([seccomp_syscall_resolve_name_arch], [], [], [[#include <seccomp.h>]])
373 # Configuration examples
374 AC_ARG_ENABLE([examples],
375 [AC_HELP_STRING([--enable-examples], [install examples [default=yes]])],
376 [], [enable_examples=yes])
377 AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
379 # Enable dumping stack traces
380 AC_ARG_ENABLE([mutex-debugging],
381 [AC_HELP_STRING([--enable-mutex-debugging], [Makes mutexes to report error and provide stack trace [default=no]])],
382 [], [enable_mutex_debugging=no])
383 AM_CONDITIONAL([MUTEX_DEBUGGING], [test "x$enable_mutex_debugging" = "xyes"])
385 AM_COND_IF([MUTEX_DEBUGGING],
386 AC_DEFINE_UNQUOTED([MUTEX_DEBUGGING], 1, [Enabling mutex debugging]))
388 # Not in older autoconf versions
389 # AS_VAR_COPY(DEST, SOURCE)
390 # -------------------------
391 # Set the polymorphic shell variable DEST to the contents of the polymorphic
392 # shell variable SOURCE.
393 m4_ifdef([AS_VAR_COPY], [],
394 [AC_DEFUN([AS_VAR_COPY],
395 [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
398 dnl PKG_CHECK_VAR was introduced with pkg-config 0.28
399 m4_ifdef([PKG_CHECK_VAR], [],
400 [AC_DEFUN([PKG_CHECK_VAR],
401 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
402 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
403 _PKG_CONFIG([$1], [variable="][$3]["], [$2])
404 AS_VAR_COPY([$1], [pkg_cv_][$1])
405 AS_VAR_IF([$1], [""], [$5], [$4])dnl
409 # Optional bash integration
410 AC_ARG_ENABLE([bash],
411 [AC_HELP_STRING([--enable-bash], [build bash integration [default=yes]])],
412 [], [enable_bash=yes])
413 AM_CONDITIONAL([ENABLE_BASH], [test "x$enable_bash" = "xyes"])
415 AM_COND_IF([ENABLE_BASH],
416 [AC_MSG_CHECKING([bash completion directory])
417 PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], ,
418 bashcompdir="${sysconfdir}/bash_completion.d")
419 AC_MSG_RESULT([$bashcompdir])
420 AC_SUBST(bashcompdir)
423 # Build the command line tools
424 AC_ARG_ENABLE([tools],
425 [AC_HELP_STRING([--enable-tools], [build the command line tools [default=yes]])],
426 [], [enable_tools=yes])
427 AM_CONDITIONAL([ENABLE_TOOLS], [test "x$enable_tools" = "xyes"])
429 # Build the liblxc commands
430 AC_ARG_ENABLE([commands],
431 [AC_HELP_STRING([--enable-commands], [build the liblxc commands [default=yes]])],
432 [], [enable_commands=yes])
433 AM_CONDITIONAL([ENABLE_COMMANDS], [test "x$enable_commands" = "xyes"])
435 # Build with ASAN commands
436 AC_ARG_ENABLE([asan],
437 [AC_HELP_STRING([--enable-asan], [build with address sanitizer enabled [default=no]])],
438 [], [enable_asan=no])
439 AM_CONDITIONAL([ENABLE_ASAN], [test "x$enable_asan" = "xyes"])
441 # Optional test binaries
442 AC_ARG_ENABLE([tests],
443 [AC_HELP_STRING([--enable-tests], [build test/example binaries [default=no]])],
444 [], [enable_tests=no])
445 AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
447 # Allow overriding the default runtime dir (/run)
448 AC_ARG_WITH([runtime-path],
450 [--with-runtime-path=dir],
451 [runtime directory (default: /run)]
452 )], [], [with_runtime_path=['/run']])
454 # LXC container path, where the containers are actually stored
455 # This is overridden by an entry in the file called LXCCONF
456 # (i.e. /etc/lxc/lxc.conf)
457 AC_ARG_WITH([config-path],
459 [--with-config-path=dir],
460 [lxc configuration repository path]
461 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
463 # The path of the global lxc configuration file.
464 AC_ARG_WITH([global-conf],
466 [--with-global-conf=dir],
467 [global lxc configuration file]
468 )], [], [with_global_conf=['${sysconfdir}/lxc/lxc.conf']])
470 # The path of the userns network configuration file
471 AC_ARG_WITH([usernic-conf],
473 [--with-usernic-conf],
474 [user network interface configuration file]
475 )], [], [with_usernic_conf=['${sysconfdir}/lxc/lxc-usernet']])
477 # The path of the runtime usernic database
478 AC_ARG_WITH([usernic-db],
481 [lxc user nic database]
482 )], [], [with_usernic_db=['${with_runtime_path}/lxc/nics']])
484 # Rootfs path, where the container mount structure is assembled
485 AC_ARG_WITH([rootfs-path],
487 [--with-rootfs-path=dir],
488 [lxc rootfs mount point]
489 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
491 # cgroup pattern specification
492 AC_ARG_WITH([cgroup-pattern],
494 [--with-cgroup-pattern=pattern],
495 [pattern for container cgroups]
496 )], [], [with_cgroup_pattern=['lxc.payload/%n']])
498 # The path for the apparmor_parser's cache for generated apparmor profiles
499 AC_ARG_WITH([apparmor-cache-dir],
501 [--with-apparmor-cache-dir=dir],
502 [path for apparmor_parser cache]
503 )], [], [with_apparmor_cache_dir=['${localstatedir}/cache/lxc/apparmor']])
505 # Container log path. By default, use $lxcpath.
506 AC_MSG_CHECKING([Whether to place logfiles in container config path])
507 AC_ARG_ENABLE([configpath-log],
508 [AC_HELP_STRING([--enable-configpath-log], [use logfiles in config path [default=no]])],
509 [], [enable_configpath_log=no])
510 AC_MSG_RESULT([$enable_configpath_log])
511 AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$enable_configpath_log" = "yes"])
513 if test "$enable_configpath_log" = "yes"; then
514 default_log_path="${with_config_path}"
516 default_log_path="${localstatedir}/log/lxc"
519 AC_ARG_WITH([log-path],
521 [--with-log-path=dir],
522 [per container log path]
523 )], [], [with_log_path=['${default_log_path}']])
525 # Expand some useful variables
526 AS_AC_EXPAND(PREFIX, "$prefix")
527 AS_AC_EXPAND(LIBDIR, "$libdir")
528 AS_AC_EXPAND(BINDIR, "$bindir")
529 AS_AC_EXPAND(SBINDIR, "$sbindir")
530 AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
531 AS_AC_EXPAND(INCLUDEDIR, "$includedir")
532 AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
533 AS_AC_EXPAND(LXC_DEFAULT_CONFIG, "$sysconfdir/lxc/default.conf")
534 AS_AC_EXPAND(DATADIR, "$datadir")
535 AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
536 AS_AC_EXPAND(DOCDIR, "$docdir")
537 AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date --utc --date=@${SOURCE_DATE_EPOCH:-$(date +%s)} '+%Y-%m-%d')")
538 AS_AC_EXPAND(LXCPATH, "$with_config_path")
539 AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf")
540 AS_AC_EXPAND(LXC_USERNIC_CONF, "$with_usernic_conf")
541 AS_AC_EXPAND(LXC_USERNIC_DB, "$with_usernic_db")
542 AS_AC_EXPAND(LXC_DISTRO_SYSCONF, "$distrosysconf")
543 AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
544 AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
545 AS_AC_EXPAND(LXCTEMPLATECONFIG, "$datadir/lxc/config")
546 AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
547 AS_AC_EXPAND(LXCBINHOOKDIR, "$libexecdir/lxc/hooks")
548 AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
549 AS_AC_EXPAND(LOGPATH, "$with_log_path")
550 AS_AC_EXPAND(RUNTIME_PATH, "$with_runtime_path")
551 AS_AC_EXPAND(APPARMOR_CACHE_DIR, "$with_apparmor_cache_dir")
552 AC_SUBST(DEFAULT_CGROUP_PATTERN, ["$with_cgroup_pattern"])
554 # We need the install path so criu knows where to reference the hook scripts.
555 AC_DEFINE_UNQUOTED([DATADIR], "$DATADIR", ["Prefix for shared files."])
557 # Check for some standard kernel headers
558 AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
560 AC_MSG_ERROR([Please install the Linux kernel headers.]),
561 [#include <sys/socket.h>])
563 # Check for alternate C libraries
564 AC_MSG_CHECKING(for bionic libc)
565 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
566 [[#ifndef __ANDROID__
571 if test "x$is_bionic" = "xyes"; then
572 AC_DEFINE([IS_BIONIC], 1, [bionic libc])
577 AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
579 # Configuration examples
581 [AC_HELP_STRING([--enable-pam], [enable pam module [default=no]])],
583 AM_CONDITIONAL([ENABLE_PAM], [test "x$enable_pam" = "xyes"])
585 AM_COND_IF([ENABLE_PAM],
588 [AS_HELP_STRING([--with-pamdir=PATH],[Specify the directory where PAM modules are stored,
589 or "none" if PAM modules are not to be built])],
590 [pamdir="${withval}"],
592 if test "${prefix}" = "/usr"; then
593 pamdir="/lib${libdir##*/lib}/security"
595 pamdir="\$(libdir)/security"
600 AM_CONDITIONAL([HAVE_PAM], [test x"$pamdir" != "xnone"])
601 AM_COND_IF([ENABLE_PAM],
602 [if test "z$pamdir" != "znone"; then
603 AC_ARG_VAR([PAM_CFLAGS], [C compiler flags for pam])
604 AC_ARG_VAR([PAM_LIBS], [linker flags for pam])
609 [AC_MSG_ERROR([*** libpam not found.])
616 # Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
617 AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
619 # Some systems lack PR_{G,S}ET_NO_NEW_PRIVS definition => HAVE_DECL_PR_{G,S}ET_NO_NEW_PRIVS
620 AC_CHECK_DECLS([PR_SET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
621 AC_CHECK_DECLS([PR_GET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
623 # Check for some headers
624 AC_CHECK_HEADERS([pty.h sys/memfd.h sys/personality.h sys/resource.h sys/signalfd.h sys/timerfd.h utmpx.h])
626 AC_CHECK_HEADER([ifaddrs.h],
627 AM_CONDITIONAL(HAVE_IFADDRS_H, true)
628 AC_DEFINE(HAVE_IFADDRS_H, 1, [Have ifaddrs.h]),
629 AM_CONDITIONAL(HAVE_IFADDRS_H, false))
631 # lookup major()/minor()/makedev()
634 # Check for some syscalls functions
635 AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat gettid memfd_create])
637 # Check for strerror_r() support. Defines:
638 # - HAVE_STRERROR_R if available
639 # - HAVE_DECL_STRERROR_R if defined
640 # - STRERROR_R_CHAR_P if it returns char *
643 # Check if "%m" is supported by printf and Co
644 AC_MSG_CHECKING([%m format])
652 rc = snprintf(msg, sizeof(msg), "%m\n");
653 if ((rc > 1) && (msg[0] != '%'))
662 [fmt_m=yes], [fmt_m=no], [fmt_m=no])
663 if test "x$fmt_m" = "xyes"; then
664 AC_DEFINE([HAVE_M_FORMAT], 1, [Have %m format])
670 # Check for some functions
671 AC_CHECK_LIB(pthread, main)
672 AC_CHECK_FUNCS(statvfs)
673 AC_CHECK_LIB(util, openpty)
674 AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent utmpxname])
675 AC_CHECK_FUNCS([getgrgid_r],
676 AM_CONDITIONAL(HAVE_GETGRGID_R, true)
677 AC_DEFINE(HAVE_GETGRGID_R,1,[Have getgrgid_r]),
678 AM_CONDITIONAL(HAVE_GETGRGID_R, false))
679 AC_CHECK_FUNCS([getline],
680 AM_CONDITIONAL(HAVE_GETLINE, true)
681 AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
682 AM_CONDITIONAL(HAVE_GETLINE, false))
683 AC_CHECK_FUNCS([getsubopt],
684 AM_CONDITIONAL(HAVE_GETSUBOPT, true)
685 AC_DEFINE(HAVE_GETSUBOPT,1,[Have getsubopt]),
686 AM_CONDITIONAL(HAVE_GETSUBOPT, false))
687 AC_CHECK_FUNCS([fgetln],
688 AM_CONDITIONAL(HAVE_FGETLN, true)
689 AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
690 AM_CONDITIONAL(HAVE_FGETLN, false))
691 AC_CHECK_FUNCS([keyctl],
692 AM_CONDITIONAL(HAVE_KEYCTL, true)
693 AC_DEFINE(HAVE_KEYCTL,1,[Have keyctl]),
694 AM_CONDITIONAL(HAVE_KEYCTL, false))
695 AC_CHECK_FUNCS([prlimit],
696 AM_CONDITIONAL(HAVE_PRLIMIT, true)
697 AC_DEFINE(HAVE_PRLIMIT,1,[Have prlimit]),
698 AM_CONDITIONAL(HAVE_PRLIMIT, false))
699 AC_CHECK_FUNCS([prlimit64],
700 AM_CONDITIONAL(HAVE_PRLIMIT64, true)
701 AC_DEFINE(HAVE_PRLIMIT64,1,[Have prlimit64]),
702 AM_CONDITIONAL(HAVE_PRLIMIT64, false))
703 AC_CHECK_FUNCS([pthread_setcancelstate],
704 AM_CONDITIONAL(HAVE_PTHREAD_SETCANCELSTATE, true)
705 AC_DEFINE(HAVE_PTHREAD_SETCANCELSTATE,1,[Have pthread_setcancelstate]),
706 AM_CONDITIONAL(HAVE_PTHREAD_SETCANCELSTATE, false))
707 AC_CHECK_FUNCS([strlcpy],
708 AM_CONDITIONAL(HAVE_STRLCPY, true)
709 AC_DEFINE(HAVE_STRLCPY,1,[Have strlcpy]),
710 AM_CONDITIONAL(HAVE_STRLCPY, false))
711 AC_CHECK_FUNCS([strlcat],
712 AM_CONDITIONAL(HAVE_STRLCAT, true)
713 AC_DEFINE(HAVE_STRLCAT,1,[Have strlcat]),
714 AM_CONDITIONAL(HAVE_STRLCAT, false))
716 # HAVE_STRUCT_RTNL_LINK_STATS64={0,1}
717 AC_CHECK_TYPES([struct rtnl_link_stats64], [], [], [[#include <linux/if_link.h>]])
719 # Check for some libraries
721 AC_SEARCH_LIBS(clock_gettime, [rt])
723 # Check for some standard binaries
724 AC_PROG_GCC_TRADITIONAL
727 # See if we support thread-local storage.
731 AX_CHECK_COMPILE_FLAG([-fdiagnostics-color], [CFLAGS="$CFLAGS -fdiagnostics-color"],,[-Werror])
732 AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough=5], [CFLAGS="$CFLAGS -Wimplicit-fallthrough=5"],,[-Werror])
733 AX_CHECK_COMPILE_FLAG([-Wcast-align], [CFLAGS="$CFLAGS -Wcast-align"],,[-Werror])
734 AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], [CFLAGS="$CFLAGS -Wstrict-prototypes"],,[-Werror])
735 AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"],,[-Werror])
736 AX_CHECK_COMPILE_FLAG([-fstack-clash-protection], [CFLAGS="$CFLAGS -fstack-clash-protection"],,[-Werror])
737 AX_CHECK_COMPILE_FLAG([-fstack-protector-strong], [CFLAGS="$CFLAGS -fstack-protector-strong"],,[-Werror])
738 AX_CHECK_COMPILE_FLAG([--param=ssp-buffer-size=4], [CFLAGS="$CFLAGS --param=ssp-buffer-size=4"],,[-Werror])
739 AX_CHECK_COMPILE_FLAG([-g], [CFLAGS="$CFLAGS -g"],,[-Werror])
740 AX_CHECK_COMPILE_FLAG([--mcet -fcf-protection], [CFLAGS="$CFLAGS --mcet -fcf-protection"],,[-Werror])
741 AX_CHECK_COMPILE_FLAG([-Werror=implicit-function-declaration], [CFLAGS="$CFLAGS -Werror=implicit-function-declaration"],,[-Werror])
742 AX_CHECK_COMPILE_FLAG([-Wlogical-op], [CFLAGS="$CFLAGS -Wlogical-op"],,[-Werror])
743 AX_CHECK_COMPILE_FLAG([-Wmissing-include-dirs], [CFLAGS="$CFLAGS -Wmissing-include-dirs"],,[-Werror])
744 AX_CHECK_COMPILE_FLAG([-Wold-style-definition], [CFLAGS="$CFLAGS -Wold-style-definition"],,[-Werror])
745 AX_CHECK_COMPILE_FLAG([-Winit-self], [CFLAGS="$CFLAGS -Winit-self"],,[-Werror])
746 AX_CHECK_COMPILE_FLAG([-Wfloat-equal], [CFLAGS="$CFLAGS -Wfloat-equal"],,[-Werror])
747 AX_CHECK_COMPILE_FLAG([-Wsuggest-attribute=noreturn], [CFLAGS="$CFLAGS -Wsuggest-attribute=noreturn"],,[-Werror])
748 AX_CHECK_COMPILE_FLAG([-Werror=return-type], [CFLAGS="$CFLAGS -Werror=return-type"],,[-Werror])
749 AX_CHECK_COMPILE_FLAG([-Werror=incompatible-pointer-types], [CFLAGS="$CFLAGS -Werror=incompatible-pointer-types"],,[-Werror])
750 AX_CHECK_COMPILE_FLAG([-Wformat=2], [CFLAGS="$CFLAGS -Wformat=2"],,[-Werror])
751 AX_CHECK_COMPILE_FLAG([-Wshadow], [CFLAGS="$CFLAGS -Wshadow"],,[-Werror])
752 AX_CHECK_COMPILE_FLAG([-Wendif-labels], [CFLAGS="$CFLAGS -Wendif-labels"],,[-Werror])
753 AX_CHECK_COMPILE_FLAG([-Werror=overflow], [CFLAGS="$CFLAGS -Werror=overflow"],,[-Werror])
754 AX_CHECK_COMPILE_FLAG([-fdiagnostics-show-option], [CFLAGS="$CFLAGS -fdiagnostics-show-option"],,[-Werror])
755 AX_CHECK_COMPILE_FLAG([-Werror=shift-count-overflow], [CFLAGS="$CFLAGS -Werror=shift-count-overflow"],,[-Werror])
756 AX_CHECK_COMPILE_FLAG([-Werror=shift-overflow=2], [CFLAGS="$CFLAGS -Werror=shift-overflow=2"],,[-Werror])
757 AX_CHECK_COMPILE_FLAG([-Wdate-time], [CFLAGS="$CFLAGS -Wdate-time"],,[-Werror])
758 AX_CHECK_COMPILE_FLAG([-Wnested-externs], [CFLAGS="$CFLAGS -Wnested-externs"],,[-Werror])
759 AX_CHECK_COMPILE_FLAG([-fasynchronous-unwind-tables], [CFLAGS="$CFLAGS -fasynchronous-unwind-tables"],,[-Werror])
760 AX_CHECK_COMPILE_FLAG([-pipe], [CFLAGS="$CFLAGS -pipe"],,[-Werror])
761 AX_CHECK_COMPILE_FLAG([-fexceptions], [CFLAGS="$CFLAGS -fexceptions"],,[-Werror])
763 AX_CHECK_LINK_FLAG([-z relro], [LDFLAGS="$LDFLAGS -z relro"],,[])
764 AX_CHECK_LINK_FLAG([-z now], [LDFLAGS="$LDFLAGS -z now"],,[])
766 CFLAGS="$CFLAGS -Wvla -std=gnu11"
767 if test "x$enable_werror" = "xyes"; then
768 CFLAGS="$CFLAGS -Werror"
771 AC_ARG_ENABLE([thread-safety],
772 [AC_HELP_STRING([--enable-thread-safety], [enforce thread-safety otherwise fail the build [default=yes]])],
773 [], [enable_thread_safety=yes])
774 AM_CONDITIONAL([ENFORCE_THREAD_SAFETY], [test "x$enable_thread_safety" = "xyes"])
776 AC_ARG_ENABLE([dlog],
777 [AC_HELP_STRING([--enable-dlog], [enable dlog support [default=no]])],
778 [], [enable_dlog=no])
779 AM_CONDITIONAL([ENABLE_DLOG], [test "x$enable_dlog" = "xyes"])
781 AM_COND_IF([ENABLE_DLOG],
782 [PKG_CHECK_MODULES([DLOG],[dlog],[],[
783 AC_CHECK_HEADER([dlog.h],[],[AC_MSG_ERROR([You must install the dlog development package in order to compile lxc])])
784 AC_CHECK_LIB([dlog], [dlog_print],[],[AC_MSG_ERROR([You must install the dlog development package in order to compile lxc])])
785 AC_SUBST([DLOG_LIBS], [-ldlog])
789 AC_ARG_ENABLE([memfd-rexec],
790 [AC_HELP_STRING([--enable-memfd-rexec], [enforce liblxc as a memfd to protect against certain symlink attacks [default=yes]])],
791 [], [enable_memfd_rexec=yes])
792 AM_CONDITIONAL([ENFORCE_MEMFD_REXEC], [test "x$enable_memfd_rexec" = "xyes"])
793 if test "x$enable_memfd_rexec" = "xyes"; then
794 AC_DEFINE([ENFORCE_MEMFD_REXEC], 1, [Rexec liblxc as memfd])
800 # Files requiring some variable expansion
807 config/apparmor/Makefile
808 config/apparmor/abstractions/start-container
809 config/selinux/Makefile
813 config/init/common/Makefile
814 config/init/common/lxc-containers
815 config/init/common/lxc-net
816 config/init/systemd/Makefile
817 config/init/systemd/lxc.service
818 config/init/systemd/lxc@.service
819 config/init/systemd/lxc-net.service
820 config/init/sysvinit/Makefile
821 config/init/sysvinit/lxc-containers
822 config/init/sysvinit/lxc-net
823 config/init/upstart/lxc.conf
824 config/init/upstart/lxc-net.conf
825 config/init/upstart/Makefile
827 config/templates/Makefile
828 config/templates/common.conf
829 config/templates/common.conf.d/Makefile
830 config/templates/nesting.conf
831 config/templates/oci.common.conf
832 config/templates/userns.conf
834 config/sysconfig/Makefile
840 doc/lxc-autostart.sgml
842 doc/lxc-checkconfig.sgml
843 doc/lxc-checkpoint.sgml
855 doc/lxc-snapshot.sgml
859 doc/lxc-unfreeze.sgml
861 doc/lxc-update-config.sgml
862 doc/lxc-user-nic.sgml
863 doc/lxc-usernsexec.sgml
867 doc/lxc.container.conf.sgml
868 doc/lxc.system.conf.sgml
871 doc/common_options.sgml
876 doc/examples/Makefile
877 doc/examples/lxc-macvlan.conf
878 doc/examples/lxc-vlan.conf
879 doc/examples/lxc-no-netns.conf
880 doc/examples/lxc-empty-netns.conf
881 doc/examples/lxc-phys.conf
882 doc/examples/lxc-veth.conf
883 doc/examples/lxc-complex.conf
886 doc/ja/lxc-attach.sgml
887 doc/ja/lxc-autostart.sgml
888 doc/ja/lxc-cgroup.sgml
889 doc/ja/lxc-checkconfig.sgml
890 doc/ja/lxc-checkpoint.sgml
891 doc/ja/lxc-config.sgml
892 doc/ja/lxc-console.sgml
894 doc/ja/lxc-create.sgml
895 doc/ja/lxc-destroy.sgml
896 doc/ja/lxc-device.sgml
897 doc/ja/lxc-execute.sgml
898 doc/ja/lxc-freeze.sgml
901 doc/ja/lxc-monitor.sgml
902 doc/ja/lxc-snapshot.sgml
903 doc/ja/lxc-start.sgml
906 doc/ja/lxc-unfreeze.sgml
907 doc/ja/lxc-unshare.sgml
908 doc/ja/lxc-update-config.sgml
909 doc/ja/lxc-user-nic.sgml
910 doc/ja/lxc-usernsexec.sgml
914 doc/ja/lxc.container.conf.sgml
915 doc/ja/lxc.system.conf.sgml
916 doc/ja/lxc-usernet.sgml
918 doc/ja/common_options.sgml
922 doc/ko/lxc-attach.sgml
923 doc/ko/lxc-autostart.sgml
924 doc/ko/lxc-cgroup.sgml
925 doc/ko/lxc-checkconfig.sgml
926 doc/ko/lxc-checkpoint.sgml
927 doc/ko/lxc-config.sgml
928 doc/ko/lxc-console.sgml
930 doc/ko/lxc-create.sgml
931 doc/ko/lxc-destroy.sgml
932 doc/ko/lxc-device.sgml
933 doc/ko/lxc-execute.sgml
934 doc/ko/lxc-freeze.sgml
937 doc/ko/lxc-monitor.sgml
938 doc/ko/lxc-snapshot.sgml
939 doc/ko/lxc-start.sgml
942 doc/ko/lxc-unfreeze.sgml
943 doc/ko/lxc-unshare.sgml
944 doc/ko/lxc-user-nic.sgml
945 doc/ko/lxc-usernsexec.sgml
949 doc/ko/lxc.container.conf.sgml
950 doc/ko/lxc.system.conf.sgml
951 doc/ko/lxc-usernet.sgml
953 doc/ko/common_options.sgml
960 templates/lxc-busybox
961 templates/lxc-download
967 src/lxc/lxc.functions
968 src/lxc/cmd/lxc-checkconfig
969 src/lxc/cmd/lxc-update-config
973 src/tests/lxc-test-usernic
975 AC_CONFIG_COMMANDS([default],[[]],[[]])
978 # Configuration overview
981 ----------------------------
983 - Command Line Tools:
984 - lxc-attach: $enable_tools
985 - lxc-autostart: $enable_tools
986 - lxc-cgroup: $enable_tools
987 - lxc-checkpoint: $enable_tools
988 - lxc-config: $enable_tools
989 - lxc-console: $enable_tools
990 - lxc-copy: $enable_tools
991 - lxc-create: $enable_tools
992 - lxc-destroy: $enable_tools
993 - lxc-device: $enable_tools
994 - lxc-execute: $enable_tools
995 - lxc-freeze: $enable_tools
996 - lxc-info: $enable_tools
997 - lxc-ls: $enable_tools
998 - lxc-monitor: $enable_tools
999 - lxc-snapshot: $enable_tools
1000 - lxc-start: $enable_tools
1001 - lxc-stop: $enable_tools
1002 - lxc-top: $enable_tools
1003 - lxc-unfreeze: $enable_tools
1004 - lxc-unshare: $enable_tools
1005 - lxc-wait: $enable_tools
1008 - lxc-checkconfig: $enable_commands
1009 - lxc-update-config: $enable_commands
1010 - lxc-init: $enable_commands
1011 - lxc-monitord: $enable_commands
1012 - lxc-user-nic: $enable_commands
1013 - lxc-usernsexec: $enable_commands
1017 - distribution: $with_distro
1018 - init script type(s): $init_script
1019 - rpath: $enable_rpath
1020 - OpenSSL: $enable_openssl
1021 - Bash integration: $enable_bash
1024 - Apparmor: $enable_apparmor
1025 - Linux capabilities: $enable_capabilities
1026 - seccomp: $enable_seccomp
1027 - SELinux: $enable_selinux
1028 - memfd rexec: $enable_memfd_rexec
1031 - PAM module: $enable_pam
1032 - cgroup PAM module: $pamdir
1035 - examples: $enable_examples
1036 - API documentation: $enable_api_docs
1037 - user documentation: $enable_doc
1040 - tests: $enable_tests
1041 - ASAN: $enable_asan
1042 - mutex debugging: $enable_mutex_debugging
1045 - Logs in configpath: $enable_configpath_log
1048 - enforce: $enable_thread_safety
1051 - enable: $enable_dlog