]> git.proxmox.com Git - mirror_lxc.git/blob - configure.ac
Add man page for lxc-clone
[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
14 # Detect the distribution. This is used for the default configuration and
15 # for some distro-specific build options.
16 AC_MSG_CHECKING([host distribution])
17 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.]))
18 if test "z$with_distro" = "z"; then
19 with_distro=`lsb_release -is`
20 fi
21 if test "z$with_distro" = "z"; then
22 AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
23 AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle")
24 AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora")
25 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
26 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
27 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
28 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
29 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
30 AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware")
31 AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="mandriva")
32 AC_CHECK_FILE(/etc/mandriva-release,with_distro="mandriva")
33 AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
34 fi
35 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
36
37 if test "z$with_distro" = "z"; then
38 with_distro="unknown"
39 fi
40 case $with_distro in
41 ubuntu)
42 defaultconf=default.conf.ubuntu
43 ;;
44 redhat|fedora|oracle|oracleserver)
45 defaultconf=default.conf.libvirt
46 ;;
47 *)
48 echo -n "Linux distribution network config unknown, defaulting to lxc.network.type = empty"
49 defaultconf=default.conf.unknown
50 ;;
51 esac
52 AC_MSG_RESULT([$with_distro])
53 AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu"])
54
55 # Allow disabling rpath
56 AC_ARG_ENABLE([rpath],
57 [AC_HELP_STRING([--disable-rpath], [do not set rpath in executables])],
58 [], [enable_rpath=yes])
59 AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
60
61 # Documentation (manpages)
62 AC_ARG_ENABLE([doc],
63 [AC_HELP_STRING([--enable-doc], [make mans (require docbook2x-man installed) [default=auto]])],
64 [], [enable_doc=auto])
65
66 if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
67 db2xman=""
68
69 AC_MSG_CHECKING(for docbook2x-man)
70 for name in docbook2x-man db2x_docbook2man; do
71 if "$name" --help >/dev/null 2>&1; then
72 db2xman="$name"
73 break;
74 fi
75 done
76
77 if test -n "${db2xman}"; then
78 AC_MSG_RESULT([${db2xman}])
79 else
80 AC_MSG_RESULT([no])
81 if test "x$enable_doc" = "xyes"; then
82 AC_MSG_ERROR([docbook2x-man required by man request, but not found])
83 fi
84 fi
85
86 AC_SUBST(db2xman)
87 fi
88 AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
89
90 # Apparmor
91 AC_ARG_ENABLE([apparmor],
92 [AC_HELP_STRING([--enable-apparmor], [enable apparmor])],
93 [], [enable_apparmor=check])
94
95 if test "$enable_apparmor" = "check" ; then
96 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
97 fi
98 AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
99
100 AM_COND_IF([ENABLE_APPARMOR],
101 [AC_CHECK_HEADER([sys/apparmor.h],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
102 AC_CHECK_LIB([apparmor], [aa_change_profile],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
103 AC_SUBST([APPARMOR_LIBS], [-lapparmor])])
104
105 # Seccomp syscall filter
106 AC_ARG_ENABLE([seccomp],
107 [AC_HELP_STRING([--enable-seccomp], [enable seccomp])],
108 [], [enable_seccomp=check])
109
110 if test "$enable_seccomp" = "check" ; then
111 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
112 fi
113 AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
114
115 AM_COND_IF([ENABLE_SECCOMP],
116 [AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
117 AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
118 AC_SUBST([SECCOMP_LIBS], [-lseccomp])])
119
120 # HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
121 AC_CHECK_TYPES([scmp_filter_ctx], [], [], [#include <seccomp.h>])
122
123 # Configuration examples
124 AC_ARG_ENABLE([examples],
125 [AC_HELP_STRING([--disable-examples], [do not install configuration examples])],
126 [], [enable_examples=yes])
127 AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
128
129 # Python3 module and scripts
130 AC_ARG_ENABLE([python],
131 [AC_HELP_STRING([--enable-python], [enable python binding])],
132 [enable_python=yes], [enable_python=no])
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 PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[],[AC_MSG_ERROR([You must install python3-dev])])
138 AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
139
140 # Lua module and scripts
141 if test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu" ; then
142 LUAPKGCONFIG=lua5.1
143 else
144 LUAPKGCONFIG=lua
145 fi
146
147 AC_ARG_ENABLE([lua],
148 [AC_HELP_STRING([--enable-lua], [enable lua binding])],
149 [enable_lua=yes], [enable_lua=no])
150
151 AM_CONDITIONAL([ENABLE_LUA], [test "x$enable_lua" = "xyes"])
152
153 AM_COND_IF([ENABLE_LUA],
154 [PKG_CHECK_MODULES([LUA], [$LUAPKGCONFIG >= 5.1],[],[AC_MSG_ERROR([You must install lua-devel for lua 5.1])])
155 AC_DEFINE_UNQUOTED([ENABLE_LUA], 1, [Lua is available])])
156
157 # Optional test binaries
158 AC_ARG_ENABLE([tests],
159 [AC_HELP_STRING([--enable-tests], [build test/example binaries])],
160 [enable_tests=yes], [enable_tests=no])
161 AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
162
163 # LXC container path, where the containers are actually stored
164 # This is overriden by an entry in the file called LXCCONF
165 # (i.e. /etc/lxc/lxc.conf)
166 AC_ARG_WITH([config-path],
167 [AC_HELP_STRING(
168 [--with-config-path=dir],
169 [lxc configuration repository path]
170 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
171
172 # The path of the global lxc configuration file.
173 AC_ARG_WITH([global-conf],
174 [AC_HELP_STRING(
175 [--with-global-conf=dir],
176 [global lxc configuration file]
177 )], [], [with_global_conf=['${sysconfdir}/lxc/lxc.conf']])
178
179 # Rootfs path, where the container mount structure is assembled
180 AC_ARG_WITH([rootfs-path],
181 [AC_HELP_STRING(
182 [--with-rootfs-path=dir],
183 [lxc rootfs mount point]
184 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
185
186 # Container log path. By default, use $lxcpath.
187 AC_MSG_CHECKING([Whether to place logfiles in container config path])
188 AC_ARG_ENABLE([configpath-log],
189 [AC_HELP_STRING([--enable-configpath-log], [use logfiles in config path])],
190 [use_configpath_logs=yes], [use_configpath_logs=no])
191 AC_MSG_RESULT([$use_configpath_logs])
192 AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$use_configpath_logs" = "yes"])
193
194 if test "$use_configpath_logs" = "yes"; then
195 default_log_path="${with_config_path}"
196 else
197 default_log_path="/var/log/lxc"
198 fi
199
200 AC_ARG_WITH([log-path],
201 [AC_HELP_STRING(
202 [--with-log-path=dir],
203 [per container log path]
204 )], [], [with_log_path=['${default_log_path}']])
205
206 # Expand some useful variables
207 AS_AC_EXPAND(PREFIX, "$prefix")
208 AS_AC_EXPAND(LIBDIR, "$libdir")
209 AS_AC_EXPAND(BINDIR, "$bindir")
210 AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
211 AS_AC_EXPAND(INCLUDEDIR, "$includedir")
212 AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
213 AS_AC_EXPAND(DATADIR, "$datadir")
214 AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
215 AS_AC_EXPAND(DOCDIR, "$docdir")
216 AS_AC_EXPAND(LXC_DEFAULT_CONF, "$defaultconf")
217 AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
218 AS_AC_EXPAND(LXCPATH, "$with_config_path")
219 AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf")
220 AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
221 AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
222 AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
223 AS_AC_EXPAND(LOGPATH, "$with_log_path")
224
225 # Check for some standard kernel headers
226 AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
227 [],
228 AC_MSG_ERROR([Please install the Linux kernel headers.]),
229 [#include <sys/socket.h>])
230
231 # Allow disabling libcap support
232 AC_ARG_ENABLE([capabilities],
233 [AC_HELP_STRING([--disable-capabilities], [disable kernel capabilities])],
234 [], [enable_capabilities=yes])
235
236 # Check for libcap support
237 if test "x$enable_capabilities" = "xyes"; then
238 AC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
239 AC_MSG_CHECKING([linux capabilities])
240 if test "x$caplib" = "xyes" ; then
241 CAP_LIBS="-lcap"
242 AC_MSG_RESULT([$CAP_LIBS])
243 else
244 AC_MSG_RESULT([no])
245 AC_MSG_ERROR([You are missing libcap support. If you really want to build without kernel capabilities, use --disable-capabilities])
246 fi
247 else
248 CAP_LIBS=""
249 fi
250 AC_SUBST([CAP_LIBS])
251
252 # Check for alternate C libraries
253 AC_MSG_CHECKING(for bionic libc)
254 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
255 [[#ifndef __ANDROID__
256 error: Not bionic!
257 #endif]])],
258 [is_bionic=yes],
259 [is_bionic=no])
260 if test "x$is_bionic" = "xyes"; then
261 AC_DEFINE([IS_BIONIC], 1, [bionic libc])
262 AC_MSG_RESULT([yes])
263 else
264 AC_MSG_RESULT([no])
265 fi
266 AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
267
268 # Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
269 AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
270
271 # Check for some headers
272 AC_CHECK_HEADERS([sys/signalfd.h pty.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
273
274 # Check for some syscalls functions
275 AC_CHECK_FUNCS([setns pivot_root sethostname unshare])
276
277 # Check for some functions
278 AC_CHECK_LIB(util, openpty)
279 AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent])
280 AC_CHECK_FUNCS([getline],
281 AM_CONDITIONAL(HAVE_GETLINE, true)
282 AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
283 AM_CONDITIONAL(HAVE_GETLINE, false))
284 AC_CHECK_FUNCS([fgetln],
285 AM_CONDITIONAL(HAVE_FGETLN, true)
286 AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
287 AM_CONDITIONAL(HAVE_FGETLN, false))
288
289 # Check for some standard binaries
290 AC_PROG_GCC_TRADITIONAL
291 AC_PROG_SED
292
293 if test "x$GCC" = "xyes"; then
294 CFLAGS="$CFLAGS -Wall -Werror"
295 fi
296
297 # Files requiring some variable expansion
298 AC_CONFIG_FILES([
299 Makefile
300 lxc.pc
301 lxc.spec
302 config/Makefile
303
304 doc/Makefile
305 doc/lxc-clone.sgml
306 doc/lxc-create.sgml
307 doc/lxc-destroy.sgml
308 doc/lxc-execute.sgml
309 doc/lxc-start.sgml
310 doc/lxc-checkpoint.sgml
311 doc/lxc-restart.sgml
312 doc/lxc-stop.sgml
313 doc/lxc-console.sgml
314 doc/lxc-freeze.sgml
315 doc/lxc-unfreeze.sgml
316 doc/lxc-monitor.sgml
317 doc/lxc-wait.sgml
318 doc/lxc-ls.sgml
319 doc/lxc-ps.sgml
320 doc/lxc-top.sgml
321 doc/lxc-cgroup.sgml
322 doc/lxc-kill.sgml
323 doc/lxc-attach.sgml
324 doc/lxc.conf.sgml
325 doc/lxc.sgml
326 doc/common_options.sgml
327 doc/see_also.sgml
328 doc/legacy/lxc-ls.sgml
329
330 doc/rootfs/Makefile
331
332 doc/examples/Makefile
333 doc/examples/lxc-macvlan.conf
334 doc/examples/lxc-vlan.conf
335 doc/examples/lxc-no-netns.conf
336 doc/examples/lxc-empty-netns.conf
337 doc/examples/lxc-phys.conf
338 doc/examples/lxc-veth.conf
339 doc/examples/lxc-complex.conf
340
341 templates/Makefile
342 templates/lxc-lenny
343 templates/lxc-debian
344 templates/lxc-ubuntu
345 templates/lxc-ubuntu-cloud
346 templates/lxc-opensuse
347 templates/lxc-busybox
348 templates/lxc-fedora
349 templates/lxc-oracle
350 templates/lxc-altlinux
351 templates/lxc-sshd
352 templates/lxc-archlinux
353 templates/lxc-alpine
354
355 src/Makefile
356 src/lxc/Makefile
357 src/lxc/lxc-ps
358 src/lxc/lxc-netstat
359 src/lxc/lxc-checkconfig
360 src/lxc/lxc-version
361 src/lxc/lxc-create
362 src/lxc/lxc-clone
363 src/lxc/lxc-shutdown
364 src/lxc/lxc-start-ephemeral
365 src/lxc/lxc-destroy
366 src/lxc/legacy/lxc-ls
367 src/lxc/lxc.functions
368
369 src/python-lxc/Makefile
370 src/python-lxc/lxc/__init__.py
371 src/python-lxc/examples/api_test.py
372
373 src/lua-lxc/Makefile
374
375 src/tests/Makefile
376 ])
377 AC_CONFIG_COMMANDS([default],[[]],[[]])
378 AC_OUTPUT