man pages: update the description for the virsh help command
[libvirt/aglitke.git] / configure.ac
blobd26bc68b29133e055700100b5df1f10c8aeac2ca
1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([libvirt], [0.8.6], [libvir-list@redhat.com], [], [http://libvirt.org])
4 AC_CONFIG_SRCDIR([src/libvirt.c])
5 AC_CONFIG_AUX_DIR([build-aux])
6 AC_CONFIG_HEADERS([config.h])
7 AC_CONFIG_MACRO_DIR([m4])
8 dnl Make automake keep quiet about wildcards & other GNUmake-isms
9 AM_INIT_AUTOMAKE([-Wno-portability])
11 # Use the silent-rules feature when possible.
12 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
13 AM_SILENT_RULES([yes])
15 AC_CANONICAL_HOST
17 LIBVIRT_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'`
18 LIBVIRT_MINOR_VERSION=`echo $VERSION | awk -F. '{print $2}'`
19 LIBVIRT_MICRO_VERSION=`echo $VERSION | awk -F. '{print $3}'`
20 LIBVIRT_VERSION=$LIBVIRT_MAJOR_VERSION.$LIBVIRT_MINOR_VERSION.$LIBVIRT_MICRO_VERSION$LIBVIRT_MICRO_VERSION_SUFFIX
21 LIBVIRT_VERSION_INFO=`expr $LIBVIRT_MAJOR_VERSION + $LIBVIRT_MINOR_VERSION`:$LIBVIRT_MICRO_VERSION:$LIBVIRT_MINOR_VERSION
22 LIBVIRT_VERSION_NUMBER=`expr $LIBVIRT_MAJOR_VERSION \* 1000000 + $LIBVIRT_MINOR_VERSION \* 1000 + $LIBVIRT_MICRO_VERSION`
24 AC_SUBST([LIBVIRT_MAJOR_VERSION])
25 AC_SUBST([LIBVIRT_MINOR_VERSION])
26 AC_SUBST([LIBVIRT_MICRO_VERSION])
27 AC_SUBST([LIBVIRT_VERSION])
28 AC_SUBST([LIBVIRT_VERSION_INFO])
29 AC_SUBST([LIBVIRT_VERSION_NUMBER])
31 dnl Required minimum versions of all libs we depend on
32 LIBXML_REQUIRED="2.6.0"
33 GNUTLS_REQUIRED="1.0.25"
34 AVAHI_REQUIRED="0.6.0"
35 POLKIT_REQUIRED="0.6"
36 PARTED_REQUIRED="1.8.0"
37 NETCF_REQUIRED="0.1.4"
38 UDEV_REQUIRED=145
39 PCIACCESS_REQUIRED=0.10.0
40 XMLRPC_REQUIRED=1.14.0
41 HAL_REQUIRED=0.5.0
42 DEVMAPPER_REQUIRED=1.0.0
43 LIBCURL_REQUIRED="7.18.0"
44 LIBPCAP_REQUIRED="1.0.0"
45 LIBNL_REQUIRED="1.1"
47 dnl Checks for C compiler.
48 AC_PROG_CC
49 AC_PROG_INSTALL
50 AC_PROG_CPP
52 gl_EARLY
53 gl_INIT
55 AM_PROG_CC_STDC
56 AC_TYPE_UID_T
58 dnl Make sure we have an ANSI compiler
59 AM_C_PROTOTYPES
60 test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant])
62 dnl Support building Win32 DLLs (must appear *before* AM_PROG_LIBTOOL)
63 AC_LIBTOOL_WIN32_DLL
65 AM_PROG_LIBTOOL
66 AM_PROG_CC_C_O
67 AM_PROG_LD
69 VERSION_SCRIPT_FLAGS=-Wl,--version-script=
70 `$LD --help 2>&1 | grep -- --version-script >/dev/null` || \
71     VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
73 LIBVIRT_COMPILE_WARNINGS([maximum])
75 AC_MSG_CHECKING([for CPUID instruction])
76 AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
77   [[
78     #include <stdint.h>
79   ]],
80   [[
81     uint32_t eax, ebx, ecx, edx;
82     asm volatile (
83         "cpuid"
84         : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
85         : "a" (eax));
86   ]]),
87   [have_cpuid=yes],
88   [have_cpuid=no])
89 if test "x$have_cpuid" = xyes; then
90   AC_DEFINE_UNQUOTED([HAVE_CPUID], 1, [whether CPUID instruction is supported])
92 AC_MSG_RESULT([$have_cpuid])
95 dnl Availability of various common functions (non-fatal if missing).
96 AC_CHECK_FUNCS_ONCE([cfmakeraw regexec sched_getaffinity getuid getgid \
97  posix_fallocate mmap])
99 dnl Availability of various not common threadsafe functions
100 AC_CHECK_FUNCS_ONCE([strerror_r getmntent_r getgrnam_r getpwuid_r])
102 dnl Availability of pthread functions (if missing, win32 threading is
103 dnl assumed).  Because of $LIB_PTHREAD, we cannot use AC_CHECK_FUNCS_ONCE.
104 dnl LIB_PTHREAD was set during gl_INIT by gnulib.
105 old_LIBS=$LIBS
106 LIBS="$LIBS $LIB_PTHREAD"
107 AC_CHECK_FUNCS([pthread_sigmask pthread_mutexattr_init])
108 LIBS=$old_libs
110 dnl Availability of various common headers (non-fatal if missing).
111 AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/syslimits.h sys/un.h \
112   sys/poll.h syslog.h mntent.h net/ethernet.h linux/magic.h \
113   sys/un.h sys/syscall.h])
115 AC_CHECK_LIB([intl],[gettext],[])
117 dnl Do we have rpcgen?
118 AC_PATH_PROG([RPCGEN], [rpcgen], [no])
119 AM_CONDITIONAL([HAVE_RPCGEN], [test "x$ac_cv_path_RPCGEN" != "xno"])
120 dnl Is this GLIBC's buggy rpcgen?
121 AM_CONDITIONAL([HAVE_GLIBC_RPCGEN],
122                [test "x$ac_cv_path_RPCGEN" != "xno" &&
123                 $ac_cv_path_RPCGEN -t </dev/null >/dev/null 2>&1])
125 dnl Miscellaneous external programs.
126 AC_PATH_PROG([XMLLINT], [xmllint], [/usr/bin/xmllint])
127 AC_PATH_PROG([XMLCATALOG], [xmlcatalog], [/usr/bin/xmlcatalog])
128 AC_PATH_PROG([XSLTPROC], [xsltproc], [/usr/bin/xsltproc])
129 AC_PATH_PROG([AUGPARSE], [augparse], [/usr/bin/augparse])
130 AC_PROG_MKDIR_P
132 dnl External programs that we can use if they are available.
133 dnl We will hard-code paths to these programs unless we cannot
134 dnl detect them, in which case we'll search for the program
135 dnl along the $PATH at runtime and fail if it's not there.
136 AC_PATH_PROG([DNSMASQ], [dnsmasq], [dnsmasq],
137         [/sbin:/usr/sbin:/usr/local/sbin:$PATH])
138 AC_PATH_PROG([BRCTL], [brctl], [brctl],
139         [/sbin:/usr/sbin:/usr/local/sbin:$PATH])
140 AC_PATH_PROG([UDEVADM], [udevadm], [],
141         [/sbin:/usr/sbin:/usr/local/sbin:$PATH])
142 AC_PATH_PROG([UDEVSETTLE], [udevsettle], [],
143         [/sbin:/usr/sbin:/usr/local/sbin:$PATH])
144 AC_PATH_PROG([MODPROBE], [modprobe], [],
145         [/sbin:/usr/sbin:/usr/local/sbin:$PATH])
147 AC_DEFINE_UNQUOTED([DNSMASQ],["$DNSMASQ"],
148         [Location or name of the dnsmasq program])
149 AC_DEFINE_UNQUOTED([BRCTL],["$BRCTL"],
150         [Location or name of the brctl program (see bridge-utils)])
151 if test -n "$UDEVADM"; then
152   AC_DEFINE_UNQUOTED([UDEVADM],["$UDEVADM"],
153         [Location or name of the udevadm program])
155 if test -n "$UDEVSETTLE"; then
156   AC_DEFINE_UNQUOTED([UDEVSETTLE],["$UDEVSETTLE"],
157         [Location or name of the udevsettle program])
159 if test -n "$MODPROBE"; then
160   AC_DEFINE_UNQUOTED([MODPROBE],["$MODPROBE"],
161         [Location or name of the modprobe program])
164 dnl Specific dir for HTML output ?
165 AC_ARG_WITH([html-dir], [AC_HELP_STRING([--with-html-dir=path],
166             [path to base html directory, default $datadir/doc/html])],
167             [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
169 AC_ARG_WITH([html-subdir], [AC_HELP_STRING([--with-html-subdir=path],
170             [directory used under html-dir, default $PACKAGE-$VERSION/html])],
171             [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
172             [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
173 AC_SUBST([HTML_DIR])
175 dnl Specific XML catalog file for validation of generated html
176 AC_ARG_WITH([xml-catalog-file],
177             [AC_HELP_STRING([--with-xml-catalog-file=path],
178                 [path to XML catalog file for validating
179                  generated html, default /etc/xml/catalog])],
180             [XML_CATALOG_FILE=$withval],
181             [XML_CATALOG_FILE='/etc/xml/catalog'])
182 AC_SUBST([XML_CATALOG_FILE])
184 dnl if --prefix is /usr, don't use /usr/var for localstatedir
185 dnl or /usr/etc for sysconfdir
186 dnl as this makes a lot of things break in testing situations
188 if test "$prefix" = "/usr" && test "$localstatedir" = '${prefix}/var' ; then
189     localstatedir='/var'
191 if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc' ; then
192     sysconfdir='/etc'
195 dnl Make some notes about which OS we're compiling for, as the lxc and qemu
196 dnl drivers require linux headers, while storage_mpath and nwfilter are also
197 dnl linux specific.  The "network" and storage_fs drivers are known to not
198 dnl work on MacOS X presently, so we also make a note if compiling for that
200 with_linux=no with_osx=no
201 case $host in
202   *-*-linux*) with_linux=yes ;;
203   *-*-darwin*) with_osx=yes ;;
204 esac
206 if test $with_linux = no; then
207     if test "x$with_lxc" != xyes
208     then
209         with_lxc=no
210     fi
211     if test "x$with_qemu" != xyes
212     then
213         with_qemu=no
214     fi
217 AM_CONDITIONAL([WITH_LINUX], [test "$with_linux" = "yes"])
219 dnl Allow to build without Xen, QEMU/KVM, test or remote driver
220 AC_ARG_WITH([xen],
221   AC_HELP_STRING([--with-xen], [add XEN support @<:@default=check@:>@]),[],[with_xen=check])
222 AC_ARG_WITH([xen-inotify],
223   AC_HELP_STRING([--with-xen-inotify], [add XEN inotify support @<:@default=check@:>@]),[],[with_xen_inotify=check])
224 AC_ARG_WITH([qemu],
225   AC_HELP_STRING([--with-qemu], [add QEMU/KVM support @<:@default=yes@:>@]),[],[with_qemu=yes])
226 AC_ARG_WITH([uml],
227   AC_HELP_STRING([--with-uml], [add UML support @<:@default=check@:>@]),[],[with_uml=check])
228 AC_ARG_WITH([openvz],
229   AC_HELP_STRING([--with-openvz], [add OpenVZ support @<:@default=yes@:>@]),[],[with_openvz=yes])
230 AC_ARG_WITH([libssh2],
231   AC_HELP_STRING([--with-libssh2=@<:@PFX@:>@], [libssh2 location @<:@default=/usr/local/lib@:>@]),[],[with_libssh2=yes])
232 AC_ARG_WITH([phyp],
233   AC_HELP_STRING([--with-phyp], [add PHYP support @<:@default=check@:>@]),[],[with_phyp=check])
234 AC_ARG_WITH([xenapi],
235   AC_HELP_STRING([--with-xenapi], [add XenAPI support @<:@default=check@:>@]),[],[with_xenapi=check])
236 AC_ARG_WITH([vbox],
237   AC_HELP_STRING([--with-vbox=@<:@PFX@:>@],
238                  [VirtualBox XPCOMC location @<:@default=yes@:>@]),[],
239                  [with_vbox=yes])
240 AC_ARG_WITH([lxc],
241   AC_HELP_STRING([--with-lxc], [add Linux Container support @<:@default=check@:>@]),[],[with_lxc=check])
242 AC_ARG_WITH([one],
243   AC_HELP_STRING([--with-one], [add ONE support @<:@default=check@:>@]),[],[with_one=check])
244 AC_ARG_WITH([esx],
245   AC_HELP_STRING([--with-esx], [add ESX support @<:@default=check@:>@]),[],[with_esx=check])
246 AC_ARG_WITH([test],
247   AC_HELP_STRING([--with-test], [add test driver support @<:@default=yes@:>@]),[],[with_test=yes])
248 AC_ARG_WITH([remote],
249   AC_HELP_STRING([--with-remote], [add remote driver support @<:@default=yes@:>@]),[],[with_remote=yes])
250 AC_ARG_WITH([libvirtd],
251   AC_HELP_STRING([--with-libvirtd], [add libvirtd support @<:@default=yes@:>@]),[],[with_libvirtd=yes])
254 dnl in case someone want to build static binaries
255 dnl STATIC_BINARIES="-static"
257 STATIC_BINARIES=
258 AC_SUBST([STATIC_BINARIES])
260 dnl --enable-debug=(yes|no)
261 AC_ARG_ENABLE([debug],
262               [AC_HELP_STRING([--enable-debug=@<:@no|yes@:>@],
263                              [enable debugging output @<:@default=yes@:>@])],[],[enable_debug=yes])
264 AM_CONDITIONAL([ENABLE_DEBUG], test x"$enable_debug" = x"yes")
265 if test x"$enable_debug" = x"yes"; then
266    AC_DEFINE([ENABLE_DEBUG], [], [whether debugging is enabled])
270 AC_MSG_CHECKING([where to write libvirtd PID file])
271 AC_ARG_WITH([remote-pid-file], [AC_HELP_STRING([--with-remote-pid-file=@<:@pidfile|none@:>@], [PID file for libvirtd])])
272 if test "x$with_remote_pid_file" = "x" ; then
273    REMOTE_PID_FILE="$localstatedir/run/libvirtd.pid"
274 elif test "x$with_remote_pid_file" = "xnone" ; then
275    REMOTE_PID_FILE=""
276 else
277    REMOTE_PID_FILE="$with_remote_pid_file"
279 AC_SUBST([REMOTE_PID_FILE])
280 AC_MSG_RESULT($REMOTE_PID_FILE)
283 dnl init script flavor
285 AC_MSG_CHECKING([for init script flavor])
286 AC_ARG_WITH([init-script],
287             [AC_HELP_STRING([--with-init-script=@<:@redhat|auto|none@:>@],
288                      [Style of init script to install @<:@default=auto@:>@])])
289 if test "x$with_init_script" = "x" || test "x$with_init_script" = "xauto"; then
290     if test "$cross_compiling" = yes || test ! -f /etc/redhat-release; then
291         with_init_script=none
292     else
293         with_init_script=redhat
294     fi
296 AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_RED_HAT], test x$with_init_script = xredhat)
297 AC_MSG_RESULT($with_init_script)
299 dnl RHEL-5 has a peculiar version of Xen, which requires some special casing
300 AC_ARG_WITH([rhel5-api],
301         [AC_HELP_STRING([--with-rhel5-api=@<:@ARG@:>@],
302                 [build for the RHEL-5 API @<:@default=no@:>@])])
303 if test x"$with_rhel5_api" = x"yes"; then
304    AC_DEFINE([WITH_RHEL5_API], [1], [whether building for the RHEL-5 API])
307 AC_PATH_PROG([IPTABLES_PATH], [iptables], /sbin/iptables, [/usr/sbin:$PATH])
308 AC_DEFINE_UNQUOTED([IPTABLES_PATH], "$IPTABLES_PATH", [path to iptables binary])
310 AC_PATH_PROG([EBTABLES_PATH], [ebtables], /sbin/ebtables, [/usr/sbin:$PATH])
311 AC_DEFINE_UNQUOTED([EBTABLES_PATH], "$EBTABLES_PATH", [path to ebtables binary])
314 if test "$with_openvz" = "yes"; then
315     AC_DEFINE_UNQUOTED([WITH_OPENVZ], 1, [whether OpenVZ driver is enabled])
317 AM_CONDITIONAL([WITH_OPENVZ], [test "$with_openvz" = "yes"])
321 dnl check for XDR
324 if test x"$with_remote" = x"yes" || test x"$with_libvirtd" = x"yes"; then
325     dnl Where are the XDR functions?
326     dnl If portablexdr is installed, prefer that.
327     dnl Otherwise try -lrpc (Cygwin) -lxdr (some MinGW), -lnsl (Solaris)
328     dnl or none (most Unix)
329     AC_CHECK_LIB([portablexdr],[xdrmem_create],[],[
330         AC_SEARCH_LIBS([xdrmem_create],[rpc xdr nsl],[],
331             [AC_MSG_ERROR([Cannot find a XDR library])])
332         ])
334     dnl check for cygwin's variation in xdr function names
335     AC_CHECK_FUNCS([xdr_u_int64_t],[],[],[#include <rpc/xdr.h>])
340 dnl check for VirtualBox XPCOMC location
343 vbox_xpcomc_dir=
345 if test "x$with_vbox" != "xyes" && test "x$with_vbox" != "xno"; then
346     # intentionally don't do any further checks here on the provided path
347     vbox_xpcomc_dir=$with_vbox
348     with_vbox=yes
351 AC_DEFINE_UNQUOTED([VBOX_XPCOMC_DIR], ["$vbox_xpcomc_dir"],
352                    [Location of directory containing VirtualBox XPCOMC library])
354 if test "x$with_vbox" = "xyes"; then
355     AC_SEARCH_LIBS([dlopen], [dl], [], [AC_MSG_ERROR([Unable to find dlopen()])])
356     case $ac_cv_search_dlopen in
357       no*) DLOPEN_LIBS= ;;
358       *) DLOPEN_LIBS=$ac_cv_search_dlopen ;;
359     esac
360     AC_SUBST([DLOPEN_LIBS])
361     AC_DEFINE_UNQUOTED([WITH_VBOX], 1, [whether VirtualBox driver is enabled])
363 AM_CONDITIONAL([WITH_VBOX], [test "$with_vbox" = "yes"])
365 if test "$with_libvirtd" = "no" ; then
366   with_qemu=no
368 if test "$with_qemu" = "yes" ; then
369     AC_DEFINE_UNQUOTED([WITH_QEMU], 1, [whether QEMU driver is enabled])
371 AM_CONDITIONAL([WITH_QEMU], [test "$with_qemu" = "yes"])
373 if test "$with_one" = "yes" ; then
374     AC_DEFINE_UNQUOTED([WITH_ONE],1,[whether ONE driver is enabled])
376 AM_CONDITIONAL([WITH_ONE],[test "$with_one" = "yes"])
378 if test "$with_test" = "yes" ; then
379     AC_DEFINE_UNQUOTED([WITH_TEST], 1, [whether Test driver is enabled])
381 AM_CONDITIONAL([WITH_TEST], [test "$with_test" = "yes"])
383 if test "$with_remote" = "yes" ; then
384     AC_DEFINE_UNQUOTED([WITH_REMOTE], 1, [whether Remote driver is enabled])
386 AM_CONDITIONAL([WITH_REMOTE], [test "$with_remote" = "yes"])
388 if test "$with_libvirtd" = "yes" ; then
389     AC_DEFINE_UNQUOTED([WITH_LIBVIRTD], 1, [whether libvirtd daemon is enabled])
391 AM_CONDITIONAL([WITH_LIBVIRTD], [test "$with_libvirtd" = "yes"])
394 old_LIBS="$LIBS"
395 old_CFLAGS="$CFLAGS"
396 LIBXENSERVER_LIBS=""
397 LIBXENSERVER_CFLAGS=""
398 dnl search for the XenServer library
399 if test "$with_xenapi" != "no" ; then
400     if test "$with_xenapi" != "yes" && test "$with_xenapi" != "check" ; then
401         LIBXENSERVER_CFLAGS="-I$with_xenapi/include"
402         LIBXENSERVER_LIBS="-L$with_xenapi"
403     fi
404     fail=0
405     CFLAGS="$CFLAGS $LIBXENSERVER_CFLAGS"
406     LIBS="$LIBS $LIBXENSERVER_LIBS"
407     AC_CHECK_LIB([xenserver], [xen_vm_start], [
408         with_xenapi=yes
409         LIBXENSERVER_LIBS="$LIBXENSERVER_LIBS -lxenserver"
410     ],[
411         if test "$with_xenapi" = "yes"; then
412             fail=1
413         fi
414             with_xenapi=no
415     ])
418 LIBS="$old_LIBS"
419 CFLAGS="$old_CFLAGS"
421 if test $fail = 1; then
422     AC_MSG_ERROR([You must install the XenServer Library to compile XenAPI driver with -lxenserver])
425 if test "$with_xenapi" = "yes"; then
426     AC_DEFINE_UNQUOTED([WITH_XENAPI], 1, [whether XenAPI driver is enabled])
429 AC_SUBST([LIBXENSERVER_CFLAGS])
430 AC_SUBST([LIBXENSERVER_LIBS])
433 old_LIBS="$LIBS"
434 old_CFLAGS="$CFLAGS"
435 XEN_LIBS=""
436 XEN_CFLAGS=""
437 dnl search for the Xen store library
438 if test "$with_xen" != "no" ; then
439     if test "$with_xen" != "yes" && test "$with_xen" != "check" ; then
440         XEN_CFLAGS="-I$with_xen/include"
441         XEN_LIBS="-L$with_xen/lib64 -L$with_xen/lib"
442     fi
443     fail=0
444     CFLAGS="$CFLAGS $XEN_CFLAGS"
445     LIBS="$LIBS $XEN_LIBS"
446     AC_CHECK_LIB([xenstore], [xs_read], [
447            with_xen=yes
448            XEN_LIBS="$XEN_LIBS -lxenstore"
449        ],[
450            if test "$with_xen" = "yes"; then
451                fail=1
452            fi
453            with_xen=no
454        ])
457 if test "$with_xen" != "no" ; then
458     AC_CHECK_HEADERS([xen/xen.h xen/version.h xen/dom0_ops.h],,[
459        if test "$with_xen" = "yes"; then
460            fail=1
461        fi
462        with_xen=no
463     ],
464 [#include <stdio.h>
465 #include <stdint.h>
469 if test "$with_xen" != "no" ; then
470     dnl Search for the location of <xen/{linux,sys}/privcmd.h>.
471     found=
472     AC_CHECK_HEADERS([xen/sys/privcmd.h xen/linux/privcmd.h], [found=yes; break;], [],
473        [#include <stdio.h>
474         #include <stdint.h>
475         #include <xen/xen.h>
476        ])
477     if test "x$found" != "xyes"; then
478         if test "$with_xen" = "yes"; then
479             fail=1
480         fi
481         with_xen=no
482     fi
485 LIBS="$old_LIBS"
486 CFLAGS="$old_CFLAGS"
488 if test $fail = 1; then
489     AC_MSG_ERROR([You must install the Xen development package to compile Xen driver with -lxenstore])
492 if test "$with_xen" = "yes"; then
493     AC_DEFINE_UNQUOTED([WITH_XEN], 1, [whether Xen driver is enabled])
496 AM_CONDITIONAL([WITH_XEN], [test "$with_xen" = "yes"])
497 AC_SUBST([XEN_CFLAGS])
498 AC_SUBST([XEN_LIBS])
501 dnl check for kernel headers required by xen_inotify
503 if test "$with_xen" != "yes"; then
504     with_xen_inotify=no
506 if test "$with_xen_inotify" != "no"; then
507     AC_CHECK_HEADER([sys/inotify.h], [
508         with_xen_inotify=yes
509     ], [
510         if test "$with_xen_inotify" = "check"; then
511             with_xen_inotify=no
512             AC_MSG_NOTICE([Header file <sys/inotify.h> is required for Xen Inotify support, disabling it])
513         else
514             AC_MSG_ERROR([Header file <sys/inotify.h> is required for Xen Inotify support!])
515         fi
516     0])
518 if test "$with_xen_inotify" = "yes"; then
519     AC_DEFINE_UNQUOTED([WITH_XEN_INOTIFY], 1,[whether Xen inotify sub-driver is enabled])
521 AM_CONDITIONAL([WITH_XEN_INOTIFY], [test "$with_xen_inotify" = "yes"])
524 dnl check for kvm headers
526 AC_CHECK_HEADERS([linux/kvm.h])
529 dnl check for sufficient headers for LXC
531 if test "$with_libvirtd" = "no" ; then
532   with_lxc=no
534 if test "$with_lxc" = "yes" || test "$with_lxc" = "check"; then
535     AC_TRY_LINK([#define _GNU_SOURCE
536         #include <sched.h>
537     ], [
538         unshare (1);
539     ], [
540         with_lxc=yes
541     ], [
542         if test "$with_lxc" = "check"; then
543             with_lxc=no
544             AC_MSG_NOTICE([Function unshare() not present in <sched.h> header but required for LXC driver, disabling it])
545         else
546             AC_MSG_ERROR([Function unshare() not present in <sched.h> header, but required for LXC driver])
547         fi
548     ])
550 if test "$with_lxc" = "yes" ; then
551     AC_DEFINE_UNQUOTED([WITH_LXC], 1, [whether LXC driver is enabled])
553 AM_CONDITIONAL([WITH_LXC], [test "$with_lxc" = "yes"])
556 dnl check for shell that understands <> redirection without truncation,
557 dnl needed by src/qemu/qemu_monitor_{text,json}.c.
559 if test "$with_qemu" = yes; then
560   lv_wrapper_shell=
561   AC_CACHE_CHECK([for shell that supports <> redirection],
562     [lv_cv_wrapper_shell],
563     [
564     # If cross-compiling, guess that /bin/sh is good enough except for
565     # Linux, where it might be dash 0.5.5 which is known broken; and on
566     # Linux, we have a good chance that /bin/bash will exist.
567     # If we guess wrong, a user can override the cache variable.
568     # Going through /bin/bash is a slight slowdown if /bin/sh works.
569     if test "$cross_compiling" = yes; then
570       case $host_os in
571         linux*) lv_cv_wrapper_shell=/bin/bash ;;
572         *) lv_cv_wrapper_shell=/bin/sh ;;
573       esac
574     else
575       for lv_cv_wrapper_shell in /bin/sh bash ksh zsh none; do
576         test $lv_cv_wrapper_shell = none &&
577           AC_MSG_ERROR([could not find decent shell])
578         echo a > conftest.a
579         ($lv_cv_wrapper_shell -c ': 1<>conftest.a') 2>/dev/null &&
580         case `cat conftest.a`.$lv_cv_wrapper_shell in
581           a./*) break;; dnl /bin/sh is good enough
582           a.*) dnl bash, ksh, and zsh all understand 'command', use that
583                dnl to determine the absolute path of the shell
584             lv_cv_wrapper_shell=`$lv_cv_wrapper_shell -c \
585               "command -v $lv_cv_wrapper_shell"`
586             case $lv_cv_wrapper_shell in
587               /*) break;;
588             esac
589             ;;
590         esac
591       done
592       rm -f conftest.a
593     fi
594   ])
595   if test "x$lv_cv_wrapper_shell" != x/bin/sh; then
596     lv_wrapper_shell=$lv_cv_wrapper_shell
597   fi
598   if test "x$lv_wrapper_shell" != x; then
599     AC_DEFINE_UNQUOTED([VIR_WRAPPER_SHELL], ["$lv_wrapper_shell"],
600       [Define to the absolute path of a shell that does not truncate on
601        <> redirection, if /bin/sh does not fit the bill])
602   fi
607 dnl check for kernel headers required by src/bridge.c
609 if test "$with_qemu" = "yes" || test "$with_lxc" = "yes" ; then
610   AC_CHECK_HEADERS([linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h],,
611                    AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt with QEMU or LXC support]))
615 dnl Need to test if pkg-config exists
616 PKG_PROG_PKG_CONFIG
618 dnl OpenNebula driver Compilation setting
621 if test "$with_libvirtd" = "no" ; then
622   with_one=no
624 XMLRPC_CFLAGS=
625 XMLRPC_LIBS=
626 if test "x$with_one" = "xyes" || test "x$with_one" = "xcheck"; then
627     PKG_CHECK_MODULES(XMLRPC, xmlrpc_client >= $XMLRPC_REQUIRED,
628       [with_one=yes], [
629       if test "x$with_one" = "xcheck" ; then
630           with_one=no
631       else
632           AC_MSG_ERROR(
633             [You must install XMLRPC-C >= $XMLRPC_REQUIRED to compile libvirt ONE driver])
634       fi
635     ])
636     if test "x$with_one" = "xyes" ; then
637         AC_DEFINE_UNQUOTED([HAVE_XMLRPC], 1,
638           [whether One is used to broadcast server presence])
639     fi
641 AM_CONDITIONAL([HAVE_XMLRPC], [test "x$with_one" = "xyes"])
642 AM_CONDITIONAL([WITH_ONE], [test "x$with_one" = "xyes"])
643 AC_SUBST([XMLRPC_CFLAGS])
644 AC_SUBST([XMLRPC_LIBS])
647 dnl ==========================================================================
648 dnl find libxml2 library, borrowed from xmlsec
649 dnl ==========================================================================
650 LIBXML_CONFIG="xml2-config"
651 LIBXML_CFLAGS=""
652 LIBXML_LIBS=""
653 LIBXML_FOUND="no"
655 AC_ARG_WITH([libxml], AC_HELP_STRING([--with-libxml=@<:@PFX@:>@], [libxml2 location]))
656 if test "x$with_libxml" = "xno" ; then
657     AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_REQUIRED)
658     AC_MSG_ERROR([libxml2 >= $LIBXML_REQUIRED is required for libvirt])
659 elif test "x$with_libxml" = "x" && test "x$PKG_CONFIG" != "x" ; then
660     PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_REQUIRED, [LIBXML_FOUND=yes], [LIBXML_FOUND=no])
662 if test "$LIBXML_FOUND" = "no" ; then
663     if test "x$with_libxml" != "x" ; then
664         LIBXML_CONFIG=$with_libxml/bin/$LIBXML_CONFIG
665     fi
666     AC_MSG_CHECKING(libxml2 $LIBXML_CONFIG >= $LIBXML_REQUIRED )
667     if ! $LIBXML_CONFIG --version > /dev/null 2>&1 ; then
668         AC_MSG_ERROR([Could not find libxml2 anywhere (see config.log for details).])
669     fi
670     vers=`$LIBXML_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
671     minvers=`echo $LIBXML_REQUIRED | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
672     if test "$vers" -ge "$minvers" ; then
673         LIBXML_LIBS="`$LIBXML_CONFIG --libs`"
674         LIBXML_CFLAGS="`$LIBXML_CONFIG --cflags`"
675         LIBXML_FOUND="yes"
676         AC_MSG_RESULT(yes)
677     else
678         AC_MSG_ERROR(
679           [You need at least libxml2 $LIBXML_REQUIRED for this version of libvirt])
680     fi
683 AC_SUBST([LIBXML_CFLAGS])
684 AC_SUBST([LIBXML_LIBS])
686 dnl xmlURI structure has query_raw?
687 old_cflags="$CFLAGS"
688 old_libs="$LIBS"
689 CFLAGS="$CFLAGS $LIBXML_CFLAGS"
690 LIBS="$LIBS $LIBXML_LIBS"
691 AC_CHECK_MEMBER([struct _xmlURI.query_raw],
692                 [AC_DEFINE([HAVE_XMLURI_QUERY_RAW], [], [Have query_raw field in libxml2 xmlURI structure])],,
693                 [#include <libxml/uri.h>])
694 CFLAGS="$old_cflags"
695 LIBS="$old_libs"
697 dnl GnuTLS library
698 GNUTLS_CFLAGS=
699 GNUTLS_LIBS=
700 GNUTLS_FOUND=no
701 if test -x "$PKG_CONFIG" ; then
702   PKG_CHECK_MODULES(GNUTLS, gnutls >= $GNUTLS_REQUIRED,
703      [GNUTLS_FOUND=yes], [GNUTLS_FOUND=no])
705 if test "$GNUTLS_FOUND" = "no"; then
706   fail=0
707   old_libs="$LIBS"
708   AC_CHECK_HEADER([gnutls/gnutls.h], [], [fail=1])
709   AC_CHECK_LIB([gnutls], [gnutls_handshake],[], [fail=1], [-lgcrypt])
711   test $fail = 1 &&
712     AC_MSG_ERROR([You must install the GnuTLS library in order to compile and run libvirt])
714   dnl Not all versions of gnutls include -lgcrypt, and so we add
715   dnl it explicitly for the calls to gcry_control/check_version
716   GNUTLS_LIBS="$LIBS -lgcrypt"
717   LIBS="$old_libs"
718 else
719   GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
722 AC_SUBST([GNUTLS_CFLAGS])
723 AC_SUBST([GNUTLS_LIBS])
725 dnl Old versions of GnuTLS uses types like 'gnutls_session' instead
726 dnl of 'gnutls_session_t'.  Try to detect this type if defined so
727 dnl that we can offer backwards compatibility.
728 old_cflags="$CFLAGS"
729 old_libs="$LIBS"
730 CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
731 LIBS="$LIBS $GNUTLS_LIBS"
732 AC_CHECK_TYPE([gnutls_session],
733         AC_DEFINE([GNUTLS_1_0_COMPAT],[],
734                 [enable GnuTLS 1.0 compatibility macros]),,
735         [#include <gnutls/gnutls.h>])
736 CFLAGS="$old_cflags"
737 LIBS="$old_libs"
740 dnl Cyrus SASL
741 AC_ARG_WITH([sasl],
742   AC_HELP_STRING([--with-sasl], [use cyrus SASL for authentication @<:@default=check@:>@]),
743   [],
744   [with_sasl=check])
746 SASL_CFLAGS=
747 SASL_LIBS=
748 if test "x$with_sasl" != "xno"; then
749   if test "x$with_sasl" != "xyes" && test "x$with_sasl" != "xcheck"; then
750     SASL_CFLAGS="-I$with_sasl"
751     SASL_LIBS="-L$with_sasl"
752   fi
753   fail=0
754   old_cflags="$CFLAGS"
755   old_libs="$LIBS"
756   CFLAGS="$CFLAGS $SASL_CFLAGS"
757   LIBS="$LIBS $SASL_LIBS"
758   AC_CHECK_HEADER([sasl/sasl.h],[],[
759     if test "x$with_sasl" = "xcheck" ; then
760         with_sasl=no
761     else
762         fail=1
763     fi])
764   if test "x$with_sasl" != "xno" ; then
765     AC_CHECK_LIB([sasl2], [sasl_client_init],[
766       SASL_LIBS="$SASL_LIBS -lsasl2"
767       with_sasl=yes
768     ],[
769       AC_CHECK_LIB([sasl], [sasl_client_init],[
770         SASL_LIBS="$SASL_LIBS -lsasl"
771         with_sasl=yes
772       ],[
773         if test "x$with_sasl" = "xcheck" ; then
774           with_sasl=no
775         else
776           fail=1
777         fi
778       ])
779     ])
780   fi
781   test $fail = 1 &&
782     AC_MSG_ERROR([You must install the Cyrus SASL development package in order to compile libvirt])
783   CFLAGS="$old_cflags"
784   LIBS="$old_libs"
785   if test "x$with_sasl" = "xyes" ; then
786     AC_DEFINE_UNQUOTED([HAVE_SASL], 1,
787       [whether Cyrus SASL is available for authentication])
788   fi
790 AM_CONDITIONAL([HAVE_SASL], [test "x$with_sasl" = "xyes"])
791 AC_SUBST([SASL_CFLAGS])
792 AC_SUBST([SASL_LIBS])
795 dnl YAJL JSON library http://lloyd.github.com/yajl/
796 AC_ARG_WITH([yajl],
797   AC_HELP_STRING([--with-yajl], [use YAJL for JSON parsing/formatting @<:@default=check@:>@]),
798   [],
799   [with_yajl=check])
801 YAJL_CFLAGS=
802 YAJL_LIBS=
803 if test "x$with_yajl" != "xno"; then
804   if test "x$with_yajl" != "xyes" && test "x$with_yajl" != "xcheck"; then
805     YAJL_CFLAGS="-I$with_yajl/include"
806     YAJL_LIBS="-L$with_yajl/lib"
807   fi
808   fail=0
809   old_cppflags="$CPPFLAGS"
810   old_libs="$LIBS"
811   CPPFLAGS="$CPPFLAGS $YAJL_CFLAGS"
812   LIBS="$LIBS $YAJL_LIBS"
813   AC_CHECK_HEADER([yajl/yajl_common.h],[],[
814     if test "x$with_yajl" = "xcheck" ; then
815         with_yajl=no
816     else
817         fail=1
818     fi])
819   if test "x$with_yajl" != "xno" ; then
820     AC_CHECK_LIB([yajl], [yajl_parse],[
821       YAJL_LIBS="$YAJL_LIBS -lyajl"
822       with_yajl=yes
823     ],[
824       if test "x$with_yajl" = "xcheck" ; then
825         with_yajl=no
826       else
827         fail=1
828       fi
829     ])
830   fi
831   test $fail = 1 &&
832     AC_MSG_ERROR([You must install the YAJL development package in order to compile libvirt])
833   CPPFLAGS="$old_cppflags"
834   LIBS="$old_libs"
835   if test "x$with_yajl" = "xyes" ; then
836     AC_DEFINE_UNQUOTED([HAVE_YAJL], 1,
837       [whether YAJL is available for JSON parsing/formatting])
838   fi
840 AM_CONDITIONAL([HAVE_YAJL], [test "x$with_yajl" = "xyes"])
841 AC_SUBST([YAJL_CFLAGS])
842 AC_SUBST([YAJL_LIBS])
845 dnl PolicyKit library
846 POLKIT_CFLAGS=
847 POLKIT_LIBS=
848 PKCHECK_PATH=
849 AC_ARG_WITH([polkit],
850   AC_HELP_STRING([--with-polkit], [use PolicyKit for UNIX socket access checks @<:@default=check@:>@]),
851   [],
852   [with_polkit=check])
854 with_polkit0=no
855 with_polkit1=no
856 if test "x$with_polkit" = "xyes" || test "x$with_polkit" = "xcheck"; then
857   dnl Check for new polkit first - just a binary
858   AC_PATH_PROG([PKCHECK_PATH],[pkcheck], [], [/usr/sbin:$PATH])
859   if test "x$PKCHECK_PATH" != "x" ; then
860     AC_DEFINE_UNQUOTED([PKCHECK_PATH],["$PKCHECK_PATH"],[Location of pkcheck program])
861     AC_DEFINE_UNQUOTED([HAVE_POLKIT], 1,
862         [use PolicyKit for UNIX socket access checks])
863     AC_DEFINE_UNQUOTED([HAVE_POLKIT1], 1,
864         [use PolicyKit for UNIX socket access checks])
865     with_polkit="yes"
866     with_polkit1="yes"
867   else
868     dnl Check for old polkit second - library + binary
869     PKG_CHECK_MODULES(POLKIT, polkit-dbus >= $POLKIT_REQUIRED,
870       [with_polkit=yes], [
871       if test "x$with_polkit" = "xcheck" ; then
872          with_polkit=no
873       else
874          AC_MSG_ERROR(
875            [You must install PolicyKit >= $POLKIT_REQUIRED to compile libvirt])
876       fi
877     ])
878     if test "x$with_polkit" = "xyes" ; then
879       AC_DEFINE_UNQUOTED([HAVE_POLKIT], 1,
880         [use PolicyKit for UNIX socket access checks])
881       AC_DEFINE_UNQUOTED([HAVE_POLKIT0], 1,
882         [use PolicyKit for UNIX socket access checks])
884       old_CFLAGS=$CFLAGS
885       old_LIBS=$LIBS
886       CFLAGS="$CFLAGS $POLKIT_CFLAGS"
887       LIBS="$LIBS $POLKIT_LIBS"
888       AC_CHECK_FUNCS([polkit_context_is_caller_authorized])
889       CFLAGS="$old_CFLAGS"
890       LIBS="$old_LIBS"
892       AC_PATH_PROG([POLKIT_AUTH], [polkit-auth])
893       if test "x$POLKIT_AUTH" != "x"; then
894         AC_DEFINE_UNQUOTED([POLKIT_AUTH],["$POLKIT_AUTH"],[Location of polkit-auth program])
895       fi
896       with_polkit0="yes"
897     fi
898   fi
900 AM_CONDITIONAL([HAVE_POLKIT], [test "x$with_polkit" = "xyes"])
901 AM_CONDITIONAL([HAVE_POLKIT0], [test "x$with_polkit0" = "xyes"])
902 AM_CONDITIONAL([HAVE_POLKIT1], [test "x$with_polkit1" = "xyes"])
903 AC_SUBST([POLKIT_CFLAGS])
904 AC_SUBST([POLKIT_LIBS])
906 dnl Avahi library
907 AC_ARG_WITH([avahi],
908   AC_HELP_STRING([--with-avahi], [use avahi to advertise remote daemon @<:@default=check@:>@]),
909   [],
910   [with_avahi=check])
912 AVAHI_CFLAGS=
913 AVAHI_LIBS=
914 if test "x$with_avahi" = "xyes" || test "x$with_avahi" = "xcheck"; then
915   PKG_CHECK_MODULES(AVAHI, avahi-client >= $AVAHI_REQUIRED,
916     [with_avahi=yes], [
917     if test "x$with_avahi" = "xcheck" ; then
918        with_avahi=no
919     else
920        AC_MSG_ERROR(
921          [You must install Avahi >= $AVAHI_REQUIRED to compile libvirt])
922     fi
923   ])
924   if test "x$with_avahi" = "xyes" ; then
925     AC_DEFINE_UNQUOTED([HAVE_AVAHI], 1,
926       [whether Avahi is used to broadcast server presense])
927   fi
929 AM_CONDITIONAL([HAVE_AVAHI], [test "x$with_avahi" = "xyes"])
930 AC_SUBST([AVAHI_CFLAGS])
931 AC_SUBST([AVAHI_LIBS])
933 dnl Audit library
934 AC_ARG_WITH([audit],
935   AC_HELP_STRING([--with-audit], [use audit library @<:@default=check@:>@]),
936   [],
937   [with_audit=check])
939 AUDIT_CFLAGS=
940 AUDIT_LIBS=
941 if test "$with_audit" != "no" ; then
942   old_cflags="$CFLAGS"
943   old_libs="$LIBS"
944   if test "$with_audit" != "check" && "$with_audit" != "yes" ; then
945     AUDIT_CFLAGS="-I$with_audit/include"
946     AUDIT_LIBS="-L$with_audit/lib"
947   fi
948   CFLAGS="$CFLAGS $AUDIT_CFLAGS"
949   LIBS="$LIBS $AUDIT_LIBS"
950   fail=0
951   AC_CHECK_HEADER([libaudit.h], [], [fail=1])
952   AC_CHECK_LIB([audit], [audit_is_enabled], [], [fail=1])
954   if test $fail = 1 ; then
955     if test "$with_audit" = "yes" ; then
956       AC_MSG_ERROR([You must install the Audit library in order to compile and run libvirt])
957     else
958       with_audit=no
959       AUDIT_CFLAGS=
960       AUDIT_LIBS=
961     fi
962   else
963     with_audit=yes
964   fi
966   if test "$with_audit" = "yes" ; then
967     AUDIT_LIBS="$AUDIT_LIBS -laudit"
968     AC_DEFINE_UNQUOTED([HAVE_AUDIT], 1, [whether libaudit is available])
969   fi
971   CFLAGS="$old_cflags"
972   LIBS="$old_libs"
974 AM_CONDITIONAL([HAVE_AUDIT], [test "$with_audit" = "yes"])
975 AC_SUBST([AUDIT_CFLAGS])
976 AC_SUBST([AUDIT_LIBS])
979 dnl SELinux
980 AC_ARG_WITH([selinux],
981   AC_HELP_STRING([--with-selinux], [use SELinux to manage security @<:@default=check@:>@]),
982   [],
983   [with_selinux=check])
985 SELINUX_CFLAGS=
986 SELINUX_LIBS=
987 if test "$with_selinux" != "no"; then
988   old_cflags="$CFLAGS"
989   old_libs="$LIBS"
990   if test "$with_selinux" = "check"; then
991     AC_CHECK_HEADER([selinux/selinux.h],[],[with_selinux=no])
992     AC_CHECK_LIB([selinux], [fgetfilecon],[],[with_selinux=no])
993     if test "$with_selinux" != "no"; then
994       with_selinux="yes"
995     fi
996   else
997     fail=0
998     AC_CHECK_HEADER([selinux/selinux.h],[],[fail=1])
999     AC_CHECK_LIB([selinux], [fgetfilecon],[],[fail=1])
1000     test $fail = 1 &&
1001       AC_MSG_ERROR([You must install the libselinux development package in order to compile libvirt with basic SELinux support])
1002   fi
1003   CFLAGS="$old_cflags"
1004   LIBS="$old_libs"
1006 if test "$with_selinux" = "yes"; then
1007   SELINUX_LIBS="-lselinux"
1008   AC_DEFINE_UNQUOTED([HAVE_SELINUX], 1, [whether basic SELinux functionality is available])
1010 AM_CONDITIONAL([HAVE_SELINUX], [test "$with_selinux" != "no"])
1011 AC_SUBST([SELINUX_CFLAGS])
1012 AC_SUBST([SELINUX_LIBS])
1015 AC_ARG_WITH([secdriver-selinux],
1016   AC_HELP_STRING([--with-secdriver-selinux], [use SELinux security driver @<:@default=check@:>@]),
1017   [],
1018   [with_secdriver_selinux=check])
1020 if test "$with_selinux" != "yes" ; then
1021   if test "$with_secdriver_selinux" = "check" ; then
1022     with_secdriver_selinux=no
1023   elif test "$with_secdriver_selinux" = "yes"; then
1024         AC_MSG_ERROR([You must install the libselinux development package and enable SELinux with the --with-selinux=yes in order to compile libvirt --with-secdriver-selinux=yes])
1025   fi
1026 else
1027   old_cflags="$CFLAGS"
1028   old_libs="$LIBS"
1029   CFLAGS="$CFLAGS $SELINUX_CFLAGS"
1030   LIBS="$CFLAGS $SELINUX_LIBS"
1032   fail=0
1033   AC_CHECK_FUNC([selinux_virtual_domain_context_path], [], [fail=1])
1034   AC_CHECK_FUNC([selinux_virtual_image_context_path], [], [fail=1])
1035   CFLAGS="$old_cflags"
1036   LIBS="$old_libs"
1038   if test "$fail" = "1" ; then
1039     if test "$with_secdriver_selinux" = "check" ; then
1040       with_secdriver_selinux=no
1041     else
1042       AC_MSG_ERROR([You must install libselinux development package >= 2.0.82 in order to compile libvirt --with-secdriver-selinux=yes])
1043     fi
1044   else
1045     with_secdriver_selinux=yes
1046     AC_DEFINE_UNQUOTED([WITH_SECDRIVER_SELINUX], 1, [whether SELinux security driver is available])
1047   fi
1049 AM_CONDITIONAL([WITH_SECDRIVER_SELINUX], [test "$with_secdriver_selinux" != "no"])
1052 dnl AppArmor
1053 AC_ARG_WITH([apparmor],
1054   AC_HELP_STRING([--with-apparmor], [use AppArmor to manage security @<:@default=check@:>@]),
1055   [],
1056   [with_apparmor=check])
1058 APPARMOR_CFLAGS=
1059 APPARMOR_LIBS=
1060 if test "$with_apparmor" != "no"; then
1061   old_cflags="$CFLAGS"
1062   old_libs="$LIBS"
1063   if test "$with_apparmor" = "check"; then
1064     AC_CHECK_HEADER([sys/apparmor.h],[],[with_apparmor=no])
1065     AC_CHECK_LIB([apparmor], [aa_change_profile],[],[with_apparmor=no])
1066     AC_CHECK_LIB([apparmor], [aa_change_hat],[],[with_apparmor=no])
1067     if test "$with_apparmor" != "no"; then
1068       with_apparmor="yes"
1069     fi
1070   else
1071     fail=0
1072     AC_CHECK_HEADER([sys/apparmor.h],[],[fail=1])
1073     AC_CHECK_LIB([apparmor], [aa_change_profile],[],[fail=1])
1074     AC_CHECK_LIB([apparmor], [aa_change_hat],[],[fail=1])
1075     test $fail = 1 &&
1076       AC_MSG_ERROR([You must install the AppArmor development package in order to compile libvirt])
1077   fi
1078   CFLAGS="$old_cflags"
1079   LIBS="$old_libs"
1081 if test "$with_apparmor" = "yes"; then
1082   APPARMOR_LIBS="-lapparmor"
1083   AC_DEFINE_UNQUOTED([HAVE_APPARMOR], 1, [whether AppArmor is available for security])
1084   AC_DEFINE_UNQUOTED([APPARMOR_DIR], "/etc/apparmor.d", [path to apparmor directory])
1085   AC_DEFINE_UNQUOTED([APPARMOR_PROFILES_PATH], "/sys/kernel/security/apparmor/profiles", [path to kernel profiles])
1087 AM_CONDITIONAL([HAVE_APPARMOR], [test "$with_apparmor" != "no"])
1088 AC_SUBST([APPARMOR_CFLAGS])
1089 AC_SUBST([APPARMOR_LIBS])
1092 AC_ARG_WITH([secdriver-apparmor],
1093   AC_HELP_STRING([--with-secdriver-apparmor], [use AppArmor security driver @<:@default=check@:>@]),
1094   [],
1095   [with_secdriver_apparmor=check])
1097 if test "$with_apparmor" != "yes" ; then
1098   if test "$with_secdriver_apparmor" = "check" ; then
1099     with_secdriver_apparmor=no
1100   else
1101     AC_MSG_ERROR([You must install the AppArmor development package in order to compile libvirt])
1102   fi
1103 else
1104   old_cflags="$CFLAGS"
1105   old_libs="$LIBS"
1106   CFLAGS="$CFLAGS $APPARMOR_CFLAGS"
1107   LIBS="$CFLAGS $APPARMOR_LIBS"
1109   fail=0
1110   AC_CHECK_FUNC([change_hat], [], [fail=1])
1111   AC_CHECK_FUNC([aa_change_profile], [], [fail=1])
1112   CFLAGS="$old_cflags"
1113   LIBS="$old_libs"
1115   if test "$fail" = "1" ; then
1116     if test "$with_secdriver_apparmor" = "check" ; then
1117       with_secdriver_apparmor=no
1118     else
1119       AC_MSG_ERROR([You must install the AppArmor development package in order to compile libvirt])
1120     fi
1121   else
1122     with_secdriver_apparmor=yes
1123     AC_DEFINE_UNQUOTED([WITH_SECDRIVER_APPARMOR], 1, [whether AppArmor security driver is available])
1124   fi
1126 AM_CONDITIONAL([WITH_SECDRIVER_APPARMOR], [test "$with_secdriver_apparmor" != "no"])
1129 dnl DTrace static probes
1130 AC_ARG_WITH([dtrace],
1131   AC_HELP_STRING([--with-dtrace], [use dtrace for static probing @<:@default=check@:>@]),
1132   [],
1133   [with_dtrace=check])
1135 if test "$with_dtrace" != "no" ; then
1136   AC_PATH_PROG([DTRACE], [dtrace], [], [/bin:/usr/bin])
1137   if test -z "$DTRACE" ; then
1138     if test "$with_dtrace" = "check"; then
1139       with_dtrace=no
1140     else
1141       AC_MSG_ERROR([You must install the 'dtrace' binary to enable libvirt static probes])
1142     fi
1143   else
1144     with_dtrace=yes
1145   fi
1146   if test "$with_dtrace" = "yes"; then
1147     AC_DEFINE_UNQUOTED([WITH_DTRACE], 1, [whether DTrace static probes are available])
1148   fi
1150 AM_CONDITIONAL([WITH_DTRACE], [test "$with_dtrace" != "no"])
1153 dnl NUMA lib
1154 AC_ARG_WITH([numactl],
1155   AC_HELP_STRING([--with-numactl], [use numactl for host topology info @<:@default=check@:>@]),
1156   [],
1157   [with_numactl=check])
1159 NUMACTL_CFLAGS=
1160 NUMACTL_LIBS=
1161 if test "$with_qemu" = "yes" && test "$with_numactl" != "no"; then
1162   old_cflags="$CFLAGS"
1163   old_libs="$LIBS"
1164   if test "$with_numactl" = "check"; then
1165     AC_CHECK_HEADER([numa.h],[],[with_numactl=no])
1166     AC_CHECK_LIB([numa], [numa_available],[],[with_numactl=no])
1167     if test "$with_numactl" != "no"; then
1168       with_numactl="yes"
1169     fi
1170   else
1171     fail=0
1172     AC_CHECK_HEADER([numa.h],[],[fail=1])
1173     AC_CHECK_LIB([numa], [numa_available],[],[fail=1])
1174     test $fail = 1 &&
1175       AC_MSG_ERROR([You must install the numactl development package in order to compile and run libvirt])
1176   fi
1177   CFLAGS="$old_cflags"
1178   LIBS="$old_libs"
1180 if test "$with_numactl" = "yes"; then
1181   NUMACTL_LIBS="-lnuma"
1182   AC_DEFINE_UNQUOTED([HAVE_NUMACTL], 1, [whether numactl is available for topology info])
1184 AM_CONDITIONAL([HAVE_NUMACTL], [test "$with_numactl" != "no"])
1185 AC_SUBST([NUMACTL_CFLAGS])
1186 AC_SUBST([NUMACTL_LIBS])
1189 dnl pcap lib
1190 LIBPCAP_CONFIG="pcap-config"
1191 LIBPCAP_CFLAGS=""
1192 LIBPCAP_LIBS=""
1193 LIBPCAP_FOUND="no"
1195 AC_ARG_WITH([libpcap], AC_HELP_STRING([--with-libpcap=@<:@PFX@:>@], [libpcap location]))
1196 if test "$with_qemu" = "yes"; then
1197     if test "x$with_libpcap" != "xno" ; then
1198         if test "x$with_libpcap" != "x" ; then
1199             LIBPCAP_CONFIG=$with_libpcap/bin/$LIBPCAP_CONFIG
1200         fi
1201         AC_MSG_CHECKING(libpcap $LIBPCAP_CONFIG >= $LIBPCAP_REQUIRED )
1202         if ! $LIBPCAP_CONFIG --libs > /dev/null 2>&1 ; then
1203             AC_MSG_RESULT(no)
1204         else
1205             LIBPCAP_LIBS="`$LIBPCAP_CONFIG --libs`"
1206             LIBPCAP_CFLAGS="`$LIBPCAP_CONFIG --cflags`"
1207             LIBPCAP_FOUND="yes"
1208             AC_MSG_RESULT(yes)
1209         fi
1210     fi
1213 if test "x$LIBPCAP_FOUND" = "xyes"; then
1214   AC_DEFINE_UNQUOTED([HAVE_LIBPCAP], 1, [whether libpcap can be used])
1217 AC_SUBST([LIBPCAP_CFLAGS])
1218 AC_SUBST([LIBPCAP_LIBS])
1223 dnl Checks for the UML driver
1226 if test "$with_libvirtd" = "no" ; then
1227   with_uml=no
1229 if test "$with_uml" = "yes" || test "$with_uml" = "check"; then
1230     AC_CHECK_HEADER([sys/inotify.h], [
1231         with_uml=yes
1232     ], [
1233         if test "$with_uml" = "check"; then
1234             with_uml=no
1235             AC_MSG_NOTICE([<sys/inotify.h> is required for the UML driver, disabling it])
1236         else
1237             AC_MSG_ERROR([The <sys/inotify.h> is required for the UML driver. Upgrade your libc6.])
1238         fi
1239     ])
1241 if test "$with_uml" = "yes" ; then
1242     AC_DEFINE_UNQUOTED([WITH_UML], 1, [whether UML driver is enabled])
1244 AM_CONDITIONAL([WITH_UML], [test "$with_uml" = "yes"])
1249 dnl libssh checks
1252 if test "$with_libssh2" != "yes" && test "$with_libssh2" != "no"; then
1253                 libssh2_path="$with_libssh2"
1254 elif test "$with_libssh2" = "yes"; then
1255                 libssh2_path="/usr/local/lib/"
1256 elif test "$with_libssh2" = "no"; then
1257                 with_phyp="no";
1260 if test "$with_phyp" = "check"; then
1261     AC_CHECK_LIB([ssh2],[libssh2_session_startup],[
1262         LIBSSH2_LIBS="$LIBSSH2_LIBS -lssh2 -L$libssh2_path"
1263         AC_SUBST([LIBSSH2_LIBS])
1264     ],[
1265         with_phyp="no"
1266         with_libssh2="no";
1267     ],[])
1269     if test "$with_phyp" != "no"; then
1270         AC_CHECK_HEADERS([libssh2.h],[
1271             with_phyp="yes"
1272             LIBSSH2_CFLAGS="-I/usr/local/include"
1273             AC_SUBST([LIBSSH2_CFLAGS])
1274         ],[
1275             with_phyp="no"
1276             with_libssh2="no";
1277         ],[
1278         ])
1279     fi
1281     if test "$with_phyp" != "no"; then
1282         saved_libs="$LIBS"
1283         LIBS="$LIBS -L$libssh2_path -lssh2"
1284         AC_TRY_LINK([#include <libssh2.h>], [
1285             (void) libssh2_session_block_directions(NULL);
1286         ], [
1287             AC_DEFINE_UNQUOTED([WITH_PHYP], 1, [whether IBM HMC / IVM driver is enabled])
1288         ], [
1289             with_phyp=no
1290             AC_MSG_NOTICE([Function libssh2_session_block_directions() not present in  your version of libssh2 but required for Phyp driver, disabling it])
1291         ])
1292         LIBS="$saved_libs"
1293     fi
1294 elif test "$with_phyp" = "yes"; then
1295   AC_CHECK_LIB([ssh2],[libssh2_session_startup],[
1296         LIBSSH2_LIBS="$LIBSSH2_LIBS -lssh2 -L$libssh2_path"
1297         AC_SUBST([LIBSSH2_LIBS])],[
1298         AC_MSG_ERROR([You must install the libssh2 to compile Phyp driver.])
1299                                 ])
1301   AC_CHECK_HEADERS([libssh2.h],[
1302         LIBSSH2_CFLAGS="-I/usr/local/include"
1303         AC_SUBST([LIBSSH2_CFLAGS])],[
1304         AC_MSG_ERROR([Cannot find libssh2 headers. Is libssh2 installed ?])
1305                                 ],[])
1307   saved_libs="$LIBS"
1308   LIBS="$LIBS -lssh2"
1309   AC_TRY_LINK([#include <libssh2.h>], [
1310   (void) libssh2_session_block_directions(NULL);
1311   ], [], [
1312   AC_MSG_ERROR([Function libssh2_session_block_directions() not present in your version of libssh2. Need >= 1.0])
1313   ])
1314   LIBS="$saved_libs"
1316   AC_DEFINE_UNQUOTED([WITH_PHYP], 1,
1317         [whether IBM HMC / IVM driver is enabled])
1319 AM_CONDITIONAL([WITH_PHYP],[test "$with_phyp" = "yes"])
1321 dnl libcap-ng
1322 AC_ARG_WITH([capng],
1323   AC_HELP_STRING([--with-capng], [use libcap-ng to reduce libvirtd privileges @<:@default=check@:>@]),
1324   [],
1325   [with_capng=check])
1328 dnl This check looks for 'capng_updatev' since that was
1329 dnl introduced in 0.4.0 release which need as minimum
1331 CAPNG_CFLAGS=
1332 CAPNG_LIBS=
1333 if test "$with_qemu" = "yes" && test "$with_capng" != "no"; then
1334   old_cflags="$CFLAGS"
1335   old_libs="$LIBS"
1336   if test "$with_capng" = "check"; then
1337     AC_CHECK_HEADER([cap-ng.h],[],[with_capng=no])
1338     AC_CHECK_LIB([cap-ng], [capng_updatev],[],[with_capng=no])
1339     if test "$with_capng" != "no"; then
1340       with_capng="yes"
1341     fi
1342   else
1343     fail=0
1344     AC_CHECK_HEADER([cap-ng.h],[],[fail=1])
1345     AC_CHECK_LIB([cap-ng], [capng_updatev],[],[fail=1])
1346     test $fail = 1 &&
1347       AC_MSG_ERROR([You must install the capng >= 0.4.0 development package in order to compile and run libvirt])
1348   fi
1349   CFLAGS="$old_cflags"
1350   LIBS="$old_libs"
1352 if test "$with_capng" = "yes"; then
1353   CAPNG_LIBS="-lcap-ng"
1354   AC_DEFINE_UNQUOTED([HAVE_CAPNG], 1, [whether capng is available for privilege reduction])
1356 AM_CONDITIONAL([HAVE_CAPNG], [test "$with_capng" != "no"])
1357 AC_SUBST([CAPNG_CFLAGS])
1358 AC_SUBST([CAPNG_LIBS])
1362 dnl virsh libraries
1363 AC_CHECK_HEADERS([readline/readline.h])
1365 # Check for readline.
1366 AC_CHECK_LIB([readline], [readline],
1367         [lv_use_readline=yes; VIRSH_LIBS="$VIRSH_LIBS -lreadline"],
1368         [lv_use_readline=no])
1370 # If the above test failed, it may simply be that -lreadline requires
1371 # some termcap-related code, e.g., from one of the following libraries.
1372 # See if adding one of them to LIBS helps.
1373 if test $lv_use_readline = no; then
1374     lv_saved_libs=$LIBS
1375     LIBS=
1376     AC_SEARCH_LIBS([tgetent], [ncurses curses termcap termlib])
1377     case $LIBS in
1378       no*) ;;  # handle "no" and "none required"
1379       *) # anything else is a -lLIBRARY
1380         # Now, check for -lreadline again, also using $LIBS.
1381         # Note: this time we use a different function, so that
1382         # we don't get a cached "no" result.
1383         AC_CHECK_LIB([readline], [rl_initialize],
1384                 [lv_use_readline=yes
1385                  VIRSH_LIBS="$VIRSH_LIBS -lreadline $LIBS"],,
1386                 [$LIBS])
1387         ;;
1388     esac
1389     test $lv_use_readline = no &&
1390         AC_MSG_WARN([readline library not found])
1391     LIBS=$lv_saved_libs
1394 if test $lv_use_readline = yes; then
1395     AC_DEFINE_UNQUOTED([USE_READLINE], 1,
1396                        [whether virsh can use readline])
1397     READLINE_CFLAGS=-DUSE_READLINE
1398 else
1399     READLINE_CFLAGS=
1401 AC_SUBST([READLINE_CFLAGS])
1402 AC_SUBST([VIRSH_LIBS])
1404 dnl check if the network driver should be compiled
1406 AC_ARG_WITH([network],
1407   AC_HELP_STRING([--with-network], [with virtual network driver @<:@default=yes@:>@]),[],[with_network=yes])
1409 dnl there's no use compiling the network driver without the libvirt
1410 dnl daemon, nor compiling it for MacOS X, where it breaks the compile
1412 if test "$with_libvirtd" = "no" || test "$with_osx" = "yes"; then
1413   with_network=no
1416 if test "$with_network" = "yes" ; then
1417   AC_DEFINE_UNQUOTED([WITH_NETWORK], 1, [whether network driver is enabled])
1419 AM_CONDITIONAL([WITH_NETWORK], [test "$with_network" = "yes"])
1421 with_bridge=no
1422 if test "$with_qemu:$with_lxc:$with_network" != "no:no:no"; then
1423     with_bridge=yes
1424     AC_DEFINE_UNQUOTED([WITH_BRIDGE], 1, [whether bridge code is needed])
1426 AM_CONDITIONAL([WITH_BRIDGE], [test "$with_bridge" = "yes"])
1428 dnl netcf library
1429 AC_ARG_WITH([netcf],
1430   AC_HELP_STRING([--with-netcf], [libnetcf support to configure physical host network interfaces @<:@default=check@:>@]),
1431 [], [with_netcf=check])
1433 NETCF_CFLAGS=
1434 NETCF_LIBS=
1435 if test "$with_netcf" = "yes" || test "$with_netcf" = "check"; then
1436   PKG_CHECK_MODULES(NETCF, netcf >= $NETCF_REQUIRED,
1437     [with_netcf=yes], [
1438     if test "$with_netcf" = "check" ; then
1439        with_netcf=no
1440     else
1441        AC_MSG_ERROR(
1442          [You must install libnetcf >= $NETCF_REQUIRED to compile libvirt])
1443     fi
1444   ])
1445   if test "$with_netcf" = "yes" ; then
1446     AC_DEFINE_UNQUOTED([WITH_NETCF], 1,
1447       [whether libnetcf is available to configure physical host network interfaces])
1448   fi
1450 AM_CONDITIONAL([WITH_NETCF], [test "$with_netcf" = "yes"])
1451 AC_SUBST([NETCF_CFLAGS])
1452 AC_SUBST([NETCF_LIBS])
1455 with_secrets=yes
1456 if test "$with_libvirtd" = "no"; then
1457   with_secrets=no
1459 if test "$with_secrets" = "yes" ; then
1460   AC_DEFINE_UNQUOTED([WITH_SECRETS], 1, [whether local secrets management driver is available])
1462 AM_CONDITIONAL([WITH_SECRETS], [test "$with_secrets" = "yes"])
1465 AC_ARG_WITH([storage-fs],
1466   AC_HELP_STRING([--with-storage-fs], [with FileSystem backend for the storage driver @<:@default=check@:>@]),[],[with_storage_fs=check])
1467 AC_ARG_WITH([storage-lvm],
1468   AC_HELP_STRING([--with-storage-lvm], [with LVM backend for the storage driver @<:@default=check@:>@]),[],[with_storage_lvm=check])
1469 AC_ARG_WITH([storage-iscsi],
1470   AC_HELP_STRING([--with-storage-iscsi], [with iSCSI backend for the storage driver @<:@default=check@:>@]),[],[with_storage_iscsi=check])
1471 AC_ARG_WITH([storage-scsi],
1472   AC_HELP_STRING([--with-storage-scsi], [with SCSI backend for the storage driver @<:@default=check@:>@]),[],[with_storage_scsi=check])
1473 AC_ARG_WITH([storage-mpath],
1474   AC_HELP_STRING([--with-storage-mpath], [with mpath backend for the storage driver @<:@default=check@:>@]),[],[with_storage_mpath=check])
1475 AC_ARG_WITH([storage-disk],
1476   AC_HELP_STRING([--with-storage-disk], [with GPartd Disk backend for the storage driver @<:@default=check@:>@]),[],[with_storage_disk=check])
1478 with_storage_dir=yes
1479 if test "$with_libvirtd" = "no"; then
1480   with_storage_dir=no
1481   with_storage_fs=no
1482   with_storage_lvm=no
1483   with_storage_iscsi=no
1484   with_storage_scsi=no
1485   with_storage_mpath=no
1486   with_storage_disk=no
1488 if test "$with_storage_dir" = "yes" ; then
1489   AC_DEFINE_UNQUOTED([WITH_STORAGE_DIR], 1, [whether directory backend for storage driver is enabled])
1491 AM_CONDITIONAL([WITH_STORAGE_DIR], [test "$with_storage_dir" = "yes"])
1493 dnl storage-fs does not work on MacOS X
1495 if test "$with_osx" = "yes"; then
1496   with_storage_fs=no
1499 if test "$with_storage_fs" = "yes" || test "$with_storage_fs" = "check"; then
1500     AC_CHECK_HEADER([mntent.h],,
1501     [
1502         if test "$with_storage_fs" = "check"; then
1503             with_storage_fs=no
1504             AC_MSG_NOTICE([<mntent.h> is required for the FS storage driver, disabling it])
1505         else
1506             AC_MSG_ERROR([<mntent.h> is required for the FS storage driver])
1507         fi
1508     ])
1511 if test "$with_storage_fs" = "yes" || test "$with_storage_fs" = "check"; then
1512   AC_PATH_PROG([MOUNT], [mount], [], [$PATH:/sbin:/usr/sbin])
1513   AC_PATH_PROG([UMOUNT], [umount], [], [$PATH:/sbin:/usr/sbin])
1514   if test "$with_storage_fs" = "yes" ; then
1515     if test -z "$MOUNT" ; then AC_MSG_ERROR([We need mount for FS storage driver]) ; fi
1516     if test -z "$UMOUNT" ; then AC_MSG_ERROR([We need umount for FS storage driver]) ; fi
1517   else
1518     if test -z "$MOUNT" ; then with_storage_fs=no ; fi
1519     if test -z "$UMOUNT" ; then with_storage_fs=no ; fi
1521     if test "$with_storage_fs" = "check" ; then with_storage_fs=yes ; fi
1522   fi
1524   if test "$with_storage_fs" = "yes" ; then
1525     AC_DEFINE_UNQUOTED([WITH_STORAGE_FS], 1, [whether FS backend for storage driver is enabled])
1526     AC_DEFINE_UNQUOTED([MOUNT],["$MOUNT"],
1527         [Location or name of the mount program])
1528     AC_DEFINE_UNQUOTED([UMOUNT],["$UMOUNT"],
1529         [Location or name of the mount program])
1530   fi
1532 AM_CONDITIONAL([WITH_STORAGE_FS], [test "$with_storage_fs" = "yes"])
1533 if test "$with_storage_fs" = "yes"; then
1534   AC_PATH_PROG([SHOWMOUNT], [showmount], [], [$PATH:/sbin:/usr/sbin])
1535   AC_DEFINE_UNQUOTED([SHOWMOUNT], ["$SHOWMOUNT"],
1536     [Location or name of the showmount program])
1539 if test "$with_storage_lvm" = "yes" || test "$with_storage_lvm" = "check"; then
1540   AC_PATH_PROG([PVCREATE], [pvcreate], [], [$PATH:/sbin:/usr/sbin])
1541   AC_PATH_PROG([VGCREATE], [vgcreate], [], [$PATH:/sbin:/usr/sbin])
1542   AC_PATH_PROG([LVCREATE], [lvcreate], [], [$PATH:/sbin:/usr/sbin])
1543   AC_PATH_PROG([PVREMOVE], [pvremove], [], [$PATH:/sbin:/usr/sbin])
1544   AC_PATH_PROG([VGREMOVE], [vgremove], [], [$PATH:/sbin:/usr/sbin])
1545   AC_PATH_PROG([LVREMOVE], [lvremove], [], [$PATH:/sbin:/usr/sbin])
1546   AC_PATH_PROG([VGCHANGE], [vgchange], [], [$PATH:/sbin:/usr/sbin])
1547   AC_PATH_PROG([VGSCAN], [vgscan], [], [$PATH:/sbin:/usr/sbin])
1548   AC_PATH_PROG([PVS], [pvs], [], [$PATH:/sbin:/usr/sbin])
1549   AC_PATH_PROG([VGS], [vgs], [], [$PATH:/sbin:/usr/sbin])
1550   AC_PATH_PROG([LVS], [lvs], [], [$PATH:/sbin:/usr/sbin])
1552   if test "$with_storage_lvm" = "yes" ; then
1553     if test -z "$PVCREATE" ; then AC_MSG_ERROR([We need pvcreate for LVM storage driver]) ; fi
1554     if test -z "$VGCREATE" ; then AC_MSG_ERROR([We need vgcreate for LVM storage driver]) ; fi
1555     if test -z "$LVCREATE" ; then AC_MSG_ERROR([We need lvcreate for LVM storage driver]) ; fi
1556     if test -z "$PVREMOVE" ; then AC_MSG_ERROR([We need pvremove for LVM storage driver]) ; fi
1557     if test -z "$VGREMOVE" ; then AC_MSG_ERROR([We need vgremove for LVM storage driver]) ; fi
1558     if test -z "$LVREMOVE" ; then AC_MSG_ERROR([We need lvremove for LVM storage driver]) ; fi
1559     if test -z "$VGCHANGE" ; then AC_MSG_ERROR([We need vgchange for LVM storage driver]) ; fi
1560     if test -z "$VGSCAN" ; then AC_MSG_ERROR([We need vgscan for LVM storage driver]) ; fi
1561     if test -z "$PVS" ; then AC_MSG_ERROR([We need pvs for LVM storage driver]) ; fi
1562     if test -z "$VGS" ; then AC_MSG_ERROR([We need vgs for LVM storage driver]) ; fi
1563     if test -z "$LVS" ; then AC_MSG_ERROR([We need lvs for LVM storage driver]) ; fi
1564   else
1565     if test -z "$PVCREATE" ; then with_storage_lvm=no ; fi
1566     if test -z "$VGCREATE" ; then with_storage_lvm=no ; fi
1567     if test -z "$LVCREATE" ; then with_storage_lvm=no ; fi
1568     if test -z "$PVREMOVE" ; then with_storage_lvm=no ; fi
1569     if test -z "$VGREMOVE" ; then with_storage_lvm=no ; fi
1570     if test -z "$LVREMOVE" ; then with_storage_lvm=no ; fi
1571     if test -z "$VGCHANGE" ; then with_storage_lvm=no ; fi
1572     if test -z "$VGSCAN" ; then with_storage_lvm=no ; fi
1573     if test -z "$PVS" ; then with_storage_lvm=no ; fi
1574     if test -z "$VGS" ; then with_storage_lvm=no ; fi
1575     if test -z "$LVS" ; then with_storage_lvm=no ; fi
1577     if test "$with_storage_lvm" = "check" ; then with_storage_lvm=yes ; fi
1578   fi
1580   if test "$with_storage_lvm" = "yes" ; then
1581     AC_DEFINE_UNQUOTED([WITH_STORAGE_LVM], 1, [whether LVM backend for storage driver is enabled])
1582     AC_DEFINE_UNQUOTED([PVCREATE],["$PVCREATE"],[Location of pvcreate program])
1583     AC_DEFINE_UNQUOTED([VGCREATE],["$VGCREATE"],[Location of vgcreate program])
1584     AC_DEFINE_UNQUOTED([LVCREATE],["$LVCREATE"],[Location of lvcreate program])
1585     AC_DEFINE_UNQUOTED([PVREMOVE],["$PVREMOVE"],[Location of pvcreate program])
1586     AC_DEFINE_UNQUOTED([VGREMOVE],["$VGREMOVE"],[Location of vgcreate program])
1587     AC_DEFINE_UNQUOTED([LVREMOVE],["$LVREMOVE"],[Location of lvcreate program])
1588     AC_DEFINE_UNQUOTED([VGCHANGE],["$VGCHANGE"],[Location of vgchange program])
1589     AC_DEFINE_UNQUOTED([VGSCAN],["$VGSCAN"],[Location of vgscan program])
1590     AC_DEFINE_UNQUOTED([PVS],["$PVS"],[Location of pvs program])
1591     AC_DEFINE_UNQUOTED([VGS],["$VGS"],[Location of vgs program])
1592     AC_DEFINE_UNQUOTED([LVS],["$LVS"],[Location of lvs program])
1593   fi
1595 AM_CONDITIONAL([WITH_STORAGE_LVM], [test "$with_storage_lvm" = "yes"])
1599 if test "$with_storage_iscsi" = "yes" || test "$with_storage_iscsi" = "check"; then
1600   AC_PATH_PROG([ISCSIADM], [iscsiadm], [], [$PATH:/sbin:/usr/sbin])
1601   if test "$with_storage_iscsi" = "yes" ; then
1602     if test -z "$ISCSIADM" ; then AC_MSG_ERROR([We need iscsiadm for iSCSI storage driver]) ; fi
1603   else
1604     if test -z "$ISCSIADM" ; then with_storage_iscsi=no ; fi
1606     if test "$with_storage_iscsi" = "check" ; then with_storage_iscsi=yes ; fi
1607   fi
1609   if test "$with_storage_iscsi" = "yes" ; then
1610     AC_DEFINE_UNQUOTED([WITH_STORAGE_ISCSI], 1, [whether iSCSI backend for storage driver is enabled])
1611     AC_DEFINE_UNQUOTED([ISCSIADM],["$ISCSIADM"],[Location of iscsiadm program])
1612   fi
1614 AM_CONDITIONAL([WITH_STORAGE_ISCSI], [test "$with_storage_iscsi" = "yes"])
1616 if test "$with_storage_scsi" = "check"; then
1617    with_storage_scsi=yes
1619    AC_DEFINE_UNQUOTED([WITH_STORAGE_SCSI], 1,
1620      [whether SCSI backend for storage driver is enabled])
1622 AM_CONDITIONAL([WITH_STORAGE_SCSI], [test "$with_storage_scsi" = "yes"])
1624 if test "$with_storage_mpath" = "check" && test "$with_linux" = "yes"; then
1625    with_storage_mpath=yes
1627    AC_DEFINE_UNQUOTED([WITH_STORAGE_MPATH], 1,
1628      [whether mpath backend for storage driver is enabled])
1630 AM_CONDITIONAL([WITH_STORAGE_MPATH], [test "$with_storage_mpath" = "yes"])
1632 if test "$with_storage_mpath" = "yes"; then
1633    DEVMAPPER_CFLAGS=
1634    DEVMAPPER_LIBS=
1635    PKG_CHECK_MODULES([DEVMAPPER], [devmapper >= $DEVMAPPER_REQUIRED], [], [DEVMAPPER_FOUND=no])
1636    if test "$DEVMAPPER_FOUND" = "no"; then
1637      # devmapper is missing pkg-config files in ubuntu, suse, etc
1638      save_LIBS="$LIBS"
1639      save_CFLAGS="$CFLAGS"
1640      DEVMAPPER_FOUND=yes
1641      AC_CHECK_HEADER([libdevmapper.h],,[DEVMAPPER_FOUND=no])
1642      AC_CHECK_LIB([devmapper], [dm_task_run],,[DEVMAPPER_FOUND=no])
1643      DEVMAPPER_LIBS="-ldevmapper"
1644      LIBS="$save_LIBS"
1645      CFLAGS="$save_CFLAGS"
1646    fi
1647    if test "$DEVMAPPER_FOUND" = "no" ; then
1648      AC_MSG_ERROR([You must install device-mapper-devel/libdevmapper >= $DEVMAPPER_REQUIRED to compile libvirt])
1649    fi
1652 AC_SUBST([DEVMAPPER_CFLAGS])
1653 AC_SUBST([DEVMAPPER_LIBS])
1655 LIBPARTED_CFLAGS=
1656 LIBPARTED_LIBS=
1657 if test "$with_storage_disk" = "yes" || test "$with_storage_disk" = "check"; then
1658   AC_PATH_PROG([PARTED], [parted], [], [$PATH:/sbin:/usr/sbin])
1659   if test -z "$PARTED" ; then
1660     with_storage_disk=no
1661     PARTED_FOUND=no
1662   else
1663     PARTED_FOUND=yes
1664   fi
1666   if test "$with_storage_disk" != "no" && test "x$PKG_CONFIG" != "x" ; then
1667     PKG_CHECK_MODULES(LIBPARTED, libparted >= $PARTED_REQUIRED, [], [PARTED_FOUND=no])
1668   fi
1669   if test "$PARTED_FOUND" = "no"; then
1670     # RHEL-5 vintage parted is missing pkg-config files
1671     save_LIBS="$LIBS"
1672     save_CFLAGS="$CFLAGS"
1673     PARTED_FOUND=yes
1674     AC_CHECK_HEADER([parted/parted.h],,[PARTED_FOUND=no])
1675     AC_CHECK_LIB([uuid], [uuid_generate],,[PARTED_FOUND=no])
1676     AC_CHECK_LIB([parted], [ped_device_read],,[PARTED_FOUND=no])
1677     LIBPARTED_LIBS="-luuid -lparted"
1678     LIBS="$save_LIBS"
1679     CFLAGS="$save_CFLAGS"
1680   fi
1682   if test "$PARTED_FOUND" = "no" ; then
1683     if test "$with_storage_disk" = "yes" ; then
1684       AC_MSG_ERROR([We need parted for disk storage driver])
1685     else
1686       with_storage_disk=no
1687     fi
1688   else
1689     with_storage_disk=yes
1690   fi
1692   if test "$with_storage_disk" = "yes"; then
1693     AC_DEFINE_UNQUOTED([WITH_STORAGE_DISK], 1, [whether Disk backend for storage driver is enabled])
1694     AC_DEFINE_UNQUOTED([PARTED],["$PARTED"], [Location or name of the parted program])
1695   fi
1697 AM_CONDITIONAL([WITH_STORAGE_DISK], [test "$with_storage_disk" = "yes"])
1698 AC_SUBST([LIBPARTED_CFLAGS])
1699 AC_SUBST([LIBPARTED_LIBS])
1702 dnl check for libcurl (ESX/XenAPI)
1705 LIBCURL_CFLAGS=""
1706 LIBCURL_LIBS=""
1708 if test "$with_esx" = "yes" || test "$with_esx" = "check" || test "$with_xenapi" = "yes" || test "$with_xenapi" = "check"; then
1709     PKG_CHECK_MODULES(LIBCURL, libcurl >= $LIBCURL_REQUIRED, [
1710         if test "$with_esx" = "check"; then
1711             with_esx=yes
1712         fi
1714         if test "$with_xenapi" = "check"; then
1715             with_xenapi=yes
1716         fi
1717     ], [
1718         if test "$with_esx" = "check"; then
1719             with_esx=no
1720             AC_MSG_NOTICE([libcurl is required for the ESX driver, disabling it])
1721         elif test "$with_esx" = "yes"; then
1722             AC_MSG_ERROR([libcurl >= $LIBCURL_REQUIRED is required for the ESX driver])
1723         fi
1725         if test "$with_xenapi" = "check"; then
1726             with_xenapi=no
1727             AC_MSG_NOTICE([libcurl is required for the XenAPI driver, disabling it])
1728         elif test "$with_xenapi" = "yes"; then
1729             AC_MSG_ERROR([libcurl >= $LIBCURL_REQUIRED is required for the XenAPI driver])
1730         fi
1731     ])
1735 if test "$with_esx" = "yes" ; then
1736     AC_DEFINE_UNQUOTED([WITH_ESX], 1, [whether ESX driver is enabled])
1738 AM_CONDITIONAL([WITH_ESX], [test "$with_esx" = "yes"])
1740 if test "$with_xenapi" = "yes" ; then
1741     AC_DEFINE_UNQUOTED([WITH_XENAPI], 1, [whether XenAPI driver is enabled])
1743 AM_CONDITIONAL([WITH_XENAPI], [test "$with_xenapi" = "yes"])
1745 # XXX as of libcurl-devel-7.20.1-3.fc13.x86_64, curl ships a version
1746 # of <curl/curl.h> that #defines several wrapper macros around underlying
1747 # functions to add type safety for gcc only.  However, these macros
1748 # spuriously trip gcc's -Wlogical-op warning.  Avoid the warning by
1749 # disabling the wrappers; even if it removes some type-check safety.
1750 LIBCURL_CFLAGS="-DCURL_DISABLE_TYPECHECK $LIBCURL_CFLAGS"
1752 AC_SUBST([LIBCURL_CFLAGS])
1753 AC_SUBST([LIBCURL_LIBS])
1756 dnl check for python
1759 AC_ARG_WITH([python],
1760   AC_HELP_STRING([--with-python], [Build python bindings @<:@default=yes@:>@]),[],[with_python=yes])
1762 if test "$enable_shared:$with_python" = no:yes; then
1763   AC_MSG_WARN([Disabling shared libraries is incompatible with building Python extensions.])
1764   AC_MSG_WARN([Ignoring --with-python.])
1765   with_python=no
1768 PYTHON_VERSION=
1769 PYTHON_INCLUDES=
1770 if test "$with_python" != "no" ; then
1771     if test -x "$with_python/bin/python"
1772     then
1773         AC_MSG_NOTICE(Found python in $with_python/bin/python)
1774         PYTHON="$with_python/bin/python"
1775         with_python=yes
1776     else
1777         if test -x "$with_python"
1778         then
1779             AC_MSG_NOTICE(Found python in $with_python)
1780             PYTHON="$with_python"
1781             with_python=yes
1782         else
1783             if test -x "$PYTHON"
1784             then
1785                 AC_MSG_NOTICE(Found python in environment PYTHON=$PYTHON)
1786                 with_python=yes
1787             fi
1788         fi
1789     fi
1791     if test "$with_python" = "yes" ; then
1792         AM_PATH_PYTHON(,, [:])
1794         if test "$PYTHON" != : ; then
1795             PYTHON_CONFIG="$PYTHON-config"
1797             if test -x "$PYTHON_CONFIG"
1798             then
1799                 PYTHON_INCLUDES=`$PYTHON_CONFIG --includes`
1800             else
1801                 if test -r $PYTHON_EXEC_PREFIX/include/python$PYTHON_VERSION/Python.h
1802                 then
1803                     PYTHON_INCLUDES=-I$PYTHON_EXEC_PREFIX/include/python$PYTHON_VERSION
1804                 else
1805                     if test -r $prefix/include/python$PYTHON_VERSION/Python.h
1806                     then
1807                         PYTHON_INCLUDES=-I$prefix/include/python$PYTHON_VERSION
1808                     else
1809                         if test -r /usr/include/python$PYTHON_VERSION/Python.h
1810                         then
1811                             PYTHON_INCLUDES=-I/usr/include/python$PYTHON_VERSION
1812                         else
1813                             AC_MSG_NOTICE([Could not find python$PYTHON_VERSION/Python.h, disabling bindings])
1814                             with_python=no
1815                         fi
1816                     fi
1817                 fi
1818             fi
1819         else
1820             AC_MSG_NOTICE([Could not find python interpreter, disabling bindings])
1821             with_python=no
1822         fi
1823     else
1824         AC_MSG_NOTICE([Could not find python in $with_python, disabling bindings])
1825         with_python=no
1826     fi
1828 AM_CONDITIONAL([WITH_PYTHON], [test "$with_python" = "yes"])
1829 AC_SUBST([PYTHON_VERSION])
1830 AC_SUBST([PYTHON_INCLUDES])
1834 AC_MSG_CHECKING([whether this host is running a Xen kernel])
1835 RUNNING_XEN=
1836 if test -d /proc/sys/xen
1837 then
1838     RUNNING_XEN=yes
1839 else
1840     RUNNING_XEN=no
1842 AC_MSG_RESULT($RUNNING_XEN)
1844 AC_MSG_CHECKING([If XenD UNIX socket /var/run/xend/xmlrpc.sock is accessible])
1845 RUNNING_XEND=
1846 if test -S /var/run/xend/xmlrpc.sock
1847 then
1848     RUNNING_XEND=yes
1849 else
1850     RUNNING_XEND=no
1852 AC_MSG_RESULT($RUNNING_XEND)
1854 AM_CONDITIONAL([ENABLE_XEN_TESTS], [test "$RUNNING_XEN" != "no" && test "$RUNNING_XEND" != "no"])
1856 AC_ARG_ENABLE([test-coverage],
1857   AC_HELP_STRING([--enable-test-coverage], [turn on code coverage instrumentation @<:@default=no@:>@]),
1858 [case "${enableval}" in
1859    yes|no) ;;
1860    *)      AC_MSG_ERROR([bad value ${enableval} for test-coverage option]) ;;
1861  esac],
1862               [enableval=no])
1863 enable_coverage=$enableval
1865 if test "${enable_coverage}" = yes; then
1866   COMPILER_FLAGS=
1867   gl_COMPILER_FLAGS(-fprofile-arcs)
1868   gl_COMPILER_FLAGS(-ftest-coverage)
1869   AC_SUBST([COVERAGE_CFLAGS], [$COMPILER_FLAGS])
1870   AC_SUBST([COVERAGE_LDFLAGS], [$COMPILER_FLAGS])
1871   COMPILER_FLAGS=
1874 AC_ARG_ENABLE([test-oom],
1875   AC_HELP_STRING([--enable-test-oom], [memory allocation failure checking @<:@default=no@:>@]),
1876 [case "${enableval}" in
1877    yes|no) ;;
1878    *)      AC_MSG_ERROR([bad value ${enableval} for test-oom option]) ;;
1879  esac],
1880               [enableval=no])
1881 enable_oom=$enableval
1883 if test "${enable_oom}" = yes; then
1884   have_trace=yes
1885   AC_CHECK_HEADER([execinfo.h],[],[have_trace=no])
1886   AC_CHECK_FUNC([backtrace],[],[have_trace=no])
1887   if test "$have_trace" = "yes"; then
1888     AC_DEFINE([TEST_OOM_TRACE], 1, [Whether backtrace() is available])
1889   fi
1890   AC_DEFINE([TEST_OOM], 1, [Whether malloc OOM checking is enabled])
1894 AC_ARG_ENABLE([test-locking],
1895   AC_HELP_STRING([--enable-test-locking], [thread locking tests using CIL @<:@default=no@:>@]),
1896 [case "${enableval}" in
1897    yes|no) ;;
1898    *)      AC_MSG_ERROR([bad value ${enableval} for test-locking option]) ;;
1899  esac],
1900               [enableval=no])
1901 enable_locking=$enableval
1903 if test "$enable_locking" = "yes"; then
1904   LOCK_CHECKING_CFLAGS="-Dbool=char -D_Bool=char -save-temps"
1905   AC_SUBST([LOCK_CHECKING_CFLAGS])
1907 AM_CONDITIONAL([WITH_CIL],[test "$enable_locking" = "yes"])
1909 dnl Enable building libvirtd?
1910 AM_CONDITIONAL([WITH_LIBVIRTD],[test "x$with_libvirtd" = "xyes"])
1912 dnl Check for gettext
1913 AM_GNU_GETTEXT_VERSION([0.14.1])
1914 AM_GNU_GETTEXT([external])
1915 dnl Since we're using such an old version of gettext, we must also define
1916 dnl this symbol, in order to make the autopoint-supplied Makefile.in.in
1917 dnl work properly.
1918 AC_SUBST([MKINSTALLDIRS], ["\$(top_builddir)/$ac_aux_dir/mkinstalldirs"])
1920 ALL_LINGUAS=`cd "$srcdir/po" > /dev/null && ls *.po | sed 's+\.po$++'`
1922 dnl Extra link-time flags for Cygwin.
1923 dnl Copied from libxml2 configure.in, but I removed mingw changes
1924 dnl for now since I'm not supporting mingw at present.  - RWMJ
1925 CYGWIN_EXTRA_LDFLAGS=
1926 CYGWIN_EXTRA_LIBADD=
1927 CYGWIN_EXTRA_PYTHON_LIBADD=
1928 MINGW_EXTRA_LDFLAGS=
1929 WIN32_EXTRA_CFLAGS=
1930 LIBVIRT_SYMBOL_FILE=libvirt.syms
1931 LIBVIRT_QEMU_SYMBOL_FILE='$(srcdir)/libvirt_qemu.syms'
1932 case "$host" in
1933   *-*-cygwin*)
1934     CYGWIN_EXTRA_LDFLAGS="-no-undefined"
1935     CYGWIN_EXTRA_LIBADD="${INTLLIBS}"
1936     if test "x$PYTHON_VERSION" != "x"; then
1937       CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
1938     fi
1939     ;;
1940   *-*-mingw*)
1941     MINGW_EXTRA_LDFLAGS="-no-undefined"
1942     ;;
1943 esac
1944 case "$host" in
1945   *-*-mingw* | *-*-cygwin* | *-*-msvc* )
1946     # If the host is Windows, and shared libraries are disabled, we
1947     # need to add -DLIBVIRT_STATIC to the CFLAGS for proper linking
1948     if test "x$enable_shared" = "xno"; then
1949       WIN32_EXTRA_CFLAGS="-DLIBVIRT_STATIC"
1950     fi
1951 esac
1952 case "$host" in
1953   *-*-mingw* | *-*-msvc* )
1954     # Also set the symbol file to .def, so src/Makefile generates libvirt.def
1955     # from libvirt.syms and passes libvirt.def instead of libvirt.syms to the linker
1956     LIBVIRT_SYMBOL_FILE=libvirt.def
1957     LIBVIRT_QEMU_SYMBOL_FILE=libvirt_qemu.def
1958     # mingw's ld has the --version-script parameter, but it requires a .def file
1959     # instead to work properly, therefore clear --version-script here and use
1960     # -Wl, to pass the .def file to the linker
1961     # cygwin's ld has the --version-script parameter too, but for some reason
1962     # it's working there as expected
1963     VERSION_SCRIPT_FLAGS="-Wl,"
1964     ;;
1965 esac
1966 AC_SUBST([CYGWIN_EXTRA_LDFLAGS])
1967 AC_SUBST([CYGWIN_EXTRA_LIBADD])
1968 AC_SUBST([CYGWIN_EXTRA_PYTHON_LIBADD])
1969 AC_SUBST([MINGW_EXTRA_LDFLAGS])
1970 AC_SUBST([WIN32_EXTRA_CFLAGS])
1971 AC_SUBST([LIBVIRT_SYMBOL_FILE])
1972 AC_SUBST([LIBVIRT_QEMU_SYMBOL_FILE])
1973 AC_SUBST([VERSION_SCRIPT_FLAGS])
1976 dnl Look for windres to build a Windows icon resource.
1977 case "$host" in
1978   *-*-mingw* | *-*-cygwin* | *-*-msvc* )
1979     AC_CHECK_TOOL([WINDRES], [windres], [])
1980     ;;
1981 esac
1982 AM_CONDITIONAL([WITH_WIN_ICON], [test "$WINDRES" != ""])
1985 dnl Driver-Modules library
1986 AC_ARG_WITH([driver-modules],
1987   AC_HELP_STRING([--with-driver-modules], [build drivers as loadable modules @<:@default=no@:>@]),
1988   [],
1989   [with_driver_modules=no])
1991 DRIVER_MODULE_CFLAGS=
1992 DRIVER_MODULE_LIBS=
1993 if test "x$with_driver_modules" = "xyes" ; then
1994   old_cflags="$CFLAGS"
1995   old_libs="$LIBS"
1996   fail=0
1997   AC_CHECK_HEADER([dlfcn.h],[],[fail=1])
1998   AC_SEARCH_LIBS([dlopen], [dl], [], [fail=1])
1999   test $fail = 1 &&
2000       AC_MSG_ERROR([You must have dlfcn.h / dlopen() support to build driver modules])
2002   CFLAGS="$old_cflags"
2003   LIBS="$old_libs"
2005 if test "$with_driver_modules" = "yes"; then
2006   DRIVER_MODULE_CFLAGS="-export-dynamic"
2007   case $ac_cv_search_dlopen in
2008     no*) DRIVER_MODULE_LIBS= ;;
2009     *) DRIVER_MODULE_LIBS=$ac_cv_search_dlopen ;;
2010   esac
2011   AC_DEFINE_UNQUOTED([WITH_DRIVER_MODULES], 1, [whether to build drivers as modules])
2013 AM_CONDITIONAL([WITH_DRIVER_MODULES], [test "$with_driver_modules" != "no"])
2014 AC_SUBST([DRIVER_MODULE_CFLAGS])
2015 AC_SUBST([DRIVER_MODULE_LIBS])
2018 # Set LV_LIBTOOL_OBJDIR to "." or $lt_cv_objdir, depending on whether
2019 # we're building shared libraries.  This is the name of the directory
2020 # in which .o files will be created.
2021 test "$enable_shared" = no && lt_cv_objdir=.
2022 LV_LIBTOOL_OBJDIR=${lt_cv_objdir-.}
2023 AC_SUBST([LV_LIBTOOL_OBJDIR])
2025 dnl HAL library check for host device enumeration
2026 HAL_CFLAGS=
2027 HAL_LIBS=
2028 AC_ARG_WITH([hal],
2029   AC_HELP_STRING([--with-hal], [use HAL for host device enumeration @<:@default=check@:>@]),
2030   [],
2031   [with_hal=check])
2033 if test "$with_libvirtd" = "no" ; then
2034   with_hal=no
2036 if test "x$with_hal" = "xyes" || test "x$with_hal" = "xcheck"; then
2037   PKG_CHECK_MODULES(HAL, hal >= $HAL_REQUIRED,
2038     [with_hal=yes], [
2039     if test "x$with_hal" = "xcheck" ; then
2040        with_hal=no
2041     else
2042        AC_MSG_ERROR(
2043          [You must install hal-devel >= $HAL_REQUIRED to compile libvirt])
2044     fi
2045   ])
2046   if test "x$with_hal" = "xyes" ; then
2047     old_CFLAGS=$CFLAGS
2048     old_LIBS=$LIBS
2049     CFLAGS="$CFLAGS $HAL_CFLAGS"
2050     LIBS="$LIBS $HAL_LIBS"
2051     AC_CHECK_FUNCS([libhal_get_all_devices],,[with_hal=no])
2052     AC_CHECK_FUNCS([dbus_watch_get_unix_fd])
2053     CFLAGS="$old_CFLAGS"
2054     LIBS="$old_LIBS"
2055   fi
2056   if test "x$with_hal" = "xyes" ; then
2057     AC_DEFINE_UNQUOTED([HAVE_HAL], 1,
2058       [use HAL for host device enumeration])
2059   fi
2061 AM_CONDITIONAL([HAVE_HAL], [test "x$with_hal" = "xyes"])
2062 AC_SUBST([HAL_CFLAGS])
2063 AC_SUBST([HAL_LIBS])
2066 dnl udev/libpciaccess library check for alternate host device enumeration
2067 UDEV_CFLAGS=
2068 UDEV_LIBS=
2069 PCIACCESS_CFLAGS=
2070 PCIACCESS_LIBS=
2071 AC_ARG_WITH([udev],
2072   AC_HELP_STRING([--with-udev], [use libudev for host device enumeration @<:@default=check@:>@]),
2073   [],
2074   [with_udev=check])
2076 if test "$with_libvirtd" = "no" ; then
2077   with_udev=no
2079 if test "x$with_udev" = "xyes" || test "x$with_udev" = "xcheck"; then
2080   PKG_CHECK_MODULES(UDEV, libudev >= $UDEV_REQUIRED,
2081     [], [
2082     if test "x$with_udev" = "xcheck" ; then
2083        with_udev=no
2084     else
2085        AC_MSG_ERROR(
2086          [You must install libudev-devel >= $UDEV_REQUIRED to compile libvirt])
2087     fi
2088   ])
2089   if test "x$with_udev" != "xno"; then
2090     PKG_CHECK_MODULES(PCIACCESS, pciaccess >= $PCIACCESS_REQUIRED,
2091       [with_udev=yes],
2092       [
2093         if test "x$with_udev" = "xcheck" ; then
2094           with_udev=no
2095         else
2096           AC_MSG_ERROR(
2097            [You must install libpciaccess-devel >= $PCIACCESS_REQUIRED to compile libvirt])
2098         fi
2099       ])
2100   fi
2101   if test "x$with_udev" = "xyes" ; then
2102     AC_DEFINE_UNQUOTED([HAVE_UDEV], 1,
2103       [use UDEV for host device enumeration])
2104   fi
2106 AM_CONDITIONAL([HAVE_UDEV], [test "x$with_udev" = "xyes"])
2107 AC_SUBST([UDEV_CFLAGS])
2108 AC_SUBST([UDEV_LIBS])
2109 AC_SUBST([PCIACCESS_CFLAGS])
2110 AC_SUBST([PCIACCESS_LIBS])
2112 with_nodedev=no;
2113 if test "$with_hal" = "yes" || test "$with_udev" = "yes";
2114 then
2115   with_nodedev=yes
2116   AC_DEFINE_UNQUOTED([WITH_NODE_DEVICES], 1, [with node device driver])
2118 AM_CONDITIONAL([WITH_NODE_DEVICES], [test "$with_nodedev" = "yes"])
2120 dnl nwfilter should only be compiled for linux, and only if the
2121 dnl libvirt daemon is also being compiled
2123 with_nwfilter=yes
2124 if test "$with_libvirtd" = "no" || test "$with_linux" != "yes"; then
2125   with_nwfilter=no
2127 if test "$with_nwfilter" = "yes" ; then
2128   AC_DEFINE([WITH_NWFILTER], 1, [whether local network filter management driver is available])
2130 AM_CONDITIONAL([WITH_NWFILTER], [test "$with_nwfilter" = "yes"])
2132 AC_ARG_WITH([qemu-user],
2133   AC_HELP_STRING([--with-qemu-user], [username to run QEMU system instance as @<:@default=root@:>@]),
2134   [QEMU_USER=${withval}],
2135   [QEMU_USER=root])
2136 AC_ARG_WITH([qemu-group],
2137   AC_HELP_STRING([--with-qemu-group], [groupname to run QEMU system instance as @<:@default=root@:>@]),
2138   [QEMU_GROUP=${withval}],
2139   [QEMU_GROUP=root])
2140 AC_DEFINE_UNQUOTED([QEMU_USER], ["$QEMU_USER"], [QEMU user account])
2141 AC_DEFINE_UNQUOTED([QEMU_GROUP], ["$QEMU_GROUP"], [QEMU group account])
2144 AC_ARG_WITH([macvtap],
2145   AC_HELP_STRING([--with-macvtap],[enable macvtap device @<:@default=check@:>@]),
2146   [with_macvtap=${withval}],
2147   [with_macvtap=check])
2149 AC_MSG_CHECKING([whether to compile with macvtap support])
2150 if test "$with_macvtap" != "no" ; then
2151     AC_TRY_COMPILE([ #include <sys/socket.h>
2152                      #include <linux/rtnetlink.h> ],
2153                    [ int x = MACVLAN_MODE_BRIDGE; ],
2154                    [ with_macvtap=yes ],
2155                    [ if test "$with_macvtap" = "yes" ; then
2156                          AC_MSG_ERROR([Installed linux headers don't show support for macvtap device.])
2157                      fi
2158                      with_macvtap=no ])
2159     if test "$with_macvtap" = "yes" ; then
2160         val=1
2161     else
2162         val=0
2163     fi
2164     AC_DEFINE_UNQUOTED([WITH_MACVTAP], $val, [whether macvtap support is enabled])
2166 AM_CONDITIONAL([WITH_MACVTAP], [test "$with_macvtap" = "yes"])
2167 AC_MSG_RESULT([$with_macvtap])
2169 AC_ARG_WITH([virtualport],
2170   AC_HELP_STRING([--with-virtualport],[enable virtual port support @<:@default=check@:>@]),
2171   [with_virtualport=${withval}],
2172   [with_virtualport=check])
2174 dnl Warn the user and error out if they requested virtualport support with configure
2175 dnl options, but the required macvtap support isn't available
2177 if test "$with_virtualport" = "yes"; then
2178     if test "$with_macvtap" = "no"; then
2179         AC_MSG_ERROR([--with-virtualport requires --with-macvtap])
2180     fi
2183 dnl virtualport checks
2185 if test "$with_macvtap" != "yes"; then
2186     with_virtualport=no
2188 if test "$with_virtualport" != "no"; then
2189     AC_MSG_CHECKING([whether to compile with virtual port support])
2190     AC_TRY_COMPILE([ #include <sys/socket.h>
2191                      #include <linux/rtnetlink.h> ],
2192                      [ int x = IFLA_PORT_MAX; ],
2193                      [ with_virtualport=yes ],
2194                      [ if test "$with_virtualport" = "yes" ; then
2195                          AC_MSG_ERROR([Installed linux headers don't show support for virtual port support.])
2196                        fi
2197                        with_virtualport=no ])
2198     if test "$with_virtualport" = "yes"; then
2199         val=1
2200     else
2201         val=0
2202     fi
2203     AC_DEFINE_UNQUOTED([WITH_VIRTUALPORT], $val,
2204                        [whether vsi vepa support is enabled])
2205     AC_MSG_RESULT([$with_virtualport])
2207 AM_CONDITIONAL([WITH_VIRTUALPORT], [test "$with_virtualport" = "yes"])
2210 dnl netlink library
2212 LIBNL_CFLAGS=""
2213 LIBNL_LIBS=""
2215 if test "$with_macvtap" = "yes"; then
2216     PKG_CHECK_MODULES([LIBNL], [libnl-1 >= $LIBNL_REQUIRED], [
2217     ], [
2218         AC_MSG_ERROR([libnl >= $LIBNL_REQUIRED is required for macvtap support])
2219     ])
2222 AC_SUBST([LIBNL_CFLAGS])
2223 AC_SUBST([LIBNL_LIBS])
2228 # Only COPYING.LIB is under version control, yet COPYING
2229 # is included as part of the distribution tarball.
2230 # Copy one to the other, but only if this is a srcdir-build.
2231 # You are unlikely to be doing distribution-related things in a non-srcdir build
2232 test "x$srcdir" = x. && ! test -f COPYING &&
2233 cp -f COPYING.LIB COPYING
2235 # Detect when running under the clang static analyzer's scan-build driver
2236 # or Coverity-prevent's cov-build.  Define STATIC_ANALYSIS accordingly.
2237 test -n "$CCC_ANALYZER_ANALYSIS$COVERITY_BUILD_COMMAND" && t=1 || t=0
2238 AC_DEFINE_UNQUOTED([STATIC_ANALYSIS], [$t],
2239   [Define to 1 when performing static analysis.])
2241 AC_OUTPUT(Makefile src/Makefile include/Makefile docs/Makefile \
2242           docs/schemas/Makefile \
2243           gnulib/lib/Makefile \
2244           gnulib/tests/Makefile \
2245           libvirt.pc libvirt.spec mingw32-libvirt.spec \
2246           po/Makefile.in \
2247           include/libvirt/Makefile include/libvirt/libvirt.h \
2248           python/Makefile python/tests/Makefile \
2249           daemon/Makefile \
2250           tools/Makefile \
2251           tests/Makefile \
2252           tests/xml2sexprdata/Makefile \
2253           tests/sexpr2xmldata/Makefile \
2254           tests/xmconfigdata/Makefile \
2255           tests/xencapsdata/Makefile \
2256           tests/confdata/Makefile \
2257           examples/apparmor/Makefile \
2258           examples/domain-events/events-c/Makefile \
2259           examples/domsuspend/Makefile \
2260           examples/dominfo/Makefile \
2261           examples/openauth/Makefile \
2262           examples/python/Makefile \
2263           examples/hellolibvirt/Makefile \
2264           examples/systemtap/Makefile \
2265           examples/xml/nwfilter/Makefile)
2267 AC_MSG_NOTICE([])
2268 AC_MSG_NOTICE([Configuration summary])
2269 AC_MSG_NOTICE([=====================])
2270 AC_MSG_NOTICE([])
2271 AC_MSG_NOTICE([Drivers])
2272 AC_MSG_NOTICE([])
2273 AC_MSG_NOTICE([     Xen: $with_xen])
2274 AC_MSG_NOTICE([    QEMU: $with_qemu])
2275 AC_MSG_NOTICE([     UML: $with_uml])
2276 AC_MSG_NOTICE([  OpenVZ: $with_openvz])
2277 AC_MSG_NOTICE([    VBox: $with_vbox])
2278 AC_MSG_NOTICE([  XenAPI: $with_xenapi])
2279 AC_MSG_NOTICE([     LXC: $with_lxc])
2280 AC_MSG_NOTICE([    PHYP: $with_phyp])
2281 AC_MSG_NOTICE([     ONE: $with_one])
2282 AC_MSG_NOTICE([     ESX: $with_esx])
2283 AC_MSG_NOTICE([    Test: $with_test])
2284 AC_MSG_NOTICE([  Remote: $with_remote])
2285 AC_MSG_NOTICE([ Network: $with_network])
2286 AC_MSG_NOTICE([Libvirtd: $with_libvirtd])
2287 AC_MSG_NOTICE([   netcf: $with_netcf])
2288 AC_MSG_NOTICE([ macvtap: $with_macvtap])
2289 AC_MSG_NOTICE([virtport: $with_virtualport])
2290 AC_MSG_NOTICE([])
2291 AC_MSG_NOTICE([Storage Drivers])
2292 AC_MSG_NOTICE([])
2293 AC_MSG_NOTICE([     Dir: $with_storage_dir])
2294 AC_MSG_NOTICE([      FS: $with_storage_fs])
2295 AC_MSG_NOTICE([   NetFS: $with_storage_fs])
2296 AC_MSG_NOTICE([     LVM: $with_storage_lvm])
2297 AC_MSG_NOTICE([   iSCSI: $with_storage_iscsi])
2298 AC_MSG_NOTICE([    SCSI: $with_storage_scsi])
2299 AC_MSG_NOTICE([   mpath: $with_storage_mpath])
2300 AC_MSG_NOTICE([    Disk: $with_storage_disk])
2301 AC_MSG_NOTICE([])
2302 AC_MSG_NOTICE([Security Drivers])
2303 AC_MSG_NOTICE([])
2304 AC_MSG_NOTICE([ SELinux: $with_secdriver_selinux])
2305 AC_MSG_NOTICE([AppArmor: $with_secdriver_apparmor])
2306 AC_MSG_NOTICE([])
2307 AC_MSG_NOTICE([Driver Loadable Modules])
2308 AC_MSG_NOTICE([])
2309 if test "$with_driver_modules" != "no" ; then
2310 AC_MSG_NOTICE([  dlopen: $DRIVER_MODULE_CFLAGS $DRIVER_MODULE_LIBS])
2311 else
2312 AC_MSG_NOTICE([  dlopen: no])
2314 AC_MSG_NOTICE([])
2315 AC_MSG_NOTICE([Libraries])
2316 AC_MSG_NOTICE([])
2317 AC_MSG_NOTICE([  libxml: $LIBXML_CFLAGS $LIBXML_LIBS])
2318 if test "$with_esx" = "yes" ; then
2319 AC_MSG_NOTICE([ libcurl: $LIBCURL_CFLAGS $LIBCURL_LIBS])
2320 else
2321 AC_MSG_NOTICE([ libcurl: no])
2323 if test "$with_libssh2" != "no" ; then
2324 AC_MSG_NOTICE([ libssh2: $LIBSSH2_CFLAGS $LIBSSH2_LIBS])
2325 else
2326 AC_MSG_NOTICE([ libssh2: no])
2328 AC_MSG_NOTICE([  gnutls: $GNUTLS_CFLAGS $GNUTLS_LIBS])
2329 if test "$with_sasl" != "no" ; then
2330 AC_MSG_NOTICE([    sasl: $SASL_CFLAGS $SASL_LIBS])
2331 else
2332 AC_MSG_NOTICE([    sasl: no])
2334 if test "$with_yajl" != "no" ; then
2335 AC_MSG_NOTICE([    yajl: $YAJL_CFLAGS $YAJL_LIBS])
2336 else
2337 AC_MSG_NOTICE([    yajl: no])
2339 if test "$with_avahi" = "yes" ; then
2340 AC_MSG_NOTICE([   avahi: $AVAHI_CFLAGS $AVAHI_LIBS])
2341 else
2342 AC_MSG_NOTICE([   avahi: no])
2344 if test "$with_polkit" = "yes" ; then
2345 if test "$with_polkit0" = "yes" ; then
2346 AC_MSG_NOTICE([  polkit: $POLKIT_CFLAGS $POLKIT_LIBS (version 0)])
2347 else
2348 AC_MSG_NOTICE([  polkit: $PKCHECK_PATH (version 1)])
2350 else
2351 AC_MSG_NOTICE([  polkit: no])
2353 if test "$with_audit" = "yes" ; then
2354 AC_MSG_NOTICE([   audit: $AUDIT_CFLAGS $AUDIT_LIBS])
2355 else
2356 AC_MSG_NOTICE([   audit: no])
2358 if test "$with_selinux" = "yes" ; then
2359 AC_MSG_NOTICE([ selinux: $SELINUX_CFLAGS $SELINUX_LIBS])
2360 else
2361 AC_MSG_NOTICE([ selinux: no])
2363 if test "$with_apparmor" = "yes" ; then
2364 AC_MSG_NOTICE([apparmor: $APPARMOR_CFLAGS $APPARMOR_LIBS])
2365 else
2366 AC_MSG_NOTICE([apparmor: no])
2368 if test "$with_numactl" = "yes" ; then
2369 AC_MSG_NOTICE([ numactl: $NUMACTL_CFLAGS $NUMACTL_LIBS])
2370 else
2371 AC_MSG_NOTICE([ numactl: no])
2373 if test "$with_capng" = "yes" ; then
2374 AC_MSG_NOTICE([   capng: $CAPNG_CFLAGS $CAPNG_LIBS])
2375 else
2376 AC_MSG_NOTICE([   capng: no])
2378 if test "$with_xen" = "yes" ; then
2379 AC_MSG_NOTICE([     xen: $XEN_CFLAGS $XEN_LIBS])
2380 else
2381 AC_MSG_NOTICE([     xen: no])
2383 if test "$with_xenapi" = "yes" ; then
2384 AC_MSG_NOTICE([  xenapi: $LIBXENSERVER_CFLAGS $LIBXENSERVER_LIBS])
2385 else
2386 AC_MSG_NOTICE([  xenapi: no])
2388 if test "$with_hal" = "yes" ; then
2389 AC_MSG_NOTICE([     hal: $HAL_CFLAGS $HAL_LIBS])
2390 else
2391 AC_MSG_NOTICE([     hal: no])
2393 if test "$with_udev" = "yes" ; then
2394 AC_MSG_NOTICE([    udev: $UDEV_CFLAGS $UDEV_LIBS $PCIACCESS_CFLAGS $PCIACCESS_LIBS])
2395 else
2396 AC_MSG_NOTICE([    udev: no])
2398 if test "$with_netcf" = "yes" ; then
2399 AC_MSG_NOTICE([   netcf: $NETCF_CFLAGS $NETCF_LIBS])
2400 else
2401 AC_MSG_NOTICE([   netcf: no])
2403 if test "$with_one" = "yes" ; then
2404 AC_MSG_NOTICE([  xmlrpc: $XMLRPC_CFLAGS $XMLRPC_LIBS])
2405 else
2406 AC_MSG_NOTICE([  xmlrpc: no])
2408 if test "$with_qemu" = "yes" ; then
2409 AC_MSG_NOTICE([    pcap: $LIBPCAP_CFLAGS $LIBPCAP_LIBS])
2410 else
2411 AC_MSG_NOTICE([    pcap: no])
2413 if test "$with_macvtap" = "yes" ; then
2414 AC_MSG_NOTICE([      nl: $LIBNL_CFLAGS $LIBNL_LIBS])
2415 else
2416 AC_MSG_NOTICE([      nl: no])
2418 AC_MSG_NOTICE([])
2419 AC_MSG_NOTICE([Test suite])
2420 AC_MSG_NOTICE([])
2421 AC_MSG_NOTICE([   Coverage: $enable_coverage])
2422 AC_MSG_NOTICE([  Alloc OOM: $enable_oom])
2423 AC_MSG_NOTICE([])
2424 AC_MSG_NOTICE([Miscellaneous])
2425 AC_MSG_NOTICE([])
2426 AC_MSG_NOTICE([        Debug: $enable_debug])
2427 AC_MSG_NOTICE([     Warnings: $enable_compile_warnings])
2428 AC_MSG_NOTICE([     Readline: $lv_use_readline])
2429 AC_MSG_NOTICE([       Python: $with_python])
2430 AC_MSG_NOTICE([       DTrace: $with_dtrace])
2431 AC_MSG_NOTICE([  XML Catalog: $XML_CATALOG_FILE])
2432 AC_MSG_NOTICE([])
2433 AC_MSG_NOTICE([Privileges])
2434 AC_MSG_NOTICE([])
2435 AC_MSG_NOTICE([      QEMU: $QEMU_USER:$QEMU_GROUP])
2436 AC_MSG_NOTICE([])