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