]>
Commit | Line | Data |
---|---|---|
2183082c SH |
1 | # Process this file with autoconf to produce a configure script. |
2 | ||
9ce186dc | 3 | AC_PREREQ([2.69]) |
9d494a0f | 4 | AC_INIT([lxcfs], [3.1.2], [lxc-devel@lists.linuxcontainers.org]) |
7456f3b5 SG |
5 | AC_SUBST(ACLOCAL_AMFLAGS, "-I m4") |
6 | AC_CONFIG_MACRO_DIR([m4]) | |
9ce186dc CB |
7 | AC_CONFIG_AUX_DIR([config]) |
8 | AC_CONFIG_HEADERS([config.h]) | |
9 | AC_CONFIG_SRCDIR([configure.ac]) | |
2183082c | 10 | |
b46e63e2 | 11 | AM_INIT_AUTOMAKE([subdir-objects -Wno-portability]) |
df54106a | 12 | |
2183082c | 13 | AC_GNU_SOURCE |
2183082c | 14 | AC_CONFIG_FILES([ |
c1f9bbee | 15 | Makefile |
3cd4195e | 16 | lxcfs.spec |
6cb7f996 SH |
17 | config/Makefile |
18 | config/init/Makefile | |
19 | config/init/systemd/Makefile | |
89113f7e | 20 | config/init/systemd/lxcfs.service |
6cb7f996 SH |
21 | config/init/sysvinit/Makefile |
22 | config/init/upstart/Makefile | |
7456f3b5 SG |
23 | share/Makefile |
24 | share/00-lxcfs.conf | |
25 | share/lxc.mount.hook | |
5d6df2dd | 26 | share/lxc.reboot.hook |
c1f9bbee | 27 | tests/Makefile ]) |
2183082c | 28 | |
2183082c | 29 | LT_INIT |
2183082c | 30 | AC_PROG_CC_C99 |
9ce186dc CB |
31 | AC_CANONICAL_HOST |
32 | AM_PROG_CC_C_O | |
33 | AC_USE_SYSTEM_EXTENSIONS | |
2183082c | 34 | |
2c51f8dd SH |
35 | AC_CHECK_LIB(pthread, main) |
36 | ||
9ce186dc CB |
37 | # We need pkg-config |
38 | PKG_PROG_PKG_CONFIG | |
39 | ||
2183082c SH |
40 | PKG_CHECK_MODULES(FUSE, fuse) |
41 | ||
42 | AC_PATH_PROG(HELP2MAN, help2man, false // No help2man //) | |
d85bd3de | 43 | AM_CONDITIONAL([HAVE_HELP2MAN], [test "x$HELP2MAN" != "xfalse // No help2man //" ]) |
2183082c | 44 | |
35482f91 SH |
45 | AC_ARG_WITH([runtime-path], |
46 | [AC_HELP_STRING( | |
47 | [--with-runtime-path=dir], | |
48 | [runtime directory (default: /run)] | |
49 | )], [], [with_runtime_path=['/run']]) | |
50 | ||
51 | AS_AC_EXPAND(RUNTIME_PATH, "$with_runtime_path") | |
7456f3b5 | 52 | AS_AC_EXPAND(LXCFSSHAREDIR, "$datarootdir/lxcfs") |
b4851b56 | 53 | AS_AC_EXPAND(LXCCONFDIR, "$datarootdir/lxc/config/common.conf.d") |
7456f3b5 SG |
54 | AS_AC_EXPAND(LXCFSTARGETDIR, "$localstatedir/lib/lxcfs") |
55 | ||
6cb7f996 SH |
56 | # Detect the distribution. This is used for the default configuration and |
57 | # for some distro-specific build options. | |
58 | AC_MSG_CHECKING([host distribution]) | |
59 | AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, oracle, centos, fedora, suse, gentoo, debian, arch, slackware, paldo, openmandriva or pardus.])) | |
60 | if type lsb_release >/dev/null 2>&1 && test "z$with_distro" = "z"; then | |
61 | with_distro=`lsb_release -is` | |
62 | fi | |
63 | if test "z$with_distro" = "z"; then | |
64 | AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat") | |
65 | AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle") | |
66 | AC_CHECK_FILE(/etc/centos-release,with_distro="centos") | |
67 | AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora") | |
68 | AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse") | |
69 | AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo") | |
70 | AC_CHECK_FILE(/etc/debian_version,with_distro="debian") | |
71 | AC_CHECK_FILE(/etc/arch-release,with_distro="arch") | |
72 | AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware") | |
73 | AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware") | |
74 | AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="openmandriva") | |
75 | AC_CHECK_FILE(/etc/mandriva-release,with_distro="openmandriva") | |
76 | AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus") | |
00d7fdd8 | 77 | AC_CHECK_FILE(/etc/pld-release,with_distro="pld") |
6cb7f996 SH |
78 | fi |
79 | with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'` | |
80 | ||
81 | if test "z$with_distro" = "z"; then | |
82 | with_distro="unknown" | |
83 | fi | |
84 | case $with_distro in | |
85 | ubuntu) | |
86 | distroconf=default.conf.ubuntu | |
87 | ;; | |
00d7fdd8 | 88 | redhat|centos|fedora|oracle|oracleserver|pld) |
6cb7f996 SH |
89 | distroconf=default.conf.libvirt |
90 | ;; | |
91 | *) | |
92 | distroconf=default.conf.unknown | |
93 | ;; | |
94 | esac | |
95 | AC_MSG_RESULT([$with_distro]) | |
96 | AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu"]) | |
97 | AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"]) | |
98 | ||
99 | # Check for init system type | |
100 | AC_MSG_CHECKING([for init system type]) | |
101 | AC_ARG_WITH([init-script], | |
102 | [AC_HELP_STRING([--with-init-script@<:@=TYPE@<:@,TYPE,...@:>@@:>@], | |
103 | [Type(s) of init script to install: bsd, openrc, sysvinit, systemd, upstart, | |
104 | distro @<:@default=distro@:>@])],[],[with_init_script=distro]) | |
105 | case "$with_init_script" in | |
106 | distro) | |
107 | case $with_distro in | |
108 | fedora) | |
109 | init_script=systemd | |
110 | ;; | |
111 | redhat|centos|oracle|oracleserver) | |
112 | init_script=sysvinit | |
113 | ;; | |
114 | debian) | |
ef2256ce | 115 | init_script=upstart,systemd,sysvinit |
6cb7f996 SH |
116 | ;; |
117 | ubuntu) | |
ef2256ce | 118 | init_script=upstart,systemd,sysvinit |
6cb7f996 | 119 | ;; |
00d7fdd8 ER |
120 | pld) |
121 | init_script=systemd,sysvinit | |
122 | ;; | |
6cb7f996 SH |
123 | slackware) |
124 | echo -n "Warning: bsd init job not yet implemented" | |
125 | init_script= | |
126 | ;; | |
127 | gentoo) | |
128 | echo -n "Warning: openrc init job not yet implemented" | |
129 | init_script= | |
130 | ;; | |
131 | *) | |
132 | echo -n "Linux distribution init system unknown." | |
133 | init_script= | |
134 | ;; | |
135 | esac | |
136 | ;; | |
137 | *) | |
138 | init_script=$with_init_script | |
139 | ;; | |
140 | esac | |
141 | ||
142 | # Check valid init systems were given, run in subshell so we don't mess up IFS | |
143 | (IFS="," ; for init_sys in $init_script; | |
144 | do | |
145 | case "$init_sys" in | |
146 | none|bsd|openrc|sysvinit|systemd|upstart) | |
147 | ;; | |
148 | *) | |
149 | exit 1 | |
150 | ;; | |
151 | esac | |
152 | done) || AC_MSG_ERROR([Unknown init system type in $init_script]) | |
153 | ||
154 | AM_CONDITIONAL([INIT_SCRIPT_BSD], [echo "$init_script" |grep -q "bsd"]) | |
155 | AM_CONDITIONAL([INIT_SCRIPT_OPENRC], [echo "$init_script" |grep -q "openrc"]) | |
156 | AM_CONDITIONAL([INIT_SCRIPT_SYSV], [echo "$init_script" |grep -q "sysvinit"]) | |
157 | AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], [echo "$init_script" |grep -q "systemd"]) | |
158 | AM_CONDITIONAL([INIT_SCRIPT_UPSTART], [echo "$init_script" |grep -q "upstart"]) | |
159 | AC_MSG_RESULT($init_script) | |
160 | ||
369154d6 | 161 | AC_SUBST([lxcfsdir], "${libdir}/lxcfs") |
df54106a | 162 | |
237e200e SH |
163 | # Rootfs path, where the container mount structure is assembled |
164 | AC_ARG_WITH([rootfs-path], | |
165 | [AC_HELP_STRING( | |
166 | [--with-rootfs-path=dir], | |
167 | [lxc rootfs mount point] | |
168 | )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']]) | |
169 | ||
170 | AS_AC_EXPAND(LIBDIR, "$libdir") | |
171 | ||
5fbea8a6 CB |
172 | AC_CHECK_FUNCS([strlcpy], |
173 | AM_CONDITIONAL(HAVE_STRLCPY, true) | |
174 | AC_DEFINE(HAVE_STRLCPY,1,[Have strlcpy]), | |
175 | AM_CONDITIONAL(HAVE_STRLCPY, false)) | |
176 | AC_CHECK_FUNCS([strlcat], | |
177 | AM_CONDITIONAL(HAVE_STRLCAT, true) | |
178 | AC_DEFINE(HAVE_STRLCAT,1,[Have strlcat]), | |
179 | AM_CONDITIONAL(HAVE_STRLCAT, false)) | |
180 | ||
87f7558b CB |
181 | AC_CHECK_TYPES([struct clone_args], [], [], [[#include <linux/sched.h>]]) |
182 | ||
183 | AC_CHECK_FUNCS([clone3], | |
184 | AM_CONDITIONAL(HAVE_CLONE3, true) | |
185 | AC_DEFINE(HAVE_CLONE3,1,[Supports clone3]), | |
186 | AM_CONDITIONAL(HAVE_CLONE3, false)) | |
187 | ||
2aa59b2e CB |
188 | AC_CHECK_FUNCS([pidfd_open], |
189 | AM_CONDITIONAL(HAVE_PIDFD_OPEN, true) | |
190 | AC_DEFINE(HAVE_PIDFD_OPEN,1,[Supports pidfd_open]), | |
191 | AM_CONDITIONAL(HAVE_PIDFD_OPEN, false)) | |
192 | ||
193 | AC_CHECK_FUNCS([pidfd_send_signal], | |
194 | AM_CONDITIONAL(HAVE_PIDFD_SEND_SIGNAL, true) | |
195 | AC_DEFINE(HAVE_PIDFD_SEND_SIGNAL,1,[Supports pidfd_send_signal]), | |
196 | AM_CONDITIONAL(HAVE_PIDFD_SEND_SIGNAL, false)) | |
197 | ||
9ce186dc CB |
198 | AX_CHECK_COMPILE_FLAG([-fdiagnostics-color], [CFLAGS="$CFLAGS -fdiagnostics-color"],,[-Werror]) |
199 | AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough=5], [CFLAGS="$CFLAGS -Wimplicit-fallthrough=5"],,[-Werror]) | |
200 | AX_CHECK_COMPILE_FLAG([-Wcast-align], [CFLAGS="$CFLAGS -Wcast-align"],,[-Werror]) | |
201 | AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], [CFLAGS="$CFLAGS -Wstrict-prototypes"],,[-Werror]) | |
202 | AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"],,[-Werror]) | |
203 | AX_CHECK_COMPILE_FLAG([-fstack-clash-protection], [CFLAGS="$CFLAGS -fstack-clash-protection"],,[-Werror]) | |
204 | AX_CHECK_LINK_FLAG([-fstack-protector-strong], [CFLAGS="$CFLAGS -fstack-protector-strong"],,[-Werror]) | |
205 | AX_CHECK_LINK_FLAG([--param=ssp-buffer-size=4], [CFLAGS="$CFLAGS --param=ssp-buffer-size=4"],,[-Werror]) | |
206 | AX_CHECK_COMPILE_FLAG([-g], [CFLAGS="$CFLAGS -g"],,[-Werror]) | |
207 | AX_CHECK_COMPILE_FLAG([--mcet -fcf-protection], [CFLAGS="$CFLAGS --mcet -fcf-protection"],,[-Werror]) | |
208 | AX_CHECK_COMPILE_FLAG([-Werror=implicit-function-declaration], [CFLAGS="$CFLAGS -Werror=implicit-function-declaration"],,[-Werror]) | |
209 | AX_CHECK_COMPILE_FLAG([-Wlogical-op], [CFLAGS="$CFLAGS -Wlogical-op"],,[-Werror]) | |
210 | AX_CHECK_COMPILE_FLAG([-Wmissing-include-dirs], [CFLAGS="$CFLAGS -Wmissing-include-dirs"],,[-Werror]) | |
211 | AX_CHECK_COMPILE_FLAG([-Wold-style-definition], [CFLAGS="$CFLAGS -Wold-style-definition"],,[-Werror]) | |
212 | AX_CHECK_COMPILE_FLAG([-Winit-self], [CFLAGS="$CFLAGS -Winit-self"],,[-Werror]) | |
213 | AX_CHECK_COMPILE_FLAG([-Wunused-but-set-variable], [CFLAGS="$CFLAGS -Wunused-but-set-variable"],,[-Werror]) | |
214 | AX_CHECK_COMPILE_FLAG([-Wfloat-equal], [CFLAGS="$CFLAGS -Wfloat-equal"],,[-Werror]) | |
215 | AX_CHECK_COMPILE_FLAG([-Wsuggest-attribute=noreturn], [CFLAGS="$CFLAGS -Wsuggest-attribute=noreturn"],,[-Werror]) | |
216 | AX_CHECK_COMPILE_FLAG([-Werror=return-type], [CFLAGS="$CFLAGS -Werror=return-type"],,[-Werror]) | |
217 | AX_CHECK_COMPILE_FLAG([-Werror=incompatible-pointer-types], [CFLAGS="$CFLAGS -Werror=incompatible-pointer-types"],,[-Werror]) | |
218 | AX_CHECK_COMPILE_FLAG([-Wformat=2], [CFLAGS="$CFLAGS -Wformat=2"],,[-Werror]) | |
219 | AX_CHECK_COMPILE_FLAG([-Wshadow], [CFLAGS="$CFLAGS -Wshadow"],,[-Werror]) | |
220 | AX_CHECK_COMPILE_FLAG([-Wendif-labels], [CFLAGS="$CFLAGS -Wendif-labels"],,[-Werror]) | |
221 | AX_CHECK_COMPILE_FLAG([-Werror=overflow], [CFLAGS="$CFLAGS -Werror=overflow"],,[-Werror]) | |
222 | AX_CHECK_COMPILE_FLAG([-fdiagnostics-show-option], [CFLAGS="$CFLAGS -fdiagnostics-show-option"],,[-Werror]) | |
223 | AX_CHECK_COMPILE_FLAG([-Werror=shift-count-overflow], [CFLAGS="$CFLAGS -Werror=shift-count-overflow"],,[-Werror]) | |
224 | AX_CHECK_COMPILE_FLAG([-Werror=shift-overflow=2], [CFLAGS="$CFLAGS -Werror=shift-overflow=2"],,[-Werror]) | |
225 | AX_CHECK_COMPILE_FLAG([-Wdate-time], [CFLAGS="$CFLAGS -Wdate-time"],,[-Werror]) | |
226 | AX_CHECK_COMPILE_FLAG([-Wnested-externs], [CFLAGS="$CFLAGS -Wnested-externs"],,[-Werror]) | |
227 | AX_CHECK_COMPILE_FLAG([-fasynchronous-unwind-tables], [CFLAGS="$CFLAGS -fasynchronous-unwind-tables"],,[-Werror]) | |
228 | AX_CHECK_COMPILE_FLAG([-pipe], [CFLAGS="$CFLAGS -pipe"],,[-Werror]) | |
229 | AX_CHECK_COMPILE_FLAG([-fexceptions], [CFLAGS="$CFLAGS -fexceptions"],,[-Werror]) | |
230 | ||
231 | AX_CHECK_LINK_FLAG([-z relro], [LDFLAGS="$LDFLAGS -z relro"],,[]) | |
232 | AX_CHECK_LINK_FLAG([-z now], [LDFLAGS="$LDFLAGS -z now"],,[]) | |
233 | ||
7eac3825 CB |
234 | # Build with ASAN commands |
235 | AC_ARG_ENABLE([asan], | |
236 | [AS_HELP_STRING([--enable-asan], [build with address sanitizer enabled [default=no]])], | |
237 | [enable_asan=$enableval], [enable_asan=no]) | |
238 | AM_CONDITIONAL([ENABLE_ASAN], [test "x$enable_asan" = "xyes"]) | |
239 | ||
240 | # Build with UBSAN commands | |
241 | AC_ARG_ENABLE([ubsan], | |
242 | [AS_HELP_STRING([--enable-ubsan], [build with ubsan sanitizer enabled [default=no]])], | |
243 | [enable_asan=$enableval], [enable_ubsan=no]) | |
244 | AM_CONDITIONAL([ENABLE_UBSAN], [test "x$enable_ubsan" = "xyes"]) | |
245 | ||
2183082c | 246 | AC_OUTPUT |
7eac3825 CB |
247 | |
248 | # Configuration overview | |
249 | cat << EOF | |
250 | ||
251 | ---------------------------- | |
252 | Environment: | |
253 | - compiler: $CC | |
254 | ||
255 | Debugging: | |
256 | - tests: $enable_tests | |
257 | - ASAN: $enable_asan | |
258 | - mutex debugging: $enable_mutex_debugging | |
259 | EOF |