]> git.proxmox.com Git - mirror_lxc.git/blob - configure.ac
configure.ac: Add code to detect bionic C library
[mirror_lxc.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_INIT([lxc], [0.9.0.alpha2])
5
6 AC_CONFIG_SRCDIR([configure.ac])
7 AC_CONFIG_AUX_DIR([config])
8 AM_CONFIG_HEADER([src/config.h])
9 AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability])
10 AC_CANONICAL_HOST
11 AM_PROG_CC_C_O
12 AC_GNU_SOURCE
13 AC_CHECK_PROG(SETCAP, setcap, yes, no, $PATH$PATH_SEPARATOR/sbin)
14
15 AC_MSG_CHECKING([host distribution])
16 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, oracle, fedora, suse, gentoo, debian, arch, slackware, paldo, mandriva or pardus]))
17 if test "z$with_distro" = "z"; then
18 with_distro=`lsb_release -is`
19 fi
20 if test "z$with_distro" = "z"; then
21 AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
22 AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle")
23 AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora")
24 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
25 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
26 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
27 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
28 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
29 AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware")
30 AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="mandriva")
31 AC_CHECK_FILE(/etc/mandriva-release,with_distro="mandriva")
32 AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
33 fi
34 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
35
36 if test "z$with_distro" = "z"; then
37 with_distro="unknown"
38 fi
39 case $with_distro in
40 ubuntu)
41 conffile=lxc.conf.ubuntu
42 ;;
43 redhat|fedora|oracle|oracleserver)
44 conffile=lxc.conf.libvirt
45 ;;
46 *)
47 echo -n "Linux distribution network config unknown, defaulting to lxc.network.type = empty"
48 conffile=lxc.conf.unknown
49 ;;
50 esac
51 AC_MSG_RESULT([$with_distro])
52
53 AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu"])
54
55 AC_ARG_ENABLE([rpath],
56 [AC_HELP_STRING([--disable-rpath], [do not set rpath in executables])],
57 [], [enable_rpath=yes])
58
59 AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
60
61 AC_ARG_ENABLE([doc],
62 [AC_HELP_STRING([--enable-doc], [make mans (require docbook2x-man installed) [default=auto]])],
63 [], [enable_doc=auto])
64
65 if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
66 db2xman=""
67
68 AC_MSG_CHECKING(for docbook2x-man)
69 for name in docbook2x-man db2x_docbook2man; do
70 if "$name" --help >/dev/null 2>&1; then
71 db2xman="$name"
72 break;
73 fi
74 done
75
76 if test -n "${db2xman}"; then
77 AC_MSG_RESULT(${db2xman})
78 else
79 AC_MSG_RESULT(no)
80 if test "x$enable_doc" = "xyes"; then
81 AC_MSG_ERROR([docbook2x-man required by man request, but not found])
82 fi
83 fi
84
85 AC_SUBST(db2xman)
86 fi
87
88 AC_ARG_ENABLE([apparmor],
89 [AC_HELP_STRING([--enable-apparmor], [enable apparmor])],
90 [], [enable_apparmor=check])
91
92 if test "$enable_apparmor" = "check" ; then
93 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
94 fi
95
96 AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
97
98 AM_COND_IF([ENABLE_APPARMOR],
99 [AC_CHECK_HEADER([sys/apparmor.h],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
100 AC_CHECK_LIB([apparmor], [aa_change_profile],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
101 AC_SUBST([APPARMOR_LIBS], [-lapparmor])])
102
103 AC_ARG_ENABLE([seccomp],
104 [AC_HELP_STRING([--enable-seccomp], [enable seccomp])],
105 [], [enable_seccomp=check])
106
107 if test "$enable_seccomp" = "check" ; then
108 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
109 fi
110
111 AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
112
113 AM_COND_IF([ENABLE_SECCOMP],
114 [AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
115 AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
116 AC_SUBST([SECCOMP_LIBS], [-lseccomp])])
117
118 # HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
119 AC_CHECK_TYPES([scmp_filter_ctx], [], [], [#include <seccomp.h>])
120
121 AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
122
123 AC_ARG_ENABLE([examples],
124 [AC_HELP_STRING([--disable-examples], [do not install configuration examples])],
125 [], [enable_examples=yes])
126
127 AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
128
129 AC_ARG_ENABLE([python],
130 [AC_HELP_STRING([--enable-python], [enable python binding])],
131 [enable_python=yes], [enable_python=no])
132
133 AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
134
135 AM_COND_IF([ENABLE_PYTHON],
136 [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])])
137 AC_CHECK_HEADER([python$PYTHON_VERSION/Python.h],[],[AC_MSG_ERROR([You must install python3-dev])])
138 AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
139
140 AC_ARG_ENABLE([tests],
141 [AC_HELP_STRING([--enable-tests], [build test/example binaries])],
142 [enable_tests=yes], [enable_tests=no])
143
144 AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
145
146 AS_AC_EXPAND(PREFIX, $prefix)
147 AS_AC_EXPAND(LIBDIR, $libdir)
148 AS_AC_EXPAND(BINDIR, $bindir)
149 AS_AC_EXPAND(LIBEXECDIR, $libexecdir)
150 AS_AC_EXPAND(INCLUDEDIR, $includedir)
151 AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
152 AS_AC_EXPAND(DATADIR, $datadir)
153 AS_AC_EXPAND(LOCALSTATEDIR, $localstatedir)
154 AS_AC_EXPAND(DOCDIR, $docdir)
155
156 AC_ARG_WITH([config-path],
157 [AC_HELP_STRING(
158 [--with-config-path=dir],
159 [lxc configuration repository path]
160 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
161
162 AC_ARG_WITH([rootfs-path],
163 [AC_HELP_STRING(
164 [--with-rootfs-path=dir],
165 [lxc rootfs mount point]
166 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
167
168 AS_AC_EXPAND(LXC_CONFFILE, $conffile)
169 AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
170 AS_AC_EXPAND(LXCPATH, "${with_config_path}")
171 AS_AC_EXPAND(LXCROOTFSMOUNT, "${with_rootfs_path}")
172 AS_AC_EXPAND(LXCTEMPLATEDIR, ['${datadir}/lxc/templates'])
173
174 AS_AC_EXPAND(LXCINITDIR, ['${libexecdir}'])
175
176 AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
177 [],
178 AC_MSG_ERROR([Please install the Linux kernel headers.]),
179 [#include <sys/socket.h>
180 ])
181
182 AC_CHECK_HEADERS([sys/capability.h], [], AC_MSG_ERROR([Please install the libcap development files.]),
183 [#include <sys/types.h>
184 #include <sys/capability.h>])
185 AC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
186 AC_MSG_CHECKING([linux capabilities])
187 if test "x$caplib" = "xyes" ; then
188 CAP_LIBS="-lcap"
189 AC_MSG_RESULT([$CAP_LIBS])
190 else
191 AC_MSG_ERROR([not found])
192 fi
193 AC_SUBST([CAP_LIBS])
194
195 # Check for alternate C libraries
196 AC_MSG_CHECKING(for bionic libc)
197 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
198 [[#ifndef __ANDROID__
199 error: Not bionic!
200 #endif]])],
201 [is_bionic=yes],
202 [is_bionic=no])
203 if test "x$is_bionic" = "xyes"; then
204 AC_DEFINE([IS_BIONIC], 1, ["bionic libc"])
205 AC_MSG_RESULT([yes])
206 else
207 AC_MSG_RESULT([no])
208 fi
209 AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
210
211 # Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
212 AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
213
214 AC_CHECK_HEADERS([sys/signalfd.h])
215
216 AC_PROG_GCC_TRADITIONAL
217 AC_PROG_SED
218
219 if test "x$GCC" = "xyes"; then
220 CFLAGS="$CFLAGS -Wall -Werror"
221 fi
222
223 AC_CONFIG_FILES([
224 Makefile
225 lxc.pc
226 lxc.spec
227 config/Makefile
228
229 doc/Makefile
230 doc/lxc-create.sgml
231 doc/lxc-destroy.sgml
232 doc/lxc-execute.sgml
233 doc/lxc-start.sgml
234 doc/lxc-checkpoint.sgml
235 doc/lxc-restart.sgml
236 doc/lxc-stop.sgml
237 doc/lxc-console.sgml
238 doc/lxc-freeze.sgml
239 doc/lxc-unfreeze.sgml
240 doc/lxc-monitor.sgml
241 doc/lxc-wait.sgml
242 doc/lxc-ls.sgml
243 doc/lxc-ps.sgml
244 doc/lxc-cgroup.sgml
245 doc/lxc-kill.sgml
246 doc/lxc-attach.sgml
247 doc/lxc.conf.sgml
248 doc/lxc.sgml
249 doc/common_options.sgml
250 doc/see_also.sgml
251 doc/legacy/lxc-ls.sgml
252
253 doc/rootfs/Makefile
254
255 doc/examples/Makefile
256 doc/examples/lxc-macvlan.conf
257 doc/examples/lxc-vlan.conf
258 doc/examples/lxc-no-netns.conf
259 doc/examples/lxc-empty-netns.conf
260 doc/examples/lxc-phys.conf
261 doc/examples/lxc-veth.conf
262 doc/examples/lxc-complex.conf
263
264 templates/Makefile
265 templates/lxc-lenny
266 templates/lxc-debian
267 templates/lxc-ubuntu
268 templates/lxc-ubuntu-cloud
269 templates/lxc-opensuse
270 templates/lxc-busybox
271 templates/lxc-fedora
272 templates/lxc-oracle
273 templates/lxc-altlinux
274 templates/lxc-sshd
275 templates/lxc-archlinux
276 templates/lxc-alpine
277
278 src/Makefile
279 src/lxc/Makefile
280 src/lxc/lxc-ps
281 src/lxc/lxc-netstat
282 src/lxc/lxc-checkconfig
283 src/lxc/lxc-setcap
284 src/lxc/lxc-setuid
285 src/lxc/lxc-version
286 src/lxc/lxc-create
287 src/lxc/lxc-clone
288 src/lxc/lxc-shutdown
289 src/lxc/lxc-start-ephemeral
290 src/lxc/lxc-destroy
291 src/lxc/legacy/lxc-ls
292
293 src/python-lxc/Makefile
294 src/python-lxc/lxc/__init__.py
295 src/python-lxc/examples/api_test.py
296
297 src/tests/Makefile
298
299 ])
300 AC_CONFIG_COMMANDS([default],[[]],[[]])
301 AC_OUTPUT
302
303 if test "x$SETCAP" = "xno"; then
304 AC_MSG_NOTICE([
305
306 Warning:
307 --------
308
309 The setcap binary was not found. This means the tools to set the
310 privilege for the lxc commands are not available, that's ok, but you
311 will need to run these commands as root or install libcap-2.
312
313 ])
314
315 else
316
317 AC_MSG_NOTICE([
318
319 Advice:
320 -------
321
322 If you wish to have a non root user to use the lxc tools,
323 you can add the needed capabilities to the tools by invoking
324 the 'lxc-setcap' script. To remove the capabilities, use
325 'lxc-setcap -d'.
326 ])
327
328 fi