]> git.proxmox.com Git - mirror_lxc.git/blame - configure.ac
snapshot: enforce keeping same backing store type (v2)
[mirror_lxc.git] / configure.ac
CommitLineData
5e97c3fc 1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
9588a6ce
SH
4m4_define([lxc_version_major], 1)
5m4_define([lxc_version_minor], 0)
6m4_define([lxc_version_micro], 0)
713893cd 7m4_define([lxc_version_beta], [beta1])
9588a6ce
SH
8
9m4_define([lxc_version_base], [lxc_version_major.lxc_version_minor.lxc_version_micro])
10m4_define([lxc_version],
11 [ifelse(lxc_version_beta, [], [lxc_version_base], [lxc_version_base.lxc_version_beta])])
12
13AC_INIT([lxc], [lxc_version])
14AC_SUBST(LXC_VERSION_BASE, lxc_version_base)
15AC_SUBST(LXC_VERSION_BETA, lxc_version_beta)
5e97c3fc 16
a22185dd
ÇO
17AC_SUBST([LXC_VERSION_MAJOR], [lxc_version_major])
18AC_SUBST([LXC_VERSION_MINOR], [lxc_version_minor])
19AC_SUBST([LXC_VERSION_MICRO], [lxc_version_micro])
20AC_SUBST([LXC_VERSION], [lxc_version])
21
f8dafdbb 22AC_CONFIG_SRCDIR([configure.ac])
5e97c3fc 23AC_CONFIG_AUX_DIR([config])
067cfaeb 24AC_CONFIG_HEADERS([src/config.h])
d007f8ab 25AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects])
5e97c3fc 26AC_CANONICAL_HOST
5e97c3fc 27AM_PROG_CC_C_O
28AC_GNU_SOURCE
5c8f9bd8 29
8aa4885c
SG
30# Detect the distribution. This is used for the default configuration and
31# for some distro-specific build options.
6f75ba0b 32AC_MSG_CHECKING([host distribution])
164105f6 33AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, oracle, centos, fedora, suse, gentoo, debian, arch, slackware, paldo, openmandriva or pardus.]))
6f75ba0b
DE
34if test "z$with_distro" = "z"; then
35 with_distro=`lsb_release -is`
be2e4e54 36fi
6f75ba0b
DE
37if test "z$with_distro" = "z"; then
38 AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
39 AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle")
164105f6 40 AC_CHECK_FILE(/etc/centos-release,with_distro="centos")
6f75ba0b
DE
41 AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora")
42 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
43 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
44 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
45 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
46 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
47 AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware")
6e7e54d9
AK
48 AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="openmandriva")
49 AC_CHECK_FILE(/etc/mandriva-release,with_distro="openmandriva")
6f75ba0b
DE
50 AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
51fi
52with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
53
54if test "z$with_distro" = "z"; then
55 with_distro="unknown"
56fi
57case $with_distro in
58 ubuntu)
3a647d58 59 distroconf=default.conf.ubuntu
6f75ba0b 60 ;;
164105f6 61 redhat|centos|fedora|oracle|oracleserver)
3a647d58 62 distroconf=default.conf.libvirt
6f75ba0b
DE
63 ;;
64 *)
65 echo -n "Linux distribution network config unknown, defaulting to lxc.network.type = empty"
3a647d58 66 distroconf=default.conf.unknown
6f75ba0b
DE
67 ;;
68esac
69AC_MSG_RESULT([$with_distro])
6f75ba0b 70AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu"])
025f59ab 71AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
be2e4e54 72
8aa4885c 73# Allow disabling rpath
1c41ddcb 74AC_ARG_ENABLE([rpath],
f91d5e4e
SG
75 [AC_HELP_STRING([--enable-rpath], [set rpath in executables [default=no]])],
76 [], [enable_rpath=no])
1c41ddcb
GK
77AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
78
8aa4885c 79# Documentation (manpages)
5c8f9bd8 80AC_ARG_ENABLE([doc],
f91d5e4e 81 [AC_HELP_STRING([--enable-doc], [make man pages [default=auto]])],
5c8f9bd8
AN
82 [], [enable_doc=auto])
83
84if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
7822022c 85 db2xman=""
7f951458 86 dbparsers="docbook2x-man db2x_docbook2man docbook2man"
69fe23ff 87
7822022c 88 AC_MSG_CHECKING(for docbook2x-man)
69fe23ff 89 for name in ${dbparsers}; do
7822022c
SG
90 if "$name" --help >/dev/null 2>&1; then
91 db2xman="$name"
92 break;
93 fi
94 done
95
96 if test -n "${db2xman}"; then
8aa4885c 97 AC_MSG_RESULT([${db2xman}])
f91d5e4e 98 enable_doc="yes"
7822022c 99 else
8aa4885c 100 AC_MSG_RESULT([no])
7822022c 101 if test "x$enable_doc" = "xyes"; then
f91d5e4e 102 AC_MSG_ERROR([docbook2x-man is required, but could not be found])
7822022c 103 fi
f91d5e4e 104 enable_doc="no"
7822022c
SG
105 fi
106
107 AC_SUBST(db2xman)
5c8f9bd8 108fi
8aa4885c 109AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
7cb14f34 110AM_CONDITIONAL([USE_DOCBOOK2X], [test "x$db2xman" != "xdocbook2man"])
5c8f9bd8 111
7f951458
DE
112if test "x$db2xman" = "xdocbook2man"; then
113 docdtd="\"-//Davenport//DTD DocBook V3.0//EN\""
114else
115 docdtd="\"-//OASIS//DTD DocBook XML\" \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""
116fi
117AC_SUBST(docdtd)
118
953e611c
JH
119# Documentation (API)
120AC_ARG_ENABLE([api-docs],
121 [AC_HELP_STRING([--enable-api-docs],
f91d5e4e 122 [make API documentation [default=auto]])],
953e611c
JH
123 [], [enable_api_docs=auto])
124
125if test "x$enable_api_docs" = "xyes" -o "x$enable_api_docs" = "xauto"; then
f91d5e4e
SG
126 AC_CHECK_PROGS([HAVE_DOXYGEN],[doxygen])
127 AC_SUBST([HAVE_DOXYGEN])
128
129 if test "x$HAVE_DOXYGEN" != "x"; then
130 enable_api_docs="yes"
131 else
132 if test "x$enable_api_docs" = "xyes"; then
133 AC_MSG_ERROR([doxygen is required, but could not be found])
134 fi
135 enable_api_docs="no"
136 fi
953e611c
JH
137fi
138
f91d5e4e 139AM_CONDITIONAL([ENABLE_API_DOCS], [test "x$HAVE_DOXYGEN" != "x"])
953e611c 140
8aa4885c 141# Apparmor
e767dd55 142AC_ARG_ENABLE([apparmor],
f91d5e4e
SG
143 [AC_HELP_STRING([--enable-apparmor], [enable apparmor support [default=auto]])],
144 [], [enable_apparmor=auto])
e767dd55 145
f91d5e4e 146if test "$enable_apparmor" = "auto" ; then
e767dd55
SH
147 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
148fi
e767dd55
SH
149AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
150
d8d44659 151AC_CHECK_LIB([gnutls], [gnutls_hash_fast], [enable_gnutls=yes], [enable_gnutls=no])
3ce74686 152
e075f5d9 153AM_COND_IF([ENABLE_APPARMOR],
8aa4885c
SG
154 [AC_CHECK_HEADER([sys/apparmor.h],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
155 AC_CHECK_LIB([apparmor], [aa_change_profile],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
156 AC_SUBST([APPARMOR_LIBS], [-lapparmor])])
e075f5d9 157
fe4de9a6
DE
158# SELinux
159AC_ARG_ENABLE([selinux],
f91d5e4e
SG
160 [AC_HELP_STRING([--enable-selinux], [enable SELinux support [default=auto]])],
161 [], [enable_selinux=auto])
fe4de9a6 162
f91d5e4e 163if test "x$enable_selinux" = xauto; then
fe4de9a6
DE
164 AC_CHECK_LIB([selinux],[setexeccon_raw],[enable_selinux=yes],[enable_selinux=no])
165fi
166AM_CONDITIONAL([ENABLE_SELINUX], [test "x$enable_selinux" = "xyes"])
167AM_COND_IF([ENABLE_SELINUX],
168 [AC_CHECK_HEADER([selinux/selinux.h],[],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
169 AC_CHECK_LIB([selinux], [setexeccon_raw],[],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
170 AC_SUBST([SELINUX_LIBS])])
171
8aa4885c 172# Seccomp syscall filter
e767dd55 173AC_ARG_ENABLE([seccomp],
f91d5e4e
SG
174 [AC_HELP_STRING([--enable-seccomp], [enable seccomp support [default=auto]])],
175 [], [enable_seccomp=auto])
e767dd55 176
f91d5e4e 177if test "x$enable_seccomp" = "xauto" ; then
e767dd55
SH
178 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
179fi
e767dd55
SH
180AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
181
8f2c3a70 182AM_COND_IF([ENABLE_SECCOMP],
8aa4885c
SG
183 [AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
184 AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
185 AC_SUBST([SECCOMP_LIBS], [-lseccomp])])
8f2c3a70 186
f91d5e4e
SG
187# Linux capabilities
188AC_ARG_ENABLE([capabilities],
189 [AC_HELP_STRING([--enable-capabilities], [enable kernel capabilities support [default=auto]])],
190 [], [enable_capabilities=auto])
191
192if test "x$enable_capabilities" = "xauto"; then
193 AC_CHECK_LIB([cap],[cap_set_proc],[enable_capabilities=yes],[enable_capabilities=no])
194fi
195AM_CONDITIONAL([ENABLE_CAP], [test "x$enable_capabilities" = "xyes"])
196
197AM_COND_IF([ENABLE_CAP],
198 [AC_CHECK_LIB(cap,cap_set_proc,[],[AC_MSG_ERROR([You are missing libcap support.])])
199 AC_SUBST([CAP_LIBS], [-lcap])])
200
769872f9 201# HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
f91d5e4e 202AC_CHECK_TYPES([scmp_filter_ctx], [], [], [[#include <seccomp.h>]])
769872f9 203
8aa4885c 204# Configuration examples
3fb0a9bb 205AC_ARG_ENABLE([examples],
f91d5e4e 206 [AC_HELP_STRING([--enable-examples], [install examples [default=yes]])],
3fb0a9bb 207 [], [enable_examples=yes])
3fb0a9bb
AN
208AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
209
f91d5e4e
SG
210# We need pkg-config
211PKG_PROG_PKG_CONFIG
212
8aa4885c 213# Python3 module and scripts
be2e4e54 214AC_ARG_ENABLE([python],
f91d5e4e
SG
215 [AC_HELP_STRING([--enable-python], [enable python binding [default=auto]])],
216 [], [enable_python=auto])
217
218if test "x$enable_python" = "xauto"; then
219 PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[enable_python=yes],[enable_python=no])
2bc93759
SG
220 if test "$CC" = "clang"; then
221 enable_python=no
222 fi
223fi
224
225if test "x$enable_python" = "xyes" && test "$CC" = "clang"; then
226 AC_MSG_ERROR([Python3 is incompatible with the clang compiler])
f91d5e4e
SG
227fi
228
be2e4e54
SG
229AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
230
231AM_COND_IF([ENABLE_PYTHON],
8aa4885c 232 [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])])
59ec0a36 233 PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[],[AC_MSG_ERROR([You must install python3-dev])])
8aa4885c 234 AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
be2e4e54 235
052616eb
ÇO
236# Enable dumping stack traces
237AC_ARG_ENABLE([mutex-debugging],
f91d5e4e
SG
238 [AC_HELP_STRING([--enable-mutex-debugging], [Makes mutexes to report error and provide stack trace [default=no]])],
239 [], [enable_mutex_debugging=no])
052616eb
ÇO
240AM_CONDITIONAL([MUTEX_DEBUGGING], [test "x$enable_mutex_debugging" = "xyes"])
241
242AM_COND_IF([MUTEX_DEBUGGING],
243 AC_DEFINE_UNQUOTED([MUTEX_DEBUGGING], 1, [Enabling mutex debugging]))
244
3a1675bf
DE
245# Not in older autoconf versions
246# AS_VAR_COPY(DEST, SOURCE)
247# -------------------------
248# Set the polymorphic shell variable DEST to the contents of the polymorphic
249# shell variable SOURCE.
250m4_ifdef([AS_VAR_COPY], [],
251[AC_DEFUN([AS_VAR_COPY],
252 [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
253])
254
12e93188
NC
255dnl PKG_CHECK_VAR was introduced with pkg-config 0.28
256m4_ifdef([PKG_CHECK_VAR], [],
257[AC_DEFUN([PKG_CHECK_VAR],
258 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
259 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
260 _PKG_CONFIG([$1], [variable="][$3]["], [$2])
261 AS_VAR_COPY([$1], [pkg_cv_][$1])
262 AS_VAR_IF([$1], [""], [$5], [$4])dnl
263 ])# PKG_CHECK_VAR
264])
f080ffd7 265
12e93188 266# Lua module and scripts
f080ffd7 267AC_ARG_ENABLE([lua],
f91d5e4e
SG
268 [AC_HELP_STRING([--enable-lua], [enable lua binding [default=auto]])],
269 [], [enable_lua=auto])
f080ffd7 270
12e93188
NC
271AC_ARG_WITH([lua-pc],
272 [AS_HELP_STRING(
273 [--with-lua-pc=PKG],
274 [Specify pkg-config package name for lua]
f756cda0
NC
275 )], [], [with_lua_pc=no])
276
277if test "x$enable_lua" = "xyes" -a "x$with_lua_pc" != "xno"; then
278 # exit with error if not found
279 PKG_CHECK_MODULES([LUA], [$with_lua_pc], [LUAPKGCONFIG=$with_lua_pc])
280fi
281
f91d5e4e 282if test "x$enable_lua" = "xauto" -a "x$with_lua_pc" != "xno"; then
f756cda0
NC
283 PKG_CHECK_MODULES([LUA], [$with_lua_pc],
284 [LUAPKGCONFIG=$with_lua_pc
285 enable_lua=yes],
286 [enable_lua=no])
287fi
288
289if test "x$enable_lua" != "xno"; then
290 PKG_CHECK_MODULES([LUA], [lua], [LUAPKGCONFIG=lua],
291 [PKG_CHECK_MODULES([LUA], [lua5.2], [LUAPKGCONFIG=lua5.2],
292 [PKG_CHECK_MODULES([LUA], [lua5.1], [LUAPKGCONFIG=lua5.1],
293 [AS_IF([test "x$enable_lua" = "xyes"],
294 [AC_MSG_ERROR([Lua not found. Please use --with-lua-pc=PKG])],
295 [enable_lua=no])]
296 )]
297 )])
298 AS_IF([test "x$LUAPKGCONFIG" != "x"], [enable_lua=yes])
299fi
12e93188
NC
300
301AM_CONDITIONAL([ENABLE_LUA],
69c757b3 302 [test "x$enable_lua" = "xyes"])
f080ffd7
DE
303
304AM_COND_IF([ENABLE_LUA],
f756cda0 305 [AC_MSG_CHECKING([Lua version])
12e93188
NC
306 PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [V],,
307 [PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [major_version])])
308 AC_MSG_RESULT([$LUA_VERSION])
309 PKG_CHECK_VAR([LUA_INSTALL_CMOD], [$LUAPKGCONFIG], [INSTALL_CMOD],,
310 [LUA_INSTALL_CMOD=$libdir/lua/$LUA_VERSION])
311 PKG_CHECK_VAR([LUA_INSTALL_LMOD], [$LUAPKGCONFIG], [INSTALL_LMOD],,
312 [LUA_INSTALL_LMOD=$datadir/lua/$LUA_VERSION])
313 ])
f080ffd7 314
8aa4885c 315# Optional test binaries
525421c9 316AC_ARG_ENABLE([tests],
f91d5e4e
SG
317 [AC_HELP_STRING([--enable-tests], [build test/example binaries [default=no]])],
318 [], [enable_tests=no])
525421c9
SG
319AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
320
8aa4885c 321# LXC container path, where the containers are actually stored
fbf5de31 322# This is overridden by an entry in the file called LXCCONF
2a59a681 323# (i.e. /etc/lxc/lxc.conf)
aef4ebcf
AN
324AC_ARG_WITH([config-path],
325 [AC_HELP_STRING(
326 [--with-config-path=dir],
e892973e 327 [lxc configuration repository path]
1c41ddcb 328 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
aef4ebcf 329
2a59a681
SH
330# The path of the global lxc configuration file.
331AC_ARG_WITH([global-conf],
332 [AC_HELP_STRING(
333 [--with-global-conf=dir],
334 [global lxc configuration file]
335 )], [], [with_global_conf=['${sysconfdir}/lxc/lxc.conf']])
336
c75c30ec 337# The path of the userns network configuration file
070a4b8e
SH
338AC_ARG_WITH([usernic-conf],
339 [AC_HELP_STRING(
340 [--with-usernic-conf],
341 [user network interface configuration file]
342 )], [], [with_usernic_conf=['${sysconfdir}/lxc/lxc-usernet']])
343
c75c30ec 344# The path of the runtime usernic database
070a4b8e
SH
345AC_ARG_WITH([usernic-db],
346 [AC_HELP_STRING(
347 [--with-usernic-db],
348 [lxc user nic database]
349 )], [], [with_usernic_db=['/run/lxc/nics']])
350
8aa4885c 351# Rootfs path, where the container mount structure is assembled
196db713
DL
352AC_ARG_WITH([rootfs-path],
353 [AC_HELP_STRING(
354 [--with-rootfs-path=dir],
355 [lxc rootfs mount point]
1c41ddcb 356 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
c75c30ec 357
6e16552d
CS
358# cgroup pattern specification
359AC_ARG_WITH([cgroup-pattern],
360 [AC_HELP_STRING(
361 [--with-cgroup-pattern=pattern],
362 [pattern for container cgroups]
363 )], [], [with_cgroup_pattern=['/lxc/%n']])
196db713 364
5e1e7aaf
SH
365# Container log path. By default, use $lxcpath.
366AC_MSG_CHECKING([Whether to place logfiles in container config path])
367AC_ARG_ENABLE([configpath-log],
f91d5e4e
SG
368 [AC_HELP_STRING([--enable-configpath-log], [use logfiles in config path [default=no]])],
369 [], [enable_configpath_log=no])
370AC_MSG_RESULT([$enable_configpath_log])
371AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$enable_configpath_log" = "yes"])
5e1e7aaf 372
f91d5e4e 373if test "$enable_configpath_log" = "yes"; then
5e1e7aaf
SH
374 default_log_path="${with_config_path}"
375else
89d556d8 376 default_log_path="${localstatedir}/log/lxc"
5e1e7aaf
SH
377fi
378
379AC_ARG_WITH([log-path],
380 [AC_HELP_STRING(
381 [--with-log-path=dir],
382 [per container log path]
383 )], [], [with_log_path=['${default_log_path}']])
384
8aa4885c
SG
385# Expand some useful variables
386AS_AC_EXPAND(PREFIX, "$prefix")
387AS_AC_EXPAND(LIBDIR, "$libdir")
388AS_AC_EXPAND(BINDIR, "$bindir")
389AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
390AS_AC_EXPAND(INCLUDEDIR, "$includedir")
391AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
0a18b545 392AS_AC_EXPAND(LXC_DEFAULT_CONFIG, "$sysconfdir/lxc/default.conf")
8aa4885c
SG
393AS_AC_EXPAND(DATADIR, "$datadir")
394AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
395AS_AC_EXPAND(DOCDIR, "$docdir")
3a647d58 396AS_AC_EXPAND(LXC_DISTRO_CONF, "$distroconf")
aef4ebcf 397AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
8aa4885c 398AS_AC_EXPAND(LXCPATH, "$with_config_path")
2a59a681 399AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf")
070a4b8e
SH
400AS_AC_EXPAND(LXC_USERNIC_CONF, "$with_usernic_conf")
401AS_AC_EXPAND(LXC_USERNIC_DB, "$with_usernic_db")
8aa4885c
SG
402AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
403AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
f2a95ee1 404AS_AC_EXPAND(LXCTEMPLATECONFIG, "$datadir/lxc/config")
906f8c4d 405AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
8aa4885c 406AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
5e1e7aaf 407AS_AC_EXPAND(LOGPATH, "$with_log_path")
6e16552d 408AC_SUBST(DEFAULT_CGROUP_PATTERN, ["$with_cgroup_pattern"])
881450bb 409
8aa4885c 410# Check for some standard kernel headers
910bb4fa 411AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
8aa4885c
SG
412 [],
413 AC_MSG_ERROR([Please install the Linux kernel headers.]),
414 [#include <sys/socket.h>])
35f549fe 415
a6168a17
SG
416# Check for alternate C libraries
417AC_MSG_CHECKING(for bionic libc)
418AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
8aa4885c 419 [[#ifndef __ANDROID__
a6168a17
SG
420error: Not bionic!
421#endif]])],
8aa4885c
SG
422 [is_bionic=yes],
423 [is_bionic=no])
a6168a17 424if test "x$is_bionic" = "xyes"; then
8aa4885c
SG
425 AC_DEFINE([IS_BIONIC], 1, [bionic libc])
426 AC_MSG_RESULT([yes])
a6168a17 427else
8aa4885c 428 AC_MSG_RESULT([no])
a6168a17
SG
429fi
430AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
431
656994bb
MH
432# Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
433AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
434
e827ff7e 435# Check for some headers
4ba0d9af 436AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
ff218c25 437
2d76d1d7 438# Check for some syscalls functions
511a6936 439AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr])
2d76d1d7 440
e827ff7e 441# Check for some functions
740ee8c7 442AC_CHECK_LIB(util, openpty)
edaf8b1b 443AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent])
1ba0013f
SG
444AC_CHECK_FUNCS([getline],
445 AM_CONDITIONAL(HAVE_GETLINE, true)
446 AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
447 AM_CONDITIONAL(HAVE_GETLINE, false))
448AC_CHECK_FUNCS([fgetln],
449 AM_CONDITIONAL(HAVE_FGETLN, true)
450 AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
451 AM_CONDITIONAL(HAVE_FGETLN, false))
452
c9a84173
SG
453# Check for some libraries
454AC_SEARCH_LIBS(sem_open, [rt pthread])
336d5469 455AC_SEARCH_LIBS(clock_gettime, [rt])
c9a84173 456
8aa4885c 457# Check for some standard binaries
5e97c3fc 458AC_PROG_GCC_TRADITIONAL
95a717e9 459AC_PROG_SED
5e97c3fc 460
461if test "x$GCC" = "xyes"; then
8aa4885c 462 CFLAGS="$CFLAGS -Wall -Werror"
5e97c3fc 463fi
464
8aa4885c 465# Files requiring some variable expansion
5e97c3fc 466AC_CONFIG_FILES([
288063bd 467 Makefile
b6345ba1 468 lxc.pc
5e97c3fc 469 lxc.spec
f2a95ee1 470
288063bd 471 config/Makefile
f2a95ee1
SG
472 config/etc/Makefile
473 config/templates/Makefile
474 config/templates/ubuntu-cloud.common.conf
475 config/templates/ubuntu-cloud.lucid.conf
476 config/templates/ubuntu-cloud.userns.conf
477 config/templates/ubuntu.common.conf
478 config/templates/ubuntu.lucid.conf
d823d5b9 479
288063bd 480 doc/Makefile
953e611c 481 doc/api/Makefile
4019712d
SG
482 doc/legacy/lxc-ls.sgml
483 doc/lxc-attach.sgml
a6adab20 484 doc/lxc-autostart.sgml
4019712d
SG
485 doc/lxc-cgroup.sgml
486 doc/lxc-checkconfig.sgml
487 doc/lxc-checkpoint.sgml
11cddd70 488 doc/lxc-clone.sgml
4019712d 489 doc/lxc-console.sgml
d823d5b9 490 doc/lxc-create.sgml
491 doc/lxc-destroy.sgml
4019712d 492 doc/lxc-device.sgml
d823d5b9 493 doc/lxc-execute.sgml
d823d5b9 494 doc/lxc-freeze.sgml
4019712d
SG
495 doc/lxc-info.sgml
496 doc/lxc-kill.sgml
d823d5b9 497 doc/lxc-ls.sgml
4019712d
SG
498 doc/lxc-monitor.sgml
499 doc/lxc-netstat.sgml
d823d5b9 500 doc/lxc-ps.sgml
4019712d 501 doc/lxc-restart.sgml
813a4837 502 doc/lxc-snapshot.sgml
4019712d
SG
503 doc/lxc-start-ephemeral.sgml
504 doc/lxc-start.sgml
505 doc/lxc-stop.sgml
f080ffd7 506 doc/lxc-top.sgml
4019712d
SG
507 doc/lxc-unfreeze.sgml
508 doc/lxc-unshare.sgml
df3415e0 509 doc/lxc-user-nic.sgml
4019712d
SG
510 doc/lxc-version.sgml
511 doc/lxc-wait.sgml
512
8a67a2b2 513 doc/lxc.conf.sgml
df3415e0 514 doc/lxc-usernet.sgml
8b8b04f8 515 doc/lxc.sgml
10fba81b 516 doc/common_options.sgml
99e4008c 517 doc/see_also.sgml
d823d5b9 518
baf6671f
DL
519 doc/rootfs/Makefile
520
0f71d073
DL
521 doc/examples/Makefile
522 doc/examples/lxc-macvlan.conf
26c39028 523 doc/examples/lxc-vlan.conf
0f71d073
DL
524 doc/examples/lxc-no-netns.conf
525 doc/examples/lxc-empty-netns.conf
526 doc/examples/lxc-phys.conf
527 doc/examples/lxc-veth.conf
c553a9c2 528 doc/examples/lxc-complex.conf
0f71d073 529
57da8c32
KY
530 doc/ja/Makefile
531 doc/ja/legacy/lxc-ls.sgml
532 doc/ja/lxc-attach.sgml
28f2ab26 533 doc/ja/lxc-autostart.sgml
57da8c32
KY
534 doc/ja/lxc-cgroup.sgml
535 doc/ja/lxc-checkconfig.sgml
536 doc/ja/lxc-checkpoint.sgml
537 doc/ja/lxc-clone.sgml
538 doc/ja/lxc-console.sgml
539 doc/ja/lxc-create.sgml
540 doc/ja/lxc-destroy.sgml
541 doc/ja/lxc-device.sgml
542 doc/ja/lxc-execute.sgml
543 doc/ja/lxc-freeze.sgml
544 doc/ja/lxc-info.sgml
545 doc/ja/lxc-kill.sgml
546 doc/ja/lxc-ls.sgml
547 doc/ja/lxc-monitor.sgml
548 doc/ja/lxc-netstat.sgml
549 doc/ja/lxc-ps.sgml
550 doc/ja/lxc-restart.sgml
ebe0aeb1 551 doc/ja/lxc-snapshot.sgml
57da8c32
KY
552 doc/ja/lxc-start-ephemeral.sgml
553 doc/ja/lxc-start.sgml
554 doc/ja/lxc-stop.sgml
555 doc/ja/lxc-top.sgml
556 doc/ja/lxc-unfreeze.sgml
557 doc/ja/lxc-unshare.sgml
07ece600 558 doc/ja/lxc-user-nic.sgml
57da8c32
KY
559 doc/ja/lxc-version.sgml
560 doc/ja/lxc-wait.sgml
561
562 doc/ja/lxc.conf.sgml
07ece600 563 doc/ja/lxc-usernet.sgml
57da8c32
KY
564 doc/ja/lxc.sgml
565 doc/ja/common_options.sgml
566 doc/ja/see_also.sgml
567
906f8c4d
SG
568 hooks/Makefile
569
c01d62f2 570 templates/Makefile
58a46e06 571 templates/lxc-cirros
c01d62f2 572 templates/lxc-debian
7c382572 573 templates/lxc-ubuntu
d1458ac8 574 templates/lxc-ubuntu-cloud
c840b37d 575 templates/lxc-opensuse
c01d62f2 576 templates/lxc-busybox
164105f6 577 templates/lxc-centos
c01d62f2 578 templates/lxc-fedora
9aad9d12 579 templates/lxc-openmandriva
708f4a80 580 templates/lxc-oracle
262f4e48 581 templates/lxc-altlinux
c01d62f2 582 templates/lxc-sshd
f6267d90 583 templates/lxc-archlinux
2a9a0a08 584 templates/lxc-alpine
cab79123 585 templates/lxc-plamo
c9844b87 586
288063bd 587 src/Makefile
5e97c3fc 588 src/lxc/Makefile
589 src/lxc/lxc-ps
9d0195cb 590 src/lxc/lxc-netstat
237315ff 591 src/lxc/lxc-checkconfig
bcd952a1 592 src/lxc/lxc-version
5b12984b 593 src/lxc/lxc-start-ephemeral
6a85cf91 594 src/lxc/legacy/lxc-ls
2a59a681 595 src/lxc/lxc.functions
a22185dd 596 src/lxc/version.h
be2e4e54
SG
597 src/python-lxc/Makefile
598
f080ffd7
DE
599 src/lua-lxc/Makefile
600
72d0e1cb 601 src/tests/Makefile
5e97c3fc 602])
603AC_CONFIG_COMMANDS([default],[[]],[[]])
604AC_OUTPUT
f91d5e4e
SG
605
606# Configuration overview
607cat << EOF
608
609----------------------------
610Environment:
611 - compiler: $CC
612 - distribution: $with_distro
613 - rpath: $enable_rpath
d8d44659 614 - GnuTLS: $enable_gnutls
f91d5e4e
SG
615
616Security features:
617 - Apparmor: $enable_apparmor
618 - Linux capabilities: $enable_capabilities
619 - seccomp: $enable_seccomp
620 - SELinux: $enable_selinux
621
622Bindings:
623 - lua: $enable_lua
624 - python3: $enable_python
625
626Documentation:
627 - examples: $enable_examples
628 - API documentation: $enable_api_docs
629 - user documentation: $enable_doc
630
631Debugging:
632 - tests: $enable_tests
633 - mutex debugging: $enable_mutex_debugging
634
635Paths:
636 - Logs in configpath: $enable_configpath_log
637EOF