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