2 # Process this file with autoconf to produce a configure script.
4 AC_INIT([lxc], [1.0.0.alpha1])
6 AC_CONFIG_SRCDIR([configure.ac])
7 AC_CONFIG_AUX_DIR([config])
8 AC_CONFIG_HEADERS([src/config.h])
9 AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects])
14 # Detect the distribution. This is used for the default configuration and
15 # for some distro-specific build options.
16 AC_MSG_CHECKING([host distribution])
17 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, mandriva or pardus.]))
18 if test "z$with_distro" = "z"; then
19 with_distro=`lsb_release -is`
21 if test "z$with_distro" = "z"; then
22 AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
23 AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle")
24 AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora")
25 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
26 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
27 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
28 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
29 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
30 AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware")
31 AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="mandriva")
32 AC_CHECK_FILE(/etc/mandriva-release,with_distro="mandriva")
33 AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
35 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
37 if test "z$with_distro" = "z"; then
42 distroconf=default.conf.ubuntu
44 redhat|fedora|oracle|oracleserver)
45 distroconf=default.conf.libvirt
48 echo -n "Linux distribution network config unknown, defaulting to lxc.network.type = empty"
49 distroconf=default.conf.unknown
52 AC_MSG_RESULT([$with_distro])
53 AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu"])
55 # Detect the newuidmap tool (required for userns)
56 AC_CHECK_PROG([NEWUIDMAP], [newuidmap], [newuidmap])
57 AM_CONDITIONAL([HAVE_NEWUIDMAP], [test -n "$NEWUIDMAP"])
59 # Allow disabling rpath
60 AC_ARG_ENABLE([rpath],
61 [AC_HELP_STRING([--disable-rpath], [do not set rpath in executables])],
62 [], [enable_rpath=yes])
63 AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
65 # Documentation (manpages)
67 [AC_HELP_STRING([--enable-doc], [make mans (requires docbook2man or docbook2x-man to be installed) [default=auto]])],
68 [], [enable_doc=auto])
70 if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
72 dbparsers="docbook2x-man db2x_docbook2man docbook2man"
74 AC_MSG_CHECKING(for docbook2x-man)
75 for name in ${dbparsers}; do
76 if "$name" --help >/dev/null 2>&1; then
82 if test -n "${db2xman}"; then
83 AC_MSG_RESULT([${db2xman}])
86 if test "x$enable_doc" = "xyes"; then
87 AC_MSG_ERROR([docbook2x-man required by man request, but not found])
93 AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
94 AM_CONDITIONAL([USE_DOCBOOK2X], [test "x$db2xman" != "xdocbook2man"])
96 if test "x$db2xman" = "xdocbook2man"; then
97 docdtd="\"-//Davenport//DTD DocBook V3.0//EN\""
99 docdtd="\"-//OASIS//DTD DocBook XML\" \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""
104 AC_ARG_ENABLE([apparmor],
105 [AC_HELP_STRING([--enable-apparmor], [enable apparmor])],
106 [], [enable_apparmor=check])
108 if test "$enable_apparmor" = "check" ; then
109 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
111 AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
113 AC_CHECK_LIB([gnutls], [gnutls_hash_fast])
115 AM_COND_IF([ENABLE_APPARMOR],
116 [AC_CHECK_HEADER([sys/apparmor.h],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
117 AC_CHECK_LIB([apparmor], [aa_change_profile],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
118 AC_SUBST([APPARMOR_LIBS], [-lapparmor])])
121 AC_ARG_ENABLE([selinux],
122 [AC_HELP_STRING([--enable-selinux], [enable SELinux support])],
123 [], [enable_selinux=check])
125 if test "x$enable_selinux" = xcheck; then
126 AC_CHECK_LIB([selinux],[setexeccon_raw],[enable_selinux=yes],[enable_selinux=no])
128 AM_CONDITIONAL([ENABLE_SELINUX], [test "x$enable_selinux" = "xyes"])
129 AM_COND_IF([ENABLE_SELINUX],
130 [AC_CHECK_HEADER([selinux/selinux.h],[],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
131 AC_CHECK_LIB([selinux], [setexeccon_raw],[],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
132 AC_SUBST([SELINUX_LIBS])])
134 # Seccomp syscall filter
135 AC_ARG_ENABLE([seccomp],
136 [AC_HELP_STRING([--enable-seccomp], [enable seccomp])],
137 [], [enable_seccomp=check])
139 if test "$enable_seccomp" = "check" ; then
140 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
142 AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
144 AM_COND_IF([ENABLE_SECCOMP],
145 [AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
146 AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
147 AC_SUBST([SECCOMP_LIBS], [-lseccomp])])
149 # HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
150 AC_CHECK_TYPES([scmp_filter_ctx], [], [], [#include <seccomp.h>])
152 # Configuration examples
153 AC_ARG_ENABLE([examples],
154 [AC_HELP_STRING([--disable-examples], [do not install configuration examples])],
155 [], [enable_examples=yes])
156 AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
158 # Python3 module and scripts
159 AC_ARG_ENABLE([python],
160 [AC_HELP_STRING([--enable-python], [enable python binding])],
161 [enable_python=yes], [enable_python=no])
162 AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
164 AM_COND_IF([ENABLE_PYTHON],
165 [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])])
166 PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[],[AC_MSG_ERROR([You must install python3-dev])])
167 AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
169 # Not in older autoconf versions
170 # AS_VAR_COPY(DEST, SOURCE)
171 # -------------------------
172 # Set the polymorphic shell variable DEST to the contents of the polymorphic
173 # shell variable SOURCE.
174 m4_ifdef([AS_VAR_COPY], [],
175 [AC_DEFUN([AS_VAR_COPY],
176 [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
179 dnl PKG_CHECK_VAR was introduced with pkg-config 0.28
180 m4_ifdef([PKG_CHECK_VAR], [],
181 [AC_DEFUN([PKG_CHECK_VAR],
182 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
183 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
184 _PKG_CONFIG([$1], [variable="][$3]["], [$2])
185 AS_VAR_COPY([$1], [pkg_cv_][$1])
186 AS_VAR_IF([$1], [""], [$5], [$4])dnl
190 # Lua module and scripts
192 [AC_HELP_STRING([--enable-lua], [enable lua binding])],
193 [], [enable_lua=check])
195 AC_ARG_WITH([lua-pc],
198 [Specify pkg-config package name for lua]
199 )], [], [with_lua_pc=no])
201 if test "x$enable_lua" = "xyes" -a "x$with_lua_pc" != "xno"; then
202 # exit with error if not found
203 PKG_CHECK_MODULES([LUA], [$with_lua_pc], [LUAPKGCONFIG=$with_lua_pc])
206 if test "x$enable_lua" = "xcheck" -a "x$with_lua_pc" != "xno"; then
207 PKG_CHECK_MODULES([LUA], [$with_lua_pc],
208 [LUAPKGCONFIG=$with_lua_pc
213 if test "x$enable_lua" != "xno"; then
214 PKG_CHECK_MODULES([LUA], [lua], [LUAPKGCONFIG=lua],
215 [PKG_CHECK_MODULES([LUA], [lua5.2], [LUAPKGCONFIG=lua5.2],
216 [PKG_CHECK_MODULES([LUA], [lua5.1], [LUAPKGCONFIG=lua5.1],
217 [AS_IF([test "x$enable_lua" = "xyes"],
218 [AC_MSG_ERROR([Lua not found. Please use --with-lua-pc=PKG])],
222 AS_IF([test "x$LUAPKGCONFIG" != "x"], [enable_lua=yes])
225 AM_CONDITIONAL([ENABLE_LUA],
226 [test "x$enable_lua" = "xyes"])
228 AM_COND_IF([ENABLE_LUA],
229 [AC_MSG_CHECKING([Lua version])
230 PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [V],,
231 [PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [major_version])])
232 AC_MSG_RESULT([$LUA_VERSION])
233 PKG_CHECK_VAR([LUA_INSTALL_CMOD], [$LUAPKGCONFIG], [INSTALL_CMOD],,
234 [LUA_INSTALL_CMOD=$libdir/lua/$LUA_VERSION])
235 PKG_CHECK_VAR([LUA_INSTALL_LMOD], [$LUAPKGCONFIG], [INSTALL_LMOD],,
236 [LUA_INSTALL_LMOD=$datadir/lua/$LUA_VERSION])
239 # Optional test binaries
240 AC_ARG_ENABLE([tests],
241 [AC_HELP_STRING([--enable-tests], [build test/example binaries])],
242 [enable_tests=yes], [enable_tests=no])
243 AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
245 # LXC container path, where the containers are actually stored
246 # This is overridden by an entry in the file called LXCCONF
247 # (i.e. /etc/lxc/lxc.conf)
248 AC_ARG_WITH([config-path],
250 [--with-config-path=dir],
251 [lxc configuration repository path]
252 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
254 # The path of the global lxc configuration file.
255 AC_ARG_WITH([global-conf],
257 [--with-global-conf=dir],
258 [global lxc configuration file]
259 )], [], [with_global_conf=['${sysconfdir}/lxc/lxc.conf']])
261 # The path of the userns network configuration file
262 AC_ARG_WITH([usernic-conf],
264 [--with-usernic-conf],
265 [user network interface configuration file]
266 )], [], [with_usernic_conf=['${sysconfdir}/lxc/lxc-usernet']])
268 # The path of the runtime usernic database
269 AC_ARG_WITH([usernic-db],
272 [lxc user nic database]
273 )], [], [with_usernic_db=['/run/lxc/nics']])
275 # Rootfs path, where the container mount structure is assembled
276 AC_ARG_WITH([rootfs-path],
278 [--with-rootfs-path=dir],
279 [lxc rootfs mount point]
280 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
282 # cgroup pattern specification
283 AC_ARG_WITH([cgroup-pattern],
285 [--with-cgroup-pattern=pattern],
286 [pattern for container cgroups]
287 )], [], [with_cgroup_pattern=['/lxc/%n']])
289 # Container log path. By default, use $lxcpath.
290 AC_MSG_CHECKING([Whether to place logfiles in container config path])
291 AC_ARG_ENABLE([configpath-log],
292 [AC_HELP_STRING([--enable-configpath-log], [use logfiles in config path])],
293 [use_configpath_logs=yes], [use_configpath_logs=no])
294 AC_MSG_RESULT([$use_configpath_logs])
295 AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$use_configpath_logs" = "yes"])
297 if test "$use_configpath_logs" = "yes"; then
298 default_log_path="${with_config_path}"
300 default_log_path="${localstatedir}/log/lxc"
303 AC_ARG_WITH([log-path],
305 [--with-log-path=dir],
306 [per container log path]
307 )], [], [with_log_path=['${default_log_path}']])
309 # Expand some useful variables
310 AS_AC_EXPAND(PREFIX, "$prefix")
311 AS_AC_EXPAND(LIBDIR, "$libdir")
312 AS_AC_EXPAND(BINDIR, "$bindir")
313 AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
314 AS_AC_EXPAND(INCLUDEDIR, "$includedir")
315 AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
316 AS_AC_EXPAND(LXC_DEFAULT_CONFIG, "$sysconfdir/lxc/default.conf")
317 AS_AC_EXPAND(DATADIR, "$datadir")
318 AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
319 AS_AC_EXPAND(DOCDIR, "$docdir")
320 AS_AC_EXPAND(LXC_DISTRO_CONF, "$distroconf")
321 AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
322 AS_AC_EXPAND(LXCPATH, "$with_config_path")
323 AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf")
324 AS_AC_EXPAND(LXC_USERNIC_CONF, "$with_usernic_conf")
325 AS_AC_EXPAND(LXC_USERNIC_DB, "$with_usernic_db")
326 AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
327 AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
328 AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
329 AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
330 AS_AC_EXPAND(LOGPATH, "$with_log_path")
331 AC_SUBST(DEFAULT_CGROUP_PATTERN, ["$with_cgroup_pattern"])
333 # Check for some standard kernel headers
334 AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
336 AC_MSG_ERROR([Please install the Linux kernel headers.]),
337 [#include <sys/socket.h>])
339 # Allow disabling libcap support
340 AC_ARG_ENABLE([capabilities],
341 [AC_HELP_STRING([--disable-capabilities], [disable kernel capabilities])],
342 [], [enable_capabilities=yes])
344 # Check for libcap support
345 if test "x$enable_capabilities" = "xyes"; then
346 AC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
347 AC_MSG_CHECKING([linux capabilities])
348 if test "x$caplib" = "xyes" ; then
350 AC_MSG_RESULT([$CAP_LIBS])
353 AC_MSG_ERROR([You are missing libcap support. If you really want to build without kernel capabilities, use --disable-capabilities])
360 # Check for alternate C libraries
361 AC_MSG_CHECKING(for bionic libc)
362 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
363 [[#ifndef __ANDROID__
368 if test "x$is_bionic" = "xyes"; then
369 AC_DEFINE([IS_BIONIC], 1, [bionic libc])
374 AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
376 # Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
377 AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
379 # Check for some headers
380 AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
382 # Check for some syscalls functions
383 AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr])
385 # Check for some functions
386 AC_CHECK_LIB(util, openpty)
387 AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent])
388 AC_CHECK_FUNCS([getline],
389 AM_CONDITIONAL(HAVE_GETLINE, true)
390 AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
391 AM_CONDITIONAL(HAVE_GETLINE, false))
392 AC_CHECK_FUNCS([fgetln],
393 AM_CONDITIONAL(HAVE_FGETLN, true)
394 AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
395 AM_CONDITIONAL(HAVE_FGETLN, false))
397 # Check for some libraries
398 AC_SEARCH_LIBS(sem_open, [rt pthread])
399 AC_SEARCH_LIBS(clock_gettime, [rt])
401 # Check for some standard binaries
402 AC_PROG_GCC_TRADITIONAL
405 if test "x$GCC" = "xyes"; then
406 CFLAGS="$CFLAGS -Wall -Werror"
409 # Files requiring some variable expansion
417 doc/legacy/lxc-ls.sgml
420 doc/lxc-checkconfig.sgml
421 doc/lxc-checkpoint.sgml
436 doc/lxc-snapshot.sgml
437 doc/lxc-start-ephemeral.sgml
441 doc/lxc-unfreeze.sgml
448 doc/common_options.sgml
453 doc/examples/Makefile
454 doc/examples/lxc-macvlan.conf
455 doc/examples/lxc-vlan.conf
456 doc/examples/lxc-no-netns.conf
457 doc/examples/lxc-empty-netns.conf
458 doc/examples/lxc-phys.conf
459 doc/examples/lxc-veth.conf
460 doc/examples/lxc-complex.conf
463 doc/ja/legacy/lxc-ls.sgml
464 doc/ja/lxc-attach.sgml
465 doc/ja/lxc-cgroup.sgml
466 doc/ja/lxc-checkconfig.sgml
467 doc/ja/lxc-checkpoint.sgml
468 doc/ja/lxc-clone.sgml
469 doc/ja/lxc-console.sgml
470 doc/ja/lxc-create.sgml
471 doc/ja/lxc-destroy.sgml
472 doc/ja/lxc-device.sgml
473 doc/ja/lxc-execute.sgml
474 doc/ja/lxc-freeze.sgml
478 doc/ja/lxc-monitor.sgml
479 doc/ja/lxc-netstat.sgml
481 doc/ja/lxc-restart.sgml
482 doc/ja/lxc-start-ephemeral.sgml
483 doc/ja/lxc-start.sgml
486 doc/ja/lxc-unfreeze.sgml
487 doc/ja/lxc-unshare.sgml
488 doc/ja/lxc-version.sgml
493 doc/ja/common_options.sgml
502 templates/lxc-ubuntu-cloud
503 templates/lxc-opensuse
504 templates/lxc-busybox
507 templates/lxc-altlinux
509 templates/lxc-archlinux
516 src/lxc/lxc-checkconfig
518 src/lxc/lxc-start-ephemeral
519 src/lxc/legacy/lxc-ls
520 src/lxc/lxc.functions
522 src/python-lxc/Makefile
528 AC_CONFIG_COMMANDS([default],[[]],[[]])