3 AC_INIT([lxcfs], [4.0.9], [lxc-devel@lists.linuxcontainers.org])
8 AC_CONFIG_SRCDIR([configure.ac])
9 AC_CONFIG_AUX_DIR([config])
10 AC_CONFIG_HEADERS([config.h])
12 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
13 AC_CONFIG_MACRO_DIR([m4])
14 AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects])
17 AC_USE_SYSTEM_EXTENSIONS
20 # Test if we have a new enough compiler.
21 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
23 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
25 #define CLANG_VERSION \
26 (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
28 #if GCC_VERSION < 40700 && CLANG_VERSION < 10000
29 #error Sorry, your compiler is too old - please upgrade it
31 ]])], [valid_compiler=yes], [valid_compiler=no])
32 if test "x$valid_compiler" = "xno"; then
33 AC_MSG_ERROR([Sorry, your compiler is too old - please upgrade it])
38 AC_SUBST([LIBTOOL_DEPS])
46 config/init/systemd/Makefile
47 config/init/systemd/lxcfs.service
48 config/init/sysvinit/Makefile
49 config/init/upstart/Makefile
62 AC_CHECK_LIB(pthread, main)
64 PKG_CHECK_MODULES(FUSE, fuse3, [have_fuse3=yes], [have_fuse3=no])
65 if test "x$have_fuse3" = "xyes"; then
66 AC_DEFINE([HAVE_FUSE3], [1], [Use fuse3])
67 AC_DEFINE_UNQUOTED([FUSE_USE_VERSION], [30], [Use fuse version 30])
69 PKG_CHECK_MODULES(FUSE, fuse, [AC_DEFINE_UNQUOTED([FUSE_USE_VERSION], [26], [Use fuse])])
72 AC_PATH_PROG(HELP2MAN, help2man, false // No help2man //)
73 AM_CONDITIONAL([HAVE_HELP2MAN], [test "x$HELP2MAN" != "xfalse // No help2man //" ])
75 AC_ARG_WITH([runtime-path],
77 [--with-runtime-path=dir],
78 [runtime directory (default: /run)]
79 )], [], [with_runtime_path=['/run']])
81 AS_AC_EXPAND(RUNTIME_PATH, "$with_runtime_path")
82 AS_AC_EXPAND(LXCFSSHAREDIR, "$datarootdir/lxcfs")
83 AS_AC_EXPAND(LXCCONFDIR, "$datarootdir/lxc/config/common.conf.d")
84 AS_AC_EXPAND(LXCFSTARGETDIR, "$localstatedir/lib/lxcfs")
86 # Detect the distribution. This is used for the default configuration and
87 # for some distro-specific build options.
88 AC_MSG_CHECKING([host distribution])
89 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.]))
90 if type lsb_release >/dev/null 2>&1 && test "z$with_distro" = "z"; then
91 with_distro=`lsb_release -is`
94 if test "z$with_distro" = "z"; then
95 AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
96 AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle")
97 AC_CHECK_FILE(/etc/centos-release,with_distro="centos")
98 AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora")
99 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
100 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
101 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
102 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
103 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
104 AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware")
105 AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="openmandriva")
106 AC_CHECK_FILE(/etc/mandriva-release,with_distro="openmandriva")
107 AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
108 AC_CHECK_FILE(/etc/pld-release,with_distro="pld")
111 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
113 if test "z$with_distro" = "z"; then
114 with_distro="unknown"
119 distroconf=default.conf.ubuntu
121 redhat|centos|fedora|oracle|oracleserver|pld)
122 distroconf=default.conf.libvirt
125 distroconf=default.conf.unknown
129 AC_MSG_RESULT([$with_distro])
130 AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu"])
131 AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
133 # Check for init system type
134 AC_MSG_CHECKING([for init system type])
135 AC_ARG_WITH([init-script],
136 [AC_HELP_STRING([--with-init-script@<:@=TYPE@<:@,TYPE,...@:>@@:>@],
137 [Type(s) of init script to install: bsd, openrc, sysvinit, systemd, upstart,
138 distro @<:@default=distro@:>@])],[],[with_init_script=distro])
139 case "$with_init_script" in
145 redhat|centos|oracle|oracleserver)
149 init_script=upstart,systemd,sysvinit
152 init_script=upstart,systemd,sysvinit
155 init_script=systemd,sysvinit
158 echo -n "Warning: bsd init job not yet implemented"
162 echo -n "Warning: openrc init job not yet implemented"
166 echo -n "Linux distribution init system unknown."
172 init_script=$with_init_script
176 # Check valid init systems were given, run in subshell so we don't mess up IFS
177 (IFS="," ; for init_sys in $init_script;
180 none|bsd|openrc|sysvinit|systemd|upstart)
186 done) || AC_MSG_ERROR([Unknown init system type in $init_script])
188 AM_CONDITIONAL([INIT_SCRIPT_BSD], [echo "$init_script" |grep -q "bsd"])
189 AM_CONDITIONAL([INIT_SCRIPT_OPENRC], [echo "$init_script" |grep -q "openrc"])
190 AM_CONDITIONAL([INIT_SCRIPT_SYSV], [echo "$init_script" |grep -q "sysvinit"])
191 AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], [echo "$init_script" |grep -q "systemd"])
192 AM_CONDITIONAL([INIT_SCRIPT_UPSTART], [echo "$init_script" |grep -q "upstart"])
193 AC_MSG_RESULT($init_script)
195 AC_SUBST([lxcfsdir], "${libdir}/lxcfs")
197 # Rootfs path, where the container mount structure is assembled
198 AC_ARG_WITH([rootfs-path],
200 [--with-rootfs-path=dir],
201 [lxc rootfs mount point]
202 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
204 AS_AC_EXPAND(LIBDIR, "$libdir")
206 AC_CHECK_FUNCS([strlcpy],
207 AM_CONDITIONAL(HAVE_STRLCPY, true)
208 AC_DEFINE(HAVE_STRLCPY,1,[Have strlcpy]),
209 AM_CONDITIONAL(HAVE_STRLCPY, false))
211 AC_CHECK_FUNCS([strlcat],
212 AM_CONDITIONAL(HAVE_STRLCAT, true)
213 AC_DEFINE(HAVE_STRLCAT,1,[Have strlcat]),
214 AM_CONDITIONAL(HAVE_STRLCAT, false))
216 AC_CHECK_FUNCS([pidfd_open],
217 AM_CONDITIONAL(HAVE_PIDFD_OPEN, true)
218 AC_DEFINE(HAVE_PIDFD_OPEN,1,[Supports pidfd_open]),
219 AM_CONDITIONAL(HAVE_PIDFD_OPEN, false))
221 AC_CHECK_FUNCS([pidfd_send_signal],
222 AM_CONDITIONAL(HAVE_PIDFD_SEND_SIGNAL, true)
223 AC_DEFINE(HAVE_PIDFD_SEND_SIGNAL,1,[Supports pidfd_send_signal]),
224 AM_CONDITIONAL(HAVE_PIDFD_SEND_SIGNAL, false))
226 AX_CHECK_COMPILE_FLAG([-fdiagnostics-color], [CFLAGS="$CFLAGS -fdiagnostics-color"],,[-Werror])
227 AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough=5], [CFLAGS="$CFLAGS -Wimplicit-fallthrough=5"],,[-Werror])
228 AX_CHECK_COMPILE_FLAG([-Wcast-align], [CFLAGS="$CFLAGS -Wcast-align"],,[-Werror])
229 AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], [CFLAGS="$CFLAGS -Wstrict-prototypes"],,[-Werror])
230 AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"],,[-Werror])
231 AX_CHECK_COMPILE_FLAG([-fstack-clash-protection], [CFLAGS="$CFLAGS -fstack-clash-protection"],,[-Werror])
232 AX_CHECK_LINK_FLAG([-fstack-protector-strong], [CFLAGS="$CFLAGS -fstack-protector-strong"],,[-Werror])
233 AX_CHECK_LINK_FLAG([--param=ssp-buffer-size=4], [CFLAGS="$CFLAGS --param=ssp-buffer-size=4"],,[-Werror])
234 AX_CHECK_COMPILE_FLAG([-g], [CFLAGS="$CFLAGS -g"],,[-Werror])
235 AX_CHECK_COMPILE_FLAG([--mcet -fcf-protection], [CFLAGS="$CFLAGS --mcet -fcf-protection"],,[-Werror])
236 AX_CHECK_COMPILE_FLAG([-Werror=implicit-function-declaration], [CFLAGS="$CFLAGS -Werror=implicit-function-declaration"],,[-Werror])
237 AX_CHECK_COMPILE_FLAG([-Wlogical-op], [CFLAGS="$CFLAGS -Wlogical-op"],,[-Werror])
238 AX_CHECK_COMPILE_FLAG([-Wmissing-include-dirs], [CFLAGS="$CFLAGS -Wmissing-include-dirs"],,[-Werror])
239 AX_CHECK_COMPILE_FLAG([-Wold-style-definition], [CFLAGS="$CFLAGS -Wold-style-definition"],,[-Werror])
240 AX_CHECK_COMPILE_FLAG([-Winit-self], [CFLAGS="$CFLAGS -Winit-self"],,[-Werror])
241 AX_CHECK_COMPILE_FLAG([-Wunused-but-set-variable], [CFLAGS="$CFLAGS -Wunused-but-set-variable"],,[-Werror])
242 AX_CHECK_COMPILE_FLAG([-Wfloat-equal], [CFLAGS="$CFLAGS -Wfloat-equal"],,[-Werror])
243 AX_CHECK_COMPILE_FLAG([-Wsuggest-attribute=noreturn], [CFLAGS="$CFLAGS -Wsuggest-attribute=noreturn"],,[-Werror])
244 AX_CHECK_COMPILE_FLAG([-Werror=return-type], [CFLAGS="$CFLAGS -Werror=return-type"],,[-Werror])
245 AX_CHECK_COMPILE_FLAG([-Werror=incompatible-pointer-types], [CFLAGS="$CFLAGS -Werror=incompatible-pointer-types"],,[-Werror])
246 AX_CHECK_COMPILE_FLAG([-Wformat=2], [CFLAGS="$CFLAGS -Wformat=2"],,[-Werror])
247 AX_CHECK_COMPILE_FLAG([-Wshadow], [CFLAGS="$CFLAGS -Wshadow"],,[-Werror])
248 AX_CHECK_COMPILE_FLAG([-Wendif-labels], [CFLAGS="$CFLAGS -Wendif-labels"],,[-Werror])
249 AX_CHECK_COMPILE_FLAG([-Werror=overflow], [CFLAGS="$CFLAGS -Werror=overflow"],,[-Werror])
250 AX_CHECK_COMPILE_FLAG([-fdiagnostics-show-option], [CFLAGS="$CFLAGS -fdiagnostics-show-option"],,[-Werror])
251 AX_CHECK_COMPILE_FLAG([-Werror=shift-count-overflow], [CFLAGS="$CFLAGS -Werror=shift-count-overflow"],,[-Werror])
252 AX_CHECK_COMPILE_FLAG([-Werror=shift-overflow=2], [CFLAGS="$CFLAGS -Werror=shift-overflow=2"],,[-Werror])
253 AX_CHECK_COMPILE_FLAG([-Wdate-time], [CFLAGS="$CFLAGS -Wdate-time"],,[-Werror])
254 AX_CHECK_COMPILE_FLAG([-Wnested-externs], [CFLAGS="$CFLAGS -Wnested-externs"],,[-Werror])
255 AX_CHECK_COMPILE_FLAG([-fasynchronous-unwind-tables], [CFLAGS="$CFLAGS -fasynchronous-unwind-tables"],,[-Werror])
256 AX_CHECK_COMPILE_FLAG([-pipe], [CFLAGS="$CFLAGS -pipe"],,[-Werror])
257 AX_CHECK_COMPILE_FLAG([-fexceptions], [CFLAGS="$CFLAGS -fexceptions"],,[-Werror])
259 CFLAGS="$CFLAGS -fvisibility=hidden -Wvla -std=gnu11"
260 AX_CHECK_LINK_FLAG([-z relro], [LDFLAGS="$LDFLAGS -z relro"],,[])
261 AX_CHECK_LINK_FLAG([-z now], [LDFLAGS="$LDFLAGS -z now"],,[])
263 # Build with ASAN commands
264 AC_ARG_ENABLE([asan],
265 [AS_HELP_STRING([--enable-asan], [build with address sanitizer enabled [default=no]])],
266 [enable_asan=$enableval], [enable_asan=no])
267 AM_CONDITIONAL([ENABLE_ASAN], [test "x$enable_asan" = "xyes"])
269 # Build with UBSAN commands
270 AC_ARG_ENABLE([ubsan],
271 [AS_HELP_STRING([--enable-ubsan], [build with ubsan sanitizer enabled [default=no]])],
272 [enable_asan=$enableval], [enable_ubsan=no])
273 AM_CONDITIONAL([ENABLE_UBSAN], [test "x$enable_ubsan" = "xyes"])
277 # Configuration overview
280 ----------------------------
285 - tests: $enable_tests
287 - mutex debugging: $enable_mutex_debugging