]> git.proxmox.com Git - mirror_lxcfs.git/blame - configure.ac
lxcfs: add --disable-cfs
[mirror_lxcfs.git] / configure.ac
CommitLineData
2183082c
SH
1# Process this file with autoconf to produce a configure script.
2
9ce186dc 3AC_PREREQ([2.69])
9d494a0f 4AC_INIT([lxcfs], [3.1.2], [lxc-devel@lists.linuxcontainers.org])
7456f3b5
SG
5AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
6AC_CONFIG_MACRO_DIR([m4])
9ce186dc
CB
7AC_CONFIG_AUX_DIR([config])
8AC_CONFIG_HEADERS([config.h])
9AC_CONFIG_SRCDIR([configure.ac])
2183082c 10
b46e63e2 11AM_INIT_AUTOMAKE([subdir-objects -Wno-portability])
df54106a 12
2183082c 13AC_GNU_SOURCE
2183082c 14AC_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 29LT_INIT
2183082c 30AC_PROG_CC_C99
9ce186dc
CB
31AC_CANONICAL_HOST
32AM_PROG_CC_C_O
33AC_USE_SYSTEM_EXTENSIONS
2183082c 34
2c51f8dd
SH
35AC_CHECK_LIB(pthread, main)
36
9ce186dc
CB
37# We need pkg-config
38PKG_PROG_PKG_CONFIG
39
2183082c
SH
40PKG_CHECK_MODULES(FUSE, fuse)
41
42AC_PATH_PROG(HELP2MAN, help2man, false // No help2man //)
d85bd3de 43AM_CONDITIONAL([HAVE_HELP2MAN], [test "x$HELP2MAN" != "xfalse // No help2man //" ])
2183082c 44
35482f91
SH
45AC_ARG_WITH([runtime-path],
46 [AC_HELP_STRING(
47 [--with-runtime-path=dir],
48 [runtime directory (default: /run)]
49 )], [], [with_runtime_path=['/run']])
50
51AS_AC_EXPAND(RUNTIME_PATH, "$with_runtime_path")
7456f3b5 52AS_AC_EXPAND(LXCFSSHAREDIR, "$datarootdir/lxcfs")
b4851b56 53AS_AC_EXPAND(LXCCONFDIR, "$datarootdir/lxc/config/common.conf.d")
7456f3b5
SG
54AS_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.
58AC_MSG_CHECKING([host distribution])
59AC_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.]))
60if type lsb_release >/dev/null 2>&1 && test "z$with_distro" = "z"; then
61 with_distro=`lsb_release -is`
62fi
63if 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
78fi
79with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
80
81if test "z$with_distro" = "z"; then
82 with_distro="unknown"
83fi
84case $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 ;;
94esac
95AC_MSG_RESULT([$with_distro])
96AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu"])
97AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
98
99# Check for init system type
100AC_MSG_CHECKING([for init system type])
101AC_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])
105case "$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 ;;
140esac
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;
144do
145 case "$init_sys" in
146 none|bsd|openrc|sysvinit|systemd|upstart)
147 ;;
148 *)
149 exit 1
150 ;;
151 esac
152done) || AC_MSG_ERROR([Unknown init system type in $init_script])
153
154AM_CONDITIONAL([INIT_SCRIPT_BSD], [echo "$init_script" |grep -q "bsd"])
155AM_CONDITIONAL([INIT_SCRIPT_OPENRC], [echo "$init_script" |grep -q "openrc"])
156AM_CONDITIONAL([INIT_SCRIPT_SYSV], [echo "$init_script" |grep -q "sysvinit"])
157AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], [echo "$init_script" |grep -q "systemd"])
158AM_CONDITIONAL([INIT_SCRIPT_UPSTART], [echo "$init_script" |grep -q "upstart"])
159AC_MSG_RESULT($init_script)
160
369154d6 161AC_SUBST([lxcfsdir], "${libdir}/lxcfs")
df54106a 162
237e200e
SH
163# Rootfs path, where the container mount structure is assembled
164AC_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
170AS_AC_EXPAND(LIBDIR, "$libdir")
171
5fbea8a6
CB
172AC_CHECK_FUNCS([strlcpy],
173 AM_CONDITIONAL(HAVE_STRLCPY, true)
174 AC_DEFINE(HAVE_STRLCPY,1,[Have strlcpy]),
175 AM_CONDITIONAL(HAVE_STRLCPY, false))
176AC_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
181AC_CHECK_TYPES([struct clone_args], [], [], [[#include <linux/sched.h>]])
182
183AC_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
188AC_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
193AC_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
198AX_CHECK_COMPILE_FLAG([-fdiagnostics-color], [CFLAGS="$CFLAGS -fdiagnostics-color"],,[-Werror])
199AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough=5], [CFLAGS="$CFLAGS -Wimplicit-fallthrough=5"],,[-Werror])
200AX_CHECK_COMPILE_FLAG([-Wcast-align], [CFLAGS="$CFLAGS -Wcast-align"],,[-Werror])
201AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], [CFLAGS="$CFLAGS -Wstrict-prototypes"],,[-Werror])
202AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"],,[-Werror])
203AX_CHECK_COMPILE_FLAG([-fstack-clash-protection], [CFLAGS="$CFLAGS -fstack-clash-protection"],,[-Werror])
204AX_CHECK_LINK_FLAG([-fstack-protector-strong], [CFLAGS="$CFLAGS -fstack-protector-strong"],,[-Werror])
205AX_CHECK_LINK_FLAG([--param=ssp-buffer-size=4], [CFLAGS="$CFLAGS --param=ssp-buffer-size=4"],,[-Werror])
206AX_CHECK_COMPILE_FLAG([-g], [CFLAGS="$CFLAGS -g"],,[-Werror])
207AX_CHECK_COMPILE_FLAG([--mcet -fcf-protection], [CFLAGS="$CFLAGS --mcet -fcf-protection"],,[-Werror])
208AX_CHECK_COMPILE_FLAG([-Werror=implicit-function-declaration], [CFLAGS="$CFLAGS -Werror=implicit-function-declaration"],,[-Werror])
209AX_CHECK_COMPILE_FLAG([-Wlogical-op], [CFLAGS="$CFLAGS -Wlogical-op"],,[-Werror])
210AX_CHECK_COMPILE_FLAG([-Wmissing-include-dirs], [CFLAGS="$CFLAGS -Wmissing-include-dirs"],,[-Werror])
211AX_CHECK_COMPILE_FLAG([-Wold-style-definition], [CFLAGS="$CFLAGS -Wold-style-definition"],,[-Werror])
212AX_CHECK_COMPILE_FLAG([-Winit-self], [CFLAGS="$CFLAGS -Winit-self"],,[-Werror])
213AX_CHECK_COMPILE_FLAG([-Wunused-but-set-variable], [CFLAGS="$CFLAGS -Wunused-but-set-variable"],,[-Werror])
214AX_CHECK_COMPILE_FLAG([-Wfloat-equal], [CFLAGS="$CFLAGS -Wfloat-equal"],,[-Werror])
215AX_CHECK_COMPILE_FLAG([-Wsuggest-attribute=noreturn], [CFLAGS="$CFLAGS -Wsuggest-attribute=noreturn"],,[-Werror])
216AX_CHECK_COMPILE_FLAG([-Werror=return-type], [CFLAGS="$CFLAGS -Werror=return-type"],,[-Werror])
217AX_CHECK_COMPILE_FLAG([-Werror=incompatible-pointer-types], [CFLAGS="$CFLAGS -Werror=incompatible-pointer-types"],,[-Werror])
218AX_CHECK_COMPILE_FLAG([-Wformat=2], [CFLAGS="$CFLAGS -Wformat=2"],,[-Werror])
219AX_CHECK_COMPILE_FLAG([-Wshadow], [CFLAGS="$CFLAGS -Wshadow"],,[-Werror])
220AX_CHECK_COMPILE_FLAG([-Wendif-labels], [CFLAGS="$CFLAGS -Wendif-labels"],,[-Werror])
221AX_CHECK_COMPILE_FLAG([-Werror=overflow], [CFLAGS="$CFLAGS -Werror=overflow"],,[-Werror])
222AX_CHECK_COMPILE_FLAG([-fdiagnostics-show-option], [CFLAGS="$CFLAGS -fdiagnostics-show-option"],,[-Werror])
223AX_CHECK_COMPILE_FLAG([-Werror=shift-count-overflow], [CFLAGS="$CFLAGS -Werror=shift-count-overflow"],,[-Werror])
224AX_CHECK_COMPILE_FLAG([-Werror=shift-overflow=2], [CFLAGS="$CFLAGS -Werror=shift-overflow=2"],,[-Werror])
225AX_CHECK_COMPILE_FLAG([-Wdate-time], [CFLAGS="$CFLAGS -Wdate-time"],,[-Werror])
226AX_CHECK_COMPILE_FLAG([-Wnested-externs], [CFLAGS="$CFLAGS -Wnested-externs"],,[-Werror])
227AX_CHECK_COMPILE_FLAG([-fasynchronous-unwind-tables], [CFLAGS="$CFLAGS -fasynchronous-unwind-tables"],,[-Werror])
228AX_CHECK_COMPILE_FLAG([-pipe], [CFLAGS="$CFLAGS -pipe"],,[-Werror])
229AX_CHECK_COMPILE_FLAG([-fexceptions], [CFLAGS="$CFLAGS -fexceptions"],,[-Werror])
230
231AX_CHECK_LINK_FLAG([-z relro], [LDFLAGS="$LDFLAGS -z relro"],,[])
232AX_CHECK_LINK_FLAG([-z now], [LDFLAGS="$LDFLAGS -z now"],,[])
233
7eac3825
CB
234# Build with ASAN commands
235AC_ARG_ENABLE([asan],
236 [AS_HELP_STRING([--enable-asan], [build with address sanitizer enabled [default=no]])],
237 [enable_asan=$enableval], [enable_asan=no])
238AM_CONDITIONAL([ENABLE_ASAN], [test "x$enable_asan" = "xyes"])
239
240# Build with UBSAN commands
241AC_ARG_ENABLE([ubsan],
242 [AS_HELP_STRING([--enable-ubsan], [build with ubsan sanitizer enabled [default=no]])],
243 [enable_asan=$enableval], [enable_ubsan=no])
244AM_CONDITIONAL([ENABLE_UBSAN], [test "x$enable_ubsan" = "xyes"])
245
2183082c 246AC_OUTPUT
7eac3825
CB
247
248# Configuration overview
249cat << EOF
250
251----------------------------
252Environment:
253 - compiler: $CC
254
255Debugging:
256 - tests: $enable_tests
257 - ASAN: $enable_asan
258 - mutex debugging: $enable_mutex_debugging
259EOF