]> git.proxmox.com Git - mirror_lxc.git/blame - configure.ac
Update for consistent indent
[mirror_lxc.git] / configure.ac
CommitLineData
5e97c3fc 1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4aa7ac35 4AC_INIT([lxc], [0.8.0])
5e97c3fc 5
f8dafdbb 6AC_CONFIG_SRCDIR([configure.ac])
5e97c3fc 7AC_CONFIG_AUX_DIR([config])
8AM_CONFIG_HEADER([src/config.h])
ad563aea 9AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability])
5e97c3fc 10AC_CANONICAL_HOST
5e97c3fc 11AM_PROG_CC_C_O
12AC_GNU_SOURCE
e90b6974 13AC_CHECK_PROG(SETCAP, setcap, yes, no, $PATH$PATH_SEPARATOR/sbin)
5c8f9bd8 14
6f75ba0b
DE
15AC_MSG_CHECKING([host distribution])
16AC_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]))
17if test "z$with_distro" = "z"; then
18 with_distro=`lsb_release -is`
be2e4e54 19fi
6f75ba0b
DE
20if 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")
33fi
34with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
35
36if test "z$with_distro" = "z"; then
37 with_distro="unknown"
38fi
39case $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 ;;
50esac
51AC_MSG_RESULT([$with_distro])
52
53AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu"])
be2e4e54 54
1c41ddcb
GK
55AC_ARG_ENABLE([rpath],
56 [AC_HELP_STRING([--disable-rpath], [do not set rpath in executables])],
57 [], [enable_rpath=yes])
58
59AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
60
5c8f9bd8 61AC_ARG_ENABLE([doc],
7822022c 62 [AC_HELP_STRING([--enable-doc], [make mans (require docbook2x-man installed) [default=auto]])],
5c8f9bd8
AN
63 [], [enable_doc=auto])
64
65if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
7822022c
SG
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)
5c8f9bd8
AN
86fi
87
e767dd55
SH
88AC_ARG_ENABLE([apparmor],
89 [AC_HELP_STRING([--enable-apparmor], [enable apparmor])],
90 [], [enable_apparmor=check])
91
92if test "$enable_apparmor" = "check" ; then
93 AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
94fi
95
96AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
97
e075f5d9
SH
98AM_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
e767dd55
SH
103AC_ARG_ENABLE([seccomp],
104 [AC_HELP_STRING([--enable-seccomp], [enable seccomp])],
105 [], [enable_seccomp=check])
106
107if test "$enable_seccomp" = "check" ; then
108 AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
109fi
110
111AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
112
8f2c3a70
SH
113AM_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
7822022c 118AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
5c8f9bd8 119
3fb0a9bb
AN
120AC_ARG_ENABLE([examples],
121 [AC_HELP_STRING([--disable-examples], [do not install configuration examples])],
122 [], [enable_examples=yes])
123
124AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
125
be2e4e54
SG
126AC_ARG_ENABLE([python],
127 [AC_HELP_STRING([--enable-python], [enable python binding])],
128 [enable_python=yes], [enable_python=no])
129
130AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
131
132AM_COND_IF([ENABLE_PYTHON],
133 [AM_PATH_PYTHON([3.2], [], [AC_MSG_ERROR([You must install python3])])
134 AC_CHECK_HEADER([python$PYTHON_VERSION/Python.h],[],[AC_MSG_ERROR([You must install python3-dev])])
135 AC_DEFINE_UNQUOTED([ENABLE_PYTHON], 1, [Python3 is available])])
136
525421c9
SG
137AC_ARG_ENABLE([tests],
138 [AC_HELP_STRING([--enable-tests], [build test/example binaries])],
139 [enable_tests=yes], [enable_tests=no])
140
141AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
142
b6345ba1
DL
143AS_AC_EXPAND(PREFIX, $prefix)
144AS_AC_EXPAND(LIBDIR, $libdir)
7ad641d5 145AS_AC_EXPAND(BINDIR, $bindir)
00ad19d4 146AS_AC_EXPAND(LIBEXECDIR, $libexecdir)
b6345ba1 147AS_AC_EXPAND(INCLUDEDIR, $includedir)
7ad641d5 148AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
3eae9733 149AS_AC_EXPAND(DATADIR, $datadir)
7ad641d5 150AS_AC_EXPAND(LOCALSTATEDIR, $localstatedir)
0f71d073 151AS_AC_EXPAND(DOCDIR, $docdir)
805415fc 152
aef4ebcf
AN
153AC_ARG_WITH([config-path],
154 [AC_HELP_STRING(
155 [--with-config-path=dir],
e892973e 156 [lxc configuration repository path]
1c41ddcb 157 )], [], [with_config_path=['${localstatedir}/lib/lxc']])
aef4ebcf 158
196db713
DL
159AC_ARG_WITH([rootfs-path],
160 [AC_HELP_STRING(
161 [--with-rootfs-path=dir],
162 [lxc rootfs mount point]
1c41ddcb 163 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
196db713 164
6f75ba0b 165AS_AC_EXPAND(LXC_CONFFILE, $conffile)
aef4ebcf 166AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
d595c68a
DE
167AS_AC_EXPAND(LXCPATH, "${with_config_path}")
168AS_AC_EXPAND(LXCROOTFSMOUNT, "${with_rootfs_path}")
169AS_AC_EXPAND(LXCTEMPLATEDIR, ['${datadir}/lxc/templates'])
d674be08 170
64c3c902 171AS_AC_EXPAND(LXCINITDIR, ['${libexecdir}'])
881450bb 172
910bb4fa 173AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
288063bd 174 [],
910bb4fa 175 AC_MSG_ERROR([Please install the Linux kernel headers.]),
288063bd 176 [#include <sys/socket.h>
90e0a869 177 ])
35f549fe 178
910bb4fa 179AC_CHECK_HEADERS([sys/capability.h], [], AC_MSG_ERROR([Please install the libcap development files.]),
ddceb1f9
DL
180[#include <sys/types.h>
181#include <sys/capability.h>])
0af683cf 182AC_CHECK_LIB(cap,cap_set_proc,caplib=yes,caplib=no)
183AC_MSG_CHECKING([linux capabilities])
184if test "x$caplib" = "xyes" ; then
185 CAP_LIBS="-lcap"
186 AC_MSG_RESULT([$CAP_LIBS])
187else
188 AC_MSG_ERROR([not found])
189fi
190AC_SUBST([CAP_LIBS])
35f549fe 191
656994bb
MH
192# Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
193AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
194
ff218c25 195AC_CHECK_HEADERS([sys/signalfd.h])
196
5e97c3fc 197AC_PROG_GCC_TRADITIONAL
95a717e9 198AC_PROG_SED
5e97c3fc 199
200if test "x$GCC" = "xyes"; then
ad563aea 201 CFLAGS="$CFLAGS -Wall -Werror"
5e97c3fc 202fi
203
204AC_CONFIG_FILES([
288063bd 205 Makefile
b6345ba1 206 lxc.pc
5e97c3fc 207 lxc.spec
288063bd 208 config/Makefile
d823d5b9 209
288063bd 210 doc/Makefile
d823d5b9 211 doc/lxc-create.sgml
212 doc/lxc-destroy.sgml
213 doc/lxc-execute.sgml
214 doc/lxc-start.sgml
396639d4
DL
215 doc/lxc-checkpoint.sgml
216 doc/lxc-restart.sgml
d823d5b9 217 doc/lxc-stop.sgml
b0a33c1e 218 doc/lxc-console.sgml
d823d5b9 219 doc/lxc-freeze.sgml
220 doc/lxc-unfreeze.sgml
221 doc/lxc-monitor.sgml
222 doc/lxc-wait.sgml
223 doc/lxc-ls.sgml
224 doc/lxc-ps.sgml
b0e505c9 225 doc/lxc-cgroup.sgml
e4b3fe58 226 doc/lxc-kill.sgml
49ee6cdc 227 doc/lxc-attach.sgml
8a67a2b2 228 doc/lxc.conf.sgml
8b8b04f8 229 doc/lxc.sgml
10fba81b 230 doc/common_options.sgml
99e4008c 231 doc/see_also.sgml
6a85cf91 232 doc/legacy/lxc-ls.sgml
d823d5b9 233
baf6671f
DL
234 doc/rootfs/Makefile
235
0f71d073
DL
236 doc/examples/Makefile
237 doc/examples/lxc-macvlan.conf
26c39028 238 doc/examples/lxc-vlan.conf
0f71d073
DL
239 doc/examples/lxc-no-netns.conf
240 doc/examples/lxc-empty-netns.conf
241 doc/examples/lxc-phys.conf
242 doc/examples/lxc-veth.conf
c553a9c2 243 doc/examples/lxc-complex.conf
0f71d073 244
c01d62f2 245 templates/Makefile
03d56dff 246 templates/lxc-lenny
c01d62f2 247 templates/lxc-debian
d1458ac8 248 templates/lxc-ubuntu-cloud
c840b37d 249 templates/lxc-opensuse
c01d62f2
DL
250 templates/lxc-busybox
251 templates/lxc-fedora
708f4a80 252 templates/lxc-oracle
262f4e48 253 templates/lxc-altlinux
c01d62f2 254 templates/lxc-sshd
f6267d90 255 templates/lxc-archlinux
c9844b87 256
288063bd 257 src/Makefile
5e97c3fc 258 src/lxc/Makefile
259 src/lxc/lxc-ps
9d0195cb 260 src/lxc/lxc-netstat
237315ff
DL
261 src/lxc/lxc-checkconfig
262 src/lxc/lxc-setcap
7a82e923 263 src/lxc/lxc-setuid
bcd952a1 264 src/lxc/lxc-version
ab2d32f8 265 src/lxc/lxc-create
be8b5972 266 src/lxc/lxc-clone
72be4f89 267 src/lxc/lxc-shutdown
5b12984b 268 src/lxc/lxc-start-ephemeral
ab2d32f8 269 src/lxc/lxc-destroy
6a85cf91 270 src/lxc/legacy/lxc-ls
c9844b87 271
be2e4e54
SG
272 src/python-lxc/Makefile
273
72d0e1cb
SG
274 src/tests/Makefile
275
5e97c3fc 276])
277AC_CONFIG_COMMANDS([default],[[]],[[]])
278AC_OUTPUT
805415fc 279
280if test "x$SETCAP" = "xno"; then
f8dafdbb 281 AC_MSG_NOTICE([
805415fc 282
283Warning:
284--------
285
87476557
FG
286The setcap binary was not found. This means the tools to set the
287privilege for the lxc commands are not available, that's ok, but you
288will need to run these commands as root or install libcap-2.
805415fc 289
290])
291
292else
293
f8dafdbb 294 AC_MSG_NOTICE([
805415fc 295
296Advice:
297-------
298
87476557 299If you wish to have a non root user to use the lxc tools,
237315ff
DL
300you can add the needed capabilities to the tools by invoking
301the 'lxc-setcap' script. To remove the capabilities, use
87476557 302'lxc-setcap -d'.
805415fc 303])
304
305fi