2 # Process this file with autoconf to produce a configure script.
4 m4_define([lxc_version_major], 1)
5 m4_define([lxc_version_minor], 0)
6 m4_define([lxc_version_micro], 0)
7 m4_define([lxc_version_beta], [alpha2])
9 m4_define([lxc_version_base], [lxc_version_major.lxc_version_minor.lxc_version_micro])
10 m4_define([lxc_version],
11 [ifelse(lxc_version_beta, [], [lxc_version_base], [lxc_version_base.lxc_version_beta])])
13 AC_INIT([lxc], [lxc_version])
14 AC_SUBST(LXC_VERSION_BASE, lxc_version_base)
15 AC_SUBST(LXC_VERSION_BETA, lxc_version_beta)
17 AC_CONFIG_SRCDIR([configure.ac])
18 AC_CONFIG_AUX_DIR([config])
19 AC_CONFIG_HEADERS([src/config.h])
20 AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects])
25 # Detect the distribution. This is used for the default configuration and
26 # for some distro-specific build options.
27 AC_MSG_CHECKING([host distribution])
28 AC_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, openmandriva or pardus.]))
29 if test "z$with_distro" = "z"; then
30 with_distro=`lsb_release -is`
32 if test "z$with_distro" = "z"; then
33 AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
34 AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle")
35 AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora")
36 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
37 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
38 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
39 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
40 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
41 AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware")
42 AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="openmandriva")
43 AC_CHECK_FILE(/etc/mandriva-release,with_distro="openmandriva")
44 AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
46 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
48 if test "z$with_distro" = "z"; then
53 distroconf=default.conf.ubuntu
55 redhat|fedora|oracle|oracleserver)
56 distroconf=default.conf.libvirt
59 echo -n "Linux distribution network config unknown, defaulting to lxc.network.type = empty"
60 distroconf=default.conf.unknown
63 AC_MSG_RESULT([$with_distro])
64 AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu"])
65 AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
67 # Detect the newuidmap tool (required for userns)
68 AC_CHECK_PROG([NEWUIDMAP], [newuidmap], [newuidmap])
69 AM_CONDITIONAL([HAVE_NEWUIDMAP], [test -n "$NEWUIDMAP"])
71 # Allow disabling rpath
72 AC_ARG_ENABLE([rpath],
73 [AC_HELP_STRING([--disable-rpath], [do not set rpath in executables])],
74 [], [enable_rpath=yes])
75 AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
77 # Documentation (manpages)
79 [AC_HELP_STRING([--enable-doc], [make mans (requires docbook2man or docbook2x-man to be installed) [default=auto]])],
80 [], [enable_doc=auto])
82 if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
84 dbparsers="docbook2x-man db2x_docbook2man docbook2man"
86 AC_MSG_CHECKING(for docbook2x-man)
87 for name in ${dbparsers}; do
88 if "$name" --help >/dev/null 2>&1; then
94 if test -n "${db2xman}"; then
95 AC_MSG_RESULT([${db2xman}])
98 if test "x$enable_doc" = "xyes"; then
99 AC_MSG_ERROR([docbook2x-man required by man request, but not found])
105 AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
106 AM_CONDITIONAL([USE_DOCBOOK2X], [test "x$db2xman" != "xdocbook2man"])
108 if test "x$db2xman" = "xdocbook2man"; then
109 docdtd="\"-//Davenport//DTD DocBook V3.0//EN\""
111 docdtd="\"-//OASIS//DTD DocBook XML\" \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""
116 AC_ARG_ENABLE([apparmor],
117 [AC_HELP_STRING([--enable-apparmor], [enable apparmor])],
118 [], [enable_apparmor=check])
120 if test "$enable_apparmor" = "check" ; then
121 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
123 AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
125 AC_CHECK_LIB([gnutls], [gnutls_hash_fast])
127 AM_COND_IF([ENABLE_APPARMOR],
128 [AC_CHECK_HEADER([sys/apparmor.h],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
129 AC_CHECK_LIB([apparmor], [aa_change_profile],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
130 AC_SUBST([APPARMOR_LIBS], [-lapparmor])])
133 AC_ARG_ENABLE([selinux],
134 [AC_HELP_STRING([--enable-selinux], [enable SELinux support])],
135 [], [enable_selinux=check])
137 if test "x$enable_selinux" = xcheck; then
138 AC_CHECK_LIB([selinux],[setexeccon_raw],[enable_selinux=yes],[enable_selinux=no])
140 AM_CONDITIONAL([ENABLE_SELINUX], [test "x$enable_selinux" = "xyes"])
141 AM_COND_IF([ENABLE_SELINUX],
142 [AC_CHECK_HEADER([selinux/selinux.h],[],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
143 AC_CHECK_LIB([selinux], [setexeccon_raw],[],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
144 AC_SUBST([SELINUX_LIBS])])
146 # Seccomp syscall filter
147 AC_ARG_ENABLE([seccomp],
148 [AC_HELP_STRING([--enable-seccomp], [enable seccomp])],
149 [], [enable_seccomp=check])
151 if test "$enable_seccomp" = "check" ; then
152 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
154 AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
156 AM_COND_IF([ENABLE_SECCOMP],
157 [AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
158 AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
159 AC_SUBST([SECCOMP_LIBS], [-lseccomp])])
161 # HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
162 AC_CHECK_TYPES([scmp_filter_ctx], [], [], [#include <seccomp.h>])
164 # Configuration examples
165 AC_ARG_ENABLE([examples],
166 [AC_HELP_STRING([--disable-examples], [do not install configuration examples])],
167 [], [enable_examples=yes])
168 AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
170 # Python3 module and scripts
171 AC_ARG_ENABLE([python],
172 [AC_HELP_STRING([--enable-python], [enable python binding])],
173 [enable_python=yes], [enable_python=no])
174 AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
176 AM_COND_IF([ENABLE_PYTHON],
177 [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])])
178 PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[],[AC_MSG_ERROR([You must install python3-dev])])
179 AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
181 # Enable dumping stack traces
182 AC_ARG_ENABLE([mutex-debugging],
183 [AC_HELP_STRING([--enable-mutex-debugging], [Makes mutexes to report error and provide stack trace])],
184 [enable_mutex_debugging=yes], [enable_mutex_debugging=no])
185 AM_CONDITIONAL([MUTEX_DEBUGGING], [test "x$enable_mutex_debugging" = "xyes"])
187 AM_COND_IF([MUTEX_DEBUGGING],
188 AC_DEFINE_UNQUOTED([MUTEX_DEBUGGING], 1, [Enabling mutex debugging]))
190 # Not in older autoconf versions
191 # AS_VAR_COPY(DEST, SOURCE)
192 # -------------------------
193 # Set the polymorphic shell variable DEST to the contents of the polymorphic
194 # shell variable SOURCE.
195 m4_ifdef([AS_VAR_COPY], [],
196 [AC_DEFUN([AS_VAR_COPY],
197 [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
200 dnl PKG_CHECK_VAR was introduced with pkg-config 0.28
201 m4_ifdef([PKG_CHECK_VAR], [],
202 [AC_DEFUN([PKG_CHECK_VAR],
203 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
204 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
205 _PKG_CONFIG([$1], [variable="][$3]["], [$2])
206 AS_VAR_COPY([$1], [pkg_cv_][$1])
207 AS_VAR_IF([$1], [""], [$5], [$4])dnl
211 # Lua module and scripts
213 [AC_HELP_STRING([--enable-lua], [enable lua binding])],
214 [], [enable_lua=check])
216 AC_ARG_WITH([lua-pc],
219 [Specify pkg-config package name for lua]
220 )], [], [with_lua_pc=no])
222 if test "x$enable_lua" = "xyes" -a "x$with_lua_pc" != "xno"; then
223 # exit with error if not found
224 PKG_CHECK_MODULES([LUA], [$with_lua_pc], [LUAPKGCONFIG=$with_lua_pc])
227 if test "x$enable_lua" = "xcheck" -a "x$with_lua_pc" != "xno"; then
228 PKG_CHECK_MODULES([LUA], [$with_lua_pc],
229 [LUAPKGCONFIG=$with_lua_pc
234 if test "x$enable_lua" != "xno"; then
235 PKG_CHECK_MODULES([LUA], [lua], [LUAPKGCONFIG=lua],
236 [PKG_CHECK_MODULES([LUA], [lua5.2], [LUAPKGCONFIG=lua5.2],
237 [PKG_CHECK_MODULES([LUA], [lua5.1], [LUAPKGCONFIG=lua5.1],
238 [AS_IF([test "x$enable_lua" = "xyes"],
239 [AC_MSG_ERROR([Lua not found. Please use --with-lua-pc=PKG])],
243 AS_IF([test "x$LUAPKGCONFIG" != "x"], [enable_lua=yes])
246 AM_CONDITIONAL([ENABLE_LUA],
247 [test "x$enable_lua" = "xyes"])
249 AM_COND_IF([ENABLE_LUA],
250 [AC_MSG_CHECKING([Lua version])
251 PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [V],,
252 [PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [major_version])])
253 AC_MSG_RESULT([$LUA_VERSION])
254 PKG_CHECK_VAR([LUA_INSTALL_CMOD], [$LUAPKGCONFIG], [INSTALL_CMOD],,
255 [LUA_INSTALL_CMOD=$libdir/lua/$LUA_VERSION])
256 PKG_CHECK_VAR([LUA_INSTALL_LMOD], [$LUAPKGCONFIG], [INSTALL_LMOD],,
257 [LUA_INSTALL_LMOD=$datadir/lua/$LUA_VERSION])
260 # Optional test binaries
261 AC_ARG_ENABLE([tests],
262 [AC_HELP_STRING([--enable-tests], [build test/example binaries])],
263 [enable_tests=yes], [enable_tests=no])
264 AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
266 # LXC container path, where the containers are actually stored
267 # This is overridden by an entry in the file called LXCCONF
268 # (i.e. /etc/lxc/lxc.conf)
269 AC_ARG_WITH([config-path],
271 [--with-config-path=dir],
272 [lxc configuration repository path]
273 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
275 # The path of the global lxc configuration file.
276 AC_ARG_WITH([global-conf],
278 [--with-global-conf=dir],
279 [global lxc configuration file]
280 )], [], [with_global_conf=['${sysconfdir}/lxc/lxc.conf']])
282 # The path of the userns network configuration file
283 AC_ARG_WITH([usernic-conf],
285 [--with-usernic-conf],
286 [user network interface configuration file]
287 )], [], [with_usernic_conf=['${sysconfdir}/lxc/lxc-usernet']])
289 # The path of the runtime usernic database
290 AC_ARG_WITH([usernic-db],
293 [lxc user nic database]
294 )], [], [with_usernic_db=['/run/lxc/nics']])
296 # Rootfs path, where the container mount structure is assembled
297 AC_ARG_WITH([rootfs-path],
299 [--with-rootfs-path=dir],
300 [lxc rootfs mount point]
301 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
303 # cgroup pattern specification
304 AC_ARG_WITH([cgroup-pattern],
306 [--with-cgroup-pattern=pattern],
307 [pattern for container cgroups]
308 )], [], [with_cgroup_pattern=['/lxc/%n']])
310 # Container log path. By default, use $lxcpath.
311 AC_MSG_CHECKING([Whether to place logfiles in container config path])
312 AC_ARG_ENABLE([configpath-log],
313 [AC_HELP_STRING([--enable-configpath-log], [use logfiles in config path])],
314 [use_configpath_logs=yes], [use_configpath_logs=no])
315 AC_MSG_RESULT([$use_configpath_logs])
316 AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$use_configpath_logs" = "yes"])
318 if test "$use_configpath_logs" = "yes"; then
319 default_log_path="${with_config_path}"
321 default_log_path="${localstatedir}/log/lxc"
324 AC_ARG_WITH([log-path],
326 [--with-log-path=dir],
327 [per container log path]
328 )], [], [with_log_path=['${default_log_path}']])
330 # Expand some useful variables
331 AS_AC_EXPAND(PREFIX, "$prefix")
332 AS_AC_EXPAND(LIBDIR, "$libdir")
333 AS_AC_EXPAND(BINDIR, "$bindir")
334 AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
335 AS_AC_EXPAND(INCLUDEDIR, "$includedir")
336 AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
337 AS_AC_EXPAND(LXC_DEFAULT_CONFIG, "$sysconfdir/lxc/default.conf")
338 AS_AC_EXPAND(DATADIR, "$datadir")
339 AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
340 AS_AC_EXPAND(DOCDIR, "$docdir")
341 AS_AC_EXPAND(LXC_DISTRO_CONF, "$distroconf")
342 AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
343 AS_AC_EXPAND(LXCPATH, "$with_config_path")
344 AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf")
345 AS_AC_EXPAND(LXC_USERNIC_CONF, "$with_usernic_conf")
346 AS_AC_EXPAND(LXC_USERNIC_DB, "$with_usernic_db")
347 AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
348 AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
349 AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
350 AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
351 AS_AC_EXPAND(LOGPATH, "$with_log_path")
352 AC_SUBST(DEFAULT_CGROUP_PATTERN, ["$with_cgroup_pattern"])
354 # Check for some standard kernel headers
355 AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
357 AC_MSG_ERROR([Please install the Linux kernel headers.]),
358 [#include <sys/socket.h>])
360 # Allow disabling libcap support
361 AC_ARG_ENABLE([capabilities],
362 [AC_HELP_STRING([--disable-capabilities], [disable kernel capabilities])],
363 [], [enable_capabilities=yes])
365 # Check for libcap support
366 if test "x$enable_capabilities" = "xyes"; then
367 AC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
368 AC_MSG_CHECKING([linux capabilities])
369 if test "x$caplib" = "xyes" ; then
371 AC_MSG_RESULT([$CAP_LIBS])
374 AC_MSG_ERROR([You are missing libcap support. If you really want to build without kernel capabilities, use --disable-capabilities])
381 # Check for alternate C libraries
382 AC_MSG_CHECKING(for bionic libc)
383 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
384 [[#ifndef __ANDROID__
389 if test "x$is_bionic" = "xyes"; then
390 AC_DEFINE([IS_BIONIC], 1, [bionic libc])
395 AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
397 # Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
398 AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
400 # Check for some headers
401 AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
403 # Check for some syscalls functions
404 AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr])
406 # Check for some functions
407 AC_CHECK_LIB(util, openpty)
408 AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent])
409 AC_CHECK_FUNCS([getline],
410 AM_CONDITIONAL(HAVE_GETLINE, true)
411 AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
412 AM_CONDITIONAL(HAVE_GETLINE, false))
413 AC_CHECK_FUNCS([fgetln],
414 AM_CONDITIONAL(HAVE_FGETLN, true)
415 AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
416 AM_CONDITIONAL(HAVE_FGETLN, false))
418 # Check for some libraries
419 AC_SEARCH_LIBS(sem_open, [rt pthread])
420 AC_SEARCH_LIBS(clock_gettime, [rt])
422 # Check for some standard binaries
423 AC_PROG_GCC_TRADITIONAL
426 if test "x$GCC" = "xyes"; then
427 CFLAGS="$CFLAGS -Wall -Werror"
430 # Files requiring some variable expansion
438 doc/legacy/lxc-ls.sgml
441 doc/lxc-checkconfig.sgml
442 doc/lxc-checkpoint.sgml
457 doc/lxc-snapshot.sgml
458 doc/lxc-start-ephemeral.sgml
462 doc/lxc-unfreeze.sgml
469 doc/common_options.sgml
474 doc/examples/Makefile
475 doc/examples/lxc-macvlan.conf
476 doc/examples/lxc-vlan.conf
477 doc/examples/lxc-no-netns.conf
478 doc/examples/lxc-empty-netns.conf
479 doc/examples/lxc-phys.conf
480 doc/examples/lxc-veth.conf
481 doc/examples/lxc-complex.conf
484 doc/ja/legacy/lxc-ls.sgml
485 doc/ja/lxc-attach.sgml
486 doc/ja/lxc-cgroup.sgml
487 doc/ja/lxc-checkconfig.sgml
488 doc/ja/lxc-checkpoint.sgml
489 doc/ja/lxc-clone.sgml
490 doc/ja/lxc-console.sgml
491 doc/ja/lxc-create.sgml
492 doc/ja/lxc-destroy.sgml
493 doc/ja/lxc-device.sgml
494 doc/ja/lxc-execute.sgml
495 doc/ja/lxc-freeze.sgml
499 doc/ja/lxc-monitor.sgml
500 doc/ja/lxc-netstat.sgml
502 doc/ja/lxc-restart.sgml
503 doc/ja/lxc-snapshot.sgml
504 doc/ja/lxc-start-ephemeral.sgml
505 doc/ja/lxc-start.sgml
508 doc/ja/lxc-unfreeze.sgml
509 doc/ja/lxc-unshare.sgml
510 doc/ja/lxc-version.sgml
515 doc/ja/common_options.sgml
524 templates/lxc-ubuntu-cloud
525 templates/lxc-opensuse
526 templates/lxc-busybox
528 templates/lxc-openmandriva
530 templates/lxc-altlinux
532 templates/lxc-archlinux
540 src/lxc/lxc-checkconfig
542 src/lxc/lxc-start-ephemeral
543 src/lxc/legacy/lxc-ls
544 src/lxc/lxc.functions
546 src/python-lxc/Makefile
552 AC_CONFIG_COMMANDS([default],[[]],[[]])