]> git.proxmox.com Git - mirror_lxc.git/blame - configure.ac
make lxc.network.script.down consistent with lxc.network.script.up
[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)
dceb6c80 7m4_define([lxc_version_beta], [alpha3])
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
3ce74686
SH
151AC_CHECK_LIB([gnutls], [gnutls_hash_fast])
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])
220fi
221
be2e4e54
SG
222AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
223
224AM_COND_IF([ENABLE_PYTHON],
8aa4885c 225 [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])])
59ec0a36 226 PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[],[AC_MSG_ERROR([You must install python3-dev])])
8aa4885c 227 AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
be2e4e54 228
052616eb
ÇO
229# Enable dumping stack traces
230AC_ARG_ENABLE([mutex-debugging],
f91d5e4e
SG
231 [AC_HELP_STRING([--enable-mutex-debugging], [Makes mutexes to report error and provide stack trace [default=no]])],
232 [], [enable_mutex_debugging=no])
052616eb
ÇO
233AM_CONDITIONAL([MUTEX_DEBUGGING], [test "x$enable_mutex_debugging" = "xyes"])
234
235AM_COND_IF([MUTEX_DEBUGGING],
236 AC_DEFINE_UNQUOTED([MUTEX_DEBUGGING], 1, [Enabling mutex debugging]))
237
3a1675bf
DE
238# Not in older autoconf versions
239# AS_VAR_COPY(DEST, SOURCE)
240# -------------------------
241# Set the polymorphic shell variable DEST to the contents of the polymorphic
242# shell variable SOURCE.
243m4_ifdef([AS_VAR_COPY], [],
244[AC_DEFUN([AS_VAR_COPY],
245 [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
246])
247
12e93188
NC
248dnl PKG_CHECK_VAR was introduced with pkg-config 0.28
249m4_ifdef([PKG_CHECK_VAR], [],
250[AC_DEFUN([PKG_CHECK_VAR],
251 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
252 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
253 _PKG_CONFIG([$1], [variable="][$3]["], [$2])
254 AS_VAR_COPY([$1], [pkg_cv_][$1])
255 AS_VAR_IF([$1], [""], [$5], [$4])dnl
256 ])# PKG_CHECK_VAR
257])
f080ffd7 258
12e93188 259# Lua module and scripts
f080ffd7 260AC_ARG_ENABLE([lua],
f91d5e4e
SG
261 [AC_HELP_STRING([--enable-lua], [enable lua binding [default=auto]])],
262 [], [enable_lua=auto])
f080ffd7 263
12e93188
NC
264AC_ARG_WITH([lua-pc],
265 [AS_HELP_STRING(
266 [--with-lua-pc=PKG],
267 [Specify pkg-config package name for lua]
f756cda0
NC
268 )], [], [with_lua_pc=no])
269
270if test "x$enable_lua" = "xyes" -a "x$with_lua_pc" != "xno"; then
271 # exit with error if not found
272 PKG_CHECK_MODULES([LUA], [$with_lua_pc], [LUAPKGCONFIG=$with_lua_pc])
273fi
274
f91d5e4e 275if test "x$enable_lua" = "xauto" -a "x$with_lua_pc" != "xno"; then
f756cda0
NC
276 PKG_CHECK_MODULES([LUA], [$with_lua_pc],
277 [LUAPKGCONFIG=$with_lua_pc
278 enable_lua=yes],
279 [enable_lua=no])
280fi
281
282if test "x$enable_lua" != "xno"; then
283 PKG_CHECK_MODULES([LUA], [lua], [LUAPKGCONFIG=lua],
284 [PKG_CHECK_MODULES([LUA], [lua5.2], [LUAPKGCONFIG=lua5.2],
285 [PKG_CHECK_MODULES([LUA], [lua5.1], [LUAPKGCONFIG=lua5.1],
286 [AS_IF([test "x$enable_lua" = "xyes"],
287 [AC_MSG_ERROR([Lua not found. Please use --with-lua-pc=PKG])],
288 [enable_lua=no])]
289 )]
290 )])
291 AS_IF([test "x$LUAPKGCONFIG" != "x"], [enable_lua=yes])
292fi
12e93188
NC
293
294AM_CONDITIONAL([ENABLE_LUA],
69c757b3 295 [test "x$enable_lua" = "xyes"])
f080ffd7
DE
296
297AM_COND_IF([ENABLE_LUA],
f756cda0 298 [AC_MSG_CHECKING([Lua version])
12e93188
NC
299 PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [V],,
300 [PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [major_version])])
301 AC_MSG_RESULT([$LUA_VERSION])
302 PKG_CHECK_VAR([LUA_INSTALL_CMOD], [$LUAPKGCONFIG], [INSTALL_CMOD],,
303 [LUA_INSTALL_CMOD=$libdir/lua/$LUA_VERSION])
304 PKG_CHECK_VAR([LUA_INSTALL_LMOD], [$LUAPKGCONFIG], [INSTALL_LMOD],,
305 [LUA_INSTALL_LMOD=$datadir/lua/$LUA_VERSION])
306 ])
f080ffd7 307
8aa4885c 308# Optional test binaries
525421c9 309AC_ARG_ENABLE([tests],
f91d5e4e
SG
310 [AC_HELP_STRING([--enable-tests], [build test/example binaries [default=no]])],
311 [], [enable_tests=no])
525421c9
SG
312AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
313
8aa4885c 314# LXC container path, where the containers are actually stored
fbf5de31 315# This is overridden by an entry in the file called LXCCONF
2a59a681 316# (i.e. /etc/lxc/lxc.conf)
aef4ebcf
AN
317AC_ARG_WITH([config-path],
318 [AC_HELP_STRING(
319 [--with-config-path=dir],
e892973e 320 [lxc configuration repository path]
1c41ddcb 321 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
aef4ebcf 322
2a59a681
SH
323# The path of the global lxc configuration file.
324AC_ARG_WITH([global-conf],
325 [AC_HELP_STRING(
326 [--with-global-conf=dir],
327 [global lxc configuration file]
328 )], [], [with_global_conf=['${sysconfdir}/lxc/lxc.conf']])
329
c75c30ec 330# The path of the userns network configuration file
070a4b8e
SH
331AC_ARG_WITH([usernic-conf],
332 [AC_HELP_STRING(
333 [--with-usernic-conf],
334 [user network interface configuration file]
335 )], [], [with_usernic_conf=['${sysconfdir}/lxc/lxc-usernet']])
336
c75c30ec 337# The path of the runtime usernic database
070a4b8e
SH
338AC_ARG_WITH([usernic-db],
339 [AC_HELP_STRING(
340 [--with-usernic-db],
341 [lxc user nic database]
342 )], [], [with_usernic_db=['/run/lxc/nics']])
343
8aa4885c 344# Rootfs path, where the container mount structure is assembled
196db713
DL
345AC_ARG_WITH([rootfs-path],
346 [AC_HELP_STRING(
347 [--with-rootfs-path=dir],
348 [lxc rootfs mount point]
1c41ddcb 349 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
c75c30ec 350
6e16552d
CS
351# cgroup pattern specification
352AC_ARG_WITH([cgroup-pattern],
353 [AC_HELP_STRING(
354 [--with-cgroup-pattern=pattern],
355 [pattern for container cgroups]
356 )], [], [with_cgroup_pattern=['/lxc/%n']])
196db713 357
5e1e7aaf
SH
358# Container log path. By default, use $lxcpath.
359AC_MSG_CHECKING([Whether to place logfiles in container config path])
360AC_ARG_ENABLE([configpath-log],
f91d5e4e
SG
361 [AC_HELP_STRING([--enable-configpath-log], [use logfiles in config path [default=no]])],
362 [], [enable_configpath_log=no])
363AC_MSG_RESULT([$enable_configpath_log])
364AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$enable_configpath_log" = "yes"])
5e1e7aaf 365
f91d5e4e 366if test "$enable_configpath_log" = "yes"; then
5e1e7aaf
SH
367 default_log_path="${with_config_path}"
368else
89d556d8 369 default_log_path="${localstatedir}/log/lxc"
5e1e7aaf
SH
370fi
371
372AC_ARG_WITH([log-path],
373 [AC_HELP_STRING(
374 [--with-log-path=dir],
375 [per container log path]
376 )], [], [with_log_path=['${default_log_path}']])
377
8aa4885c
SG
378# Expand some useful variables
379AS_AC_EXPAND(PREFIX, "$prefix")
380AS_AC_EXPAND(LIBDIR, "$libdir")
381AS_AC_EXPAND(BINDIR, "$bindir")
382AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
383AS_AC_EXPAND(INCLUDEDIR, "$includedir")
384AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
0a18b545 385AS_AC_EXPAND(LXC_DEFAULT_CONFIG, "$sysconfdir/lxc/default.conf")
8aa4885c
SG
386AS_AC_EXPAND(DATADIR, "$datadir")
387AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
388AS_AC_EXPAND(DOCDIR, "$docdir")
3a647d58 389AS_AC_EXPAND(LXC_DISTRO_CONF, "$distroconf")
aef4ebcf 390AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
8aa4885c 391AS_AC_EXPAND(LXCPATH, "$with_config_path")
2a59a681 392AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf")
070a4b8e
SH
393AS_AC_EXPAND(LXC_USERNIC_CONF, "$with_usernic_conf")
394AS_AC_EXPAND(LXC_USERNIC_DB, "$with_usernic_db")
8aa4885c
SG
395AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
396AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
f2a95ee1 397AS_AC_EXPAND(LXCTEMPLATECONFIG, "$datadir/lxc/config")
906f8c4d 398AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
8aa4885c 399AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
5e1e7aaf 400AS_AC_EXPAND(LOGPATH, "$with_log_path")
6e16552d 401AC_SUBST(DEFAULT_CGROUP_PATTERN, ["$with_cgroup_pattern"])
881450bb 402
8aa4885c 403# Check for some standard kernel headers
910bb4fa 404AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
8aa4885c
SG
405 [],
406 AC_MSG_ERROR([Please install the Linux kernel headers.]),
407 [#include <sys/socket.h>])
35f549fe 408
a6168a17
SG
409# Check for alternate C libraries
410AC_MSG_CHECKING(for bionic libc)
411AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
8aa4885c 412 [[#ifndef __ANDROID__
a6168a17
SG
413error: Not bionic!
414#endif]])],
8aa4885c
SG
415 [is_bionic=yes],
416 [is_bionic=no])
a6168a17 417if test "x$is_bionic" = "xyes"; then
8aa4885c
SG
418 AC_DEFINE([IS_BIONIC], 1, [bionic libc])
419 AC_MSG_RESULT([yes])
a6168a17 420else
8aa4885c 421 AC_MSG_RESULT([no])
a6168a17
SG
422fi
423AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
424
656994bb
MH
425# Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
426AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
427
e827ff7e 428# Check for some headers
4ba0d9af 429AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
ff218c25 430
2d76d1d7 431# Check for some syscalls functions
511a6936 432AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr])
2d76d1d7 433
e827ff7e 434# Check for some functions
740ee8c7 435AC_CHECK_LIB(util, openpty)
edaf8b1b 436AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent])
1ba0013f
SG
437AC_CHECK_FUNCS([getline],
438 AM_CONDITIONAL(HAVE_GETLINE, true)
439 AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
440 AM_CONDITIONAL(HAVE_GETLINE, false))
441AC_CHECK_FUNCS([fgetln],
442 AM_CONDITIONAL(HAVE_FGETLN, true)
443 AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
444 AM_CONDITIONAL(HAVE_FGETLN, false))
445
c9a84173
SG
446# Check for some libraries
447AC_SEARCH_LIBS(sem_open, [rt pthread])
336d5469 448AC_SEARCH_LIBS(clock_gettime, [rt])
c9a84173 449
8aa4885c 450# Check for some standard binaries
5e97c3fc 451AC_PROG_GCC_TRADITIONAL
95a717e9 452AC_PROG_SED
5e97c3fc 453
454if test "x$GCC" = "xyes"; then
8aa4885c 455 CFLAGS="$CFLAGS -Wall -Werror"
5e97c3fc 456fi
457
8aa4885c 458# Files requiring some variable expansion
5e97c3fc 459AC_CONFIG_FILES([
288063bd 460 Makefile
b6345ba1 461 lxc.pc
5e97c3fc 462 lxc.spec
f2a95ee1 463
288063bd 464 config/Makefile
f2a95ee1
SG
465 config/etc/Makefile
466 config/templates/Makefile
467 config/templates/ubuntu-cloud.common.conf
468 config/templates/ubuntu-cloud.lucid.conf
469 config/templates/ubuntu-cloud.userns.conf
470 config/templates/ubuntu.common.conf
471 config/templates/ubuntu.lucid.conf
d823d5b9 472
288063bd 473 doc/Makefile
953e611c 474 doc/api/Makefile
4019712d
SG
475 doc/legacy/lxc-ls.sgml
476 doc/lxc-attach.sgml
477 doc/lxc-cgroup.sgml
478 doc/lxc-checkconfig.sgml
479 doc/lxc-checkpoint.sgml
11cddd70 480 doc/lxc-clone.sgml
4019712d 481 doc/lxc-console.sgml
d823d5b9 482 doc/lxc-create.sgml
483 doc/lxc-destroy.sgml
4019712d 484 doc/lxc-device.sgml
d823d5b9 485 doc/lxc-execute.sgml
d823d5b9 486 doc/lxc-freeze.sgml
4019712d
SG
487 doc/lxc-info.sgml
488 doc/lxc-kill.sgml
d823d5b9 489 doc/lxc-ls.sgml
4019712d
SG
490 doc/lxc-monitor.sgml
491 doc/lxc-netstat.sgml
d823d5b9 492 doc/lxc-ps.sgml
4019712d 493 doc/lxc-restart.sgml
813a4837 494 doc/lxc-snapshot.sgml
4019712d
SG
495 doc/lxc-start-ephemeral.sgml
496 doc/lxc-start.sgml
497 doc/lxc-stop.sgml
f080ffd7 498 doc/lxc-top.sgml
4019712d
SG
499 doc/lxc-unfreeze.sgml
500 doc/lxc-unshare.sgml
df3415e0 501 doc/lxc-user-nic.sgml
4019712d
SG
502 doc/lxc-version.sgml
503 doc/lxc-wait.sgml
504
8a67a2b2 505 doc/lxc.conf.sgml
df3415e0 506 doc/lxc-usernet.sgml
8b8b04f8 507 doc/lxc.sgml
10fba81b 508 doc/common_options.sgml
99e4008c 509 doc/see_also.sgml
d823d5b9 510
baf6671f
DL
511 doc/rootfs/Makefile
512
0f71d073
DL
513 doc/examples/Makefile
514 doc/examples/lxc-macvlan.conf
26c39028 515 doc/examples/lxc-vlan.conf
0f71d073
DL
516 doc/examples/lxc-no-netns.conf
517 doc/examples/lxc-empty-netns.conf
518 doc/examples/lxc-phys.conf
519 doc/examples/lxc-veth.conf
c553a9c2 520 doc/examples/lxc-complex.conf
0f71d073 521
57da8c32
KY
522 doc/ja/Makefile
523 doc/ja/legacy/lxc-ls.sgml
524 doc/ja/lxc-attach.sgml
525 doc/ja/lxc-cgroup.sgml
526 doc/ja/lxc-checkconfig.sgml
527 doc/ja/lxc-checkpoint.sgml
528 doc/ja/lxc-clone.sgml
529 doc/ja/lxc-console.sgml
530 doc/ja/lxc-create.sgml
531 doc/ja/lxc-destroy.sgml
532 doc/ja/lxc-device.sgml
533 doc/ja/lxc-execute.sgml
534 doc/ja/lxc-freeze.sgml
535 doc/ja/lxc-info.sgml
536 doc/ja/lxc-kill.sgml
537 doc/ja/lxc-ls.sgml
538 doc/ja/lxc-monitor.sgml
539 doc/ja/lxc-netstat.sgml
540 doc/ja/lxc-ps.sgml
541 doc/ja/lxc-restart.sgml
ebe0aeb1 542 doc/ja/lxc-snapshot.sgml
57da8c32
KY
543 doc/ja/lxc-start-ephemeral.sgml
544 doc/ja/lxc-start.sgml
545 doc/ja/lxc-stop.sgml
546 doc/ja/lxc-top.sgml
547 doc/ja/lxc-unfreeze.sgml
548 doc/ja/lxc-unshare.sgml
549 doc/ja/lxc-version.sgml
550 doc/ja/lxc-wait.sgml
551
552 doc/ja/lxc.conf.sgml
553 doc/ja/lxc.sgml
554 doc/ja/common_options.sgml
555 doc/ja/see_also.sgml
556
906f8c4d
SG
557 hooks/Makefile
558
c01d62f2 559 templates/Makefile
58a46e06 560 templates/lxc-cirros
c01d62f2 561 templates/lxc-debian
7c382572 562 templates/lxc-ubuntu
d1458ac8 563 templates/lxc-ubuntu-cloud
c840b37d 564 templates/lxc-opensuse
c01d62f2 565 templates/lxc-busybox
164105f6 566 templates/lxc-centos
c01d62f2 567 templates/lxc-fedora
9aad9d12 568 templates/lxc-openmandriva
708f4a80 569 templates/lxc-oracle
262f4e48 570 templates/lxc-altlinux
c01d62f2 571 templates/lxc-sshd
f6267d90 572 templates/lxc-archlinux
2a9a0a08 573 templates/lxc-alpine
cab79123 574 templates/lxc-plamo
c9844b87 575
288063bd 576 src/Makefile
5e97c3fc 577 src/lxc/Makefile
578 src/lxc/lxc-ps
9d0195cb 579 src/lxc/lxc-netstat
237315ff 580 src/lxc/lxc-checkconfig
bcd952a1 581 src/lxc/lxc-version
5b12984b 582 src/lxc/lxc-start-ephemeral
6a85cf91 583 src/lxc/legacy/lxc-ls
2a59a681 584 src/lxc/lxc.functions
a22185dd 585 src/lxc/version.h
be2e4e54
SG
586 src/python-lxc/Makefile
587
f080ffd7
DE
588 src/lua-lxc/Makefile
589
72d0e1cb 590 src/tests/Makefile
5e97c3fc 591])
592AC_CONFIG_COMMANDS([default],[[]],[[]])
593AC_OUTPUT
f91d5e4e
SG
594
595# Configuration overview
596cat << EOF
597
598----------------------------
599Environment:
600 - compiler: $CC
601 - distribution: $with_distro
602 - rpath: $enable_rpath
603
604Security features:
605 - Apparmor: $enable_apparmor
606 - Linux capabilities: $enable_capabilities
607 - seccomp: $enable_seccomp
608 - SELinux: $enable_selinux
609
610Bindings:
611 - lua: $enable_lua
612 - python3: $enable_python
613
614Documentation:
615 - examples: $enable_examples
616 - API documentation: $enable_api_docs
617 - user documentation: $enable_doc
618
619Debugging:
620 - tests: $enable_tests
621 - mutex debugging: $enable_mutex_debugging
622
623Paths:
624 - Logs in configpath: $enable_configpath_log
625EOF