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\""
111 # Documentation (API)
112 AC_ARG_ENABLE([api-docs],
113 [AC_HELP_STRING([--enable-api-docs],
114 [make API documentation (requires doxygen to be installed) [default=auto]])],
115 [], [enable_api_docs=auto])
117 if test "x$enable_api_docs" = "xyes" -o "x$enable_api_docs" = "xauto"; then
118 AC_CHECK_PROGS([HAVE_DOXYGEN],[doxygen])
119 AC_SUBST([HAVE_DOXYGEN])
122 AM_CONDITIONAL([ENABLE_API_DOCS], [test ! -z "$HAVE_DOXYGEN"])
125 AC_ARG_ENABLE([apparmor],
126 [AC_HELP_STRING([--enable-apparmor], [enable apparmor])],
127 [], [enable_apparmor=check])
129 if test "$enable_apparmor" = "check" ; then
130 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
132 AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
134 AC_CHECK_LIB([gnutls], [gnutls_hash_fast])
136 AM_COND_IF([ENABLE_APPARMOR],
137 [AC_CHECK_HEADER([sys/apparmor.h],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
138 AC_CHECK_LIB([apparmor], [aa_change_profile],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
139 AC_SUBST([APPARMOR_LIBS], [-lapparmor])])
142 AC_ARG_ENABLE([selinux],
143 [AC_HELP_STRING([--enable-selinux], [enable SELinux support])],
144 [], [enable_selinux=check])
146 if test "x$enable_selinux" = xcheck; then
147 AC_CHECK_LIB([selinux],[setexeccon_raw],[enable_selinux=yes],[enable_selinux=no])
149 AM_CONDITIONAL([ENABLE_SELINUX], [test "x$enable_selinux" = "xyes"])
150 AM_COND_IF([ENABLE_SELINUX],
151 [AC_CHECK_HEADER([selinux/selinux.h],[],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
152 AC_CHECK_LIB([selinux], [setexeccon_raw],[],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
153 AC_SUBST([SELINUX_LIBS])])
155 # Seccomp syscall filter
156 AC_ARG_ENABLE([seccomp],
157 [AC_HELP_STRING([--enable-seccomp], [enable seccomp])],
158 [], [enable_seccomp=check])
160 if test "$enable_seccomp" = "check" ; then
161 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
163 AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
165 AM_COND_IF([ENABLE_SECCOMP],
166 [AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
167 AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
168 AC_SUBST([SECCOMP_LIBS], [-lseccomp])])
170 # HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
171 AC_CHECK_TYPES([scmp_filter_ctx], [], [], [#include <seccomp.h>])
173 # Configuration examples
174 AC_ARG_ENABLE([examples],
175 [AC_HELP_STRING([--disable-examples], [do not install configuration examples])],
176 [], [enable_examples=yes])
177 AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
179 # Python3 module and scripts
180 AC_ARG_ENABLE([python],
181 [AC_HELP_STRING([--enable-python], [enable python binding])],
182 [enable_python=yes], [enable_python=no])
183 AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
185 AM_COND_IF([ENABLE_PYTHON],
186 [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])])
187 PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[],[AC_MSG_ERROR([You must install python3-dev])])
188 AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
190 # Enable dumping stack traces
191 AC_ARG_ENABLE([mutex-debugging],
192 [AC_HELP_STRING([--enable-mutex-debugging], [Makes mutexes to report error and provide stack trace])],
193 [enable_mutex_debugging=yes], [enable_mutex_debugging=no])
194 AM_CONDITIONAL([MUTEX_DEBUGGING], [test "x$enable_mutex_debugging" = "xyes"])
196 AM_COND_IF([MUTEX_DEBUGGING],
197 AC_DEFINE_UNQUOTED([MUTEX_DEBUGGING], 1, [Enabling mutex debugging]))
199 # Not in older autoconf versions
200 # AS_VAR_COPY(DEST, SOURCE)
201 # -------------------------
202 # Set the polymorphic shell variable DEST to the contents of the polymorphic
203 # shell variable SOURCE.
204 m4_ifdef([AS_VAR_COPY], [],
205 [AC_DEFUN([AS_VAR_COPY],
206 [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
209 dnl PKG_CHECK_VAR was introduced with pkg-config 0.28
210 m4_ifdef([PKG_CHECK_VAR], [],
211 [AC_DEFUN([PKG_CHECK_VAR],
212 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
213 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
214 _PKG_CONFIG([$1], [variable="][$3]["], [$2])
215 AS_VAR_COPY([$1], [pkg_cv_][$1])
216 AS_VAR_IF([$1], [""], [$5], [$4])dnl
220 # Lua module and scripts
222 [AC_HELP_STRING([--enable-lua], [enable lua binding])],
223 [], [enable_lua=check])
225 AC_ARG_WITH([lua-pc],
228 [Specify pkg-config package name for lua]
229 )], [], [with_lua_pc=no])
231 if test "x$enable_lua" = "xyes" -a "x$with_lua_pc" != "xno"; then
232 # exit with error if not found
233 PKG_CHECK_MODULES([LUA], [$with_lua_pc], [LUAPKGCONFIG=$with_lua_pc])
236 if test "x$enable_lua" = "xcheck" -a "x$with_lua_pc" != "xno"; then
237 PKG_CHECK_MODULES([LUA], [$with_lua_pc],
238 [LUAPKGCONFIG=$with_lua_pc
243 if test "x$enable_lua" != "xno"; then
244 PKG_CHECK_MODULES([LUA], [lua], [LUAPKGCONFIG=lua],
245 [PKG_CHECK_MODULES([LUA], [lua5.2], [LUAPKGCONFIG=lua5.2],
246 [PKG_CHECK_MODULES([LUA], [lua5.1], [LUAPKGCONFIG=lua5.1],
247 [AS_IF([test "x$enable_lua" = "xyes"],
248 [AC_MSG_ERROR([Lua not found. Please use --with-lua-pc=PKG])],
252 AS_IF([test "x$LUAPKGCONFIG" != "x"], [enable_lua=yes])
255 AM_CONDITIONAL([ENABLE_LUA],
256 [test "x$enable_lua" = "xyes"])
258 AM_COND_IF([ENABLE_LUA],
259 [AC_MSG_CHECKING([Lua version])
260 PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [V],,
261 [PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [major_version])])
262 AC_MSG_RESULT([$LUA_VERSION])
263 PKG_CHECK_VAR([LUA_INSTALL_CMOD], [$LUAPKGCONFIG], [INSTALL_CMOD],,
264 [LUA_INSTALL_CMOD=$libdir/lua/$LUA_VERSION])
265 PKG_CHECK_VAR([LUA_INSTALL_LMOD], [$LUAPKGCONFIG], [INSTALL_LMOD],,
266 [LUA_INSTALL_LMOD=$datadir/lua/$LUA_VERSION])
269 # Optional test binaries
270 AC_ARG_ENABLE([tests],
271 [AC_HELP_STRING([--enable-tests], [build test/example binaries])],
272 [enable_tests=yes], [enable_tests=no])
273 AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
275 # LXC container path, where the containers are actually stored
276 # This is overridden by an entry in the file called LXCCONF
277 # (i.e. /etc/lxc/lxc.conf)
278 AC_ARG_WITH([config-path],
280 [--with-config-path=dir],
281 [lxc configuration repository path]
282 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
284 # The path of the global lxc configuration file.
285 AC_ARG_WITH([global-conf],
287 [--with-global-conf=dir],
288 [global lxc configuration file]
289 )], [], [with_global_conf=['${sysconfdir}/lxc/lxc.conf']])
291 # The path of the userns network configuration file
292 AC_ARG_WITH([usernic-conf],
294 [--with-usernic-conf],
295 [user network interface configuration file]
296 )], [], [with_usernic_conf=['${sysconfdir}/lxc/lxc-usernet']])
298 # The path of the runtime usernic database
299 AC_ARG_WITH([usernic-db],
302 [lxc user nic database]
303 )], [], [with_usernic_db=['/run/lxc/nics']])
305 # Rootfs path, where the container mount structure is assembled
306 AC_ARG_WITH([rootfs-path],
308 [--with-rootfs-path=dir],
309 [lxc rootfs mount point]
310 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
312 # cgroup pattern specification
313 AC_ARG_WITH([cgroup-pattern],
315 [--with-cgroup-pattern=pattern],
316 [pattern for container cgroups]
317 )], [], [with_cgroup_pattern=['/lxc/%n']])
319 # Container log path. By default, use $lxcpath.
320 AC_MSG_CHECKING([Whether to place logfiles in container config path])
321 AC_ARG_ENABLE([configpath-log],
322 [AC_HELP_STRING([--enable-configpath-log], [use logfiles in config path])],
323 [use_configpath_logs=yes], [use_configpath_logs=no])
324 AC_MSG_RESULT([$use_configpath_logs])
325 AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$use_configpath_logs" = "yes"])
327 if test "$use_configpath_logs" = "yes"; then
328 default_log_path="${with_config_path}"
330 default_log_path="${localstatedir}/log/lxc"
333 AC_ARG_WITH([log-path],
335 [--with-log-path=dir],
336 [per container log path]
337 )], [], [with_log_path=['${default_log_path}']])
339 # Expand some useful variables
340 AS_AC_EXPAND(PREFIX, "$prefix")
341 AS_AC_EXPAND(LIBDIR, "$libdir")
342 AS_AC_EXPAND(BINDIR, "$bindir")
343 AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
344 AS_AC_EXPAND(INCLUDEDIR, "$includedir")
345 AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
346 AS_AC_EXPAND(LXC_DEFAULT_CONFIG, "$sysconfdir/lxc/default.conf")
347 AS_AC_EXPAND(DATADIR, "$datadir")
348 AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
349 AS_AC_EXPAND(DOCDIR, "$docdir")
350 AS_AC_EXPAND(LXC_DISTRO_CONF, "$distroconf")
351 AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
352 AS_AC_EXPAND(LXCPATH, "$with_config_path")
353 AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf")
354 AS_AC_EXPAND(LXC_USERNIC_CONF, "$with_usernic_conf")
355 AS_AC_EXPAND(LXC_USERNIC_DB, "$with_usernic_db")
356 AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
357 AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
358 AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
359 AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
360 AS_AC_EXPAND(LOGPATH, "$with_log_path")
361 AC_SUBST(DEFAULT_CGROUP_PATTERN, ["$with_cgroup_pattern"])
363 # Check for some standard kernel headers
364 AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
366 AC_MSG_ERROR([Please install the Linux kernel headers.]),
367 [#include <sys/socket.h>])
369 # Allow disabling libcap support
370 AC_ARG_ENABLE([capabilities],
371 [AC_HELP_STRING([--disable-capabilities], [disable kernel capabilities])],
372 [], [enable_capabilities=yes])
374 # Check for libcap support
375 if test "x$enable_capabilities" = "xyes"; then
376 AC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
377 AC_MSG_CHECKING([linux capabilities])
378 if test "x$caplib" = "xyes" ; then
380 AC_MSG_RESULT([$CAP_LIBS])
383 AC_MSG_ERROR([You are missing libcap support. If you really want to build without kernel capabilities, use --disable-capabilities])
390 # Check for alternate C libraries
391 AC_MSG_CHECKING(for bionic libc)
392 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
393 [[#ifndef __ANDROID__
398 if test "x$is_bionic" = "xyes"; then
399 AC_DEFINE([IS_BIONIC], 1, [bionic libc])
404 AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
406 # Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
407 AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
409 # Check for some headers
410 AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
412 # Check for some syscalls functions
413 AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr])
415 # Check for some functions
416 AC_CHECK_LIB(util, openpty)
417 AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent])
418 AC_CHECK_FUNCS([getline],
419 AM_CONDITIONAL(HAVE_GETLINE, true)
420 AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
421 AM_CONDITIONAL(HAVE_GETLINE, false))
422 AC_CHECK_FUNCS([fgetln],
423 AM_CONDITIONAL(HAVE_FGETLN, true)
424 AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
425 AM_CONDITIONAL(HAVE_FGETLN, false))
427 # Check for some libraries
428 AC_SEARCH_LIBS(sem_open, [rt pthread])
429 AC_SEARCH_LIBS(clock_gettime, [rt])
431 # Check for some standard binaries
432 AC_PROG_GCC_TRADITIONAL
435 if test "x$GCC" = "xyes"; then
436 CFLAGS="$CFLAGS -Wall -Werror"
439 # Files requiring some variable expansion
448 doc/legacy/lxc-ls.sgml
451 doc/lxc-checkconfig.sgml
452 doc/lxc-checkpoint.sgml
467 doc/lxc-snapshot.sgml
468 doc/lxc-start-ephemeral.sgml
472 doc/lxc-unfreeze.sgml
479 doc/common_options.sgml
484 doc/examples/Makefile
485 doc/examples/lxc-macvlan.conf
486 doc/examples/lxc-vlan.conf
487 doc/examples/lxc-no-netns.conf
488 doc/examples/lxc-empty-netns.conf
489 doc/examples/lxc-phys.conf
490 doc/examples/lxc-veth.conf
491 doc/examples/lxc-complex.conf
494 doc/ja/legacy/lxc-ls.sgml
495 doc/ja/lxc-attach.sgml
496 doc/ja/lxc-cgroup.sgml
497 doc/ja/lxc-checkconfig.sgml
498 doc/ja/lxc-checkpoint.sgml
499 doc/ja/lxc-clone.sgml
500 doc/ja/lxc-console.sgml
501 doc/ja/lxc-create.sgml
502 doc/ja/lxc-destroy.sgml
503 doc/ja/lxc-device.sgml
504 doc/ja/lxc-execute.sgml
505 doc/ja/lxc-freeze.sgml
509 doc/ja/lxc-monitor.sgml
510 doc/ja/lxc-netstat.sgml
512 doc/ja/lxc-restart.sgml
513 doc/ja/lxc-snapshot.sgml
514 doc/ja/lxc-start-ephemeral.sgml
515 doc/ja/lxc-start.sgml
518 doc/ja/lxc-unfreeze.sgml
519 doc/ja/lxc-unshare.sgml
520 doc/ja/lxc-version.sgml
525 doc/ja/common_options.sgml
534 templates/lxc-ubuntu-cloud
535 templates/lxc-opensuse
536 templates/lxc-busybox
538 templates/lxc-openmandriva
540 templates/lxc-altlinux
542 templates/lxc-archlinux
550 src/lxc/lxc-checkconfig
552 src/lxc/lxc-start-ephemeral
553 src/lxc/legacy/lxc-ls
554 src/lxc/lxc.functions
556 src/python-lxc/Makefile
562 AC_CONFIG_COMMANDS([default],[[]],[[]])