]>
Commit | Line | Data |
---|---|---|
5e97c3fc | 1 | # -*- Autoconf -*- |
2 | # Process this file with autoconf to produce a configure script. | |
3 | ||
8465a7f4 | 4 | m4_define([lxc_devel], 1) |
282753c6 | 5 | m4_define([lxc_version_major], 3) |
4dcd858b | 6 | m4_define([lxc_version_minor], 1) |
9588a6ce | 7 | m4_define([lxc_version_micro], 0) |
5b66b6ee | 8 | m4_define([lxc_version_beta], []) |
26419a7a SG |
9 | |
10 | m4_define([lxc_abi_major], 1) | |
4dcd858b | 11 | m4_define([lxc_abi_minor], 5) |
26419a7a SG |
12 | m4_define([lxc_abi_micro], 0) |
13 | m4_define([lxc_abi], [lxc_abi_major.lxc_abi_minor.lxc_abi_micro]) | |
9588a6ce SH |
14 | |
15 | m4_define([lxc_version_base], [lxc_version_major.lxc_version_minor.lxc_version_micro]) | |
16 | m4_define([lxc_version], | |
8465a7f4 | 17 | [ifelse(lxc_devel, 1, |
5f98011c SG |
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]))]) | |
9588a6ce SH |
20 | |
21 | AC_INIT([lxc], [lxc_version]) | |
ddb93593 SG |
22 | |
23 | # We need pkg-config | |
24 | PKG_PROG_PKG_CONFIG | |
25 | ||
9588a6ce SH |
26 | AC_SUBST(LXC_VERSION_BASE, lxc_version_base) |
27 | AC_SUBST(LXC_VERSION_BETA, lxc_version_beta) | |
5e97c3fc | 28 | |
a22185dd ÇO |
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]) | |
d2d6b991 | 33 | AC_SUBST([LXC_DEVEL], [lxc_devel]) |
a22185dd | 34 | |
26419a7a SG |
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 | ||
f8dafdbb | 40 | AC_CONFIG_SRCDIR([configure.ac]) |
5e97c3fc | 41 | AC_CONFIG_AUX_DIR([config]) |
067cfaeb | 42 | AC_CONFIG_HEADERS([src/config.h]) |
d007f8ab | 43 | AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects]) |
5e97c3fc | 44 | AC_CANONICAL_HOST |
5e97c3fc | 45 | AM_PROG_CC_C_O |
46 | AC_GNU_SOURCE | |
5c8f9bd8 | 47 | |
9b5724cd CB |
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 | ||
218e8144 | 56 | #if GCC_VERSION < 40700 && CLANG_VERSION < 10000 |
9b5724cd CB |
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 | ||
26419a7a SG |
64 | # libtool |
65 | LT_INIT | |
66 | AC_SUBST([LIBTOOL_DEPS]) | |
67 | ||
8aa4885c SG |
68 | # Detect the distribution. This is used for the default configuration and |
69 | # for some distro-specific build options. | |
6f75ba0b | 70 | AC_MSG_CHECKING([host distribution]) |
b195038d | 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.])) |
5a15791e | 72 | if type lsb_release >/dev/null 2>&1 && test "z$with_distro" = "z"; then |
6f75ba0b | 73 | with_distro=`lsb_release -is` |
be2e4e54 | 74 | fi |
6f75ba0b DE |
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") | |
beabd0a2 | 78 | AC_CHECK_FILE(/etc/sparclinux-release,with_distro="sparclinux") |
164105f6 | 79 | AC_CHECK_FILE(/etc/centos-release,with_distro="centos") |
6f75ba0b DE |
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") | |
af2d9fad | 86 | AC_CHECK_FILE(/etc/plamo-version,with_distro="plamo") |
6f75ba0b | 87 | AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware") |
6e7e54d9 AK |
88 | AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="openmandriva") |
89 | AC_CHECK_FILE(/etc/mandriva-release,with_distro="openmandriva") | |
6f75ba0b | 90 | AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus") |
5c60f990 | 91 | AC_CHECK_FILE(/etc/altlinux-release,with_distro="altlinux") |
487ea5f6 | 92 | AC_CHECK_FILE(/etc/pld-release,with_distro="pld") |
6f75ba0b DE |
93 | fi |
94 | with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'` | |
95 | ||
beabd0a2 WC |
96 | if test "z$with_distro" = "zforsparc"; then |
97 | with_distro="sparclinux" | |
98 | fi | |
99 | ||
6f75ba0b DE |
100 | if test "z$with_distro" = "z"; then |
101 | with_distro="unknown" | |
102 | fi | |
103 | case $with_distro in | |
1c1bb85a | 104 | ubuntu|raspbian) |
0af99319 MW |
105 | distroconf=default.conf.lxcbr |
106 | distrosysconf="$sysconfdir/default" | |
6f75ba0b | 107 | ;; |
b195038d | 108 | redhat|redhatenterpriseserver|centos|fedora|oracle|oracleserver|sparclinux|altlinux|suse|opensuse*|plamo|pld) |
0af99319 MW |
109 | distroconf=default.conf.lxcbr |
110 | distrosysconf="$sysconfdir/sysconfig" | |
6f75ba0b DE |
111 | ;; |
112 | *) | |
3a647d58 | 113 | distroconf=default.conf.unknown |
0af99319 | 114 | distrosysconf="$sysconfdir/default" |
6f75ba0b DE |
115 | ;; |
116 | esac | |
117 | AC_MSG_RESULT([$with_distro]) | |
1c1bb85a | 118 | AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu" -o x"$with_distro" = "xraspbian"]) |
025f59ab | 119 | AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"]) |
be2e4e54 | 120 | |
d79067a7 DM |
121 | AC_CONFIG_LINKS([config/etc/default.conf:config/etc/${distroconf}]) |
122 | ||
420dfb59 DE |
123 | # Check for init system type |
124 | AC_MSG_CHECKING([for init system type]) | |
125 | AC_ARG_WITH([init-script], | |
89f79f6b | 126 | [AC_HELP_STRING([--with-init-script@<:@=TYPE@<:@,TYPE,...@:>@@:>@], |
dc068290 | 127 | [Type(s) of init script to install: sysvinit, systemd, upstart, |
89f79f6b | 128 | distro @<:@default=distro@:>@])],[],[with_init_script=distro]) |
420dfb59 | 129 | case "$with_init_script" in |
420dfb59 DE |
130 | distro) |
131 | case $with_distro in | |
5c60f990 | 132 | fedora|altlinux|opensuse*) |
420dfb59 DE |
133 | init_script=systemd |
134 | ;; | |
b195038d | 135 | redhat|redhatenterpriseserver|oracle|oracleserver|sparclinux|plamo) |
dc068290 | 136 | init_script=sysvinit |
420dfb59 | 137 | ;; |
234f9815 | 138 | centos) |
139 | init_script=sysvinit,systemd | |
140 | ;; | |
82b47911 | 141 | debian|raspbian|ubuntu) |
882ab607 | 142 | init_script=upstart,systemd |
420dfb59 | 143 | ;; |
487ea5f6 ER |
144 | pld) |
145 | init_script=sysvinit,upstart,systemd | |
146 | ;; | |
420dfb59 | 147 | *) |
dc068290 SG |
148 | echo -n "Linux distribution init system unknown." |
149 | init_script= | |
420dfb59 DE |
150 | ;; |
151 | esac | |
152 | ;; | |
153 | *) | |
89f79f6b | 154 | init_script=$with_init_script |
420dfb59 DE |
155 | ;; |
156 | esac | |
89f79f6b DE |
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 | |
dc068290 | 162 | none|sysvinit|systemd|upstart) |
89f79f6b DE |
163 | ;; |
164 | *) | |
165 | exit 1 | |
166 | ;; | |
167 | esac | |
168 | done) || AC_MSG_ERROR([Unknown init system type in $init_script]) | |
169 | ||
dc068290 | 170 | AM_CONDITIONAL([INIT_SCRIPT_SYSV], [echo "$init_script" |grep -q "sysvinit"]) |
89f79f6b DE |
171 | AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], [echo "$init_script" |grep -q "systemd"]) |
172 | AM_CONDITIONAL([INIT_SCRIPT_UPSTART], [echo "$init_script" |grep -q "upstart"]) | |
420dfb59 DE |
173 | AC_MSG_RESULT($init_script) |
174 | ||
213b0fe0 MP |
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 | ||
e9f34eb4 JP |
187 | AC_ARG_ENABLE([werror], |
188 | [AC_HELP_STRING([--disable-werror], | |
189 | [do not treat warnings as errors])], | |
190 | [], [enable_werror=yes]) | |
191 | ||
8aa4885c | 192 | # Allow disabling rpath |
1c41ddcb | 193 | AC_ARG_ENABLE([rpath], |
f91d5e4e SG |
194 | [AC_HELP_STRING([--enable-rpath], [set rpath in executables [default=no]])], |
195 | [], [enable_rpath=no]) | |
1c41ddcb GK |
196 | AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"]) |
197 | ||
8aa4885c | 198 | # Documentation (manpages) |
5c8f9bd8 | 199 | AC_ARG_ENABLE([doc], |
f91d5e4e | 200 | [AC_HELP_STRING([--enable-doc], [make man pages [default=auto]])], |
5c8f9bd8 AN |
201 | [], [enable_doc=auto]) |
202 | ||
203 | if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then | |
7822022c | 204 | db2xman="" |
487ea5f6 | 205 | dbparsers="docbook2X2man docbook2x-man db2x_docbook2man docbook2man docbook-to-man" |
69fe23ff | 206 | |
7822022c | 207 | AC_MSG_CHECKING(for docbook2x-man) |
69fe23ff | 208 | for name in ${dbparsers}; do |
7822022c SG |
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 | |
8aa4885c | 216 | AC_MSG_RESULT([${db2xman}]) |
f91d5e4e | 217 | enable_doc="yes" |
7822022c | 218 | else |
8aa4885c | 219 | AC_MSG_RESULT([no]) |
7822022c | 220 | if test "x$enable_doc" = "xyes"; then |
f91d5e4e | 221 | AC_MSG_ERROR([docbook2x-man is required, but could not be found]) |
7822022c | 222 | fi |
f91d5e4e | 223 | enable_doc="no" |
7822022c SG |
224 | fi |
225 | ||
226 | AC_SUBST(db2xman) | |
5c8f9bd8 | 227 | fi |
8aa4885c | 228 | AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"]) |
7cb14f34 | 229 | AM_CONDITIONAL([USE_DOCBOOK2X], [test "x$db2xman" != "xdocbook2man"]) |
5c8f9bd8 | 230 | |
7f951458 DE |
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 | ||
953e611c JH |
238 | # Documentation (API) |
239 | AC_ARG_ENABLE([api-docs], | |
240 | [AC_HELP_STRING([--enable-api-docs], | |
f91d5e4e | 241 | [make API documentation [default=auto]])], |
953e611c JH |
242 | [], [enable_api_docs=auto]) |
243 | ||
244 | if test "x$enable_api_docs" = "xyes" -o "x$enable_api_docs" = "xauto"; then | |
f91d5e4e SG |
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 | |
953e611c JH |
256 | fi |
257 | ||
f91d5e4e | 258 | AM_CONDITIONAL([ENABLE_API_DOCS], [test "x$HAVE_DOXYGEN" != "x"]) |
953e611c | 259 | |
fa2bb6ba SH |
260 | AC_CONFIG_MACRO_DIRS([config]) |
261 | ||
8aa4885c | 262 | # Apparmor |
e767dd55 | 263 | AC_ARG_ENABLE([apparmor], |
f91d5e4e SG |
264 | [AC_HELP_STRING([--enable-apparmor], [enable apparmor support [default=auto]])], |
265 | [], [enable_apparmor=auto]) | |
e767dd55 | 266 | |
f91d5e4e | 267 | if test "$enable_apparmor" = "auto" ; then |
e767dd55 SH |
268 | AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no]) |
269 | fi | |
e767dd55 SH |
270 | AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"]) |
271 | ||
fa2bb6ba SH |
272 | # OpenSSL |
273 | # libssl-dev | |
274 | AC_ARG_ENABLE([openssl], | |
275 | [AC_HELP_STRING([--enable-openssl], [enable OpenSSL support [default=auto]])], | |
276 | [], [enable_openssl=auto]) | |
277 | ||
278 | if test "$enable_openssl" = "auto" ; then | |
279 | AC_CHECK_LIB([ssl], [OPENSSL_init_ssl], [enable_openssl=yes], [enable_openssl=no]) | |
c8601571 | 280 | |
c8601571 | 281 | fi |
fa2bb6ba | 282 | AM_CONDITIONAL([ENABLE_OPENSSL], [test "x$enable_openssl" = "xyes"]) |
c8601571 | 283 | |
fa2bb6ba SH |
284 | AM_COND_IF([ENABLE_OPENSSL], |
285 | [AC_CHECK_HEADER([openssl/engine.h],[],[AC_MSG_ERROR([You must install the OpenSSL development package in order to compile lxc])]) | |
286 | AC_SUBST([OPENSSL_LIBS], '-lssl -lcrypto')]) | |
c8601571 | 287 | |
fe4de9a6 DE |
288 | # SELinux |
289 | AC_ARG_ENABLE([selinux], | |
f91d5e4e SG |
290 | [AC_HELP_STRING([--enable-selinux], [enable SELinux support [default=auto]])], |
291 | [], [enable_selinux=auto]) | |
fe4de9a6 | 292 | |
f91d5e4e | 293 | if test "x$enable_selinux" = xauto; then |
fe4de9a6 DE |
294 | AC_CHECK_LIB([selinux],[setexeccon_raw],[enable_selinux=yes],[enable_selinux=no]) |
295 | fi | |
296 | AM_CONDITIONAL([ENABLE_SELINUX], [test "x$enable_selinux" = "xyes"]) | |
297 | AM_COND_IF([ENABLE_SELINUX], | |
298 | [AC_CHECK_HEADER([selinux/selinux.h],[],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])]) | |
e9aeeade DE |
299 | AC_CHECK_LIB([selinux], [setexeccon_raw],[true],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])]) |
300 | AC_SUBST([SELINUX_LIBS], [-lselinux])]) | |
fe4de9a6 | 301 | |
8aa4885c | 302 | # Seccomp syscall filter |
e767dd55 | 303 | AC_ARG_ENABLE([seccomp], |
f91d5e4e SG |
304 | [AC_HELP_STRING([--enable-seccomp], [enable seccomp support [default=auto]])], |
305 | [], [enable_seccomp=auto]) | |
e767dd55 | 306 | |
f91d5e4e | 307 | if test "x$enable_seccomp" = "xauto" ; then |
e767dd55 SH |
308 | AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no]) |
309 | fi | |
e767dd55 SH |
310 | AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"]) |
311 | ||
8f2c3a70 | 312 | AM_COND_IF([ENABLE_SECCOMP], |
12dcc892 JS |
313 | [PKG_CHECK_MODULES([SECCOMP],[libseccomp],[],[ |
314 | AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])]) | |
315 | AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])]) | |
316 | AC_SUBST([SECCOMP_LIBS], [-lseccomp]) | |
317 | ]) | |
318 | ]) | |
8f2c3a70 | 319 | |
c06ed219 | 320 | AC_MSG_CHECKING(for static libcap) |
e78884c9 DE |
321 | # Check for static libcap, make sure the function checked for differs from the |
322 | # the one checked below so the cache doesn't give a wrong answer | |
323 | OLD_CFLAGS="$CFLAGS" | |
c06ed219 SH |
324 | OLD_CPPFLAGS="$CPPFLAGS" |
325 | OLD_LDFLAGS="$LDFLAGS" | |
326 | OLD_LIBS="$LIBS" | |
327 | CFLAGS="" | |
328 | CPPFLAGS="" | |
329 | LDFLAGS="-static" | |
330 | LIBS="-lcap" | |
331 | AC_LINK_IFELSE([ | |
332 | AC_LANG_SOURCE( | |
333 | [[int main() { return 0; }]] | |
334 | )],[have_static_libcap=yes],[have_static_libcap=no]) | |
e78884c9 DE |
335 | AM_CONDITIONAL([HAVE_STATIC_LIBCAP], [test "x$have_static_libcap" = "xyes"]) |
336 | if test "x$have_static_libcap" = "xyes"; then | |
337 | AC_DEFINE([HAVE_STATIC_LIBCAP], 1, [Have static libcap]) | |
c06ed219 SH |
338 | AC_MSG_RESULT([yes]) |
339 | else | |
340 | AC_MSG_RESULT([no]) | |
e78884c9 | 341 | fi |
c06ed219 | 342 | CPPFLAGS="$OLD_CPPFLAGS" |
e78884c9 | 343 | CFLAGS="$OLD_CFLAGS" |
c06ed219 SH |
344 | LDFLAGS="$OLD_LDFLAGS" |
345 | LIBS="$OLD_LIBS" | |
e78884c9 DE |
346 | |
347 | ||
f91d5e4e SG |
348 | # Linux capabilities |
349 | AC_ARG_ENABLE([capabilities], | |
350 | [AC_HELP_STRING([--enable-capabilities], [enable kernel capabilities support [default=auto]])], | |
351 | [], [enable_capabilities=auto]) | |
352 | ||
353 | if test "x$enable_capabilities" = "xauto"; then | |
354 | AC_CHECK_LIB([cap],[cap_set_proc],[enable_capabilities=yes],[enable_capabilities=no]) | |
355 | fi | |
356 | AM_CONDITIONAL([ENABLE_CAP], [test "x$enable_capabilities" = "xyes"]) | |
357 | ||
358 | AM_COND_IF([ENABLE_CAP], | |
e37dda71 FF |
359 | [AC_CHECK_HEADER([sys/capability.h],[],[AC_MSG_ERROR([You must install the libcap development package in order to compile lxc])]) |
360 | AC_CHECK_LIB(cap,cap_set_proc,[],[AC_MSG_ERROR([You must install the libcap development package in order to compile lxc])]) | |
69924fff CB |
361 | # Test whether we support getting file capabilities via cap_get_file(). |
362 | AC_CHECK_LIB(cap,cap_get_file, AC_DEFINE(LIBCAP_SUPPORTS_FILE_CAPABILITIES,1,[Have cap_get_file]),[],[]) | |
363 | AC_SUBST([CAP_LIBS], [-lcap])]) | |
f91d5e4e | 364 | |
769872f9 | 365 | # HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0 |
12dcc892 JS |
366 | OLD_CFLAGS="$CFLAGS" |
367 | CFLAGS="$CFLAGS $SECCOMP_CFLAGS" | |
f91d5e4e | 368 | AC_CHECK_TYPES([scmp_filter_ctx], [], [], [[#include <seccomp.h>]]) |
da9c8317 | 369 | AC_CHECK_DECLS([seccomp_notify_fd], [], [], [[#include <seccomp.h>]]) |
4a094eec | 370 | AC_CHECK_TYPES([struct seccomp_notif_sizes], [], [], [[#include <seccomp.h>]]) |
2b0ae718 | 371 | AC_CHECK_DECLS([seccomp_syscall_resolve_name_arch], [], [], [[#include <seccomp.h>]]) |
12dcc892 | 372 | CFLAGS="$OLD_CFLAGS" |
769872f9 | 373 | |
8aa4885c | 374 | # Configuration examples |
3fb0a9bb | 375 | AC_ARG_ENABLE([examples], |
f91d5e4e | 376 | [AC_HELP_STRING([--enable-examples], [install examples [default=yes]])], |
3fb0a9bb | 377 | [], [enable_examples=yes]) |
3fb0a9bb AN |
378 | AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"]) |
379 | ||
052616eb ÇO |
380 | # Enable dumping stack traces |
381 | AC_ARG_ENABLE([mutex-debugging], | |
f91d5e4e SG |
382 | [AC_HELP_STRING([--enable-mutex-debugging], [Makes mutexes to report error and provide stack trace [default=no]])], |
383 | [], [enable_mutex_debugging=no]) | |
052616eb ÇO |
384 | AM_CONDITIONAL([MUTEX_DEBUGGING], [test "x$enable_mutex_debugging" = "xyes"]) |
385 | ||
386 | AM_COND_IF([MUTEX_DEBUGGING], | |
387 | AC_DEFINE_UNQUOTED([MUTEX_DEBUGGING], 1, [Enabling mutex debugging])) | |
388 | ||
3a1675bf DE |
389 | # Not in older autoconf versions |
390 | # AS_VAR_COPY(DEST, SOURCE) | |
391 | # ------------------------- | |
392 | # Set the polymorphic shell variable DEST to the contents of the polymorphic | |
393 | # shell variable SOURCE. | |
394 | m4_ifdef([AS_VAR_COPY], [], | |
395 | [AC_DEFUN([AS_VAR_COPY], | |
396 | [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])]) | |
397 | ]) | |
398 | ||
12e93188 NC |
399 | dnl PKG_CHECK_VAR was introduced with pkg-config 0.28 |
400 | m4_ifdef([PKG_CHECK_VAR], [], | |
401 | [AC_DEFUN([PKG_CHECK_VAR], | |
402 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | |
403 | AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl | |
404 | _PKG_CONFIG([$1], [variable="][$3]["], [$2]) | |
405 | AS_VAR_COPY([$1], [pkg_cv_][$1]) | |
406 | AS_VAR_IF([$1], [""], [$5], [$4])dnl | |
407 | ])# PKG_CHECK_VAR | |
408 | ]) | |
f080ffd7 | 409 | |
0306de4f SG |
410 | # Optional bash integration |
411 | AC_ARG_ENABLE([bash], | |
412 | [AC_HELP_STRING([--enable-bash], [build bash integration [default=yes]])], | |
413 | [], [enable_bash=yes]) | |
414 | AM_CONDITIONAL([ENABLE_BASH], [test "x$enable_bash" = "xyes"]) | |
415 | ||
23f4c8a0 EG |
416 | AM_COND_IF([ENABLE_BASH], |
417 | [AC_MSG_CHECKING([bash completion directory]) | |
418 | PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], , | |
419 | bashcompdir="${sysconfdir}/bash_completion.d") | |
420 | AC_MSG_RESULT([$bashcompdir]) | |
421 | AC_SUBST(bashcompdir) | |
422 | ]) | |
423 | ||
8d060937 CB |
424 | # Build the command line tools |
425 | AC_ARG_ENABLE([tools], | |
426 | [AC_HELP_STRING([--enable-tools], [build the command line tools [default=yes]])], | |
427 | [], [enable_tools=yes]) | |
428 | AM_CONDITIONAL([ENABLE_TOOLS], [test "x$enable_tools" = "xyes"]) | |
429 | ||
430 | # Build the liblxc commands | |
431 | AC_ARG_ENABLE([commands], | |
432 | [AC_HELP_STRING([--enable-commands], [build the liblxc commands [default=yes]])], | |
433 | [], [enable_commands=yes]) | |
434 | AM_CONDITIONAL([ENABLE_COMMANDS], [test "x$enable_commands" = "xyes"]) | |
435 | ||
565c4427 CB |
436 | # Build with ASAN commands |
437 | AC_ARG_ENABLE([asan], | |
438 | [AC_HELP_STRING([--enable-asan], [build with address sanitizer enabled [default=no]])], | |
439 | [], [enable_asan=no]) | |
440 | AM_CONDITIONAL([ENABLE_ASAN], [test "x$enable_asan" = "xyes"]) | |
441 | ||
8aa4885c | 442 | # Optional test binaries |
525421c9 | 443 | AC_ARG_ENABLE([tests], |
f91d5e4e SG |
444 | [AC_HELP_STRING([--enable-tests], [build test/example binaries [default=no]])], |
445 | [], [enable_tests=no]) | |
525421c9 SG |
446 | AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"]) |
447 | ||
061ba5d0 SG |
448 | # Allow overriding the default runtime dir (/run) |
449 | AC_ARG_WITH([runtime-path], | |
450 | [AC_HELP_STRING( | |
451 | [--with-runtime-path=dir], | |
452 | [runtime directory (default: /run)] | |
453 | )], [], [with_runtime_path=['/run']]) | |
454 | ||
8aa4885c | 455 | # LXC container path, where the containers are actually stored |
fbf5de31 | 456 | # This is overridden by an entry in the file called LXCCONF |
2a59a681 | 457 | # (i.e. /etc/lxc/lxc.conf) |
aef4ebcf AN |
458 | AC_ARG_WITH([config-path], |
459 | [AC_HELP_STRING( | |
460 | [--with-config-path=dir], | |
e892973e | 461 | [lxc configuration repository path] |
1c41ddcb | 462 | )], [], [with_config_path=['${localstatedir}/lib/lxc']]) |
aef4ebcf | 463 | |
2a59a681 SH |
464 | # The path of the global lxc configuration file. |
465 | AC_ARG_WITH([global-conf], | |
466 | [AC_HELP_STRING( | |
467 | [--with-global-conf=dir], | |
468 | [global lxc configuration file] | |
469 | )], [], [with_global_conf=['${sysconfdir}/lxc/lxc.conf']]) | |
470 | ||
c75c30ec | 471 | # The path of the userns network configuration file |
070a4b8e SH |
472 | AC_ARG_WITH([usernic-conf], |
473 | [AC_HELP_STRING( | |
474 | [--with-usernic-conf], | |
475 | [user network interface configuration file] | |
476 | )], [], [with_usernic_conf=['${sysconfdir}/lxc/lxc-usernet']]) | |
477 | ||
c75c30ec | 478 | # The path of the runtime usernic database |
070a4b8e SH |
479 | AC_ARG_WITH([usernic-db], |
480 | [AC_HELP_STRING( | |
481 | [--with-usernic-db], | |
482 | [lxc user nic database] | |
5a15791e | 483 | )], [], [with_usernic_db=['${with_runtime_path}/lxc/nics']]) |
070a4b8e | 484 | |
8aa4885c | 485 | # Rootfs path, where the container mount structure is assembled |
196db713 DL |
486 | AC_ARG_WITH([rootfs-path], |
487 | [AC_HELP_STRING( | |
488 | [--with-rootfs-path=dir], | |
489 | [lxc rootfs mount point] | |
1c41ddcb | 490 | )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']]) |
c75c30ec | 491 | |
6e16552d CS |
492 | # cgroup pattern specification |
493 | AC_ARG_WITH([cgroup-pattern], | |
494 | [AC_HELP_STRING( | |
495 | [--with-cgroup-pattern=pattern], | |
496 | [pattern for container cgroups] | |
292b3910 | 497 | )], [], [with_cgroup_pattern=['lxc.payload/%n']]) |
196db713 | 498 | |
1800f924 WB |
499 | # The path for the apparmor_parser's cache for generated apparmor profiles |
500 | AC_ARG_WITH([apparmor-cache-dir], | |
501 | [AC_HELP_STRING( | |
502 | [--with-apparmor-cache-dir=dir], | |
503 | [path for apparmor_parser cache] | |
504 | )], [], [with_apparmor_cache_dir=['${localstatedir}/cache/lxc/apparmor']]) | |
505 | ||
5e1e7aaf SH |
506 | # Container log path. By default, use $lxcpath. |
507 | AC_MSG_CHECKING([Whether to place logfiles in container config path]) | |
508 | AC_ARG_ENABLE([configpath-log], | |
f91d5e4e SG |
509 | [AC_HELP_STRING([--enable-configpath-log], [use logfiles in config path [default=no]])], |
510 | [], [enable_configpath_log=no]) | |
511 | AC_MSG_RESULT([$enable_configpath_log]) | |
512 | AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$enable_configpath_log" = "yes"]) | |
5e1e7aaf | 513 | |
f91d5e4e | 514 | if test "$enable_configpath_log" = "yes"; then |
5e1e7aaf SH |
515 | default_log_path="${with_config_path}" |
516 | else | |
89d556d8 | 517 | default_log_path="${localstatedir}/log/lxc" |
5e1e7aaf SH |
518 | fi |
519 | ||
520 | AC_ARG_WITH([log-path], | |
521 | [AC_HELP_STRING( | |
522 | [--with-log-path=dir], | |
523 | [per container log path] | |
524 | )], [], [with_log_path=['${default_log_path}']]) | |
525 | ||
8aa4885c SG |
526 | # Expand some useful variables |
527 | AS_AC_EXPAND(PREFIX, "$prefix") | |
528 | AS_AC_EXPAND(LIBDIR, "$libdir") | |
529 | AS_AC_EXPAND(BINDIR, "$bindir") | |
718e4f48 | 530 | AS_AC_EXPAND(SBINDIR, "$sbindir") |
8aa4885c SG |
531 | AS_AC_EXPAND(LIBEXECDIR, "$libexecdir") |
532 | AS_AC_EXPAND(INCLUDEDIR, "$includedir") | |
533 | AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir") | |
0a18b545 | 534 | AS_AC_EXPAND(LXC_DEFAULT_CONFIG, "$sysconfdir/lxc/default.conf") |
8aa4885c SG |
535 | AS_AC_EXPAND(DATADIR, "$datadir") |
536 | AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir") | |
537 | AS_AC_EXPAND(DOCDIR, "$docdir") | |
8d256e4d | 538 | AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date --utc --date=@${SOURCE_DATE_EPOCH:-$(date +%s)} '+%Y-%m-%d')") |
8aa4885c | 539 | AS_AC_EXPAND(LXCPATH, "$with_config_path") |
2a59a681 | 540 | AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf") |
070a4b8e SH |
541 | AS_AC_EXPAND(LXC_USERNIC_CONF, "$with_usernic_conf") |
542 | AS_AC_EXPAND(LXC_USERNIC_DB, "$with_usernic_db") | |
0af99319 | 543 | AS_AC_EXPAND(LXC_DISTRO_SYSCONF, "$distrosysconf") |
8aa4885c SG |
544 | AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path") |
545 | AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates") | |
f2a95ee1 | 546 | AS_AC_EXPAND(LXCTEMPLATECONFIG, "$datadir/lxc/config") |
906f8c4d | 547 | AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks") |
16d08ae7 | 548 | AS_AC_EXPAND(LXCBINHOOKDIR, "$libexecdir/lxc/hooks") |
8aa4885c | 549 | AS_AC_EXPAND(LXCINITDIR, "$libexecdir") |
5e1e7aaf | 550 | AS_AC_EXPAND(LOGPATH, "$with_log_path") |
061ba5d0 | 551 | AS_AC_EXPAND(RUNTIME_PATH, "$with_runtime_path") |
1800f924 | 552 | AS_AC_EXPAND(APPARMOR_CACHE_DIR, "$with_apparmor_cache_dir") |
6e16552d | 553 | AC_SUBST(DEFAULT_CGROUP_PATTERN, ["$with_cgroup_pattern"]) |
881450bb | 554 | |
0080bebf TA |
555 | # We need the install path so criu knows where to reference the hook scripts. |
556 | AC_DEFINE_UNQUOTED([DATADIR], "$DATADIR", ["Prefix for shared files."]) | |
557 | ||
8aa4885c | 558 | # Check for some standard kernel headers |
910bb4fa | 559 | AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h], |
8aa4885c SG |
560 | [], |
561 | AC_MSG_ERROR([Please install the Linux kernel headers.]), | |
562 | [#include <sys/socket.h>]) | |
35f549fe | 563 | |
a6168a17 SG |
564 | # Check for alternate C libraries |
565 | AC_MSG_CHECKING(for bionic libc) | |
566 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( | |
8aa4885c | 567 | [[#ifndef __ANDROID__ |
a6168a17 SG |
568 | error: Not bionic! |
569 | #endif]])], | |
8aa4885c SG |
570 | [is_bionic=yes], |
571 | [is_bionic=no]) | |
a6168a17 | 572 | if test "x$is_bionic" = "xyes"; then |
8aa4885c SG |
573 | AC_DEFINE([IS_BIONIC], 1, [bionic libc]) |
574 | AC_MSG_RESULT([yes]) | |
a6168a17 | 575 | else |
8aa4885c | 576 | AC_MSG_RESULT([no]) |
a6168a17 SG |
577 | fi |
578 | AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"]) | |
579 | ||
f7a8609f CB |
580 | # Configuration examples |
581 | AC_ARG_ENABLE([pam], | |
582 | [AC_HELP_STRING([--enable-pam], [enable pam module [default=no]])], | |
583 | [], [enable_pam=no]) | |
584 | AM_CONDITIONAL([ENABLE_PAM], [test "x$enable_pam" = "xyes"]) | |
585 | ||
586 | AM_COND_IF([ENABLE_PAM], | |
587 | [AC_ARG_WITH( | |
588 | [pamdir], | |
589 | [AS_HELP_STRING([--with-pamdir=PATH],[Specify the directory where PAM modules are stored, | |
590 | or "none" if PAM modules are not to be built])], | |
591 | [pamdir="${withval}"], | |
592 | [ | |
593 | if test "${prefix}" = "/usr"; then | |
594 | pamdir="/lib${libdir##*/lib}/security" | |
595 | else | |
596 | pamdir="\$(libdir)/security" | |
597 | fi | |
598 | ] | |
599 | )]) | |
7ac43d3d CB |
600 | |
601 | AM_CONDITIONAL([HAVE_PAM], [test x"$pamdir" != "xnone"]) | |
f7a8609f CB |
602 | AM_COND_IF([ENABLE_PAM], |
603 | [if test "z$pamdir" != "znone"; then | |
604 | AC_ARG_VAR([PAM_CFLAGS], [C compiler flags for pam]) | |
605 | AC_ARG_VAR([PAM_LIBS], [linker flags for pam]) | |
606 | AC_CHECK_LIB( | |
607 | [pam], | |
608 | [pam_authenticate], | |
609 | [PAM_LIBS="-lpam"], | |
610 | [AC_MSG_ERROR([*** libpam not found.]) | |
611 | ]) | |
612 | ||
613 | AC_SUBST(PAM_LIBS) | |
614 | AC_SUBST([pamdir]) | |
615 | fi]) | |
7ac43d3d | 616 | |
656994bb MH |
617 | # Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP |
618 | AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>]) | |
619 | ||
955e2a02 CB |
620 | # Some systems lack PR_{G,S}ET_NO_NEW_PRIVS definition => HAVE_DECL_PR_{G,S}ET_NO_NEW_PRIVS |
621 | AC_CHECK_DECLS([PR_SET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>]) | |
622 | AC_CHECK_DECLS([PR_GET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>]) | |
623 | ||
e827ff7e | 624 | # Check for some headers |
8bc781b4 | 625 | AC_CHECK_HEADERS([pty.h sys/memfd.h sys/personality.h sys/resource.h sys/signalfd.h sys/timerfd.h utmpx.h]) |
d029e1de CB |
626 | |
627 | AC_CHECK_HEADER([ifaddrs.h], | |
628 | AM_CONDITIONAL(HAVE_IFADDRS_H, true) | |
629 | AC_DEFINE(HAVE_IFADDRS_H, 1, [Have ifaddrs.h]), | |
630 | AM_CONDITIONAL(HAVE_IFADDRS_H, false)) | |
ff218c25 | 631 | |
af6824fc ST |
632 | # lookup major()/minor()/makedev() |
633 | AC_HEADER_MAJOR | |
634 | ||
2d76d1d7 | 635 | # Check for some syscalls functions |
413c294f | 636 | AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat gettid memfd_create]) |
2d76d1d7 | 637 | |
607e3fca CB |
638 | # Check for strerror_r() support. Defines: |
639 | # - HAVE_STRERROR_R if available | |
640 | # - HAVE_DECL_STRERROR_R if defined | |
641 | # - STRERROR_R_CHAR_P if it returns char * | |
642 | AC_FUNC_STRERROR_R | |
643 | ||
720bbb31 RK |
644 | # Check if "%m" is supported by printf and Co |
645 | AC_MSG_CHECKING([%m format]) | |
646 | AC_TRY_RUN([ | |
647 | #include <stdio.h> | |
648 | int main(void) | |
649 | { | |
650 | char msg[256]; | |
651 | int rc; | |
652 | ||
653 | rc = snprintf(msg, sizeof(msg), "%m\n"); | |
654 | if ((rc > 1) && (msg[0] != '%')) | |
655 | { | |
656 | return 0; | |
657 | } | |
658 | else | |
659 | { | |
660 | return 1; | |
661 | } | |
662 | }], | |
d4df6414 | 663 | [fmt_m=yes], [fmt_m=no], [fmt_m=no]) |
720bbb31 RK |
664 | if test "x$fmt_m" = "xyes"; then |
665 | AC_DEFINE([HAVE_M_FORMAT], 1, [Have %m format]) | |
666 | AC_MSG_RESULT([yes]) | |
667 | else | |
668 | AC_MSG_RESULT([no]) | |
669 | fi | |
670 | ||
e827ff7e | 671 | # Check for some functions |
babbea4b | 672 | AC_CHECK_LIB(pthread, main) |
614305f3 | 673 | AC_CHECK_FUNCS(statvfs) |
740ee8c7 | 674 | AC_CHECK_LIB(util, openpty) |
8b6d8b71 | 675 | AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent utmpxname]) |
477e62b6 CB |
676 | AC_CHECK_FUNCS([getgrgid_r], |
677 | AM_CONDITIONAL(HAVE_GETGRGID_R, true) | |
678 | AC_DEFINE(HAVE_GETGRGID_R,1,[Have getgrgid_r]), | |
679 | AM_CONDITIONAL(HAVE_GETGRGID_R, false)) | |
1ba0013f SG |
680 | AC_CHECK_FUNCS([getline], |
681 | AM_CONDITIONAL(HAVE_GETLINE, true) | |
682 | AC_DEFINE(HAVE_GETLINE,1,[Have getline]), | |
683 | AM_CONDITIONAL(HAVE_GETLINE, false)) | |
9dbcd668 SG |
684 | AC_CHECK_FUNCS([getsubopt], |
685 | AM_CONDITIONAL(HAVE_GETSUBOPT, true) | |
686 | AC_DEFINE(HAVE_GETSUBOPT,1,[Have getsubopt]), | |
687 | AM_CONDITIONAL(HAVE_GETSUBOPT, false)) | |
1ba0013f SG |
688 | AC_CHECK_FUNCS([fgetln], |
689 | AM_CONDITIONAL(HAVE_FGETLN, true) | |
690 | AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]), | |
691 | AM_CONDITIONAL(HAVE_FGETLN, false)) | |
b25291da CB |
692 | AC_CHECK_FUNCS([keyctl], |
693 | AM_CONDITIONAL(HAVE_KEYCTL, true) | |
694 | AC_DEFINE(HAVE_KEYCTL,1,[Have keyctl]), | |
695 | AM_CONDITIONAL(HAVE_KEYCTL, false)) | |
a04f5407 CB |
696 | AC_CHECK_FUNCS([prlimit], |
697 | AM_CONDITIONAL(HAVE_PRLIMIT, true) | |
698 | AC_DEFINE(HAVE_PRLIMIT,1,[Have prlimit]), | |
699 | AM_CONDITIONAL(HAVE_PRLIMIT, false)) | |
f48b5fd8 FF |
700 | AC_CHECK_FUNCS([prlimit64], |
701 | AM_CONDITIONAL(HAVE_PRLIMIT64, true) | |
702 | AC_DEFINE(HAVE_PRLIMIT64,1,[Have prlimit64]), | |
703 | AM_CONDITIONAL(HAVE_PRLIMIT64, false)) | |
477e62b6 CB |
704 | AC_CHECK_FUNCS([pthread_setcancelstate], |
705 | AM_CONDITIONAL(HAVE_PTHREAD_SETCANCELSTATE, true) | |
706 | AC_DEFINE(HAVE_PTHREAD_SETCANCELSTATE,1,[Have pthread_setcancelstate]), | |
707 | AM_CONDITIONAL(HAVE_PTHREAD_SETCANCELSTATE, false)) | |
91c272a5 CB |
708 | AC_CHECK_FUNCS([strlcpy], |
709 | AM_CONDITIONAL(HAVE_STRLCPY, true) | |
710 | AC_DEFINE(HAVE_STRLCPY,1,[Have strlcpy]), | |
711 | AM_CONDITIONAL(HAVE_STRLCPY, false)) | |
9a5e7ac4 CB |
712 | AC_CHECK_FUNCS([strlcat], |
713 | AM_CONDITIONAL(HAVE_STRLCAT, true) | |
714 | AC_DEFINE(HAVE_STRLCAT,1,[Have strlcat]), | |
715 | AM_CONDITIONAL(HAVE_STRLCAT, false)) | |
1ba0013f | 716 | |
da5efb6f CB |
717 | # HAVE_STRUCT_RTNL_LINK_STATS64={0,1} |
718 | AC_CHECK_TYPES([struct rtnl_link_stats64], [], [], [[#include <linux/if_link.h>]]) | |
719 | ||
c9a84173 | 720 | # Check for some libraries |
a81c46e9 | 721 | AX_PTHREAD |
336d5469 | 722 | AC_SEARCH_LIBS(clock_gettime, [rt]) |
c9a84173 | 723 | |
8aa4885c | 724 | # Check for some standard binaries |
5e97c3fc | 725 | AC_PROG_GCC_TRADITIONAL |
95a717e9 | 726 | AC_PROG_SED |
5e97c3fc | 727 | |
babbea4b ÇO |
728 | # See if we support thread-local storage. |
729 | LXC_CHECK_TLS | |
730 | ||
fb3b3ef4 | 731 | # Hardening flags |
cf0fd972 | 732 | AX_CHECK_COMPILE_FLAG([-fdiagnostics-color], [CFLAGS="$CFLAGS -fdiagnostics-color"],,[-Werror]) |
55733496 | 733 | AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough=5], [CFLAGS="$CFLAGS -Wimplicit-fallthrough=5"],,[-Werror]) |
6ce39620 | 734 | AX_CHECK_COMPILE_FLAG([-Wcast-align], [CFLAGS="$CFLAGS -Wcast-align"],,[-Werror]) |
246736be | 735 | AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], [CFLAGS="$CFLAGS -Wstrict-prototypes"],,[-Werror]) |
a3bb6b8e | 736 | AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"],,[-Werror]) |
2268c277 | 737 | AX_CHECK_COMPILE_FLAG([-fstack-clash-protection], [CFLAGS="$CFLAGS -fstack-clash-protection"],,[-Werror]) |
3b5a0eeb CB |
738 | AX_CHECK_COMPILE_FLAG([-fstack-protector-strong], [CFLAGS="$CFLAGS -fstack-protector-strong"],,[-Werror]) |
739 | AX_CHECK_COMPILE_FLAG([--param=ssp-buffer-size=4], [CFLAGS="$CFLAGS --param=ssp-buffer-size=4"],,[-Werror]) | |
2268c277 CB |
740 | AX_CHECK_COMPILE_FLAG([-g], [CFLAGS="$CFLAGS -g"],,[-Werror]) |
741 | AX_CHECK_COMPILE_FLAG([--mcet -fcf-protection], [CFLAGS="$CFLAGS --mcet -fcf-protection"],,[-Werror]) | |
742 | AX_CHECK_COMPILE_FLAG([-Werror=implicit-function-declaration], [CFLAGS="$CFLAGS -Werror=implicit-function-declaration"],,[-Werror]) | |
fb3b3ef4 | 743 | AX_CHECK_COMPILE_FLAG([-Wlogical-op], [CFLAGS="$CFLAGS -Wlogical-op"],,[-Werror]) |
cc0c3a06 | 744 | AX_CHECK_COMPILE_FLAG([-Wmissing-include-dirs], [CFLAGS="$CFLAGS -Wmissing-include-dirs"],,[-Werror]) |
11af5f2b | 745 | AX_CHECK_COMPILE_FLAG([-Wold-style-definition], [CFLAGS="$CFLAGS -Wold-style-definition"],,[-Werror]) |
f03f7b5c | 746 | AX_CHECK_COMPILE_FLAG([-Winit-self], [CFLAGS="$CFLAGS -Winit-self"],,[-Werror]) |
30462b91 | 747 | AX_CHECK_COMPILE_FLAG([-Wfloat-equal], [CFLAGS="$CFLAGS -Wfloat-equal"],,[-Werror]) |
e3b4674d | 748 | AX_CHECK_COMPILE_FLAG([-Wsuggest-attribute=noreturn], [CFLAGS="$CFLAGS -Wsuggest-attribute=noreturn"],,[-Werror]) |
13311d70 | 749 | AX_CHECK_COMPILE_FLAG([-Werror=return-type], [CFLAGS="$CFLAGS -Werror=return-type"],,[-Werror]) |
42a2ab35 | 750 | AX_CHECK_COMPILE_FLAG([-Werror=incompatible-pointer-types], [CFLAGS="$CFLAGS -Werror=incompatible-pointer-types"],,[-Werror]) |
d07545c7 CB |
751 | AX_CHECK_COMPILE_FLAG([-Wformat=2], [CFLAGS="$CFLAGS -Wformat=2"],,[-Werror]) |
752 | AX_CHECK_COMPILE_FLAG([-Wshadow], [CFLAGS="$CFLAGS -Wshadow"],,[-Werror]) | |
4ccb8878 | 753 | AX_CHECK_COMPILE_FLAG([-Wendif-labels], [CFLAGS="$CFLAGS -Wendif-labels"],,[-Werror]) |
a703da6c | 754 | AX_CHECK_COMPILE_FLAG([-Werror=overflow], [CFLAGS="$CFLAGS -Werror=overflow"],,[-Werror]) |
64871d41 | 755 | AX_CHECK_COMPILE_FLAG([-fdiagnostics-show-option], [CFLAGS="$CFLAGS -fdiagnostics-show-option"],,[-Werror]) |
463bee7b | 756 | AX_CHECK_COMPILE_FLAG([-Werror=shift-count-overflow], [CFLAGS="$CFLAGS -Werror=shift-count-overflow"],,[-Werror]) |
fcfce08a | 757 | AX_CHECK_COMPILE_FLAG([-Werror=shift-overflow=2], [CFLAGS="$CFLAGS -Werror=shift-overflow=2"],,[-Werror]) |
a30c52ac | 758 | AX_CHECK_COMPILE_FLAG([-Wdate-time], [CFLAGS="$CFLAGS -Wdate-time"],,[-Werror]) |
d0afbad9 | 759 | AX_CHECK_COMPILE_FLAG([-Wnested-externs], [CFLAGS="$CFLAGS -Wnested-externs"],,[-Werror]) |
c9248f71 | 760 | AX_CHECK_COMPILE_FLAG([-fasynchronous-unwind-tables], [CFLAGS="$CFLAGS -fasynchronous-unwind-tables"],,[-Werror]) |
a40093c6 | 761 | AX_CHECK_COMPILE_FLAG([-pipe], [CFLAGS="$CFLAGS -pipe"],,[-Werror]) |
e74d1fd9 | 762 | AX_CHECK_COMPILE_FLAG([-fexceptions], [CFLAGS="$CFLAGS -fexceptions"],,[-Werror]) |
cf0fd972 | 763 | |
e7d7f268 CB |
764 | AX_CHECK_LINK_FLAG([-z relro], [LDFLAGS="$LDFLAGS -z relro"],,[]) |
765 | AX_CHECK_LINK_FLAG([-z now], [LDFLAGS="$LDFLAGS -z now"],,[]) | |
e6fe24e1 | 766 | |
218e8144 | 767 | CFLAGS="$CFLAGS -Wvla -std=gnu11" |
81a56e80 | 768 | if test "x$enable_werror" = "xyes"; then |
218e8144 | 769 | CFLAGS="$CFLAGS -Werror" |
5e97c3fc | 770 | fi |
771 | ||
81c76cff CB |
772 | AC_ARG_ENABLE([thread-safety], |
773 | [AC_HELP_STRING([--enable-thread-safety], [enforce thread-safety otherwise fail the build [default=yes]])], | |
774 | [], [enable_thread_safety=yes]) | |
775 | AM_CONDITIONAL([ENFORCE_THREAD_SAFETY], [test "x$enable_thread_safety" = "xyes"]) | |
776 | ||
5c7bfc02 | 777 | AC_ARG_ENABLE([dlog], |
778 | [AC_HELP_STRING([--enable-dlog], [enable dlog support [default=no]])], | |
779 | [], [enable_dlog=no]) | |
780 | AM_CONDITIONAL([ENABLE_DLOG], [test "x$enable_dlog" = "xyes"]) | |
781 | ||
782 | AM_COND_IF([ENABLE_DLOG], | |
783 | [PKG_CHECK_MODULES([DLOG],[dlog],[],[ | |
784 | AC_CHECK_HEADER([dlog.h],[],[AC_MSG_ERROR([You must install the dlog development package in order to compile lxc])]) | |
785 | AC_CHECK_LIB([dlog], [dlog_print],[],[AC_MSG_ERROR([You must install the dlog development package in order to compile lxc])]) | |
786 | AC_SUBST([DLOG_LIBS], [-ldlog]) | |
787 | ]) | |
788 | ]) | |
789 | ||
6400238d CB |
790 | AC_ARG_ENABLE([memfd-rexec], |
791 | [AC_HELP_STRING([--enable-memfd-rexec], [enforce liblxc as a memfd to protect against certain symlink attacks [default=yes]])], | |
792 | [], [enable_memfd_rexec=yes]) | |
793 | AM_CONDITIONAL([ENFORCE_MEMFD_REXEC], [test "x$enable_memfd_rexec" = "xyes"]) | |
794 | if test "x$enable_memfd_rexec" = "xyes"; then | |
795 | AC_DEFINE([ENFORCE_MEMFD_REXEC], 1, [Rexec liblxc as memfd]) | |
796 | AC_MSG_RESULT([yes]) | |
797 | else | |
798 | AC_MSG_RESULT([no]) | |
799 | fi | |
800 | ||
8aa4885c | 801 | # Files requiring some variable expansion |
5e97c3fc | 802 | AC_CONFIG_FILES([ |
288063bd | 803 | Makefile |
b6345ba1 | 804 | lxc.pc |
5e97c3fc | 805 | lxc.spec |
f2a95ee1 | 806 | |
288063bd | 807 | config/Makefile |
8da250da | 808 | config/apparmor/Makefile |
b19c5d12 | 809 | config/apparmor/abstractions/start-container |
719fae07 | 810 | config/selinux/Makefile |
0306de4f SG |
811 | config/bash/Makefile |
812 | config/bash/lxc | |
dc068290 | 813 | config/init/Makefile |
0af99319 MW |
814 | config/init/common/Makefile |
815 | config/init/common/lxc-containers | |
816 | config/init/common/lxc-net | |
dc068290 | 817 | config/init/systemd/Makefile |
015f0dd7 | 818 | config/init/systemd/lxc.service |
de2b7e65 | 819 | config/init/systemd/lxc@.service |
65b27d84 | 820 | config/init/systemd/lxc-net.service |
0af99319 MW |
821 | config/init/sysvinit/Makefile |
822 | config/init/sysvinit/lxc-containers | |
823 | config/init/sysvinit/lxc-net | |
a8c71063 | 824 | config/init/upstart/lxc.conf |
0af99319 | 825 | config/init/upstart/lxc-net.conf |
dc068290 | 826 | config/init/upstart/Makefile |
f2a95ee1 SG |
827 | config/etc/Makefile |
828 | config/templates/Makefile | |
5b99af00 | 829 | config/templates/common.conf |
4662c6de | 830 | config/templates/common.conf.d/Makefile |
108b88ce | 831 | config/templates/nesting.conf |
1689c7cf | 832 | config/templates/oci.common.conf |
5b99af00 | 833 | config/templates/userns.conf |
7ceebfd1 | 834 | config/yum/Makefile |
0af99319 MW |
835 | config/sysconfig/Makefile |
836 | config/sysconfig/lxc | |
d823d5b9 | 837 | |
288063bd | 838 | doc/Makefile |
953e611c | 839 | doc/api/Makefile |
4019712d | 840 | doc/lxc-attach.sgml |
a6adab20 | 841 | doc/lxc-autostart.sgml |
4019712d SG |
842 | doc/lxc-cgroup.sgml |
843 | doc/lxc-checkconfig.sgml | |
735f2c6e | 844 | doc/lxc-checkpoint.sgml |
ff5e2751 | 845 | doc/lxc-config.sgml |
4019712d | 846 | doc/lxc-console.sgml |
2b47bac3 | 847 | doc/lxc-copy.sgml |
d823d5b9 | 848 | doc/lxc-create.sgml |
849 | doc/lxc-destroy.sgml | |
4019712d | 850 | doc/lxc-device.sgml |
d823d5b9 | 851 | doc/lxc-execute.sgml |
d823d5b9 | 852 | doc/lxc-freeze.sgml |
4019712d | 853 | doc/lxc-info.sgml |
d823d5b9 | 854 | doc/lxc-ls.sgml |
4019712d | 855 | doc/lxc-monitor.sgml |
813a4837 | 856 | doc/lxc-snapshot.sgml |
4019712d SG |
857 | doc/lxc-start.sgml |
858 | doc/lxc-stop.sgml | |
f080ffd7 | 859 | doc/lxc-top.sgml |
4019712d SG |
860 | doc/lxc-unfreeze.sgml |
861 | doc/lxc-unshare.sgml | |
0a29a3ef | 862 | doc/lxc-update-config.sgml |
df3415e0 | 863 | doc/lxc-user-nic.sgml |
adade80c | 864 | doc/lxc-usernsexec.sgml |
4019712d SG |
865 | doc/lxc-wait.sgml |
866 | ||
8a67a2b2 | 867 | doc/lxc.conf.sgml |
55fc19a1 SG |
868 | doc/lxc.container.conf.sgml |
869 | doc/lxc.system.conf.sgml | |
df3415e0 | 870 | doc/lxc-usernet.sgml |
8b8b04f8 | 871 | doc/lxc.sgml |
10fba81b | 872 | doc/common_options.sgml |
99e4008c | 873 | doc/see_also.sgml |
d823d5b9 | 874 | |
baf6671f DL |
875 | doc/rootfs/Makefile |
876 | ||
0f71d073 DL |
877 | doc/examples/Makefile |
878 | doc/examples/lxc-macvlan.conf | |
26c39028 | 879 | doc/examples/lxc-vlan.conf |
0f71d073 DL |
880 | doc/examples/lxc-no-netns.conf |
881 | doc/examples/lxc-empty-netns.conf | |
882 | doc/examples/lxc-phys.conf | |
883 | doc/examples/lxc-veth.conf | |
c553a9c2 | 884 | doc/examples/lxc-complex.conf |
0f71d073 | 885 | |
57da8c32 | 886 | doc/ja/Makefile |
57da8c32 | 887 | doc/ja/lxc-attach.sgml |
28f2ab26 | 888 | doc/ja/lxc-autostart.sgml |
57da8c32 KY |
889 | doc/ja/lxc-cgroup.sgml |
890 | doc/ja/lxc-checkconfig.sgml | |
b0e26ca7 | 891 | doc/ja/lxc-checkpoint.sgml |
3220eceb | 892 | doc/ja/lxc-config.sgml |
57da8c32 | 893 | doc/ja/lxc-console.sgml |
842948e4 | 894 | doc/ja/lxc-copy.sgml |
57da8c32 KY |
895 | doc/ja/lxc-create.sgml |
896 | doc/ja/lxc-destroy.sgml | |
897 | doc/ja/lxc-device.sgml | |
898 | doc/ja/lxc-execute.sgml | |
899 | doc/ja/lxc-freeze.sgml | |
900 | doc/ja/lxc-info.sgml | |
57da8c32 KY |
901 | doc/ja/lxc-ls.sgml |
902 | doc/ja/lxc-monitor.sgml | |
ebe0aeb1 | 903 | doc/ja/lxc-snapshot.sgml |
57da8c32 KY |
904 | doc/ja/lxc-start.sgml |
905 | doc/ja/lxc-stop.sgml | |
906 | doc/ja/lxc-top.sgml | |
907 | doc/ja/lxc-unfreeze.sgml | |
908 | doc/ja/lxc-unshare.sgml | |
607a8de5 | 909 | doc/ja/lxc-update-config.sgml |
07ece600 | 910 | doc/ja/lxc-user-nic.sgml |
755d8d03 | 911 | doc/ja/lxc-usernsexec.sgml |
57da8c32 KY |
912 | doc/ja/lxc-wait.sgml |
913 | ||
914 | doc/ja/lxc.conf.sgml | |
fb261f53 KY |
915 | doc/ja/lxc.container.conf.sgml |
916 | doc/ja/lxc.system.conf.sgml | |
07ece600 | 917 | doc/ja/lxc-usernet.sgml |
57da8c32 KY |
918 | doc/ja/lxc.sgml |
919 | doc/ja/common_options.sgml | |
920 | doc/ja/see_also.sgml | |
921 | ||
2b371b26 | 922 | doc/ko/Makefile |
2b371b26 SY |
923 | doc/ko/lxc-attach.sgml |
924 | doc/ko/lxc-autostart.sgml | |
925 | doc/ko/lxc-cgroup.sgml | |
926 | doc/ko/lxc-checkconfig.sgml | |
927 | doc/ko/lxc-checkpoint.sgml | |
2b371b26 SY |
928 | doc/ko/lxc-config.sgml |
929 | doc/ko/lxc-console.sgml | |
b035f792 | 930 | doc/ko/lxc-copy.sgml |
2b371b26 SY |
931 | doc/ko/lxc-create.sgml |
932 | doc/ko/lxc-destroy.sgml | |
933 | doc/ko/lxc-device.sgml | |
934 | doc/ko/lxc-execute.sgml | |
935 | doc/ko/lxc-freeze.sgml | |
936 | doc/ko/lxc-info.sgml | |
937 | doc/ko/lxc-ls.sgml | |
938 | doc/ko/lxc-monitor.sgml | |
939 | doc/ko/lxc-snapshot.sgml | |
2b371b26 SY |
940 | doc/ko/lxc-start.sgml |
941 | doc/ko/lxc-stop.sgml | |
942 | doc/ko/lxc-top.sgml | |
943 | doc/ko/lxc-unfreeze.sgml | |
944 | doc/ko/lxc-unshare.sgml | |
945 | doc/ko/lxc-user-nic.sgml | |
946 | doc/ko/lxc-usernsexec.sgml | |
947 | doc/ko/lxc-wait.sgml | |
948 | ||
949 | doc/ko/lxc.conf.sgml | |
950 | doc/ko/lxc.container.conf.sgml | |
951 | doc/ko/lxc.system.conf.sgml | |
952 | doc/ko/lxc-usernet.sgml | |
953 | doc/ko/lxc.sgml | |
954 | doc/ko/common_options.sgml | |
955 | doc/ko/see_also.sgml | |
956 | ||
906f8c4d | 957 | hooks/Makefile |
84bf5645 | 958 | hooks/dhclient |
906f8c4d | 959 | |
c01d62f2 | 960 | templates/Makefile |
f8d0243a | 961 | templates/lxc-busybox |
71d3a659 | 962 | templates/lxc-download |
35444f38 | 963 | templates/lxc-local |
0ef43a5c | 964 | templates/lxc-oci |
c9844b87 | 965 | |
288063bd | 966 | src/Makefile |
5e97c3fc | 967 | src/lxc/Makefile |
2a59a681 | 968 | src/lxc/lxc.functions |
48b1dc4c | 969 | src/lxc/cmd/lxc-checkconfig |
6a342cab | 970 | src/lxc/cmd/lxc-update-config |
a22185dd | 971 | src/lxc/version.h |
be2e4e54 | 972 | |
72d0e1cb | 973 | src/tests/Makefile |
8cb8e496 | 974 | src/tests/lxc-test-usernic |
5e97c3fc | 975 | ]) |
976 | AC_CONFIG_COMMANDS([default],[[]],[[]]) | |
977 | AC_OUTPUT | |
f91d5e4e SG |
978 | |
979 | # Configuration overview | |
980 | cat << EOF | |
981 | ||
982 | ---------------------------- | |
8d060937 CB |
983 | Binaries |
984 | - Command Line Tools: | |
985 | - lxc-attach: $enable_tools | |
986 | - lxc-autostart: $enable_tools | |
987 | - lxc-cgroup: $enable_tools | |
988 | - lxc-checkpoint: $enable_tools | |
989 | - lxc-config: $enable_tools | |
990 | - lxc-console: $enable_tools | |
991 | - lxc-copy: $enable_tools | |
992 | - lxc-create: $enable_tools | |
993 | - lxc-destroy: $enable_tools | |
994 | - lxc-device: $enable_tools | |
995 | - lxc-execute: $enable_tools | |
996 | - lxc-freeze: $enable_tools | |
997 | - lxc-info: $enable_tools | |
998 | - lxc-ls: $enable_tools | |
999 | - lxc-monitor: $enable_tools | |
1000 | - lxc-snapshot: $enable_tools | |
1001 | - lxc-start: $enable_tools | |
1002 | - lxc-stop: $enable_tools | |
1003 | - lxc-top: $enable_tools | |
1004 | - lxc-unfreeze: $enable_tools | |
1005 | - lxc-unshare: $enable_tools | |
1006 | - lxc-wait: $enable_tools | |
1007 | ||
1008 | - liblxc Commands: | |
1009 | - lxc-checkconfig: $enable_commands | |
1010 | - lxc-update-config: $enable_commands | |
1011 | - lxc-init: $enable_commands | |
1012 | - lxc-monitord: $enable_commands | |
1013 | - lxc-user-nic: $enable_commands | |
1014 | - lxc-usernsexec: $enable_commands | |
1015 | ||
f91d5e4e SG |
1016 | Environment: |
1017 | - compiler: $CC | |
1018 | - distribution: $with_distro | |
89f79f6b | 1019 | - init script type(s): $init_script |
f91d5e4e | 1020 | - rpath: $enable_rpath |
fa2bb6ba | 1021 | - OpenSSL: $enable_openssl |
0306de4f | 1022 | - Bash integration: $enable_bash |
f91d5e4e SG |
1023 | |
1024 | Security features: | |
1025 | - Apparmor: $enable_apparmor | |
1026 | - Linux capabilities: $enable_capabilities | |
1027 | - seccomp: $enable_seccomp | |
1028 | - SELinux: $enable_selinux | |
6400238d | 1029 | - memfd rexec: $enable_memfd_rexec |
f91d5e4e | 1030 | |
7ac43d3d | 1031 | PAM: |
f7a8609f | 1032 | - PAM module: $enable_pam |
7ac43d3d CB |
1033 | - cgroup PAM module: $pamdir |
1034 | ||
f91d5e4e SG |
1035 | Documentation: |
1036 | - examples: $enable_examples | |
1037 | - API documentation: $enable_api_docs | |
1038 | - user documentation: $enable_doc | |
1039 | ||
1040 | Debugging: | |
1041 | - tests: $enable_tests | |
565c4427 | 1042 | - ASAN: $enable_asan |
f91d5e4e SG |
1043 | - mutex debugging: $enable_mutex_debugging |
1044 | ||
1045 | Paths: | |
1046 | - Logs in configpath: $enable_configpath_log | |
81c76cff CB |
1047 | |
1048 | Thread-safety: | |
1049 | - enforce: $enable_thread_safety | |
5c7bfc02 | 1050 | |
1051 | Dlog: | |
1052 | - enable: $enable_dlog | |
f91d5e4e | 1053 | EOF |