]> git.proxmox.com Git - mirror_lxc.git/blob - configure.ac
Add distro config file /etc/lxc/lxc.conf
[mirror_lxc.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_INIT([lxc], [0.8.0])
5
6 AC_CONFIG_SRCDIR([configure.ac])
7 AC_CONFIG_AUX_DIR([config])
8 AM_CONFIG_HEADER([src/config.h])
9 AM_INIT_AUTOMAKE([-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 docbook2man installed) [default=auto]])],
63 [], [enable_doc=auto])
64
65 if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
66 AC_CHECK_PROG(have_docbook, [docbook2man], [yes], [no])
67
68 test "x$have_docbook" = "xno" -a "x$enable_doc" = "xyes" && \
69 AC_MSG_ERROR([docbook2man required by man request, but not found])
70 fi
71
72 AC_ARG_ENABLE([apparmor],
73 [AC_HELP_STRING([--enable-apparmor], [enable apparmor])],
74 [], [enable_apparmor=check])
75
76 if test "$enable_apparmor" = "check" ; then
77 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
78 fi
79
80 AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
81
82 AM_COND_IF([ENABLE_APPARMOR],
83 [AC_CHECK_HEADER([sys/apparmor.h],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
84 AC_CHECK_LIB([apparmor], [aa_change_profile],[],[AC_MSG_ERROR([You must install the AppArmor development package in order to compile lxc])])
85 AC_SUBST([APPARMOR_LIBS], [-lapparmor])])
86
87 AC_ARG_ENABLE([seccomp],
88 [AC_HELP_STRING([--enable-seccomp], [enable seccomp])],
89 [], [enable_seccomp=check])
90
91 if test "$enable_seccomp" = "check" ; then
92 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
93 fi
94
95 AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
96
97 AM_COND_IF([ENABLE_SECCOMP],
98 [AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
99 AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
100 AC_SUBST([SECCOMP_LIBS], [-lseccomp])])
101
102 AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$have_docbook" = "xyes"])
103
104 AC_ARG_ENABLE([examples],
105 [AC_HELP_STRING([--disable-examples], [do not install configuration examples])],
106 [], [enable_examples=yes])
107
108 AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
109
110 AC_ARG_ENABLE([python],
111 [AC_HELP_STRING([--enable-python], [enable python binding])],
112 [enable_python=yes], [enable_python=no])
113
114 AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
115
116 AM_COND_IF([ENABLE_PYTHON],
117 [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])])
118 AC_CHECK_HEADER([python$PYTHON_VERSION/Python.h],[],[AC_MSG_ERROR([You must install python3-dev])])
119 AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
120
121 AC_ARG_ENABLE([tests],
122 [AC_HELP_STRING([--enable-tests], [build test/example binaries])],
123 [enable_tests=yes], [enable_tests=no])
124
125 AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
126
127 AS_AC_EXPAND(PREFIX, $prefix)
128 AS_AC_EXPAND(LIBDIR, $libdir)
129 AS_AC_EXPAND(BINDIR, $bindir)
130 AS_AC_EXPAND(LIBEXECDIR, $libexecdir)
131 AS_AC_EXPAND(INCLUDEDIR, $includedir)
132 AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
133 AS_AC_EXPAND(DATADIR, $datadir)
134 AS_AC_EXPAND(LOCALSTATEDIR, $localstatedir)
135 AS_AC_EXPAND(DOCDIR, $docdir)
136
137 AC_ARG_WITH([config-path],
138 [AC_HELP_STRING(
139 [--with-config-path=dir],
140 [lxc configuration repository path]
141 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
142
143 AC_ARG_WITH([rootfs-path],
144 [AC_HELP_STRING(
145 [--with-rootfs-path=dir],
146 [lxc rootfs mount point]
147 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
148
149 AS_AC_EXPAND(LXC_CONFFILE, $conffile)
150 AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
151 AS_AC_EXPAND(LXCPATH, "${with_config_path}")
152 AS_AC_EXPAND(LXCROOTFSMOUNT, "${with_rootfs_path}")
153 AS_AC_EXPAND(LXCTEMPLATEDIR, ['${datadir}/lxc/templates'])
154
155 AC_SUBST(LXCINITDIR, ['${libexecdir}'])
156
157 AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
158 [],
159 AC_MSG_ERROR([Please install the Linux kernel headers.]),
160 [#include <sys/socket.h>
161 ])
162
163 AC_CHECK_HEADERS([sys/capability.h], [], AC_MSG_ERROR([Please install the libcap development files.]),
164 [#include <sys/types.h>
165 #include <sys/capability.h>])
166 AC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
167 AC_MSG_CHECKING([linux capabilities])
168 if test "x$caplib" = "xyes" ; then
169 CAP_LIBS="-lcap"
170 AC_MSG_RESULT([$CAP_LIBS])
171 else
172 AC_MSG_ERROR([not found])
173 fi
174 AC_SUBST([CAP_LIBS])
175
176 # Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
177 AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
178
179 AC_CHECK_HEADERS([sys/signalfd.h])
180
181 AC_PROG_GCC_TRADITIONAL
182 AC_PROG_SED
183
184 if test "x$GCC" = "xyes"; then
185 CFLAGS="$CFLAGS -Wall"
186 fi
187
188 AC_CONFIG_FILES([
189 Makefile
190 lxc.pc
191 lxc.spec
192 config/Makefile
193
194 doc/Makefile
195 doc/lxc-create.sgml
196 doc/lxc-destroy.sgml
197 doc/lxc-execute.sgml
198 doc/lxc-start.sgml
199 doc/lxc-checkpoint.sgml
200 doc/lxc-restart.sgml
201 doc/lxc-stop.sgml
202 doc/lxc-console.sgml
203 doc/lxc-freeze.sgml
204 doc/lxc-unfreeze.sgml
205 doc/lxc-monitor.sgml
206 doc/lxc-wait.sgml
207 doc/lxc-ls.sgml
208 doc/lxc-ps.sgml
209 doc/lxc-cgroup.sgml
210 doc/lxc-kill.sgml
211 doc/lxc-attach.sgml
212 doc/lxc.conf.sgml
213 doc/lxc.sgml
214 doc/common_options.sgml
215 doc/see_also.sgml
216
217 doc/rootfs/Makefile
218
219 doc/examples/Makefile
220 doc/examples/lxc-macvlan.conf
221 doc/examples/lxc-vlan.conf
222 doc/examples/lxc-no-netns.conf
223 doc/examples/lxc-empty-netns.conf
224 doc/examples/lxc-phys.conf
225 doc/examples/lxc-veth.conf
226 doc/examples/lxc-complex.conf
227
228 templates/Makefile
229 templates/lxc-lenny
230 templates/lxc-debian
231 templates/lxc-ubuntu
232 templates/lxc-ubuntu-cloud
233 templates/lxc-opensuse
234 templates/lxc-busybox
235 templates/lxc-fedora
236 templates/lxc-oracle
237 templates/lxc-altlinux
238 templates/lxc-sshd
239 templates/lxc-archlinux
240
241 src/Makefile
242 src/lxc/Makefile
243 src/lxc/lxc-ps
244 src/lxc/lxc-ls
245 src/lxc/lxc-netstat
246 src/lxc/lxc-checkconfig
247 src/lxc/lxc-setcap
248 src/lxc/lxc-setuid
249 src/lxc/lxc-version
250 src/lxc/lxc-create
251 src/lxc/lxc-clone
252 src/lxc/lxc-shutdown
253 src/lxc/lxc-start-ephemeral
254 src/lxc/lxc-destroy
255
256 src/python-lxc/Makefile
257
258 src/tests/Makefile
259
260 ])
261 AC_CONFIG_COMMANDS([default],[[]],[[]])
262 AC_OUTPUT
263
264 if test "x$SETCAP" = "xno"; then
265 AC_MSG_NOTICE([
266
267 Warning:
268 --------
269
270 The setcap binary was not found. This means the tools to set the
271 privilege for the lxc commands are not available, that's ok, but you
272 will need to run these commands as root or install libcap-2.
273
274 ])
275
276 else
277
278 AC_MSG_NOTICE([
279
280 Advice:
281 -------
282
283 If you wish to have a non root user to use the lxc tools,
284 you can add the needed capabilities to the tools by invoking
285 the 'lxc-setcap' script. To remove the capabilities, use
286 'lxc-setcap -d'.
287 ])
288
289 fi