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], [alpha3])
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 # Allow disabling rpath
68 AC_ARG_ENABLE([rpath],
69 [AC_HELP_STRING([--disable-rpath], [do not set rpath in executables])],
70 [], [enable_rpath=yes])
71 AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
73 # Documentation (manpages)
75 [AC_HELP_STRING([--enable-doc], [make mans (requires docbook2man or docbook2x-man to be installed) [default=auto]])],
76 [], [enable_doc=auto])
78 if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
80 dbparsers="docbook2x-man db2x_docbook2man docbook2man"
82 AC_MSG_CHECKING(for docbook2x-man)
83 for name in ${dbparsers}; do
84 if "$name" --help >/dev/null 2>&1; then
90 if test -n "${db2xman}"; then
91 AC_MSG_RESULT([${db2xman}])
94 if test "x$enable_doc" = "xyes"; then
95 AC_MSG_ERROR([docbook2x-man required by man request, but not found])
101 AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
102 AM_CONDITIONAL([USE_DOCBOOK2X], [test "x$db2xman" != "xdocbook2man"])
104 if test "x$db2xman" = "xdocbook2man"; then
105 docdtd="\"-//Davenport//DTD DocBook V3.0//EN\""
107 docdtd="\"-//OASIS//DTD DocBook XML\" \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""
112 AC_ARG_ENABLE([apparmor],
113 [AC_HELP_STRING([--enable-apparmor], [enable apparmor])],
114 [], [enable_apparmor=check])
116 if test "$enable_apparmor" = "check" ; then
117 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
119 AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
121 AC_CHECK_LIB([gnutls], [gnutls_hash_fast])
123 AM_COND_IF([ENABLE_APPARMOR],
124 [AC_CHECK_HEADER([sys/apparmor.h],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
125 AC_CHECK_LIB([apparmor], [aa_change_profile],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
126 AC_SUBST([APPARMOR_LIBS], [-lapparmor])])
129 AC_ARG_ENABLE([selinux],
130 [AC_HELP_STRING([--enable-selinux], [enable SELinux support])],
131 [], [enable_selinux=check])
133 if test "x$enable_selinux" = xcheck; then
134 AC_CHECK_LIB([selinux],[setexeccon_raw],[enable_selinux=yes],[enable_selinux=no])
136 AM_CONDITIONAL([ENABLE_SELINUX], [test "x$enable_selinux" = "xyes"])
137 AM_COND_IF([ENABLE_SELINUX],
138 [AC_CHECK_HEADER([selinux/selinux.h],[],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
139 AC_CHECK_LIB([selinux], [setexeccon_raw],[],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
140 AC_SUBST([SELINUX_LIBS])])
142 # Seccomp syscall filter
143 AC_ARG_ENABLE([seccomp],
144 [AC_HELP_STRING([--enable-seccomp], [enable seccomp])],
145 [], [enable_seccomp=check])
147 if test "$enable_seccomp" = "check" ; then
148 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
150 AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
152 AM_COND_IF([ENABLE_SECCOMP],
153 [AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
154 AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
155 AC_SUBST([SECCOMP_LIBS], [-lseccomp])])
157 # HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
158 AC_CHECK_TYPES([scmp_filter_ctx], [], [], [#include <seccomp.h>])
160 # Configuration examples
161 AC_ARG_ENABLE([examples],
162 [AC_HELP_STRING([--disable-examples], [do not install configuration examples])],
163 [], [enable_examples=yes])
164 AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
166 # Python3 module and scripts
167 AC_ARG_ENABLE([python],
168 [AC_HELP_STRING([--enable-python], [enable python binding])],
169 [enable_python=yes], [enable_python=no])
170 AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
172 AM_COND_IF([ENABLE_PYTHON],
173 [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])])
174 PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[],[AC_MSG_ERROR([You must install python3-dev])])
175 AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
177 # Enable dumping stack traces
178 AC_ARG_ENABLE([mutex-debugging],
179 [AC_HELP_STRING([--enable-mutex-debugging], [Makes mutexes to report error and provide stack trace])],
180 [enable_mutex_debugging=yes], [enable_mutex_debugging=no])
181 AM_CONDITIONAL([MUTEX_DEBUGGING], [test "x$enable_mutex_debugging" = "xyes"])
183 AM_COND_IF([MUTEX_DEBUGGING],
184 AC_DEFINE_UNQUOTED([MUTEX_DEBUGGING], 1, [Enabling mutex debugging]))
186 # Not in older autoconf versions
187 # AS_VAR_COPY(DEST, SOURCE)
188 # -------------------------
189 # Set the polymorphic shell variable DEST to the contents of the polymorphic
190 # shell variable SOURCE.
191 m4_ifdef([AS_VAR_COPY], [],
192 [AC_DEFUN([AS_VAR_COPY],
193 [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
196 dnl PKG_CHECK_VAR was introduced with pkg-config 0.28
197 m4_ifdef([PKG_CHECK_VAR], [],
198 [AC_DEFUN([PKG_CHECK_VAR],
199 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
200 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
201 _PKG_CONFIG([$1], [variable="][$3]["], [$2])
202 AS_VAR_COPY([$1], [pkg_cv_][$1])
203 AS_VAR_IF([$1], [""], [$5], [$4])dnl
207 # Lua module and scripts
209 [AC_HELP_STRING([--enable-lua], [enable lua binding])],
210 [], [enable_lua=check])
212 AC_ARG_WITH([lua-pc],
215 [Specify pkg-config package name for lua]
216 )], [], [with_lua_pc=no])
218 if test "x$enable_lua" = "xyes" -a "x$with_lua_pc" != "xno"; then
219 # exit with error if not found
220 PKG_CHECK_MODULES([LUA], [$with_lua_pc], [LUAPKGCONFIG=$with_lua_pc])
223 if test "x$enable_lua" = "xcheck" -a "x$with_lua_pc" != "xno"; then
224 PKG_CHECK_MODULES([LUA], [$with_lua_pc],
225 [LUAPKGCONFIG=$with_lua_pc
230 if test "x$enable_lua" != "xno"; then
231 PKG_CHECK_MODULES([LUA], [lua], [LUAPKGCONFIG=lua],
232 [PKG_CHECK_MODULES([LUA], [lua5.2], [LUAPKGCONFIG=lua5.2],
233 [PKG_CHECK_MODULES([LUA], [lua5.1], [LUAPKGCONFIG=lua5.1],
234 [AS_IF([test "x$enable_lua" = "xyes"],
235 [AC_MSG_ERROR([Lua not found. Please use --with-lua-pc=PKG])],
239 AS_IF([test "x$LUAPKGCONFIG" != "x"], [enable_lua=yes])
242 AM_CONDITIONAL([ENABLE_LUA],
243 [test "x$enable_lua" = "xyes"])
245 AM_COND_IF([ENABLE_LUA],
246 [AC_MSG_CHECKING([Lua version])
247 PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [V],,
248 [PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [major_version])])
249 AC_MSG_RESULT([$LUA_VERSION])
250 PKG_CHECK_VAR([LUA_INSTALL_CMOD], [$LUAPKGCONFIG], [INSTALL_CMOD],,
251 [LUA_INSTALL_CMOD=$libdir/lua/$LUA_VERSION])
252 PKG_CHECK_VAR([LUA_INSTALL_LMOD], [$LUAPKGCONFIG], [INSTALL_LMOD],,
253 [LUA_INSTALL_LMOD=$datadir/lua/$LUA_VERSION])
256 # Optional test binaries
257 AC_ARG_ENABLE([tests],
258 [AC_HELP_STRING([--enable-tests], [build test/example binaries])],
259 [enable_tests=yes], [enable_tests=no])
260 AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
262 # LXC container path, where the containers are actually stored
263 # This is overridden by an entry in the file called LXCCONF
264 # (i.e. /etc/lxc/lxc.conf)
265 AC_ARG_WITH([config-path],
267 [--with-config-path=dir],
268 [lxc configuration repository path]
269 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
271 # The path of the global lxc configuration file.
272 AC_ARG_WITH([global-conf],
274 [--with-global-conf=dir],
275 [global lxc configuration file]
276 )], [], [with_global_conf=['${sysconfdir}/lxc/lxc.conf']])
278 # The path of the userns network configuration file
279 AC_ARG_WITH([usernic-conf],
281 [--with-usernic-conf],
282 [user network interface configuration file]
283 )], [], [with_usernic_conf=['${sysconfdir}/lxc/lxc-usernet']])
285 # The path of the runtime usernic database
286 AC_ARG_WITH([usernic-db],
289 [lxc user nic database]
290 )], [], [with_usernic_db=['/run/lxc/nics']])
292 # Rootfs path, where the container mount structure is assembled
293 AC_ARG_WITH([rootfs-path],
295 [--with-rootfs-path=dir],
296 [lxc rootfs mount point]
297 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
299 # cgroup pattern specification
300 AC_ARG_WITH([cgroup-pattern],
302 [--with-cgroup-pattern=pattern],
303 [pattern for container cgroups]
304 )], [], [with_cgroup_pattern=['/lxc/%n']])
306 # Container log path. By default, use $lxcpath.
307 AC_MSG_CHECKING([Whether to place logfiles in container config path])
308 AC_ARG_ENABLE([configpath-log],
309 [AC_HELP_STRING([--enable-configpath-log], [use logfiles in config path])],
310 [use_configpath_logs=yes], [use_configpath_logs=no])
311 AC_MSG_RESULT([$use_configpath_logs])
312 AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$use_configpath_logs" = "yes"])
314 if test "$use_configpath_logs" = "yes"; then
315 default_log_path="${with_config_path}"
317 default_log_path="${localstatedir}/log/lxc"
320 AC_ARG_WITH([log-path],
322 [--with-log-path=dir],
323 [per container log path]
324 )], [], [with_log_path=['${default_log_path}']])
326 # Expand some useful variables
327 AS_AC_EXPAND(PREFIX, "$prefix")
328 AS_AC_EXPAND(LIBDIR, "$libdir")
329 AS_AC_EXPAND(BINDIR, "$bindir")
330 AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
331 AS_AC_EXPAND(INCLUDEDIR, "$includedir")
332 AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
333 AS_AC_EXPAND(LXC_DEFAULT_CONFIG, "$sysconfdir/lxc/default.conf")
334 AS_AC_EXPAND(DATADIR, "$datadir")
335 AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
336 AS_AC_EXPAND(DOCDIR, "$docdir")
337 AS_AC_EXPAND(LXC_DISTRO_CONF, "$distroconf")
338 AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
339 AS_AC_EXPAND(LXCPATH, "$with_config_path")
340 AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf")
341 AS_AC_EXPAND(LXC_USERNIC_CONF, "$with_usernic_conf")
342 AS_AC_EXPAND(LXC_USERNIC_DB, "$with_usernic_db")
343 AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
344 AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
345 AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
346 AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
347 AS_AC_EXPAND(LOGPATH, "$with_log_path")
348 AC_SUBST(DEFAULT_CGROUP_PATTERN, ["$with_cgroup_pattern"])
350 # Check for some standard kernel headers
351 AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
353 AC_MSG_ERROR([Please install the Linux kernel headers.]),
354 [#include <sys/socket.h>])
356 # Allow disabling libcap support
357 AC_ARG_ENABLE([capabilities],
358 [AC_HELP_STRING([--disable-capabilities], [disable kernel capabilities])],
359 [], [enable_capabilities=yes])
361 # Check for libcap support
362 if test "x$enable_capabilities" = "xyes"; then
363 AC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
364 AC_MSG_CHECKING([linux capabilities])
365 if test "x$caplib" = "xyes" ; then
367 AC_MSG_RESULT([$CAP_LIBS])
370 AC_MSG_ERROR([You are missing libcap support. If you really want to build without kernel capabilities, use --disable-capabilities])
377 # Check for alternate C libraries
378 AC_MSG_CHECKING(for bionic libc)
379 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
380 [[#ifndef __ANDROID__
385 if test "x$is_bionic" = "xyes"; then
386 AC_DEFINE([IS_BIONIC], 1, [bionic libc])
391 AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
393 # Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
394 AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
396 # Check for some headers
397 AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
399 # Check for some syscalls functions
400 AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr])
402 # Check for some functions
403 AC_CHECK_LIB(util, openpty)
404 AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent])
405 AC_CHECK_FUNCS([getline],
406 AM_CONDITIONAL(HAVE_GETLINE, true)
407 AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
408 AM_CONDITIONAL(HAVE_GETLINE, false))
409 AC_CHECK_FUNCS([fgetln],
410 AM_CONDITIONAL(HAVE_FGETLN, true)
411 AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
412 AM_CONDITIONAL(HAVE_FGETLN, false))
414 # Check for some libraries
415 AC_SEARCH_LIBS(sem_open, [rt pthread])
416 AC_SEARCH_LIBS(clock_gettime, [rt])
418 # Check for some standard binaries
419 AC_PROG_GCC_TRADITIONAL
422 if test "x$GCC" = "xyes"; then
423 CFLAGS="$CFLAGS -Wall -Werror"
426 # Files requiring some variable expansion
434 doc/legacy/lxc-ls.sgml
437 doc/lxc-checkconfig.sgml
438 doc/lxc-checkpoint.sgml
453 doc/lxc-snapshot.sgml
454 doc/lxc-start-ephemeral.sgml
458 doc/lxc-unfreeze.sgml
465 doc/common_options.sgml
470 doc/examples/Makefile
471 doc/examples/lxc-macvlan.conf
472 doc/examples/lxc-vlan.conf
473 doc/examples/lxc-no-netns.conf
474 doc/examples/lxc-empty-netns.conf
475 doc/examples/lxc-phys.conf
476 doc/examples/lxc-veth.conf
477 doc/examples/lxc-complex.conf
480 doc/ja/legacy/lxc-ls.sgml
481 doc/ja/lxc-attach.sgml
482 doc/ja/lxc-cgroup.sgml
483 doc/ja/lxc-checkconfig.sgml
484 doc/ja/lxc-checkpoint.sgml
485 doc/ja/lxc-clone.sgml
486 doc/ja/lxc-console.sgml
487 doc/ja/lxc-create.sgml
488 doc/ja/lxc-destroy.sgml
489 doc/ja/lxc-device.sgml
490 doc/ja/lxc-execute.sgml
491 doc/ja/lxc-freeze.sgml
495 doc/ja/lxc-monitor.sgml
496 doc/ja/lxc-netstat.sgml
498 doc/ja/lxc-restart.sgml
499 doc/ja/lxc-snapshot.sgml
500 doc/ja/lxc-start-ephemeral.sgml
501 doc/ja/lxc-start.sgml
504 doc/ja/lxc-unfreeze.sgml
505 doc/ja/lxc-unshare.sgml
506 doc/ja/lxc-version.sgml
511 doc/ja/common_options.sgml
520 templates/lxc-ubuntu-cloud
521 templates/lxc-opensuse
522 templates/lxc-busybox
524 templates/lxc-openmandriva
526 templates/lxc-altlinux
528 templates/lxc-archlinux
536 src/lxc/lxc-checkconfig
538 src/lxc/lxc-start-ephemeral
539 src/lxc/legacy/lxc-ls
540 src/lxc/lxc.functions
542 src/python-lxc/Makefile
548 AC_CONFIG_COMMANDS([default],[[]],[[]])