]> git.proxmox.com Git - mirror_lxc.git/blob - configure.ac
use a default per-container logfile
[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.alpha2])
5
6 AC_CONFIG_SRCDIR([configure.ac])
7 AC_CONFIG_AUX_DIR([config])
8 AM_CONFIG_HEADER([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 conffile=lxc.conf.ubuntu
43 ;;
44 redhat|fedora|oracle|oracleserver)
45 conffile=lxc.conf.libvirt
46 ;;
47 *)
48 echo -n "Linux distribution network config unknown, defaulting to lxc.network.type = empty"
49 conffile=lxc.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 (require docbook2x-man installed) [default=auto]])],
64 [], [enable_doc=auto])
65
66 if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
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
78 AC_MSG_RESULT([${db2xman}])
79 else
80 AC_MSG_RESULT([no])
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)
87 fi
88 AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
89
90 # Apparmor
91 AC_ARG_ENABLE([apparmor],
92 [AC_HELP_STRING([--enable-apparmor], [enable apparmor])],
93 [], [enable_apparmor=check])
94
95 if test "$enable_apparmor" = "check" ; then
96 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
97 fi
98 AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
99
100 AM_COND_IF([ENABLE_APPARMOR],
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])])
104
105 # Seccomp syscall filter
106 AC_ARG_ENABLE([seccomp],
107 [AC_HELP_STRING([--enable-seccomp], [enable seccomp])],
108 [], [enable_seccomp=check])
109
110 if test "$enable_seccomp" = "check" ; then
111 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
112 fi
113 AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
114
115 AM_COND_IF([ENABLE_SECCOMP],
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])])
119
120 # HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
121 AC_CHECK_TYPES([scmp_filter_ctx], [], [], [#include <seccomp.h>])
122
123 # Configuration examples
124 AC_ARG_ENABLE([examples],
125 [AC_HELP_STRING([--disable-examples], [do not install configuration examples])],
126 [], [enable_examples=yes])
127 AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
128
129 # Python3 module and scripts
130 AC_ARG_ENABLE([python],
131 [AC_HELP_STRING([--enable-python], [enable python binding])],
132 [enable_python=yes], [enable_python=no])
133 AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
134
135 AM_COND_IF([ENABLE_PYTHON],
136 [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])])
137 PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[],[AC_MSG_ERROR([You must install python3-dev])])
138 AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
139
140 # Optional test binaries
141 AC_ARG_ENABLE([tests],
142 [AC_HELP_STRING([--enable-tests], [build test/example binaries])],
143 [enable_tests=yes], [enable_tests=no])
144 AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
145
146 # LXC container path, where the containers are actually stored
147 AC_ARG_WITH([config-path],
148 [AC_HELP_STRING(
149 [--with-config-path=dir],
150 [lxc configuration repository path]
151 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
152
153 # Rootfs path, where the container mount structure is assembled
154 AC_ARG_WITH([rootfs-path],
155 [AC_HELP_STRING(
156 [--with-rootfs-path=dir],
157 [lxc rootfs mount point]
158 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
159
160 # Container log path. By default, use $lxcpath.
161 AC_MSG_CHECKING([Whether to place logfiles in container config path])
162 AC_ARG_ENABLE([configpath-log],
163 [AC_HELP_STRING([--enable-configpath-log], [use logfiles in config path])],
164 [use_configpath_logs=yes], [use_configpath_logs=no])
165 AC_MSG_RESULT([$use_configpath_logs])
166 AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$use_configpath_logs" = "yes"])
167
168 if test "$use_configpath_logs" = "yes"; then
169 default_log_path="${with_config_path}"
170 else
171 default_log_path="/var/log/lxc"
172 fi
173
174 AC_ARG_WITH([log-path],
175 [AC_HELP_STRING(
176 [--with-log-path=dir],
177 [per container log path]
178 )], [], [with_log_path=['${default_log_path}']])
179
180 # Expand some useful variables
181 AS_AC_EXPAND(PREFIX, "$prefix")
182 AS_AC_EXPAND(LIBDIR, "$libdir")
183 AS_AC_EXPAND(BINDIR, "$bindir")
184 AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
185 AS_AC_EXPAND(INCLUDEDIR, "$includedir")
186 AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
187 AS_AC_EXPAND(DATADIR, "$datadir")
188 AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
189 AS_AC_EXPAND(DOCDIR, "$docdir")
190 AS_AC_EXPAND(LXC_CONFFILE, "$conffile")
191 AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
192 AS_AC_EXPAND(LXCPATH, "$with_config_path")
193 AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
194 AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
195 AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
196 AS_AC_EXPAND(LOGPATH, "$with_log_path")
197
198 # Check for some standard kernel headers
199 AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
200 [],
201 AC_MSG_ERROR([Please install the Linux kernel headers.]),
202 [#include <sys/socket.h>])
203
204 # Allow disabling libcap support
205 AC_ARG_ENABLE([capabilities],
206 [AC_HELP_STRING([--disable-capabilities], [disable kernel capabilities])],
207 [], [enable_capabilities=yes])
208
209 # Check for libcap support
210 if test "x$enable_capabilities" = "xyes"; then
211 AC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
212 AC_MSG_CHECKING([linux capabilities])
213 if test "x$caplib" = "xyes" ; then
214 CAP_LIBS="-lcap"
215 AC_MSG_RESULT([$CAP_LIBS])
216 else
217 AC_MSG_RESULT([no])
218 AC_MSG_ERROR([You are missing libcap support. If you really want to build without kernel capabilities, use --disable-capabilities])
219 fi
220 else
221 CAP_LIBS=""
222 fi
223 AC_SUBST([CAP_LIBS])
224
225 # Check for alternate C libraries
226 AC_MSG_CHECKING(for bionic libc)
227 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
228 [[#ifndef __ANDROID__
229 error: Not bionic!
230 #endif]])],
231 [is_bionic=yes],
232 [is_bionic=no])
233 if test "x$is_bionic" = "xyes"; then
234 AC_DEFINE([IS_BIONIC], 1, [bionic libc])
235 AC_MSG_RESULT([yes])
236 else
237 AC_MSG_RESULT([no])
238 fi
239 AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
240
241 # Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
242 AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
243
244 # Check for some headers
245 AC_CHECK_HEADERS([sys/signalfd.h pty.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
246
247 # Check for some syscalls functions
248 AC_CHECK_FUNCS([setns pivot_root sethostname unshare])
249
250 # Check for some functions
251 AC_CHECK_LIB(util, openpty)
252 AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent])
253 AC_CHECK_FUNCS([getline],
254 AM_CONDITIONAL(HAVE_GETLINE, true)
255 AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
256 AM_CONDITIONAL(HAVE_GETLINE, false))
257 AC_CHECK_FUNCS([fgetln],
258 AM_CONDITIONAL(HAVE_FGETLN, true)
259 AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
260 AM_CONDITIONAL(HAVE_FGETLN, false))
261
262 # Check for some standard binaries
263 AC_PROG_GCC_TRADITIONAL
264 AC_PROG_SED
265
266 if test "x$GCC" = "xyes"; then
267 CFLAGS="$CFLAGS -Wall -Werror"
268 fi
269
270 # Files requiring some variable expansion
271 AC_CONFIG_FILES([
272 Makefile
273 lxc.pc
274 lxc.spec
275 config/Makefile
276
277 doc/Makefile
278 doc/lxc-create.sgml
279 doc/lxc-destroy.sgml
280 doc/lxc-execute.sgml
281 doc/lxc-start.sgml
282 doc/lxc-checkpoint.sgml
283 doc/lxc-restart.sgml
284 doc/lxc-stop.sgml
285 doc/lxc-console.sgml
286 doc/lxc-freeze.sgml
287 doc/lxc-unfreeze.sgml
288 doc/lxc-monitor.sgml
289 doc/lxc-wait.sgml
290 doc/lxc-ls.sgml
291 doc/lxc-ps.sgml
292 doc/lxc-cgroup.sgml
293 doc/lxc-kill.sgml
294 doc/lxc-attach.sgml
295 doc/lxc.conf.sgml
296 doc/lxc.sgml
297 doc/common_options.sgml
298 doc/see_also.sgml
299 doc/legacy/lxc-ls.sgml
300
301 doc/rootfs/Makefile
302
303 doc/examples/Makefile
304 doc/examples/lxc-macvlan.conf
305 doc/examples/lxc-vlan.conf
306 doc/examples/lxc-no-netns.conf
307 doc/examples/lxc-empty-netns.conf
308 doc/examples/lxc-phys.conf
309 doc/examples/lxc-veth.conf
310 doc/examples/lxc-complex.conf
311
312 templates/Makefile
313 templates/lxc-lenny
314 templates/lxc-debian
315 templates/lxc-ubuntu
316 templates/lxc-ubuntu-cloud
317 templates/lxc-opensuse
318 templates/lxc-busybox
319 templates/lxc-fedora
320 templates/lxc-oracle
321 templates/lxc-altlinux
322 templates/lxc-sshd
323 templates/lxc-archlinux
324 templates/lxc-alpine
325
326 src/Makefile
327 src/lxc/Makefile
328 src/lxc/lxc-ps
329 src/lxc/lxc-netstat
330 src/lxc/lxc-checkconfig
331 src/lxc/lxc-setcap
332 src/lxc/lxc-setuid
333 src/lxc/lxc-version
334 src/lxc/lxc-create
335 src/lxc/lxc-clone
336 src/lxc/lxc-shutdown
337 src/lxc/lxc-start-ephemeral
338 src/lxc/lxc-destroy
339 src/lxc/legacy/lxc-ls
340
341 src/python-lxc/Makefile
342 src/python-lxc/lxc/__init__.py
343 src/python-lxc/examples/api_test.py
344
345 src/tests/Makefile
346 ])
347 AC_CONFIG_COMMANDS([default],[[]],[[]])
348 AC_OUTPUT
349
350
351 # Detect missing setcap binary
352 AC_CHECK_PROG(SETCAP, setcap, yes, no, $PATH$PATH_SEPARATOR/sbin)
353 if test "x$SETCAP" = "xno"; then
354 AC_MSG_NOTICE([
355
356 Warning:
357 --------
358
359 The setcap binary was not found. This means the tools to set the
360 privilege for the lxc commands are not available, that's ok, but you
361 will need to run these commands as root or install libcap-2.
362
363 ])
364
365 else
366
367 AC_MSG_NOTICE([
368
369 Advice:
370 -------
371
372 If you wish to have a non root user to use the lxc tools,
373 you can add the needed capabilities to the tools by invoking
374 the 'lxc-setcap' script. To remove the capabilities, use
375 'lxc-setcap -d'.
376 ])
377 fi