]> git.proxmox.com Git - mirror_lxc.git/blob - configure.ac
spelling: container
[mirror_lxc.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 m4_define([lxc_devel], 0)
5 m4_define([lxc_version_major], 3)
6 m4_define([lxc_version_minor], 0)
7 m4_define([lxc_version_micro], 0)
8 m4_define([lxc_version_beta], [])
9
10 m4_define([lxc_abi_major], 1)
11 m4_define([lxc_abi_minor], 4)
12 m4_define([lxc_abi_micro], 0)
13 m4_define([lxc_abi], [lxc_abi_major.lxc_abi_minor.lxc_abi_micro])
14
15 m4_define([lxc_version_base], [lxc_version_major.lxc_version_minor.lxc_version_micro])
16 m4_define([lxc_version],
17 [ifelse(lxc_devel, 1,
18 ifelse(lxc_version_beta, [], [lxc_version_base], [lxc_version_base.lxc_version_beta])-devel,
19 ifelse(lxc_version_beta, [], [lxc_version_base], [lxc_version_base.lxc_version_beta]))])
20
21 AC_INIT([lxc], [lxc_version])
22
23 # We need pkg-config
24 PKG_PROG_PKG_CONFIG
25
26 AC_SUBST(LXC_VERSION_BASE, lxc_version_base)
27 AC_SUBST(LXC_VERSION_BETA, lxc_version_beta)
28
29 AC_SUBST([LXC_VERSION_MAJOR], [lxc_version_major])
30 AC_SUBST([LXC_VERSION_MINOR], [lxc_version_minor])
31 AC_SUBST([LXC_VERSION_MICRO], [lxc_version_micro])
32 AC_SUBST([LXC_VERSION], [lxc_version])
33 AC_SUBST([LXC_DEVEL], [lxc_devel])
34
35 AC_SUBST([LXC_ABI_MAJOR], [lxc_abi_major])
36 AC_SUBST([LXC_ABI_MINOR], [lxc_abi_minor])
37 AC_SUBST([LXC_ABI_MICRO], [lxc_abi_micro])
38 AC_SUBST([LXC_ABI], [lxc_abi])
39
40 AC_CONFIG_SRCDIR([configure.ac])
41 AC_CONFIG_AUX_DIR([config])
42 AC_CONFIG_HEADERS([src/config.h])
43 AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects])
44 AC_CANONICAL_HOST
45 AM_PROG_CC_C_O
46 AC_GNU_SOURCE
47
48 # Test if we have a new enough compiler.
49 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
50 #define GCC_VERSION \
51 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
52
53 #define CLANG_VERSION \
54 (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
55
56 #if GCC_VERSION < 40700 && CLANG_VERSION < 10000
57 #error Sorry, your compiler is too old - please upgrade it
58 #endif
59 ]])], [valid_compiler=yes], [valid_compiler=no])
60 if test "x$valid_compiler" = "xno"; then
61 AC_MSG_ERROR([Sorry, your compiler is too old - please upgrade it])
62 fi
63
64 # libtool
65 LT_INIT
66 AC_SUBST([LIBTOOL_DEPS])
67
68 # Detect the distribution. This is used for the default configuration and
69 # for some distro-specific build options.
70 AC_MSG_CHECKING([host distribution])
71 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, redhatenterpriseserver, oracle, centos, fedora, suse, gentoo, debian, arch, slackware, plamo, paldo, openmandriva, pardus, sparclinux, altlinux.]))
72 if type lsb_release >/dev/null 2>&1 && test "z$with_distro" = "z"; then
73 with_distro=`lsb_release -is`
74 fi
75 if test "z$with_distro" = "z"; then
76 AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
77 AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle")
78 AC_CHECK_FILE(/etc/sparclinux-release,with_distro="sparclinux")
79 AC_CHECK_FILE(/etc/centos-release,with_distro="centos")
80 AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora")
81 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
82 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
83 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
84 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
85 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
86 AC_CHECK_FILE(/etc/plamo-version,with_distro="plamo")
87 AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware")
88 AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="openmandriva")
89 AC_CHECK_FILE(/etc/mandriva-release,with_distro="openmandriva")
90 AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
91 AC_CHECK_FILE(/etc/altlinux-release,with_distro="altlinux")
92 AC_CHECK_FILE(/etc/pld-release,with_distro="pld")
93 fi
94 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
95
96 if test "z$with_distro" = "zforsparc"; then
97 with_distro="sparclinux"
98 fi
99
100 if test "z$with_distro" = "z"; then
101 with_distro="unknown"
102 fi
103 case $with_distro in
104 ubuntu|raspbian)
105 distroconf=default.conf.lxcbr
106 distrosysconf="$sysconfdir/default"
107 ;;
108 redhat|redhatenterpriseserver|centos|fedora|oracle|oracleserver|sparclinux|altlinux|suse|opensuse*|plamo|pld)
109 distroconf=default.conf.lxcbr
110 distrosysconf="$sysconfdir/sysconfig"
111 ;;
112 *)
113 distroconf=default.conf.unknown
114 distrosysconf="$sysconfdir/default"
115 ;;
116 esac
117 AC_MSG_RESULT([$with_distro])
118 AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu" -o x"$with_distro" = "xraspbian"])
119 AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
120
121 AC_CONFIG_LINKS([config/etc/default.conf:config/etc/${distroconf}])
122
123 # Check for init system type
124 AC_MSG_CHECKING([for init system type])
125 AC_ARG_WITH([init-script],
126 [AC_HELP_STRING([--with-init-script@<:@=TYPE@<:@,TYPE,...@:>@@:>@],
127 [Type(s) of init script to install: sysvinit, systemd, upstart,
128 distro @<:@default=distro@:>@])],[],[with_init_script=distro])
129 case "$with_init_script" in
130 distro)
131 case $with_distro in
132 fedora|altlinux|opensuse*)
133 init_script=systemd
134 ;;
135 redhat|redhatenterpriseserver|oracle|oracleserver|sparclinux|plamo)
136 init_script=sysvinit
137 ;;
138 centos)
139 init_script=sysvinit,systemd
140 ;;
141 debian|raspbian|ubuntu)
142 init_script=upstart,systemd
143 ;;
144 pld)
145 init_script=sysvinit,upstart,systemd
146 ;;
147 *)
148 echo -n "Linux distribution init system unknown."
149 init_script=
150 ;;
151 esac
152 ;;
153 *)
154 init_script=$with_init_script
155 ;;
156 esac
157
158 # Check valid init systems were given, run in subshell so we don't mess up IFS
159 (IFS="," ; for init_sys in $init_script;
160 do
161 case "$init_sys" in
162 none|sysvinit|systemd|upstart)
163 ;;
164 *)
165 exit 1
166 ;;
167 esac
168 done) || AC_MSG_ERROR([Unknown init system type in $init_script])
169
170 AM_CONDITIONAL([INIT_SCRIPT_SYSV], [echo "$init_script" |grep -q "sysvinit"])
171 AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], [echo "$init_script" |grep -q "systemd"])
172 AM_CONDITIONAL([INIT_SCRIPT_UPSTART], [echo "$init_script" |grep -q "upstart"])
173 AC_MSG_RESULT($init_script)
174
175 # systemd unit dir
176 AC_ARG_WITH([systemdsystemunitdir],
177 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
178 [],
179 [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
180 if test -z "$with_systemdsystemunitdir"; then
181 with_systemdsystemunitdir=/lib/systemd/system
182 fi
183 if test "x$with_systemdsystemunitdir" != "xno"; then
184 AC_SUBST([SYSTEMD_UNIT_DIR], [$with_systemdsystemunitdir])
185 fi
186
187 AC_ARG_ENABLE([werror],
188 [AC_HELP_STRING([--disable-werror],
189 [do not treat warnings as errors])],
190 [], [enable_werror=yes])
191
192 # Allow disabling rpath
193 AC_ARG_ENABLE([rpath],
194 [AC_HELP_STRING([--enable-rpath], [set rpath in executables [default=no]])],
195 [], [enable_rpath=no])
196 AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
197
198 # Documentation (manpages)
199 AC_ARG_ENABLE([doc],
200 [AC_HELP_STRING([--enable-doc], [make man pages [default=auto]])],
201 [], [enable_doc=auto])
202
203 if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
204 db2xman=""
205 dbparsers="docbook2X2man docbook2x-man db2x_docbook2man docbook2man docbook-to-man"
206
207 AC_MSG_CHECKING(for docbook2x-man)
208 for name in ${dbparsers}; do
209 if "$name" --help >/dev/null 2>&1; then
210 db2xman="$name"
211 break;
212 fi
213 done
214
215 if test -n "${db2xman}"; then
216 AC_MSG_RESULT([${db2xman}])
217 enable_doc="yes"
218 else
219 AC_MSG_RESULT([no])
220 if test "x$enable_doc" = "xyes"; then
221 AC_MSG_ERROR([docbook2x-man is required, but could not be found])
222 fi
223 enable_doc="no"
224 fi
225
226 AC_SUBST(db2xman)
227 fi
228 AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
229 AM_CONDITIONAL([USE_DOCBOOK2X], [test "x$db2xman" != "xdocbook2man"])
230
231 if test "x$db2xman" = "xdocbook2man"; then
232 docdtd="\"-//Davenport//DTD DocBook V3.0//EN\""
233 else
234 docdtd="\"-//OASIS//DTD DocBook XML\" \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""
235 fi
236 AC_SUBST(docdtd)
237
238 # Documentation (API)
239 AC_ARG_ENABLE([api-docs],
240 [AC_HELP_STRING([--enable-api-docs],
241 [make API documentation [default=auto]])],
242 [], [enable_api_docs=auto])
243
244 if test "x$enable_api_docs" = "xyes" -o "x$enable_api_docs" = "xauto"; then
245 AC_CHECK_PROGS([HAVE_DOXYGEN],[doxygen])
246 AC_SUBST([HAVE_DOXYGEN])
247
248 if test "x$HAVE_DOXYGEN" != "x"; then
249 enable_api_docs="yes"
250 else
251 if test "x$enable_api_docs" = "xyes"; then
252 AC_MSG_ERROR([doxygen is required, but could not be found])
253 fi
254 enable_api_docs="no"
255 fi
256 fi
257
258 AM_CONDITIONAL([ENABLE_API_DOCS], [test "x$HAVE_DOXYGEN" != "x"])
259
260 # Apparmor
261 AC_ARG_ENABLE([apparmor],
262 [AC_HELP_STRING([--enable-apparmor], [enable apparmor support [default=auto]])],
263 [], [enable_apparmor=auto])
264
265 if test "$enable_apparmor" = "auto" ; then
266 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
267 fi
268 AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
269
270 # GnuTLS
271 AC_ARG_ENABLE([gnutls],
272 [AC_HELP_STRING([--enable-gnutls], [enable GnuTLS support [default=auto]])],
273 [], [enable_gnutls=auto])
274
275 if test "$enable_gnutls" = "auto" ; then
276 AC_CHECK_LIB([gnutls], [gnutls_hash_fast], [enable_gnutls=yes], [enable_gnutls=no])
277 fi
278 AM_CONDITIONAL([ENABLE_GNUTLS], [test "x$enable_gnutls" = "xyes"])
279
280 AM_COND_IF([ENABLE_GNUTLS],
281 [AC_CHECK_HEADER([gnutls/gnutls.h],[],[AC_MSG_ERROR([You must install the GnuTLS development package in order to compile lxc])])
282 AC_CHECK_LIB([gnutls], [gnutls_hash_fast],[true],[AC_MSG_ERROR([You must install the GnuTLS development package in order to compile lxc])])
283 AC_SUBST([GNUTLS_LIBS], [-lgnutls])])
284
285 # SELinux
286 AC_ARG_ENABLE([selinux],
287 [AC_HELP_STRING([--enable-selinux], [enable SELinux support [default=auto]])],
288 [], [enable_selinux=auto])
289
290 if test "x$enable_selinux" = xauto; then
291 AC_CHECK_LIB([selinux],[setexeccon_raw],[enable_selinux=yes],[enable_selinux=no])
292 fi
293 AM_CONDITIONAL([ENABLE_SELINUX], [test "x$enable_selinux" = "xyes"])
294 AM_COND_IF([ENABLE_SELINUX],
295 [AC_CHECK_HEADER([selinux/selinux.h],[],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
296 AC_CHECK_LIB([selinux], [setexeccon_raw],[true],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
297 AC_SUBST([SELINUX_LIBS], [-lselinux])])
298
299 # Seccomp syscall filter
300 AC_ARG_ENABLE([seccomp],
301 [AC_HELP_STRING([--enable-seccomp], [enable seccomp support [default=auto]])],
302 [], [enable_seccomp=auto])
303
304 if test "x$enable_seccomp" = "xauto" ; then
305 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
306 fi
307 AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
308
309 AM_COND_IF([ENABLE_SECCOMP],
310 [PKG_CHECK_MODULES([SECCOMP],[libseccomp],[],[
311 AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
312 AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
313 AC_SUBST([SECCOMP_LIBS], [-lseccomp])
314 ])
315 ])
316
317 AC_MSG_CHECKING(for static libcap)
318 # Check for static libcap, make sure the function checked for differs from the
319 # the one checked below so the cache doesn't give a wrong answer
320 OLD_CFLAGS="$CFLAGS"
321 OLD_CPPFLAGS="$CPPFLAGS"
322 OLD_LDFLAGS="$LDFLAGS"
323 OLD_LIBS="$LIBS"
324 CFLAGS=""
325 CPPFLAGS=""
326 LDFLAGS="-static"
327 LIBS="-lcap"
328 AC_LINK_IFELSE([
329 AC_LANG_SOURCE(
330 [[int main() { return 0; }]]
331 )],[have_static_libcap=yes],[have_static_libcap=no])
332 AM_CONDITIONAL([HAVE_STATIC_LIBCAP], [test "x$have_static_libcap" = "xyes"])
333 if test "x$have_static_libcap" = "xyes"; then
334 AC_DEFINE([HAVE_STATIC_LIBCAP], 1, [Have static libcap])
335 AC_MSG_RESULT([yes])
336 else
337 AC_MSG_RESULT([no])
338 fi
339 CPPFLAGS="$OLD_CPPFLAGS"
340 CFLAGS="$OLD_CFLAGS"
341 LDFLAGS="$OLD_LDFLAGS"
342 LIBS="$OLD_LIBS"
343
344
345 # Linux capabilities
346 AC_ARG_ENABLE([capabilities],
347 [AC_HELP_STRING([--enable-capabilities], [enable kernel capabilities support [default=auto]])],
348 [], [enable_capabilities=auto])
349
350 if test "x$enable_capabilities" = "xauto"; then
351 AC_CHECK_LIB([cap],[cap_set_proc],[enable_capabilities=yes],[enable_capabilities=no])
352 fi
353 AM_CONDITIONAL([ENABLE_CAP], [test "x$enable_capabilities" = "xyes"])
354
355 AM_COND_IF([ENABLE_CAP],
356 [AC_CHECK_HEADER([sys/capability.h],[],[AC_MSG_ERROR([You must install the libcap development package in order to compile lxc])])
357 AC_CHECK_LIB(cap,cap_set_proc,[],[AC_MSG_ERROR([You must install the libcap development package in order to compile lxc])])
358 # Test whether we support getting file capabilities via cap_get_file().
359 AC_CHECK_LIB(cap,cap_get_file, AC_DEFINE(LIBCAP_SUPPORTS_FILE_CAPABILITIES,1,[Have cap_get_file]),[],[])
360 AC_SUBST([CAP_LIBS], [-lcap])])
361
362 # HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
363 OLD_CFLAGS="$CFLAGS"
364 CFLAGS="$CFLAGS $SECCOMP_CFLAGS"
365 AC_CHECK_TYPES([scmp_filter_ctx], [], [], [[#include <seccomp.h>]])
366 AC_CHECK_DECLS([seccomp_syscall_resolve_name_arch], [], [], [[#include <seccomp.h>]])
367 CFLAGS="$OLD_CFLAGS"
368
369 # Configuration examples
370 AC_ARG_ENABLE([examples],
371 [AC_HELP_STRING([--enable-examples], [install examples [default=yes]])],
372 [], [enable_examples=yes])
373 AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
374
375 # Enable dumping stack traces
376 AC_ARG_ENABLE([mutex-debugging],
377 [AC_HELP_STRING([--enable-mutex-debugging], [Makes mutexes to report error and provide stack trace [default=no]])],
378 [], [enable_mutex_debugging=no])
379 AM_CONDITIONAL([MUTEX_DEBUGGING], [test "x$enable_mutex_debugging" = "xyes"])
380
381 AM_COND_IF([MUTEX_DEBUGGING],
382 AC_DEFINE_UNQUOTED([MUTEX_DEBUGGING], 1, [Enabling mutex debugging]))
383
384 # Not in older autoconf versions
385 # AS_VAR_COPY(DEST, SOURCE)
386 # -------------------------
387 # Set the polymorphic shell variable DEST to the contents of the polymorphic
388 # shell variable SOURCE.
389 m4_ifdef([AS_VAR_COPY], [],
390 [AC_DEFUN([AS_VAR_COPY],
391 [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
392 ])
393
394 dnl PKG_CHECK_VAR was introduced with pkg-config 0.28
395 m4_ifdef([PKG_CHECK_VAR], [],
396 [AC_DEFUN([PKG_CHECK_VAR],
397 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
398 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
399 _PKG_CONFIG([$1], [variable="][$3]["], [$2])
400 AS_VAR_COPY([$1], [pkg_cv_][$1])
401 AS_VAR_IF([$1], [""], [$5], [$4])dnl
402 ])# PKG_CHECK_VAR
403 ])
404
405 # Optional bash integration
406 AC_ARG_ENABLE([bash],
407 [AC_HELP_STRING([--enable-bash], [build bash integration [default=yes]])],
408 [], [enable_bash=yes])
409 AM_CONDITIONAL([ENABLE_BASH], [test "x$enable_bash" = "xyes"])
410
411 AM_COND_IF([ENABLE_BASH],
412 [AC_MSG_CHECKING([bash completion directory])
413 PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], ,
414 bashcompdir="${sysconfdir}/bash_completion.d")
415 AC_MSG_RESULT([$bashcompdir])
416 AC_SUBST(bashcompdir)
417 ])
418
419 # Build the command line tools
420 AC_ARG_ENABLE([tools],
421 [AC_HELP_STRING([--enable-tools], [build the command line tools [default=yes]])],
422 [], [enable_tools=yes])
423 AM_CONDITIONAL([ENABLE_TOOLS], [test "x$enable_tools" = "xyes"])
424
425 # Build the liblxc commands
426 AC_ARG_ENABLE([commands],
427 [AC_HELP_STRING([--enable-commands], [build the liblxc commands [default=yes]])],
428 [], [enable_commands=yes])
429 AM_CONDITIONAL([ENABLE_COMMANDS], [test "x$enable_commands" = "xyes"])
430
431 # Optional test binaries
432 AC_ARG_ENABLE([tests],
433 [AC_HELP_STRING([--enable-tests], [build test/example binaries [default=no]])],
434 [], [enable_tests=no])
435 AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
436
437 # Allow overriding the default runtime dir (/run)
438 AC_ARG_WITH([runtime-path],
439 [AC_HELP_STRING(
440 [--with-runtime-path=dir],
441 [runtime directory (default: /run)]
442 )], [], [with_runtime_path=['/run']])
443
444 # LXC container path, where the containers are actually stored
445 # This is overridden by an entry in the file called LXCCONF
446 # (i.e. /etc/lxc/lxc.conf)
447 AC_ARG_WITH([config-path],
448 [AC_HELP_STRING(
449 [--with-config-path=dir],
450 [lxc configuration repository path]
451 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
452
453 # The path of the global lxc configuration file.
454 AC_ARG_WITH([global-conf],
455 [AC_HELP_STRING(
456 [--with-global-conf=dir],
457 [global lxc configuration file]
458 )], [], [with_global_conf=['${sysconfdir}/lxc/lxc.conf']])
459
460 # The path of the userns network configuration file
461 AC_ARG_WITH([usernic-conf],
462 [AC_HELP_STRING(
463 [--with-usernic-conf],
464 [user network interface configuration file]
465 )], [], [with_usernic_conf=['${sysconfdir}/lxc/lxc-usernet']])
466
467 # The path of the runtime usernic database
468 AC_ARG_WITH([usernic-db],
469 [AC_HELP_STRING(
470 [--with-usernic-db],
471 [lxc user nic database]
472 )], [], [with_usernic_db=['${with_runtime_path}/lxc/nics']])
473
474 # Rootfs path, where the container mount structure is assembled
475 AC_ARG_WITH([rootfs-path],
476 [AC_HELP_STRING(
477 [--with-rootfs-path=dir],
478 [lxc rootfs mount point]
479 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
480
481 # cgroup pattern specification
482 AC_ARG_WITH([cgroup-pattern],
483 [AC_HELP_STRING(
484 [--with-cgroup-pattern=pattern],
485 [pattern for container cgroups]
486 )], [], [with_cgroup_pattern=['lxc.payload/%n']])
487
488 # The path for the apparmor_parser's cache for generated apparmor profiles
489 AC_ARG_WITH([apparmor-cache-dir],
490 [AC_HELP_STRING(
491 [--with-apparmor-cache-dir=dir],
492 [path for apparmor_parser cache]
493 )], [], [with_apparmor_cache_dir=['${localstatedir}/cache/lxc/apparmor']])
494
495 # Container log path. By default, use $lxcpath.
496 AC_MSG_CHECKING([Whether to place logfiles in container config path])
497 AC_ARG_ENABLE([configpath-log],
498 [AC_HELP_STRING([--enable-configpath-log], [use logfiles in config path [default=no]])],
499 [], [enable_configpath_log=no])
500 AC_MSG_RESULT([$enable_configpath_log])
501 AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$enable_configpath_log" = "yes"])
502
503 if test "$enable_configpath_log" = "yes"; then
504 default_log_path="${with_config_path}"
505 else
506 default_log_path="${localstatedir}/log/lxc"
507 fi
508
509 AC_ARG_WITH([log-path],
510 [AC_HELP_STRING(
511 [--with-log-path=dir],
512 [per container log path]
513 )], [], [with_log_path=['${default_log_path}']])
514
515 # Expand some useful variables
516 AS_AC_EXPAND(PREFIX, "$prefix")
517 AS_AC_EXPAND(LIBDIR, "$libdir")
518 AS_AC_EXPAND(BINDIR, "$bindir")
519 AS_AC_EXPAND(SBINDIR, "$sbindir")
520 AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
521 AS_AC_EXPAND(INCLUDEDIR, "$includedir")
522 AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
523 AS_AC_EXPAND(LXC_DEFAULT_CONFIG, "$sysconfdir/lxc/default.conf")
524 AS_AC_EXPAND(DATADIR, "$datadir")
525 AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
526 AS_AC_EXPAND(DOCDIR, "$docdir")
527 AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date --utc --date=@${SOURCE_DATE_EPOCH:-$(date +%s)} '+%Y-%m-%d')")
528 AS_AC_EXPAND(LXCPATH, "$with_config_path")
529 AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf")
530 AS_AC_EXPAND(LXC_USERNIC_CONF, "$with_usernic_conf")
531 AS_AC_EXPAND(LXC_USERNIC_DB, "$with_usernic_db")
532 AS_AC_EXPAND(LXC_DISTRO_SYSCONF, "$distrosysconf")
533 AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
534 AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
535 AS_AC_EXPAND(LXCTEMPLATECONFIG, "$datadir/lxc/config")
536 AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
537 AS_AC_EXPAND(LXCBINHOOKDIR, "$libexecdir/lxc/hooks")
538 AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
539 AS_AC_EXPAND(LOGPATH, "$with_log_path")
540 AS_AC_EXPAND(RUNTIME_PATH, "$with_runtime_path")
541 AS_AC_EXPAND(APPARMOR_CACHE_DIR, "$with_apparmor_cache_dir")
542 AC_SUBST(DEFAULT_CGROUP_PATTERN, ["$with_cgroup_pattern"])
543
544 # We need the install path so criu knows where to reference the hook scripts.
545 AC_DEFINE_UNQUOTED([DATADIR], "$DATADIR", ["Prefix for shared files."])
546
547 # Check for some standard kernel headers
548 AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
549 [],
550 AC_MSG_ERROR([Please install the Linux kernel headers.]),
551 [#include <sys/socket.h>])
552
553 # Check for alternate C libraries
554 AC_MSG_CHECKING(for bionic libc)
555 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
556 [[#ifndef __ANDROID__
557 error: Not bionic!
558 #endif]])],
559 [is_bionic=yes],
560 [is_bionic=no])
561 if test "x$is_bionic" = "xyes"; then
562 AC_DEFINE([IS_BIONIC], 1, [bionic libc])
563 AC_MSG_RESULT([yes])
564 else
565 AC_MSG_RESULT([no])
566 fi
567 AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
568
569 # Configuration examples
570 AC_ARG_ENABLE([pam],
571 [AC_HELP_STRING([--enable-pam], [enable pam module [default=no]])],
572 [], [enable_pam=no])
573 AM_CONDITIONAL([ENABLE_PAM], [test "x$enable_pam" = "xyes"])
574
575 AM_COND_IF([ENABLE_PAM],
576 [AC_ARG_WITH(
577 [pamdir],
578 [AS_HELP_STRING([--with-pamdir=PATH],[Specify the directory where PAM modules are stored,
579 or "none" if PAM modules are not to be built])],
580 [pamdir="${withval}"],
581 [
582 if test "${prefix}" = "/usr"; then
583 pamdir="/lib${libdir##*/lib}/security"
584 else
585 pamdir="\$(libdir)/security"
586 fi
587 ]
588 )])
589
590 AM_CONDITIONAL([HAVE_PAM], [test x"$pamdir" != "xnone"])
591 AM_COND_IF([ENABLE_PAM],
592 [if test "z$pamdir" != "znone"; then
593 AC_ARG_VAR([PAM_CFLAGS], [C compiler flags for pam])
594 AC_ARG_VAR([PAM_LIBS], [linker flags for pam])
595 AC_CHECK_LIB(
596 [pam],
597 [pam_authenticate],
598 [PAM_LIBS="-lpam"],
599 [AC_MSG_ERROR([*** libpam not found.])
600 ])
601
602 AC_SUBST(PAM_LIBS)
603 AC_SUBST([pamdir])
604 fi])
605
606 # Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
607 AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
608
609 # Some systems lack PR_{G,S}ET_NO_NEW_PRIVS definition => HAVE_DECL_PR_{G,S}ET_NO_NEW_PRIVS
610 AC_CHECK_DECLS([PR_SET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
611 AC_CHECK_DECLS([PR_GET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
612
613 # Check for some headers
614 AC_CHECK_HEADERS([pty.h sys/memfd.h sys/personality.h sys/resource.h sys/signalfd.h sys/timerfd.h utmpx.h])
615
616 AC_CHECK_HEADER([ifaddrs.h],
617 AM_CONDITIONAL(HAVE_IFADDRS_H, true)
618 AC_DEFINE(HAVE_IFADDRS_H, 1, [Have ifaddrs.h]),
619 AM_CONDITIONAL(HAVE_IFADDRS_H, false))
620
621 # lookup major()/minor()/makedev()
622 AC_HEADER_MAJOR
623
624 # Check for some syscalls functions
625 AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat gettid memfd_create])
626
627 # Check for strerror_r() support. Defines:
628 # - HAVE_STRERROR_R if available
629 # - HAVE_DECL_STRERROR_R if defined
630 # - STRERROR_R_CHAR_P if it returns char *
631 AC_FUNC_STRERROR_R
632
633 # Check for some functions
634 AC_CHECK_LIB(pthread, main)
635 AC_CHECK_FUNCS(statvfs)
636 AC_CHECK_LIB(util, openpty)
637 AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent utmpxname])
638 AC_CHECK_FUNCS([getgrgid_r],
639 AM_CONDITIONAL(HAVE_GETGRGID_R, true)
640 AC_DEFINE(HAVE_GETGRGID_R,1,[Have getgrgid_r]),
641 AM_CONDITIONAL(HAVE_GETGRGID_R, false))
642 AC_CHECK_FUNCS([getline],
643 AM_CONDITIONAL(HAVE_GETLINE, true)
644 AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
645 AM_CONDITIONAL(HAVE_GETLINE, false))
646 AC_CHECK_FUNCS([getsubopt],
647 AM_CONDITIONAL(HAVE_GETSUBOPT, true)
648 AC_DEFINE(HAVE_GETSUBOPT,1,[Have getsubopt]),
649 AM_CONDITIONAL(HAVE_GETSUBOPT, false))
650 AC_CHECK_FUNCS([fgetln],
651 AM_CONDITIONAL(HAVE_FGETLN, true)
652 AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
653 AM_CONDITIONAL(HAVE_FGETLN, false))
654 AC_CHECK_FUNCS([keyctl],
655 AM_CONDITIONAL(HAVE_KEYCTL, true)
656 AC_DEFINE(HAVE_KEYCTL,1,[Have keyctl]),
657 AM_CONDITIONAL(HAVE_KEYCTL, false))
658 AC_CHECK_FUNCS([prlimit],
659 AM_CONDITIONAL(HAVE_PRLIMIT, true)
660 AC_DEFINE(HAVE_PRLIMIT,1,[Have prlimit]),
661 AM_CONDITIONAL(HAVE_PRLIMIT, false))
662 AC_CHECK_FUNCS([prlimit64],
663 AM_CONDITIONAL(HAVE_PRLIMIT64, true)
664 AC_DEFINE(HAVE_PRLIMIT64,1,[Have prlimit64]),
665 AM_CONDITIONAL(HAVE_PRLIMIT64, false))
666 AC_CHECK_FUNCS([pthread_setcancelstate],
667 AM_CONDITIONAL(HAVE_PTHREAD_SETCANCELSTATE, true)
668 AC_DEFINE(HAVE_PTHREAD_SETCANCELSTATE,1,[Have pthread_setcancelstate]),
669 AM_CONDITIONAL(HAVE_PTHREAD_SETCANCELSTATE, false))
670 AC_CHECK_FUNCS([strlcpy],
671 AM_CONDITIONAL(HAVE_STRLCPY, true)
672 AC_DEFINE(HAVE_STRLCPY,1,[Have strlcpy]),
673 AM_CONDITIONAL(HAVE_STRLCPY, false))
674 AC_CHECK_FUNCS([strlcat],
675 AM_CONDITIONAL(HAVE_STRLCAT, true)
676 AC_DEFINE(HAVE_STRLCAT,1,[Have strlcat]),
677 AM_CONDITIONAL(HAVE_STRLCAT, false))
678
679 # HAVE_STRUCT_RTNL_LINK_STATS64={0,1}
680 AC_CHECK_TYPES([struct rtnl_link_stats64], [], [], [[#include <linux/if_link.h>]])
681
682 # Check for some libraries
683 AX_PTHREAD
684 AC_SEARCH_LIBS(clock_gettime, [rt])
685
686 # Check for some standard binaries
687 AC_PROG_GCC_TRADITIONAL
688 AC_PROG_SED
689
690 # See if we support thread-local storage.
691 LXC_CHECK_TLS
692
693 AX_CHECK_COMPILE_FLAG([-fdiagnostics-color], [CFLAGS="$CFLAGS -fdiagnostics-color"],,[-Werror])
694 AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough], [CFLAGS="$CFLAGS -Wimplicit-fallthrough"],,[-Werror])
695 AX_CHECK_COMPILE_FLAG([-Wcast-align], [CFLAGS="$CFLAGS -Wcast-align"],,[-Werror])
696 AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], [CFLAGS="$CFLAGS -Wstrict-prototypes"],,[-Werror])
697 AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"],,[-Werror])
698 AX_CHECK_COMPILE_FLAG([-fstack-clash-protection], [CFLAGS="$CFLAGS -fstack-clash-protection"],,[-Werror])
699 AX_CHECK_COMPILE_FLAG([-fstack-protector-strong], [CFLAGS="$CFLAGS -fstack-protector-strong"],,[-Werror])
700 AX_CHECK_COMPILE_FLAG([-g], [CFLAGS="$CFLAGS -g"],,[-Werror])
701 AX_CHECK_COMPILE_FLAG([--mcet -fcf-protection], [CFLAGS="$CFLAGS --mcet -fcf-protection"],,[-Werror])
702 AX_CHECK_COMPILE_FLAG([-Werror=implicit-function-declaration], [CFLAGS="$CFLAGS -Werror=implicit-function-declaration"],,[-Werror])
703
704 AX_CHECK_LINK_FLAG([-z relro], [LDLAGS="$LDLAGS -z relro"],,[])
705 AX_CHECK_LINK_FLAG([-z now], [LDLAGS="$LDLAGS -z now"],,[])
706
707 CFLAGS="$CFLAGS -Wvla -std=gnu11"
708 if test "x$enable_werror" = "xyes"; then
709 CFLAGS="$CFLAGS -Werror"
710 fi
711
712 AC_ARG_ENABLE([thread-safety],
713 [AC_HELP_STRING([--enable-thread-safety], [enforce thread-safety otherwise fail the build [default=yes]])],
714 [], [enable_thread_safety=yes])
715 AM_CONDITIONAL([ENFORCE_THREAD_SAFETY], [test "x$enable_thread_safety" = "xyes"])
716
717 AC_ARG_ENABLE([dlog],
718 [AC_HELP_STRING([--enable-dlog], [enable dlog support [default=no]])],
719 [], [enable_dlog=no])
720 AM_CONDITIONAL([ENABLE_DLOG], [test "x$enable_dlog" = "xyes"])
721
722 AM_COND_IF([ENABLE_DLOG],
723 [PKG_CHECK_MODULES([DLOG],[dlog],[],[
724 AC_CHECK_HEADER([dlog.h],[],[AC_MSG_ERROR([You must install the dlog development package in order to compile lxc])])
725 AC_CHECK_LIB([dlog], [dlog_print],[],[AC_MSG_ERROR([You must install the dlog development package in order to compile lxc])])
726 AC_SUBST([DLOG_LIBS], [-ldlog])
727 ])
728 ])
729
730 # Files requiring some variable expansion
731 AC_CONFIG_FILES([
732 Makefile
733 lxc.pc
734 lxc.spec
735
736 config/Makefile
737 config/apparmor/Makefile
738 config/apparmor/abstractions/start-container
739 config/selinux/Makefile
740 config/bash/Makefile
741 config/bash/lxc
742 config/init/Makefile
743 config/init/common/Makefile
744 config/init/common/lxc-containers
745 config/init/common/lxc-net
746 config/init/systemd/Makefile
747 config/init/systemd/lxc.service
748 config/init/systemd/lxc@.service
749 config/init/systemd/lxc-net.service
750 config/init/sysvinit/Makefile
751 config/init/sysvinit/lxc-containers
752 config/init/sysvinit/lxc-net
753 config/init/upstart/lxc.conf
754 config/init/upstart/lxc-net.conf
755 config/init/upstart/Makefile
756 config/etc/Makefile
757 config/templates/Makefile
758 config/templates/common.conf
759 config/templates/common.conf.d/Makefile
760 config/templates/nesting.conf
761 config/templates/oci.common.conf
762 config/templates/userns.conf
763 config/yum/Makefile
764 config/sysconfig/Makefile
765 config/sysconfig/lxc
766
767 doc/Makefile
768 doc/api/Makefile
769 doc/lxc-attach.sgml
770 doc/lxc-autostart.sgml
771 doc/lxc-cgroup.sgml
772 doc/lxc-checkconfig.sgml
773 doc/lxc-checkpoint.sgml
774 doc/lxc-config.sgml
775 doc/lxc-console.sgml
776 doc/lxc-copy.sgml
777 doc/lxc-create.sgml
778 doc/lxc-destroy.sgml
779 doc/lxc-device.sgml
780 doc/lxc-execute.sgml
781 doc/lxc-freeze.sgml
782 doc/lxc-info.sgml
783 doc/lxc-ls.sgml
784 doc/lxc-monitor.sgml
785 doc/lxc-snapshot.sgml
786 doc/lxc-start.sgml
787 doc/lxc-stop.sgml
788 doc/lxc-top.sgml
789 doc/lxc-unfreeze.sgml
790 doc/lxc-unshare.sgml
791 doc/lxc-update-config.sgml
792 doc/lxc-user-nic.sgml
793 doc/lxc-usernsexec.sgml
794 doc/lxc-wait.sgml
795
796 doc/lxc.conf.sgml
797 doc/lxc.container.conf.sgml
798 doc/lxc.system.conf.sgml
799 doc/lxc-usernet.sgml
800 doc/lxc.sgml
801 doc/common_options.sgml
802 doc/see_also.sgml
803
804 doc/rootfs/Makefile
805
806 doc/examples/Makefile
807 doc/examples/lxc-macvlan.conf
808 doc/examples/lxc-vlan.conf
809 doc/examples/lxc-no-netns.conf
810 doc/examples/lxc-empty-netns.conf
811 doc/examples/lxc-phys.conf
812 doc/examples/lxc-veth.conf
813 doc/examples/lxc-complex.conf
814
815 doc/ja/Makefile
816 doc/ja/lxc-attach.sgml
817 doc/ja/lxc-autostart.sgml
818 doc/ja/lxc-cgroup.sgml
819 doc/ja/lxc-checkconfig.sgml
820 doc/ja/lxc-checkpoint.sgml
821 doc/ja/lxc-config.sgml
822 doc/ja/lxc-console.sgml
823 doc/ja/lxc-copy.sgml
824 doc/ja/lxc-create.sgml
825 doc/ja/lxc-destroy.sgml
826 doc/ja/lxc-device.sgml
827 doc/ja/lxc-execute.sgml
828 doc/ja/lxc-freeze.sgml
829 doc/ja/lxc-info.sgml
830 doc/ja/lxc-ls.sgml
831 doc/ja/lxc-monitor.sgml
832 doc/ja/lxc-snapshot.sgml
833 doc/ja/lxc-start.sgml
834 doc/ja/lxc-stop.sgml
835 doc/ja/lxc-top.sgml
836 doc/ja/lxc-unfreeze.sgml
837 doc/ja/lxc-unshare.sgml
838 doc/ja/lxc-update-config.sgml
839 doc/ja/lxc-user-nic.sgml
840 doc/ja/lxc-usernsexec.sgml
841 doc/ja/lxc-wait.sgml
842
843 doc/ja/lxc.conf.sgml
844 doc/ja/lxc.container.conf.sgml
845 doc/ja/lxc.system.conf.sgml
846 doc/ja/lxc-usernet.sgml
847 doc/ja/lxc.sgml
848 doc/ja/common_options.sgml
849 doc/ja/see_also.sgml
850
851 doc/ko/Makefile
852 doc/ko/lxc-attach.sgml
853 doc/ko/lxc-autostart.sgml
854 doc/ko/lxc-cgroup.sgml
855 doc/ko/lxc-checkconfig.sgml
856 doc/ko/lxc-checkpoint.sgml
857 doc/ko/lxc-config.sgml
858 doc/ko/lxc-console.sgml
859 doc/ko/lxc-copy.sgml
860 doc/ko/lxc-create.sgml
861 doc/ko/lxc-destroy.sgml
862 doc/ko/lxc-device.sgml
863 doc/ko/lxc-execute.sgml
864 doc/ko/lxc-freeze.sgml
865 doc/ko/lxc-info.sgml
866 doc/ko/lxc-ls.sgml
867 doc/ko/lxc-monitor.sgml
868 doc/ko/lxc-snapshot.sgml
869 doc/ko/lxc-start.sgml
870 doc/ko/lxc-stop.sgml
871 doc/ko/lxc-top.sgml
872 doc/ko/lxc-unfreeze.sgml
873 doc/ko/lxc-unshare.sgml
874 doc/ko/lxc-user-nic.sgml
875 doc/ko/lxc-usernsexec.sgml
876 doc/ko/lxc-wait.sgml
877
878 doc/ko/lxc.conf.sgml
879 doc/ko/lxc.container.conf.sgml
880 doc/ko/lxc.system.conf.sgml
881 doc/ko/lxc-usernet.sgml
882 doc/ko/lxc.sgml
883 doc/ko/common_options.sgml
884 doc/ko/see_also.sgml
885
886 hooks/Makefile
887 hooks/dhclient
888
889 templates/Makefile
890 templates/lxc-busybox
891 templates/lxc-download
892 templates/lxc-local
893 templates/lxc-oci
894
895 src/Makefile
896 src/lxc/Makefile
897 src/lxc/lxc.functions
898 src/lxc/cmd/lxc-checkconfig
899 src/lxc/cmd/lxc-update-config
900 src/lxc/version.h
901
902 src/tests/Makefile
903 src/tests/lxc-test-usernic
904 ])
905 AC_CONFIG_COMMANDS([default],[[]],[[]])
906 AC_OUTPUT
907
908 # Configuration overview
909 cat << EOF
910
911 ----------------------------
912 Binaries
913 - Command Line Tools:
914 - lxc-attach: $enable_tools
915 - lxc-autostart: $enable_tools
916 - lxc-cgroup: $enable_tools
917 - lxc-checkpoint: $enable_tools
918 - lxc-config: $enable_tools
919 - lxc-console: $enable_tools
920 - lxc-copy: $enable_tools
921 - lxc-create: $enable_tools
922 - lxc-destroy: $enable_tools
923 - lxc-device: $enable_tools
924 - lxc-execute: $enable_tools
925 - lxc-freeze: $enable_tools
926 - lxc-info: $enable_tools
927 - lxc-ls: $enable_tools
928 - lxc-monitor: $enable_tools
929 - lxc-snapshot: $enable_tools
930 - lxc-start: $enable_tools
931 - lxc-stop: $enable_tools
932 - lxc-top: $enable_tools
933 - lxc-unfreeze: $enable_tools
934 - lxc-unshare: $enable_tools
935 - lxc-wait: $enable_tools
936
937 - liblxc Commands:
938 - lxc-checkconfig: $enable_commands
939 - lxc-update-config: $enable_commands
940 - lxc-init: $enable_commands
941 - lxc-monitord: $enable_commands
942 - lxc-user-nic: $enable_commands
943 - lxc-usernsexec: $enable_commands
944
945 Environment:
946 - compiler: $CC
947 - distribution: $with_distro
948 - init script type(s): $init_script
949 - rpath: $enable_rpath
950 - GnuTLS: $enable_gnutls
951 - Bash integration: $enable_bash
952
953 Security features:
954 - Apparmor: $enable_apparmor
955 - Linux capabilities: $enable_capabilities
956 - seccomp: $enable_seccomp
957 - SELinux: $enable_selinux
958
959 PAM:
960 - PAM module: $enable_pam
961 - cgroup PAM module: $pamdir
962
963 Documentation:
964 - examples: $enable_examples
965 - API documentation: $enable_api_docs
966 - user documentation: $enable_doc
967
968 Debugging:
969 - tests: $enable_tests
970 - mutex debugging: $enable_mutex_debugging
971
972 Paths:
973 - Logs in configpath: $enable_configpath_log
974
975 Thread-safety:
976 - enforce: $enable_thread_safety
977
978 Dlog:
979 - enable: $enable_dlog
980 EOF