]> git.proxmox.com Git - mirror_lxc.git/blame - configure.ac
configure/makefile: rename default_conf to distro_conf
[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")
221AS_AC_EXPAND(DATADIR, "$datadir")
222AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
223AS_AC_EXPAND(DOCDIR, "$docdir")
3a647d58 224AS_AC_EXPAND(LXC_DISTRO_CONF, "$distroconf")
aef4ebcf 225AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
8aa4885c 226AS_AC_EXPAND(LXCPATH, "$with_config_path")
2a59a681 227AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf")
8aa4885c
SG
228AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
229AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
906f8c4d 230AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
8aa4885c 231AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
5e1e7aaf 232AS_AC_EXPAND(LOGPATH, "$with_log_path")
881450bb 233
8aa4885c 234# Check for some standard kernel headers
910bb4fa 235AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
8aa4885c
SG
236 [],
237 AC_MSG_ERROR([Please install the Linux kernel headers.]),
238 [#include <sys/socket.h>])
35f549fe 239
495d2046
SG
240# Allow disabling libcap support
241AC_ARG_ENABLE([capabilities],
242 [AC_HELP_STRING([--disable-capabilities], [disable kernel capabilities])],
243 [], [enable_capabilities=yes])
244
8aa4885c 245# Check for libcap support
495d2046
SG
246if test "x$enable_capabilities" = "xyes"; then
247 AC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
248 AC_MSG_CHECKING([linux capabilities])
249 if test "x$caplib" = "xyes" ; then
250 CAP_LIBS="-lcap"
251 AC_MSG_RESULT([$CAP_LIBS])
252 else
253 AC_MSG_RESULT([no])
254 AC_MSG_ERROR([You are missing libcap support. If you really want to build without kernel capabilities, use --disable-capabilities])
255 fi
0af683cf 256else
495d2046 257 CAP_LIBS=""
0af683cf 258fi
259AC_SUBST([CAP_LIBS])
35f549fe 260
a6168a17
SG
261# Check for alternate C libraries
262AC_MSG_CHECKING(for bionic libc)
263AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
8aa4885c 264 [[#ifndef __ANDROID__
a6168a17
SG
265error: Not bionic!
266#endif]])],
8aa4885c
SG
267 [is_bionic=yes],
268 [is_bionic=no])
a6168a17 269if test "x$is_bionic" = "xyes"; then
8aa4885c
SG
270 AC_DEFINE([IS_BIONIC], 1, [bionic libc])
271 AC_MSG_RESULT([yes])
a6168a17 272else
8aa4885c 273 AC_MSG_RESULT([no])
a6168a17
SG
274fi
275AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
276
656994bb
MH
277# Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
278AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
279
e827ff7e 280# Check for some headers
9be380b0 281AC_CHECK_HEADERS([sys/signalfd.h pty.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
ff218c25 282
2d76d1d7
SG
283# Check for some syscalls functions
284AC_CHECK_FUNCS([setns pivot_root sethostname unshare])
285
e827ff7e 286# Check for some functions
740ee8c7 287AC_CHECK_LIB(util, openpty)
edaf8b1b 288AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent])
1ba0013f
SG
289AC_CHECK_FUNCS([getline],
290 AM_CONDITIONAL(HAVE_GETLINE, true)
291 AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
292 AM_CONDITIONAL(HAVE_GETLINE, false))
293AC_CHECK_FUNCS([fgetln],
294 AM_CONDITIONAL(HAVE_FGETLN, true)
295 AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
296 AM_CONDITIONAL(HAVE_FGETLN, false))
297
c9a84173
SG
298# Check for some libraries
299AC_SEARCH_LIBS(sem_open, [rt pthread])
336d5469 300AC_SEARCH_LIBS(clock_gettime, [rt])
c9a84173 301
8aa4885c 302# Check for some standard binaries
5e97c3fc 303AC_PROG_GCC_TRADITIONAL
95a717e9 304AC_PROG_SED
5e97c3fc 305
306if test "x$GCC" = "xyes"; then
8aa4885c 307 CFLAGS="$CFLAGS -Wall -Werror"
5e97c3fc 308fi
309
8aa4885c 310# Files requiring some variable expansion
5e97c3fc 311AC_CONFIG_FILES([
288063bd 312 Makefile
b6345ba1 313 lxc.pc
5e97c3fc 314 lxc.spec
288063bd 315 config/Makefile
d823d5b9 316
288063bd 317 doc/Makefile
4019712d
SG
318 doc/legacy/lxc-ls.sgml
319 doc/lxc-attach.sgml
320 doc/lxc-cgroup.sgml
321 doc/lxc-checkconfig.sgml
322 doc/lxc-checkpoint.sgml
11cddd70 323 doc/lxc-clone.sgml
4019712d 324 doc/lxc-console.sgml
d823d5b9 325 doc/lxc-create.sgml
326 doc/lxc-destroy.sgml
4019712d 327 doc/lxc-device.sgml
d823d5b9 328 doc/lxc-execute.sgml
d823d5b9 329 doc/lxc-freeze.sgml
4019712d
SG
330 doc/lxc-info.sgml
331 doc/lxc-kill.sgml
d823d5b9 332 doc/lxc-ls.sgml
4019712d
SG
333 doc/lxc-monitor.sgml
334 doc/lxc-netstat.sgml
d823d5b9 335 doc/lxc-ps.sgml
4019712d 336 doc/lxc-restart.sgml
4019712d
SG
337 doc/lxc-start-ephemeral.sgml
338 doc/lxc-start.sgml
339 doc/lxc-stop.sgml
f080ffd7 340 doc/lxc-top.sgml
4019712d
SG
341 doc/lxc-unfreeze.sgml
342 doc/lxc-unshare.sgml
343 doc/lxc-version.sgml
344 doc/lxc-wait.sgml
345
8a67a2b2 346 doc/lxc.conf.sgml
8b8b04f8 347 doc/lxc.sgml
10fba81b 348 doc/common_options.sgml
99e4008c 349 doc/see_also.sgml
d823d5b9 350
baf6671f
DL
351 doc/rootfs/Makefile
352
0f71d073
DL
353 doc/examples/Makefile
354 doc/examples/lxc-macvlan.conf
26c39028 355 doc/examples/lxc-vlan.conf
0f71d073
DL
356 doc/examples/lxc-no-netns.conf
357 doc/examples/lxc-empty-netns.conf
358 doc/examples/lxc-phys.conf
359 doc/examples/lxc-veth.conf
c553a9c2 360 doc/examples/lxc-complex.conf
0f71d073 361
906f8c4d
SG
362 hooks/Makefile
363
c01d62f2 364 templates/Makefile
58a46e06 365 templates/lxc-cirros
c01d62f2 366 templates/lxc-debian
7c382572 367 templates/lxc-ubuntu
d1458ac8 368 templates/lxc-ubuntu-cloud
c840b37d 369 templates/lxc-opensuse
c01d62f2
DL
370 templates/lxc-busybox
371 templates/lxc-fedora
708f4a80 372 templates/lxc-oracle
262f4e48 373 templates/lxc-altlinux
c01d62f2 374 templates/lxc-sshd
f6267d90 375 templates/lxc-archlinux
2a9a0a08 376 templates/lxc-alpine
c9844b87 377
288063bd 378 src/Makefile
5e97c3fc 379 src/lxc/Makefile
380 src/lxc/lxc-ps
9d0195cb 381 src/lxc/lxc-netstat
237315ff 382 src/lxc/lxc-checkconfig
bcd952a1 383 src/lxc/lxc-version
5b12984b 384 src/lxc/lxc-start-ephemeral
6a85cf91 385 src/lxc/legacy/lxc-ls
2a59a681 386 src/lxc/lxc.functions
c9844b87 387
be2e4e54
SG
388 src/python-lxc/Makefile
389
f080ffd7
DE
390 src/lua-lxc/Makefile
391
72d0e1cb 392 src/tests/Makefile
5e97c3fc 393])
394AC_CONFIG_COMMANDS([default],[[]],[[]])
395AC_OUTPUT