]> git.proxmox.com Git - mirror_lxc.git/blame - configure.ac
Define LXC_DEFAULT_CONFIG
[mirror_lxc.git] / configure.ac
CommitLineData
5e97c3fc 1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
e9831f83 4AC_INIT([lxc], [0.9.0])
5e97c3fc 5
f8dafdbb 6AC_CONFIG_SRCDIR([configure.ac])
5e97c3fc 7AC_CONFIG_AUX_DIR([config])
067cfaeb 8AC_CONFIG_HEADERS([src/config.h])
ad563aea 9AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability])
5e97c3fc 10AC_CANONICAL_HOST
5e97c3fc 11AM_PROG_CC_C_O
12AC_GNU_SOURCE
5c8f9bd8 13
8aa4885c
SG
14# Detect the distribution. This is used for the default configuration and
15# for some distro-specific build options.
6f75ba0b 16AC_MSG_CHECKING([host distribution])
8aa4885c 17AC_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.]))
6f75ba0b
DE
18if test "z$with_distro" = "z"; then
19 with_distro=`lsb_release -is`
be2e4e54 20fi
6f75ba0b
DE
21if 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")
34fi
35with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
36
37if test "z$with_distro" = "z"; then
38 with_distro="unknown"
39fi
40case $with_distro in
41 ubuntu)
3a647d58 42 distroconf=default.conf.ubuntu
6f75ba0b
DE
43 ;;
44 redhat|fedora|oracle|oracleserver)
3a647d58 45 distroconf=default.conf.libvirt
6f75ba0b
DE
46 ;;
47 *)
48 echo -n "Linux distribution network config unknown, defaulting to lxc.network.type = empty"
3a647d58 49 distroconf=default.conf.unknown
6f75ba0b
DE
50 ;;
51esac
52AC_MSG_RESULT([$with_distro])
6f75ba0b 53AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu"])
be2e4e54 54
8aa4885c 55# Allow disabling rpath
1c41ddcb
GK
56AC_ARG_ENABLE([rpath],
57 [AC_HELP_STRING([--disable-rpath], [do not set rpath in executables])],
58 [], [enable_rpath=yes])
1c41ddcb
GK
59AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
60
8aa4885c 61# Documentation (manpages)
5c8f9bd8 62AC_ARG_ENABLE([doc],
7f951458 63 [AC_HELP_STRING([--enable-doc], [make mans (requires docbook2man or docbook2x-man to be installed) [default=auto]])],
5c8f9bd8
AN
64 [], [enable_doc=auto])
65
66if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
7822022c 67 db2xman=""
7f951458 68 dbparsers="docbook2x-man db2x_docbook2man docbook2man"
69fe23ff 69
7822022c 70 AC_MSG_CHECKING(for docbook2x-man)
69fe23ff 71 for name in ${dbparsers}; do
7822022c
SG
72 if "$name" --help >/dev/null 2>&1; then
73 db2xman="$name"
74 break;
75 fi
76 done
77
78 if test -n "${db2xman}"; then
8aa4885c 79 AC_MSG_RESULT([${db2xman}])
7822022c 80 else
8aa4885c 81 AC_MSG_RESULT([no])
7822022c
SG
82 if test "x$enable_doc" = "xyes"; then
83 AC_MSG_ERROR([docbook2x-man required by man request, but not found])
84 fi
85 fi
86
87 AC_SUBST(db2xman)
5c8f9bd8 88fi
8aa4885c 89AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
5c8f9bd8 90
7f951458
DE
91if test "x$db2xman" = "xdocbook2man"; then
92 docdtd="\"-//Davenport//DTD DocBook V3.0//EN\""
93else
94 docdtd="\"-//OASIS//DTD DocBook XML\" \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""
95fi
96AC_SUBST(docdtd)
97
8aa4885c 98# Apparmor
e767dd55
SH
99AC_ARG_ENABLE([apparmor],
100 [AC_HELP_STRING([--enable-apparmor], [enable apparmor])],
101 [], [enable_apparmor=check])
102
103if test "$enable_apparmor" = "check" ; then
104 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
105fi
e767dd55
SH
106AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
107
e075f5d9 108AM_COND_IF([ENABLE_APPARMOR],
8aa4885c
SG
109 [AC_CHECK_HEADER([sys/apparmor.h],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
110 AC_CHECK_LIB([apparmor], [aa_change_profile],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
111 AC_SUBST([APPARMOR_LIBS], [-lapparmor])])
e075f5d9 112
8aa4885c 113# Seccomp syscall filter
e767dd55
SH
114AC_ARG_ENABLE([seccomp],
115 [AC_HELP_STRING([--enable-seccomp], [enable seccomp])],
116 [], [enable_seccomp=check])
117
118if test "$enable_seccomp" = "check" ; then
119 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
120fi
e767dd55
SH
121AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
122
8f2c3a70 123AM_COND_IF([ENABLE_SECCOMP],
8aa4885c
SG
124 [AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
125 AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
126 AC_SUBST([SECCOMP_LIBS], [-lseccomp])])
8f2c3a70 127
769872f9
SH
128# HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
129AC_CHECK_TYPES([scmp_filter_ctx], [], [], [#include <seccomp.h>])
130
8aa4885c 131# Configuration examples
3fb0a9bb
AN
132AC_ARG_ENABLE([examples],
133 [AC_HELP_STRING([--disable-examples], [do not install configuration examples])],
134 [], [enable_examples=yes])
3fb0a9bb
AN
135AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
136
8aa4885c 137# Python3 module and scripts
be2e4e54
SG
138AC_ARG_ENABLE([python],
139 [AC_HELP_STRING([--enable-python], [enable python binding])],
140 [enable_python=yes], [enable_python=no])
be2e4e54
SG
141AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
142
143AM_COND_IF([ENABLE_PYTHON],
8aa4885c 144 [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])])
59ec0a36 145 PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[],[AC_MSG_ERROR([You must install python3-dev])])
8aa4885c 146 AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
be2e4e54 147
f080ffd7
DE
148# Lua module and scripts
149if test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu" ; then
150 LUAPKGCONFIG=lua5.1
151else
152 LUAPKGCONFIG=lua
153fi
154
155AC_ARG_ENABLE([lua],
156 [AC_HELP_STRING([--enable-lua], [enable lua binding])],
157 [enable_lua=yes], [enable_lua=no])
158
159AM_CONDITIONAL([ENABLE_LUA], [test "x$enable_lua" = "xyes"])
160
161AM_COND_IF([ENABLE_LUA],
162 [PKG_CHECK_MODULES([LUA], [$LUAPKGCONFIG >= 5.1],[],[AC_MSG_ERROR([You must install lua-devel for lua 5.1])])
163 AC_DEFINE_UNQUOTED([ENABLE_LUA], 1, [Lua is available])])
164
8aa4885c 165# Optional test binaries
525421c9
SG
166AC_ARG_ENABLE([tests],
167 [AC_HELP_STRING([--enable-tests], [build test/example binaries])],
168 [enable_tests=yes], [enable_tests=no])
525421c9
SG
169AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
170
8aa4885c 171# LXC container path, where the containers are actually stored
fbf5de31 172# This is overridden by an entry in the file called LXCCONF
2a59a681 173# (i.e. /etc/lxc/lxc.conf)
aef4ebcf
AN
174AC_ARG_WITH([config-path],
175 [AC_HELP_STRING(
176 [--with-config-path=dir],
e892973e 177 [lxc configuration repository path]
1c41ddcb 178 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
aef4ebcf 179
2a59a681
SH
180# The path of the global lxc configuration file.
181AC_ARG_WITH([global-conf],
182 [AC_HELP_STRING(
183 [--with-global-conf=dir],
184 [global lxc configuration file]
185 )], [], [with_global_conf=['${sysconfdir}/lxc/lxc.conf']])
186
8aa4885c 187# Rootfs path, where the container mount structure is assembled
196db713
DL
188AC_ARG_WITH([rootfs-path],
189 [AC_HELP_STRING(
190 [--with-rootfs-path=dir],
191 [lxc rootfs mount point]
1c41ddcb 192 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
196db713 193
5e1e7aaf
SH
194# Container log path. By default, use $lxcpath.
195AC_MSG_CHECKING([Whether to place logfiles in container config path])
196AC_ARG_ENABLE([configpath-log],
197 [AC_HELP_STRING([--enable-configpath-log], [use logfiles in config path])],
198 [use_configpath_logs=yes], [use_configpath_logs=no])
199AC_MSG_RESULT([$use_configpath_logs])
200AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$use_configpath_logs" = "yes"])
201
202if test "$use_configpath_logs" = "yes"; then
203 default_log_path="${with_config_path}"
204else
89d556d8 205 default_log_path="${localstatedir}/log/lxc"
5e1e7aaf
SH
206fi
207
208AC_ARG_WITH([log-path],
209 [AC_HELP_STRING(
210 [--with-log-path=dir],
211 [per container log path]
212 )], [], [with_log_path=['${default_log_path}']])
213
8aa4885c
SG
214# Expand some useful variables
215AS_AC_EXPAND(PREFIX, "$prefix")
216AS_AC_EXPAND(LIBDIR, "$libdir")
217AS_AC_EXPAND(BINDIR, "$bindir")
218AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
219AS_AC_EXPAND(INCLUDEDIR, "$includedir")
220AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
0a18b545 221AS_AC_EXPAND(LXC_DEFAULT_CONFIG, "$sysconfdir/lxc/default.conf")
8aa4885c
SG
222AS_AC_EXPAND(DATADIR, "$datadir")
223AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
224AS_AC_EXPAND(DOCDIR, "$docdir")
3a647d58 225AS_AC_EXPAND(LXC_DISTRO_CONF, "$distroconf")
aef4ebcf 226AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
8aa4885c 227AS_AC_EXPAND(LXCPATH, "$with_config_path")
2a59a681 228AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf")
8aa4885c
SG
229AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
230AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
906f8c4d 231AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
8aa4885c 232AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
5e1e7aaf 233AS_AC_EXPAND(LOGPATH, "$with_log_path")
881450bb 234
8aa4885c 235# Check for some standard kernel headers
910bb4fa 236AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
8aa4885c
SG
237 [],
238 AC_MSG_ERROR([Please install the Linux kernel headers.]),
239 [#include <sys/socket.h>])
35f549fe 240
495d2046
SG
241# Allow disabling libcap support
242AC_ARG_ENABLE([capabilities],
243 [AC_HELP_STRING([--disable-capabilities], [disable kernel capabilities])],
244 [], [enable_capabilities=yes])
245
8aa4885c 246# Check for libcap support
495d2046
SG
247if test "x$enable_capabilities" = "xyes"; then
248 AC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
249 AC_MSG_CHECKING([linux capabilities])
250 if test "x$caplib" = "xyes" ; then
251 CAP_LIBS="-lcap"
252 AC_MSG_RESULT([$CAP_LIBS])
253 else
254 AC_MSG_RESULT([no])
255 AC_MSG_ERROR([You are missing libcap support. If you really want to build without kernel capabilities, use --disable-capabilities])
256 fi
0af683cf 257else
495d2046 258 CAP_LIBS=""
0af683cf 259fi
260AC_SUBST([CAP_LIBS])
35f549fe 261
a6168a17
SG
262# Check for alternate C libraries
263AC_MSG_CHECKING(for bionic libc)
264AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
8aa4885c 265 [[#ifndef __ANDROID__
a6168a17
SG
266error: Not bionic!
267#endif]])],
8aa4885c
SG
268 [is_bionic=yes],
269 [is_bionic=no])
a6168a17 270if test "x$is_bionic" = "xyes"; then
8aa4885c
SG
271 AC_DEFINE([IS_BIONIC], 1, [bionic libc])
272 AC_MSG_RESULT([yes])
a6168a17 273else
8aa4885c 274 AC_MSG_RESULT([no])
a6168a17
SG
275fi
276AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
277
656994bb
MH
278# Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
279AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
280
e827ff7e 281# Check for some headers
9be380b0 282AC_CHECK_HEADERS([sys/signalfd.h pty.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
ff218c25 283
2d76d1d7
SG
284# Check for some syscalls functions
285AC_CHECK_FUNCS([setns pivot_root sethostname unshare])
286
e827ff7e 287# Check for some functions
740ee8c7 288AC_CHECK_LIB(util, openpty)
edaf8b1b 289AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent])
1ba0013f
SG
290AC_CHECK_FUNCS([getline],
291 AM_CONDITIONAL(HAVE_GETLINE, true)
292 AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
293 AM_CONDITIONAL(HAVE_GETLINE, false))
294AC_CHECK_FUNCS([fgetln],
295 AM_CONDITIONAL(HAVE_FGETLN, true)
296 AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
297 AM_CONDITIONAL(HAVE_FGETLN, false))
298
c9a84173
SG
299# Check for some libraries
300AC_SEARCH_LIBS(sem_open, [rt pthread])
336d5469 301AC_SEARCH_LIBS(clock_gettime, [rt])
c9a84173 302
8aa4885c 303# Check for some standard binaries
5e97c3fc 304AC_PROG_GCC_TRADITIONAL
95a717e9 305AC_PROG_SED
5e97c3fc 306
307if test "x$GCC" = "xyes"; then
8aa4885c 308 CFLAGS="$CFLAGS -Wall -Werror"
5e97c3fc 309fi
310
8aa4885c 311# Files requiring some variable expansion
5e97c3fc 312AC_CONFIG_FILES([
288063bd 313 Makefile
b6345ba1 314 lxc.pc
5e97c3fc 315 lxc.spec
288063bd 316 config/Makefile
d823d5b9 317
288063bd 318 doc/Makefile
4019712d
SG
319 doc/legacy/lxc-ls.sgml
320 doc/lxc-attach.sgml
321 doc/lxc-cgroup.sgml
322 doc/lxc-checkconfig.sgml
323 doc/lxc-checkpoint.sgml
11cddd70 324 doc/lxc-clone.sgml
4019712d 325 doc/lxc-console.sgml
d823d5b9 326 doc/lxc-create.sgml
327 doc/lxc-destroy.sgml
4019712d 328 doc/lxc-device.sgml
d823d5b9 329 doc/lxc-execute.sgml
d823d5b9 330 doc/lxc-freeze.sgml
4019712d
SG
331 doc/lxc-info.sgml
332 doc/lxc-kill.sgml
d823d5b9 333 doc/lxc-ls.sgml
4019712d
SG
334 doc/lxc-monitor.sgml
335 doc/lxc-netstat.sgml
d823d5b9 336 doc/lxc-ps.sgml
4019712d 337 doc/lxc-restart.sgml
4019712d
SG
338 doc/lxc-start-ephemeral.sgml
339 doc/lxc-start.sgml
340 doc/lxc-stop.sgml
f080ffd7 341 doc/lxc-top.sgml
4019712d
SG
342 doc/lxc-unfreeze.sgml
343 doc/lxc-unshare.sgml
344 doc/lxc-version.sgml
345 doc/lxc-wait.sgml
346
8a67a2b2 347 doc/lxc.conf.sgml
8b8b04f8 348 doc/lxc.sgml
10fba81b 349 doc/common_options.sgml
99e4008c 350 doc/see_also.sgml
d823d5b9 351
baf6671f
DL
352 doc/rootfs/Makefile
353
0f71d073
DL
354 doc/examples/Makefile
355 doc/examples/lxc-macvlan.conf
26c39028 356 doc/examples/lxc-vlan.conf
0f71d073
DL
357 doc/examples/lxc-no-netns.conf
358 doc/examples/lxc-empty-netns.conf
359 doc/examples/lxc-phys.conf
360 doc/examples/lxc-veth.conf
c553a9c2 361 doc/examples/lxc-complex.conf
0f71d073 362
906f8c4d
SG
363 hooks/Makefile
364
c01d62f2 365 templates/Makefile
58a46e06 366 templates/lxc-cirros
c01d62f2 367 templates/lxc-debian
7c382572 368 templates/lxc-ubuntu
d1458ac8 369 templates/lxc-ubuntu-cloud
c840b37d 370 templates/lxc-opensuse
c01d62f2
DL
371 templates/lxc-busybox
372 templates/lxc-fedora
708f4a80 373 templates/lxc-oracle
262f4e48 374 templates/lxc-altlinux
c01d62f2 375 templates/lxc-sshd
f6267d90 376 templates/lxc-archlinux
2a9a0a08 377 templates/lxc-alpine
c9844b87 378
288063bd 379 src/Makefile
5e97c3fc 380 src/lxc/Makefile
381 src/lxc/lxc-ps
9d0195cb 382 src/lxc/lxc-netstat
237315ff 383 src/lxc/lxc-checkconfig
bcd952a1 384 src/lxc/lxc-version
5b12984b 385 src/lxc/lxc-start-ephemeral
6a85cf91 386 src/lxc/legacy/lxc-ls
2a59a681 387 src/lxc/lxc.functions
c9844b87 388
be2e4e54
SG
389 src/python-lxc/Makefile
390
f080ffd7
DE
391 src/lua-lxc/Makefile
392
72d0e1cb 393 src/tests/Makefile
5e97c3fc 394])
395AC_CONFIG_COMMANDS([default],[[]],[[]])
396AC_OUTPUT