2 # Process this file with autoconf to produce a configure script.
4 AC_INIT([lxc], [0.9.0.rc1])
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])
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 defaultconf=default.conf.ubuntu
44 redhat|fedora|oracle|oracleserver)
45 defaultconf=default.conf.libvirt
48 echo -n "Linux distribution network config unknown, defaulting to lxc.network.type = empty"
49 defaultconf=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 # Allow disabling rpath
56 AC_ARG_ENABLE([rpath],
57 [AC_HELP_STRING([--disable-rpath], [do not set rpath in executables])],
58 [], [enable_rpath=yes])
59 AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
61 # Documentation (manpages)
63 [AC_HELP_STRING([--enable-doc], [make mans (require docbook2x-man installed) [default=auto]])],
64 [], [enable_doc=auto])
66 if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
69 AC_MSG_CHECKING(for docbook2x-man)
70 for name in docbook2x-man db2x_docbook2man; do
71 if "$name" --help >/dev/null 2>&1; then
77 if test -n "${db2xman}"; then
78 AC_MSG_RESULT([${db2xman}])
81 if test "x$enable_doc" = "xyes"; then
82 AC_MSG_ERROR([docbook2x-man required by man request, but not found])
88 AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
91 AC_ARG_ENABLE([apparmor],
92 [AC_HELP_STRING([--enable-apparmor], [enable apparmor])],
93 [], [enable_apparmor=check])
95 if test "$enable_apparmor" = "check" ; then
96 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
98 AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
100 AM_COND_IF([ENABLE_APPARMOR],
101 [AC_CHECK_HEADER([sys/apparmor.h],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
102 AC_CHECK_LIB([apparmor], [aa_change_profile],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
103 AC_SUBST([APPARMOR_LIBS], [-lapparmor])])
105 # Seccomp syscall filter
106 AC_ARG_ENABLE([seccomp],
107 [AC_HELP_STRING([--enable-seccomp], [enable seccomp])],
108 [], [enable_seccomp=check])
110 if test "$enable_seccomp" = "check" ; then
111 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
113 AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
115 AM_COND_IF([ENABLE_SECCOMP],
116 [AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
117 AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
118 AC_SUBST([SECCOMP_LIBS], [-lseccomp])])
120 # HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
121 AC_CHECK_TYPES([scmp_filter_ctx], [], [], [#include <seccomp.h>])
123 # Configuration examples
124 AC_ARG_ENABLE([examples],
125 [AC_HELP_STRING([--disable-examples], [do not install configuration examples])],
126 [], [enable_examples=yes])
127 AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
129 # Python3 module and scripts
130 AC_ARG_ENABLE([python],
131 [AC_HELP_STRING([--enable-python], [enable python binding])],
132 [enable_python=yes], [enable_python=no])
133 AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
135 AM_COND_IF([ENABLE_PYTHON],
136 [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])])
137 PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[],[AC_MSG_ERROR([You must install python3-dev])])
138 AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
140 # Lua module and scripts
141 if test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu" ; then
148 [AC_HELP_STRING([--enable-lua], [enable lua binding])],
149 [enable_lua=yes], [enable_lua=no])
151 AM_CONDITIONAL([ENABLE_LUA], [test "x$enable_lua" = "xyes"])
153 AM_COND_IF([ENABLE_LUA],
154 [PKG_CHECK_MODULES([LUA], [$LUAPKGCONFIG >= 5.1],[],[AC_MSG_ERROR([You must install lua-devel for lua 5.1])])
155 AC_DEFINE_UNQUOTED([ENABLE_LUA], 1, [Lua is available])])
157 # Optional test binaries
158 AC_ARG_ENABLE([tests],
159 [AC_HELP_STRING([--enable-tests], [build test/example binaries])],
160 [enable_tests=yes], [enable_tests=no])
161 AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
163 # LXC container path, where the containers are actually stored
164 # This is overridden by an entry in the file called LXCCONF
165 # (i.e. /etc/lxc/lxc.conf)
166 AC_ARG_WITH([config-path],
168 [--with-config-path=dir],
169 [lxc configuration repository path]
170 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
172 # The path of the global lxc configuration file.
173 AC_ARG_WITH([global-conf],
175 [--with-global-conf=dir],
176 [global lxc configuration file]
177 )], [], [with_global_conf=['${sysconfdir}/lxc/lxc.conf']])
179 # Rootfs path, where the container mount structure is assembled
180 AC_ARG_WITH([rootfs-path],
182 [--with-rootfs-path=dir],
183 [lxc rootfs mount point]
184 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
186 # Container log path. By default, use $lxcpath.
187 AC_MSG_CHECKING([Whether to place logfiles in container config path])
188 AC_ARG_ENABLE([configpath-log],
189 [AC_HELP_STRING([--enable-configpath-log], [use logfiles in config path])],
190 [use_configpath_logs=yes], [use_configpath_logs=no])
191 AC_MSG_RESULT([$use_configpath_logs])
192 AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$use_configpath_logs" = "yes"])
194 if test "$use_configpath_logs" = "yes"; then
195 default_log_path="${with_config_path}"
197 default_log_path="${localstatedir}/log/lxc"
200 AC_ARG_WITH([log-path],
202 [--with-log-path=dir],
203 [per container log path]
204 )], [], [with_log_path=['${default_log_path}']])
206 # Expand some useful variables
207 AS_AC_EXPAND(PREFIX, "$prefix")
208 AS_AC_EXPAND(LIBDIR, "$libdir")
209 AS_AC_EXPAND(BINDIR, "$bindir")
210 AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
211 AS_AC_EXPAND(INCLUDEDIR, "$includedir")
212 AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
213 AS_AC_EXPAND(DATADIR, "$datadir")
214 AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
215 AS_AC_EXPAND(DOCDIR, "$docdir")
216 AS_AC_EXPAND(LXC_DEFAULT_CONF, "$defaultconf")
217 AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
218 AS_AC_EXPAND(LXCPATH, "$with_config_path")
219 AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf")
220 AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
221 AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
222 AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
223 AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
224 AS_AC_EXPAND(LOGPATH, "$with_log_path")
226 # Check for some standard kernel headers
227 AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
229 AC_MSG_ERROR([Please install the Linux kernel headers.]),
230 [#include <sys/socket.h>])
232 # Allow disabling libcap support
233 AC_ARG_ENABLE([capabilities],
234 [AC_HELP_STRING([--disable-capabilities], [disable kernel capabilities])],
235 [], [enable_capabilities=yes])
237 # Check for libcap support
238 if test "x$enable_capabilities" = "xyes"; then
239 AC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
240 AC_MSG_CHECKING([linux capabilities])
241 if test "x$caplib" = "xyes" ; then
243 AC_MSG_RESULT([$CAP_LIBS])
246 AC_MSG_ERROR([You are missing libcap support. If you really want to build without kernel capabilities, use --disable-capabilities])
253 # Check for alternate C libraries
254 AC_MSG_CHECKING(for bionic libc)
255 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
256 [[#ifndef __ANDROID__
261 if test "x$is_bionic" = "xyes"; then
262 AC_DEFINE([IS_BIONIC], 1, [bionic libc])
267 AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
269 # Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
270 AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
272 # Check for some headers
273 AC_CHECK_HEADERS([sys/signalfd.h pty.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
275 # Check for some syscalls functions
276 AC_CHECK_FUNCS([setns pivot_root sethostname unshare])
278 # Check for some functions
279 AC_CHECK_LIB(util, openpty)
280 AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent])
281 AC_CHECK_FUNCS([getline],
282 AM_CONDITIONAL(HAVE_GETLINE, true)
283 AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
284 AM_CONDITIONAL(HAVE_GETLINE, false))
285 AC_CHECK_FUNCS([fgetln],
286 AM_CONDITIONAL(HAVE_FGETLN, true)
287 AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
288 AM_CONDITIONAL(HAVE_FGETLN, false))
290 # Check for some libraries
291 AC_SEARCH_LIBS(sem_open, [rt pthread])
292 AC_SEARCH_LIBS(clock_gettime, [rt])
294 # Check for some standard binaries
295 AC_PROG_GCC_TRADITIONAL
298 if test "x$GCC" = "xyes"; then
299 CFLAGS="$CFLAGS -Wall -Werror"
302 # Files requiring some variable expansion
310 doc/legacy/lxc-ls.sgml
313 doc/lxc-checkconfig.sgml
314 doc/lxc-checkpoint.sgml
329 doc/lxc-shutdown.sgml
330 doc/lxc-start-ephemeral.sgml
334 doc/lxc-unfreeze.sgml
341 doc/common_options.sgml
346 doc/examples/Makefile
347 doc/examples/lxc-macvlan.conf
348 doc/examples/lxc-vlan.conf
349 doc/examples/lxc-no-netns.conf
350 doc/examples/lxc-empty-netns.conf
351 doc/examples/lxc-phys.conf
352 doc/examples/lxc-veth.conf
353 doc/examples/lxc-complex.conf
360 templates/lxc-ubuntu-cloud
361 templates/lxc-opensuse
362 templates/lxc-busybox
365 templates/lxc-altlinux
367 templates/lxc-archlinux
374 src/lxc/lxc-checkconfig
379 src/lxc/lxc-start-ephemeral
381 src/lxc/legacy/lxc-ls
382 src/lxc/lxc.functions
384 src/python-lxc/Makefile
390 AC_CONFIG_COMMANDS([default],[[]],[[]])