]> git.proxmox.com Git - mirror_lxc.git/blob - configure.ac
configure/makefile: Allow specify Lua pkg-config file with --with-lua-pc
[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])
5
6 AC_CONFIG_SRCDIR([configure.ac])
7 AC_CONFIG_AUX_DIR([config])
8 AC_CONFIG_HEADERS([src/config.h])
9 AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects])
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 distroconf=default.conf.ubuntu
43 ;;
44 redhat|fedora|oracle|oracleserver)
45 distroconf=default.conf.libvirt
46 ;;
47 *)
48 echo -n "Linux distribution network config unknown, defaulting to lxc.network.type = empty"
49 distroconf=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 AC_CHECK_PROG([NEWUIDMAP], [newuidmap], [newuidmap])
56 AM_CONDITIONAL([HAVE_NEWUIDMAP], [test -n "$NEWUIDMAP"])
57
58 # Allow disabling rpath
59 AC_ARG_ENABLE([rpath],
60 [AC_HELP_STRING([--disable-rpath], [do not set rpath in executables])],
61 [], [enable_rpath=yes])
62 AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
63
64 # Documentation (manpages)
65 AC_ARG_ENABLE([doc],
66 [AC_HELP_STRING([--enable-doc], [make mans (requires docbook2man or docbook2x-man to be installed) [default=auto]])],
67 [], [enable_doc=auto])
68
69 if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
70 db2xman=""
71 dbparsers="docbook2x-man db2x_docbook2man docbook2man"
72
73 AC_MSG_CHECKING(for docbook2x-man)
74 for name in ${dbparsers}; do
75 if "$name" --help >/dev/null 2>&1; then
76 db2xman="$name"
77 break;
78 fi
79 done
80
81 if test -n "${db2xman}"; then
82 AC_MSG_RESULT([${db2xman}])
83 else
84 AC_MSG_RESULT([no])
85 if test "x$enable_doc" = "xyes"; then
86 AC_MSG_ERROR([docbook2x-man required by man request, but not found])
87 fi
88 fi
89
90 AC_SUBST(db2xman)
91 fi
92 AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
93
94 if test "x$db2xman" = "xdocbook2man"; then
95 docdtd="\"-//Davenport//DTD DocBook V3.0//EN\""
96 else
97 docdtd="\"-//OASIS//DTD DocBook XML\" \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""
98 fi
99 AC_SUBST(docdtd)
100
101 # Apparmor
102 AC_ARG_ENABLE([apparmor],
103 [AC_HELP_STRING([--enable-apparmor], [enable apparmor])],
104 [], [enable_apparmor=check])
105
106 if test "$enable_apparmor" = "check" ; then
107 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
108 fi
109 AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
110
111 AC_CHECK_LIB([gnutls], [gnutls_hash_fast])
112
113 AM_COND_IF([ENABLE_APPARMOR],
114 [AC_CHECK_HEADER([sys/apparmor.h],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
115 AC_CHECK_LIB([apparmor], [aa_change_profile],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
116 AC_SUBST([APPARMOR_LIBS], [-lapparmor])])
117
118 # Seccomp syscall filter
119 AC_ARG_ENABLE([seccomp],
120 [AC_HELP_STRING([--enable-seccomp], [enable seccomp])],
121 [], [enable_seccomp=check])
122
123 if test "$enable_seccomp" = "check" ; then
124 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
125 fi
126 AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
127
128 AM_COND_IF([ENABLE_SECCOMP],
129 [AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
130 AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
131 AC_SUBST([SECCOMP_LIBS], [-lseccomp])])
132
133 # HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
134 AC_CHECK_TYPES([scmp_filter_ctx], [], [], [#include <seccomp.h>])
135
136 # Configuration examples
137 AC_ARG_ENABLE([examples],
138 [AC_HELP_STRING([--disable-examples], [do not install configuration examples])],
139 [], [enable_examples=yes])
140 AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
141
142 # Python3 module and scripts
143 AC_ARG_ENABLE([python],
144 [AC_HELP_STRING([--enable-python], [enable python binding])],
145 [enable_python=yes], [enable_python=no])
146 AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
147
148 AM_COND_IF([ENABLE_PYTHON],
149 [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])])
150 PKG_CHECK_MODULES([PYTHONDEV], [python3 >= 3.2],[],[AC_MSG_ERROR([You must install python3-dev])])
151 AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
152
153 dnl PKG_CHECK_VAR was introduced with pkg-config 0.28
154 m4_ifdef([PKG_CHECK_VAR], [],
155 [AC_DEFUN([PKG_CHECK_VAR],
156 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
157 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
158 _PKG_CONFIG([$1], [variable="][$3]["], [$2])
159 AS_VAR_COPY([$1], [pkg_cv_][$1])
160 AS_VAR_IF([$1], [""], [$5], [$4])dnl
161 ])# PKG_CHECK_VAR
162 ])
163
164 # Lua module and scripts
165 AC_ARG_ENABLE([lua],
166 [AC_HELP_STRING([--enable-lua], [enable lua binding])],
167 [enable_lua=yes], [enable_lua=no])
168
169 AC_ARG_WITH([lua-pc],
170 [AS_HELP_STRING(
171 [--with-lua-pc=PKG],
172 [Specify pkg-config package name for lua]
173 )],
174 [LUAPKGCONFIG=$with_lua_pc
175 enable_lua=yes], [with_lua_pc=auto])
176
177 AM_CONDITIONAL([ENABLE_LUA],
178 [test "x$enable_lua" = "xyes" -o "xwith_lua_pc != xno"])
179
180 AM_COND_IF([ENABLE_LUA],
181 [AS_IF([test "x$with_lua_pc" = "xauto"],
182 [PKG_CHECK_MODULES([LUA], [lua],[LUAPKGCONFIG=lua],
183 [PKG_CHECK_MODULES([LUA], [lua5.2],[LUAPKGCONFIG=lua5.2],
184 [PKG_CHECK_MODULES([LUA], [lua5.1],
185 [LUAPKGCONFIG=lua5.1])]
186 )]
187 )],
188 [PKG_CHECK_MODULES([LUA], [$with_lua_pc])])
189 AC_MSG_CHECKING([Lua version])
190 PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [V],,
191 [PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [major_version])])
192 AC_MSG_RESULT([$LUA_VERSION])
193 PKG_CHECK_VAR([LUA_INSTALL_CMOD], [$LUAPKGCONFIG], [INSTALL_CMOD],,
194 [LUA_INSTALL_CMOD=$libdir/lua/$LUA_VERSION])
195 PKG_CHECK_VAR([LUA_INSTALL_LMOD], [$LUAPKGCONFIG], [INSTALL_LMOD],,
196 [LUA_INSTALL_LMOD=$datadir/lua/$LUA_VERSION])
197 ])
198
199 # Optional test binaries
200 AC_ARG_ENABLE([tests],
201 [AC_HELP_STRING([--enable-tests], [build test/example binaries])],
202 [enable_tests=yes], [enable_tests=no])
203 AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
204
205 # LXC container path, where the containers are actually stored
206 # This is overridden by an entry in the file called LXCCONF
207 # (i.e. /etc/lxc/lxc.conf)
208 AC_ARG_WITH([config-path],
209 [AC_HELP_STRING(
210 [--with-config-path=dir],
211 [lxc configuration repository path]
212 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
213
214 # The path of the global lxc configuration file.
215 AC_ARG_WITH([global-conf],
216 [AC_HELP_STRING(
217 [--with-global-conf=dir],
218 [global lxc configuration file]
219 )], [], [with_global_conf=['${sysconfdir}/lxc/lxc.conf']])
220
221 AC_ARG_WITH([usernic-conf],
222 [AC_HELP_STRING(
223 [--with-usernic-conf],
224 [user network interface configuration file]
225 )], [], [with_usernic_conf=['${sysconfdir}/lxc/lxc-usernet']])
226
227 AC_ARG_WITH([usernic-db],
228 [AC_HELP_STRING(
229 [--with-usernic-db],
230 [lxc user nic database]
231 )], [], [with_usernic_db=['/run/lxc/nics']])
232
233 # Rootfs path, where the container mount structure is assembled
234 AC_ARG_WITH([rootfs-path],
235 [AC_HELP_STRING(
236 [--with-rootfs-path=dir],
237 [lxc rootfs mount point]
238 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
239
240 # Container log path. By default, use $lxcpath.
241 AC_MSG_CHECKING([Whether to place logfiles in container config path])
242 AC_ARG_ENABLE([configpath-log],
243 [AC_HELP_STRING([--enable-configpath-log], [use logfiles in config path])],
244 [use_configpath_logs=yes], [use_configpath_logs=no])
245 AC_MSG_RESULT([$use_configpath_logs])
246 AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$use_configpath_logs" = "yes"])
247
248 if test "$use_configpath_logs" = "yes"; then
249 default_log_path="${with_config_path}"
250 else
251 default_log_path="${localstatedir}/log/lxc"
252 fi
253
254 AC_ARG_WITH([log-path],
255 [AC_HELP_STRING(
256 [--with-log-path=dir],
257 [per container log path]
258 )], [], [with_log_path=['${default_log_path}']])
259
260 # Expand some useful variables
261 AS_AC_EXPAND(PREFIX, "$prefix")
262 AS_AC_EXPAND(LIBDIR, "$libdir")
263 AS_AC_EXPAND(BINDIR, "$bindir")
264 AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
265 AS_AC_EXPAND(INCLUDEDIR, "$includedir")
266 AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
267 AS_AC_EXPAND(LXC_DEFAULT_CONFIG, "$sysconfdir/lxc/default.conf")
268 AS_AC_EXPAND(DATADIR, "$datadir")
269 AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
270 AS_AC_EXPAND(DOCDIR, "$docdir")
271 AS_AC_EXPAND(LXC_DISTRO_CONF, "$distroconf")
272 AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
273 AS_AC_EXPAND(LXCPATH, "$with_config_path")
274 AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf")
275 AS_AC_EXPAND(LXC_USERNIC_CONF, "$with_usernic_conf")
276 AS_AC_EXPAND(LXC_USERNIC_DB, "$with_usernic_db")
277 AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
278 AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
279 AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
280 AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
281 AS_AC_EXPAND(LOGPATH, "$with_log_path")
282
283 # Check for some standard kernel headers
284 AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
285 [],
286 AC_MSG_ERROR([Please install the Linux kernel headers.]),
287 [#include <sys/socket.h>])
288
289 # Allow disabling libcap support
290 AC_ARG_ENABLE([capabilities],
291 [AC_HELP_STRING([--disable-capabilities], [disable kernel capabilities])],
292 [], [enable_capabilities=yes])
293
294 # Check for libcap support
295 if test "x$enable_capabilities" = "xyes"; then
296 AC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
297 AC_MSG_CHECKING([linux capabilities])
298 if test "x$caplib" = "xyes" ; then
299 CAP_LIBS="-lcap"
300 AC_MSG_RESULT([$CAP_LIBS])
301 else
302 AC_MSG_RESULT([no])
303 AC_MSG_ERROR([You are missing libcap support. If you really want to build without kernel capabilities, use --disable-capabilities])
304 fi
305 else
306 CAP_LIBS=""
307 fi
308 AC_SUBST([CAP_LIBS])
309
310 # Check for alternate C libraries
311 AC_MSG_CHECKING(for bionic libc)
312 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
313 [[#ifndef __ANDROID__
314 error: Not bionic!
315 #endif]])],
316 [is_bionic=yes],
317 [is_bionic=no])
318 if test "x$is_bionic" = "xyes"; then
319 AC_DEFINE([IS_BIONIC], 1, [bionic libc])
320 AC_MSG_RESULT([yes])
321 else
322 AC_MSG_RESULT([no])
323 fi
324 AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
325
326 # Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
327 AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
328
329 # Check for some headers
330 AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
331
332 # Check for some syscalls functions
333 AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr])
334
335 # Check for some functions
336 AC_CHECK_LIB(util, openpty)
337 AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent])
338 AC_CHECK_FUNCS([getline],
339 AM_CONDITIONAL(HAVE_GETLINE, true)
340 AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
341 AM_CONDITIONAL(HAVE_GETLINE, false))
342 AC_CHECK_FUNCS([fgetln],
343 AM_CONDITIONAL(HAVE_FGETLN, true)
344 AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
345 AM_CONDITIONAL(HAVE_FGETLN, false))
346
347 # Check for some libraries
348 AC_SEARCH_LIBS(sem_open, [rt pthread])
349 AC_SEARCH_LIBS(clock_gettime, [rt])
350
351 # Check for some standard binaries
352 AC_PROG_GCC_TRADITIONAL
353 AC_PROG_SED
354
355 if test "x$GCC" = "xyes"; then
356 CFLAGS="$CFLAGS -Wall -Werror"
357 fi
358
359 # Files requiring some variable expansion
360 AC_CONFIG_FILES([
361 Makefile
362 lxc.pc
363 lxc.spec
364 config/Makefile
365
366 doc/Makefile
367 doc/legacy/lxc-ls.sgml
368 doc/lxc-attach.sgml
369 doc/lxc-cgroup.sgml
370 doc/lxc-checkconfig.sgml
371 doc/lxc-checkpoint.sgml
372 doc/lxc-clone.sgml
373 doc/lxc-console.sgml
374 doc/lxc-create.sgml
375 doc/lxc-destroy.sgml
376 doc/lxc-device.sgml
377 doc/lxc-execute.sgml
378 doc/lxc-freeze.sgml
379 doc/lxc-info.sgml
380 doc/lxc-kill.sgml
381 doc/lxc-ls.sgml
382 doc/lxc-monitor.sgml
383 doc/lxc-netstat.sgml
384 doc/lxc-ps.sgml
385 doc/lxc-restart.sgml
386 doc/lxc-start-ephemeral.sgml
387 doc/lxc-start.sgml
388 doc/lxc-stop.sgml
389 doc/lxc-top.sgml
390 doc/lxc-unfreeze.sgml
391 doc/lxc-unshare.sgml
392 doc/lxc-version.sgml
393 doc/lxc-wait.sgml
394
395 doc/lxc.conf.sgml
396 doc/lxc.sgml
397 doc/common_options.sgml
398 doc/see_also.sgml
399
400 doc/rootfs/Makefile
401
402 doc/examples/Makefile
403 doc/examples/lxc-macvlan.conf
404 doc/examples/lxc-vlan.conf
405 doc/examples/lxc-no-netns.conf
406 doc/examples/lxc-empty-netns.conf
407 doc/examples/lxc-phys.conf
408 doc/examples/lxc-veth.conf
409 doc/examples/lxc-complex.conf
410
411 hooks/Makefile
412
413 templates/Makefile
414 templates/lxc-cirros
415 templates/lxc-debian
416 templates/lxc-ubuntu
417 templates/lxc-ubuntu-cloud
418 templates/lxc-opensuse
419 templates/lxc-busybox
420 templates/lxc-fedora
421 templates/lxc-oracle
422 templates/lxc-altlinux
423 templates/lxc-sshd
424 templates/lxc-archlinux
425 templates/lxc-alpine
426
427 src/Makefile
428 src/lxc/Makefile
429 src/lxc/lxc-ps
430 src/lxc/lxc-netstat
431 src/lxc/lxc-checkconfig
432 src/lxc/lxc-version
433 src/lxc/lxc-start-ephemeral
434 src/lxc/legacy/lxc-ls
435 src/lxc/lxc.functions
436
437 src/python-lxc/Makefile
438
439 src/lua-lxc/Makefile
440
441 src/tests/Makefile
442 ])
443 AC_CONFIG_COMMANDS([default],[[]],[[]])
444 AC_OUTPUT