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