backup: qemu: Wire up qemu full push backup commands over QMP
[libvirt/ericb.git] / configure.ac
blobf41c6d5d86d3c4684e8182e8e5b7b0e91b114fd8
1 dnl Process this file with autoconf to produce a configure script.
3 dnl Copyright (C) 2005-2015 Red Hat, Inc.
4 dnl
5 dnl This library is free software; you can redistribute it and/or
6 dnl modify it under the terms of the GNU Lesser General Public
7 dnl License as published by the Free Software Foundation; either
8 dnl version 2.1 of the License, or (at your option) any later version.
9 dnl
10 dnl This library is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 dnl Lesser General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU Lesser General Public
16 dnl License along with this library.  If not, see
17 dnl <http://www.gnu.org/licenses/>.
19 AC_INIT([libvirt], [5.7.0], [libvir-list@redhat.com], [], [https://libvirt.org])
20 AC_CONFIG_SRCDIR([src/libvirt.c])
21 AC_CONFIG_AUX_DIR([build-aux])
22 AC_CONFIG_HEADERS([config.h])
23 AH_BOTTOM([#include <config-post.h>])
24 AC_CONFIG_MACRO_DIR([m4])
25 dnl Make automake keep quiet about wildcards & other GNUmake-isms
26 AM_INIT_AUTOMAKE([
27     foreign
28     -Wno-portability
29     tar-pax
30     no-dist-gzip
31     dist-xz
32     subdir-objects
33     ])
34 dnl older automake's default of ARFLAGS=cru is noisy on newer binutils;
35 dnl we don't really need the 'u' even in older toolchains.  Then there is
36 dnl older libtool, which spelled it AR_FLAGS
37 m4_divert_text([DEFAULTS], [: "${ARFLAGS=cr} ${AR_FLAGS=cr}"])
39 # Maintainer note - comment this line out if you plan to rerun
40 # GNULIB_POSIXCHECK testing to see if libvirt should be using more modules.
41 # Leave it uncommented for normal releases, for faster ./configure.
42 gl_ASSERT_NO_GNULIB_POSIXCHECK
44 # Default to using the silent-rules feature when possible.  Formatting
45 # chosen to bypass 'grep' checks that cause older automake to warn.
46 # Users (include rpm) can still change the default at configure time.
47 m4_ifndef([AM_SILENT_RULES],
48  [m4_define([AM_SILENT_RULES],[])])AM_SILENT_RULES([yes])
50 AC_CANONICAL_HOST
52 # First extract pieces from the version number string
53 LIBVIRT_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'`
54 LIBVIRT_MINOR_VERSION=`echo $VERSION | awk -F. '{print $2}'`
55 LIBVIRT_MICRO_VERSION=`echo $VERSION | awk -F. '{print $3}'`
56 LIBVIRT_VERSION=$LIBVIRT_MAJOR_VERSION.$LIBVIRT_MINOR_VERSION.$LIBVIRT_MICRO_VERSION$LIBVIRT_MICRO_VERSION_SUFFIX
57 LIBVIRT_VERSION_NUMBER=`expr $LIBVIRT_MAJOR_VERSION \* 1000000 + $LIBVIRT_MINOR_VERSION \* 1000 + $LIBVIRT_MICRO_VERSION`
59 # In libtool terminology we need to figure out:
61 # CURRENT
62 #     The most recent interface number that this library implements.
64 # REVISION
65 #     The implementation number of the CURRENT interface.
67 # AGE
68 #     The difference between the newest and oldest interfaces that this
69 #     library implements.
71 # In other words, the library implements all the interface numbers
72 # in the range from number `CURRENT - AGE' to `CURRENT'.
74 # Libtool assigns the soname version from `CURRENT - AGE', and we
75 # don't want that to ever change in libvirt. ie it must always be
76 # zero, to produce libvirt.so.0.
78 # We would, however, like the libvirt version number reflected
79 # in the so version'd symlinks, and this is based on AGE.REVISION
80 # eg  libvirt.so.0.AGE.REVISION
82 # Assuming we do ever want to break soname version, this can
83 # toggled. But seriously, don't ever touch this.
84 LIBVIRT_SONUM=0
86 # The following examples show what libtool will do
88 # Input: 0.9.14 ->   libvirt.so.0.9.14
89 # Input: 1.0.0  ->   libvirt.so.0.1000.0
90 # Input: 2.5.8  ->   libvirt.so.0.2005.8
92 AGE=`expr $LIBVIRT_MAJOR_VERSION '*' 1000 + $LIBVIRT_MINOR_VERSION`
93 REVISION=$LIBVIRT_MICRO_VERSION
94 CURRENT=`expr $LIBVIRT_SONUM + $AGE`
95 LIBVIRT_VERSION_INFO=$CURRENT:$REVISION:$AGE
97 AC_SUBST([LIBVIRT_MAJOR_VERSION])
98 AC_SUBST([LIBVIRT_MINOR_VERSION])
99 AC_SUBST([LIBVIRT_MICRO_VERSION])
100 AC_SUBST([LIBVIRT_SONUM])
101 AC_SUBST([LIBVIRT_VERSION])
102 AC_SUBST([LIBVIRT_VERSION_INFO])
103 AC_SUBST([LIBVIRT_VERSION_NUMBER])
105 LIBVIRT_ARG_WITH([PACKAGER], [Extra packager name], [no])
106 LIBVIRT_ARG_WITH([PACKAGER_VERSION], [Extra packager version], [no])
107 if test "x$with_packager" != "xno"
108 then
109   AC_DEFINE_UNQUOTED([PACKAGER], ["$with_packager"],
110                      [Extra package name])
112 if test "x$with_packager_version" != "xno"
113 then
114   AC_DEFINE_UNQUOTED([PACKAGER_VERSION], ["$with_packager_version"],
115                      [Extra package version])
118 dnl Where we look for daemons and admin binaries during configure
119 LIBVIRT_SBIN_PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin"
121 dnl Checks for C compiler.
122 AC_PROG_CC
123 AC_PROG_INSTALL
124 AC_PROG_CPP
126 dnl Setting AB_VERSION makes the 'autobuild' lines of configure output
127 dnl slightly more useful
128 if test -d $srcdir/.git && git --version >/dev/null 2>&1 ; then
129   AB_VERSION=`cd $srcdir && git describe --match 'v[[0-9]]*' 2>/dev/null`
132 gl_EARLY
133 gl_INIT
135 AC_TYPE_UID_T
137 dnl Support building Win32 DLLs (must appear *before* AM_PROG_LIBTOOL)
138 AC_LIBTOOL_WIN32_DLL
140 AC_HEADER_MAJOR
142 m4_ifndef([LT_INIT], [
143   AM_PROG_LIBTOOL
144 ], [
145   LT_INIT([shared disable-static])
147 AM_PROG_CC_C_O
148 AM_PROG_LD
150 AC_MSG_CHECKING([for how to mark DSO non-deletable at runtime])
151 LIBVIRT_NODELETE=
152 `$LD --help 2>&1 | grep -- "-z nodelete" >/dev/null` && \
153     LIBVIRT_NODELETE="-Wl,-z -Wl,nodelete"
154 AC_MSG_RESULT([$LIBVIRT_NODELETE])
155 AC_SUBST([LIBVIRT_NODELETE])
157 AC_MSG_CHECKING([for how to set DSO symbol versions])
158 case "$host" in
159   *-*-mingw* | *-*-msvc* )
160     # mingw's ld has the --version-script parameter, but it requires a .def file
161     # instead to work properly, therefore clear --version-script here and use
162     # -Wl, to pass the .def file to the linker
163     # cygwin's ld has the --version-script parameter too, but for some reason
164     # it's working there as expected
165     VERSION_SCRIPT_FLAGS="-Wl,"
166     ;;
167   * )
168     VERSION_SCRIPT_FLAGS=-Wl,--version-script=
169       `$LD --help 2>&1 | grep -- --version-script >/dev/null` || \
170         VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
171     ;;
172 esac
173 AC_MSG_RESULT([$VERSION_SCRIPT_FLAGS])
174 AC_SUBST([VERSION_SCRIPT_FLAGS])
176 dnl Specify if we rely on ifconfig instead of iproute2 (e.g. in case
177 dnl we're working on BSD)
178 want_ifconfig=no
180 dnl Make some notes about which OS we're compiling for, as the lxc and qemu
181 dnl drivers require linux headers, and storage_mpath, dtrace, and nwfilter
182 dnl are also linux specific.  The "network" and storage_fs drivers are known
183 dnl to not work on macOS presently, so we also make a note if compiling
184 dnl for that
186 with_linux=no with_macos=no with_freebsd=no with_win=no with_cygwin=no
187 case $host in
188   *-*-linux*) with_linux=yes ;;
189   *-*-darwin*) with_macos=yes ;;
190   *-*-freebsd*) with_freebsd=yes ;;
191   *-*-mingw* | *-*-msvc* ) with_win=yes ;;
192   *-*-cygwin*) with_cygwin=yes ;;
193 esac
195 if test $with_linux = no; then
196     if test "x$with_lxc" != xyes
197     then
198         with_lxc=no
199     fi
200     with_dtrace=no
201     with_storage_scsi=no
204 if test $with_freebsd = yes; then
205     want_ifconfig=yes
206     with_firewalld=no
209 if test $with_cygwin = yes; then
210     with_vbox=no
213 AM_CONDITIONAL([WITH_LINUX], [test "$with_linux" = "yes"])
214 AM_CONDITIONAL([WITH_FREEBSD], [test "$with_freebsd" = "yes"])
216 # We don't support the daemon yet
217 if test "$with_win" = "yes" ; then
218   with_libvirtd=no
221 # The daemon requires remote support.  Likewise, if we are not using
222 # RPC, we don't need several libraries.
223 if test "$with_remote" = "no" ; then
224   with_libvirtd=no
225   with_ssh2=no
226   with_sasl=no
227   with_libssh=no
229 # Stateful drivers are useful only when building the daemon.
230 if test "$with_libvirtd" = "no" ; then
231   with_qemu=no
232   with_lxc=no
233   with_libxl=no
234   with_vbox=no
237 # Check for compiler and library settings.
239 LIBVIRT_COMPILE_WARNINGS
240 LIBVIRT_COMPILE_PIE
241 LIBVIRT_LINKER_RELRO
242 LIBVIRT_LINKER_NO_INDIRECT
243 LIBVIRT_LINKER_NO_UNDEFINED
245 LIBVIRT_ARG_APPARMOR
246 LIBVIRT_ARG_ATTR
247 LIBVIRT_ARG_AUDIT
248 LIBVIRT_ARG_BASH_COMPLETION
249 LIBVIRT_ARG_BLKID
250 LIBVIRT_ARG_CAPNG
251 LIBVIRT_ARG_CURL
252 LIBVIRT_ARG_DBUS
253 LIBVIRT_ARG_FIREWALLD
254 LIBVIRT_ARG_FIREWALLD_ZONE
255 LIBVIRT_ARG_FUSE
256 LIBVIRT_ARG_GLUSTER
257 LIBVIRT_ARG_HAL
258 LIBVIRT_ARG_LIBISCSI
259 LIBVIRT_ARG_LIBPCAP
260 LIBVIRT_ARG_LIBSSH
261 LIBVIRT_ARG_LIBXML
262 LIBVIRT_ARG_MACVTAP
263 LIBVIRT_ARG_NETCF
264 LIBVIRT_ARG_NLS
265 LIBVIRT_ARG_NSS
266 LIBVIRT_ARG_NUMACTL
267 LIBVIRT_ARG_OPENWSMAN
268 LIBVIRT_ARG_PCIACCESS
269 LIBVIRT_ARG_PM_UTILS
270 LIBVIRT_ARG_POLKIT
271 LIBVIRT_ARG_READLINE
272 LIBVIRT_ARG_SANLOCK
273 LIBVIRT_ARG_SASL
274 LIBVIRT_ARG_SELINUX
275 LIBVIRT_ARG_SSH2
276 LIBVIRT_ARG_UDEV
277 LIBVIRT_ARG_VIRTUALPORT
278 LIBVIRT_ARG_WIRESHARK
279 LIBVIRT_ARG_YAJL
281 LIBVIRT_CHECK_ACL
282 LIBVIRT_CHECK_APPARMOR
283 LIBVIRT_CHECK_ATOMIC
284 LIBVIRT_CHECK_ATTR
285 LIBVIRT_CHECK_AUDIT
286 LIBVIRT_CHECK_BASH_COMPLETION
287 LIBVIRT_CHECK_BLKID
288 LIBVIRT_CHECK_CAPNG
289 LIBVIRT_CHECK_CURL
290 LIBVIRT_CHECK_DBUS
291 LIBVIRT_CHECK_DEVMAPPER
292 LIBVIRT_CHECK_DLOPEN
293 LIBVIRT_CHECK_FIREWALLD
294 LIBVIRT_CHECK_FIREWALLD_ZONE
295 LIBVIRT_CHECK_FUSE
296 LIBVIRT_CHECK_GLUSTER
297 LIBVIRT_CHECK_GNUTLS
298 LIBVIRT_CHECK_HAL
299 LIBVIRT_CHECK_LIBISCSI
300 LIBVIRT_CHECK_LIBNL
301 LIBVIRT_CHECK_LIBPARTED
302 LIBVIRT_CHECK_LIBPCAP
303 LIBVIRT_CHECK_LIBSSH
304 LIBVIRT_CHECK_LIBXML
305 LIBVIRT_CHECK_MACVTAP
306 LIBVIRT_CHECK_NETCF
307 LIBVIRT_CHECK_NLS
308 LIBVIRT_CHECK_NUMACTL
309 LIBVIRT_CHECK_NWFILTER
310 LIBVIRT_CHECK_OPENWSMAN
311 LIBVIRT_CHECK_PCIACCESS
312 LIBVIRT_CHECK_PM_UTILS
313 LIBVIRT_CHECK_POLKIT
314 LIBVIRT_CHECK_PTHREAD
315 LIBVIRT_CHECK_READLINE
316 LIBVIRT_CHECK_SANLOCK
317 LIBVIRT_CHECK_SASL
318 LIBVIRT_CHECK_SELINUX
319 LIBVIRT_CHECK_SSH2
320 LIBVIRT_CHECK_UDEV
321 LIBVIRT_CHECK_VIRTUALPORT
322 LIBVIRT_CHECK_WIRESHARK
323 LIBVIRT_CHECK_XDR
324 LIBVIRT_CHECK_YAJL
326 AC_CHECK_SIZEOF([long])
328 dnl Availability of various common functions (non-fatal if missing),
329 dnl and various less common threadsafe functions
330 AC_CHECK_FUNCS_ONCE([\
331   cfmakeraw \
332   fallocate \
333   geteuid \
334   getgid \
335   getifaddrs \
336   getmntent_r \
337   getpwuid_r \
338   getrlimit \
339   getuid \
340   if_indextoname \
341   mmap \
342   newlocale \
343   posix_fallocate \
344   posix_memalign \
345   prlimit \
346   sched_getaffinity \
347   sched_setscheduler \
348   setgroups \
349   setns \
350   setrlimit \
351   symlink \
352   sysctlbyname \
353   unshare \
354   ])
356 dnl Availability of various common headers (non-fatal if missing).
357 AC_CHECK_HEADERS([\
358   ifaddrs.h \
359   libtasn1.h \
360   linux/magic.h \
361   mntent.h \
362   net/ethernet.h \
363   netinet/tcp.h \
364   pwd.h \
365   stdarg.h \
366   syslog.h \
367   sys/mount.h \
368   sys/syscall.h \
369   sys/sysctl.h \
370   sys/ucred.h \
371   sys/un.h \
372   ])
373 dnl Check whether endian provides handy macros.
374 AC_CHECK_DECLS([htole64], [], [], [[#include <endian.h>]])
375 AC_CHECK_FUNCS([stat stat64 __xstat __xstat64 lstat lstat64 __lxstat __lxstat64])
377 AC_CHECK_TYPE([struct ifreq],
378   [AC_DEFINE([HAVE_STRUCT_IFREQ],[1],
379     [Defined if struct ifreq exists in net/if.h])],
380   [], [[#include <sys/socket.h>
381         #include <net/if.h>
382   ]])
384 AC_CHECK_TYPE([struct sockpeercred],
385   [AC_DEFINE([HAVE_STRUCT_SOCKPEERCRED], [1],
386     [Defined if struct sockpeercred is available])],
387   [], [[#include <sys/socket.h>
388   ]])
390 AC_CHECK_DECLS([ETH_FLAG_TXVLAN, ETH_FLAG_NTUPLE, ETH_FLAG_RXHASH, ETH_FLAG_LRO,
391                 ETHTOOL_GGSO, ETHTOOL_GGRO, ETHTOOL_GFLAGS, ETHTOOL_GFEATURES,
392                 ETHTOOL_SCOALESCE, ETHTOOL_GCOALESCE],
393   [], [], [[#include <linux/ethtool.h>
394   ]])
396 AC_CHECK_DECLS([SEEK_HOLE], [], [],
397                [#include <sys/types.h>
398                 #include <unistd.h>])
401 dnl Our only use of libtasn1.h is in the testsuite, and can be skipped
402 dnl if the header is not present.  Assume -ltasn1 is present if the
403 dnl header could be found.
404 AM_CONDITIONAL([HAVE_LIBTASN1], [test "x$ac_cv_header_libtasn1_h" = "xyes"])
406 AC_CHECK_LIB([intl],[gettext],[])
410 dnl Check for external programs
413 LIBVIRT_CHECK_EXTERNAL_PROGRAMS
415 dnl if --prefix is /usr, don't use /usr/var for localstatedir
416 dnl or /usr/etc for sysconfdir
417 dnl as this makes a lot of things break in testing situations
419 if test "$prefix" = "/usr" && test "$localstatedir" = '${prefix}/var' ; then
420     localstatedir='/var'
422 if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc' ; then
423     sysconfdir='/etc'
427 dnl Virtualization drivers check
430 LIBVIRT_DRIVER_ARG_QEMU
431 LIBVIRT_DRIVER_ARG_OPENVZ
432 LIBVIRT_DRIVER_ARG_VMWARE
433 LIBVIRT_DRIVER_ARG_PHYP
434 LIBVIRT_DRIVER_ARG_XENAPI
435 LIBVIRT_DRIVER_ARG_LIBXL
436 LIBVIRT_DRIVER_ARG_VBOX
437 LIBVIRT_DRIVER_ARG_LXC
438 LIBVIRT_DRIVER_ARG_VZ
439 LIBVIRT_DRIVER_ARG_BHYVE
440 LIBVIRT_DRIVER_ARG_ESX
441 LIBVIRT_DRIVER_ARG_HYPERV
442 LIBVIRT_DRIVER_ARG_TEST
443 LIBVIRT_DRIVER_ARG_REMOTE
444 LIBVIRT_DRIVER_ARG_LIBVIRTD
445 LIBVIRT_DRIVER_ARG_NETWORK
446 LIBVIRT_DRIVER_ARG_INTERFACE
448 LIBVIRT_DRIVER_CHECK_QEMU
449 LIBVIRT_DRIVER_CHECK_OPENVZ
450 LIBVIRT_DRIVER_CHECK_VMWARE
451 LIBVIRT_DRIVER_CHECK_PHYP
452 LIBVIRT_DRIVER_CHECK_XENAPI
453 LIBVIRT_DRIVER_CHECK_LIBXL
454 LIBVIRT_DRIVER_CHECK_VBOX
455 LIBVIRT_DRIVER_CHECK_LXC
456 LIBVIRT_DRIVER_CHECK_VZ
457 LIBVIRT_DRIVER_CHECK_BHYVE
458 LIBVIRT_DRIVER_CHECK_ESX
459 LIBVIRT_DRIVER_CHECK_HYPERV
460 LIBVIRT_DRIVER_CHECK_TEST
461 LIBVIRT_DRIVER_CHECK_REMOTE
462 LIBVIRT_DRIVER_CHECK_LIBVIRTD
463 LIBVIRT_DRIVER_CHECK_NETWORK
464 LIBVIRT_DRIVER_CHECK_INTERFACE
466 AM_CONDITIONAL([WITH_XENCONFIG], [test "$with_libxl" = "yes"])
470 dnl in case someone want to build static binaries
471 dnl STATIC_BINARIES="-static"
473 STATIC_BINARIES=
474 AC_SUBST([STATIC_BINARIES])
477 dnl Miscellaneous checks
480 LIBVIRT_ARG_DEBUG
481 LIBVIRT_ARG_DTRACE
482 LIBVIRT_ARG_NUMAD
483 LIBVIRT_ARG_INIT_SCRIPT
484 LIBVIRT_ARG_CHRDEV_LOCK_FILES
485 LIBVIRT_ARG_DEFAULT_EDITOR
486 LIBVIRT_ARG_LOADER_NVRAM
487 LIBVIRT_ARG_LOGIN_SHELL
488 LIBVIRT_ARG_HOST_VALIDATE
489 LIBVIRT_ARG_TLS_PRIORITY
490 LIBVIRT_ARG_SYSCTL_CONFIG
493 LIBVIRT_CHECK_DEBUG
494 LIBVIRT_CHECK_DTRACE
495 LIBVIRT_CHECK_NUMAD
496 LIBVIRT_CHECK_INIT_SCRIPT
497 LIBVIRT_CHECK_CHRDEV_LOCK_FILES
498 LIBVIRT_CHECK_DEFAULT_EDITOR
499 LIBVIRT_CHECK_LOADER_NVRAM
500 LIBVIRT_CHECK_LOGIN_SHELL
501 LIBVIRT_CHECK_HOST_VALIDATE
502 LIBVIRT_CHECK_TLS_PRIORITY
503 LIBVIRT_CHECK_SYSCTL_CONFIG
504 LIBVIRT_CHECK_NSS
510 dnl check for kvm headers
512 AC_CHECK_HEADERS([linux/kvm.h])
516 dnl check for kernel headers required by src/bridge.c
518 if test "$with_linux" = "yes"; then
519     # Various kernel versions have headers that are not self-standing, but
520     # yet are incompatible with the corresponding glibc headers.  In order
521     # to guarantee compilation across a wide range of versions (from RHEL 5
522     # to rawhide), we first have to probe whether glibc and kernel can be
523     # used in tandem; and if not, provide workarounds that ensure that
524     # ABI-compatible IPv6 types are present for use by the kernel headers.
525     # These probes mirror the usage in virnetdevbridge.c
526     AC_CACHE_CHECK(
527       [whether <linux/*.h> and <netinet/*.h> headers are compatible],
528       [lv_cv_netinet_linux_compatible],
529       [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
530         #include <netinet/in.h>
531         #include <linux/in6.h>
532       ]])],
533       [lv_cv_netinet_linux_compatible=yes],
534       [lv_cv_netinet_linux_compatible=no])])
535     if test "x$lv_cv_netinet_linux_compatible" != xyes; then
536       AC_DEFINE([NETINET_LINUX_WORKAROUND], [1],
537         [define to 1 if Linux kernel headers require a workaround to avoid
538         compilation errors when mixed with glibc netinet headers])
539     fi
540     AC_CHECK_HEADERS([linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h],,
541       [AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt with QEMU or LXC support])],
542       [[#include <netinet/in.h>
543         #if NETINET_LINUX_WORKAROUND
544         # define in6_addr in6_addr_
545         # define sockaddr_in6 sockaddr_in6_
546         # define ipv6_mreq ipv6_mreq_
547         # define in6addr_any in6addr_any_
548         # define in6addr_loopback in6addr_loopback_
549         #endif
550         #include <linux/in6.h>
551       ]])
555 dnl Need to test if pkg-config exists
556 PKG_PROG_PKG_CONFIG
559 dnl Security driver checks
560 LIBVIRT_SECDRIVER_ARG_SELINUX
561 LIBVIRT_SECDRIVER_ARG_APPARMOR
563 LIBVIRT_SECDRIVER_CHECK_SELINUX
564 LIBVIRT_SECDRIVER_CHECK_APPARMOR
567 LIBVIRT_ARG_WITH_FEATURE([SECRETS], [local secrets management driver], [yes])
569 if test "$with_libvirtd" = "no"; then
570   with_secrets=no
572 if test "$with_secrets" = "yes" ; then
573   AC_DEFINE_UNQUOTED([WITH_SECRETS], 1, [whether local secrets management driver is available])
575 AM_CONDITIONAL([WITH_SECRETS], [test "$with_secrets" = "yes"])
579 dnl Storage driver checks
582 LIBVIRT_STORAGE_ARG_DIR
583 LIBVIRT_STORAGE_ARG_FS
584 LIBVIRT_STORAGE_ARG_LVM
585 LIBVIRT_STORAGE_ARG_ISCSI
586 LIBVIRT_STORAGE_ARG_ISCSI_DIRECT
587 LIBVIRT_STORAGE_ARG_SCSI
588 LIBVIRT_STORAGE_ARG_MPATH
589 LIBVIRT_STORAGE_ARG_DISK
590 LIBVIRT_STORAGE_ARG_RBD
591 LIBVIRT_STORAGE_ARG_SHEEPDOG
592 LIBVIRT_STORAGE_ARG_GLUSTER
593 LIBVIRT_STORAGE_ARG_ZFS
594 LIBVIRT_STORAGE_ARG_VSTORAGE
596 if test "$with_libvirtd" = "no"; then
597   with_storage_dir=no
598   with_storage_fs=no
599   with_storage_lvm=no
600   with_storage_iscsi=no
601   with_storage_iscsi_direct=no
602   with_storage_scsi=no
603   with_storage_mpath=no
604   with_storage_disk=no
605   with_storage_rbd=no
606   with_storage_sheepdog=no
607   with_storage_gluster=no
608   with_storage_zfs=no
609   with_storage_vstorage=no
612 dnl storage-fs does not work on macOS
614 if test "$with_macos" = "yes"; then
615   with_storage_fs=no
618 LIBVIRT_STORAGE_CHECK_DIR
619 LIBVIRT_STORAGE_CHECK_FS
620 LIBVIRT_STORAGE_CHECK_LVM
621 LIBVIRT_STORAGE_CHECK_ISCSI
622 LIBVIRT_STORAGE_CHECK_ISCSI_DIRECT
623 LIBVIRT_STORAGE_CHECK_SCSI
624 LIBVIRT_STORAGE_CHECK_MPATH
625 LIBVIRT_STORAGE_CHECK_DISK
626 LIBVIRT_STORAGE_CHECK_RBD
627 LIBVIRT_STORAGE_CHECK_SHEEPDOG
628 LIBVIRT_STORAGE_CHECK_GLUSTER
629 LIBVIRT_STORAGE_CHECK_ZFS
630 LIBVIRT_STORAGE_CHECK_VSTORAGE
632 with_storage=no
633 for backend in dir fs lvm iscsi iscsi_direct scsi mpath rbd disk; do
634     if eval test \$with_storage_$backend = yes; then
635         with_storage=yes
636         break
637     fi
638 done
639 if test $with_storage = yes; then
640     AC_DEFINE([WITH_STORAGE], [1],
641       [Define to 1 if at least one storage backend is in use])
643 AM_CONDITIONAL([WITH_STORAGE], [test "$with_storage" = "yes"])
646 dnl check for kernel headers required by btrfs ioctl
648 if test "$with_linux" = "yes"; then
649     AC_CHECK_HEADERS([linux/btrfs.h])
653 dnl check for xfs dev headers required by xfs ioctl
655 if test "$with_linux" = "yes"; then
656     AC_CHECK_HEADERS([xfs/xfs.h])
660 dnl check for DEVLINK_CMD_ESWITCH_GET
662 dnl Assume DEVLINK_ESWITCH_MODE_SWITCHDEV is also
663 dnl available, as it was introudced in kernel 4.8
664 dnl along with the original spelling of this constant
665 dnl (DEVLINK_CMD_ESWITCH_MODE_GET, not supported by libvirt)
667 if test "$with_linux" = "yes"; then
668     AC_CHECK_HEADERS([linux/devlink.h])
669     AC_CHECK_DECLS([DEVLINK_CMD_ESWITCH_GET], [], [],
670                    [[#include <linux/devlink.h>]])
674 dnl check for VHOST_VSOCK_SET_GUEST_CID
676 if test "$with_linux" = "yes"; then
677     AC_CHECK_DECLS([VHOST_VSOCK_SET_GUEST_CID], [], [],
678                    [[#include <linux/vhost.h>]])
681 dnl Allow perl/python overrides
682 AC_PATH_PROGS([PYTHON], [python3 python2 python])
683 if test -z "$PYTHON"; then
684     AC_MSG_ERROR(['python3', 'python2' or 'python' binary is required to build libvirt])
686 AC_PATH_PROG([PERL], [perl])
687 if test -z "$PERL"; then
688          AC_MSG_ERROR(['perl' binary is required to build libvirt])
691 LIBVIRT_ARG_WITH([TEST_SUITE], [build test suite by default], [check])
692 case "$with_test_suite" in
693     yes|no|check) ;;
694     *) AC_MSG_ERROR([bad value ${withval} for tests option]) ;;
695 esac
697 AC_MSG_CHECKING([Whether to build test suite by default])
698 if test "$with_test_suite" = "check" ; then
699   if test -d $srcdir/.git ; then
700     with_test_suite=yes
701   else
702     with_test_suite=no
703   fi
705 AC_MSG_RESULT([$with_test_suite])
706 AM_CONDITIONAL([WITH_TESTS], [test "$with_test_suite" = "yes"])
708 LIBVIRT_ARG_ENABLE([EXPENSIVE_TESTS],
709                    [set the default for enabling expensive tests ]
710                      [(gnulib and long timeouts), use VIR_TEST_EXPENSIVE to ]
711                      [override during make],
712                    [check])
713 case "$enable_expensive_tests" in
714   0|no) VIR_TEST_EXPENSIVE_DEFAULT=0 ;;
715   1|yes) VIR_TEST_EXPENSIVE_DEFAULT=1 ;;
716   check) ;;
717   *) AC_MSG_ERROR([bad value ${enable_expensive_tests} for enable-expensive-tests option]) ;;
718 esac
719 if test "$enable_expensive_tests" = check; then
720   if test -d $srcdir/.git ; then
721     VIR_TEST_EXPENSIVE_DEFAULT=0
722   else
723     VIR_TEST_EXPENSIVE_DEFAULT=1
724   fi
726 AC_SUBST([VIR_TEST_EXPENSIVE_DEFAULT])
727 AM_CONDITIONAL([WITH_EXPENSIVE_TESTS], [test $VIR_TEST_EXPENSIVE_DEFAULT = 1])
729 LIBVIRT_ARG_ENABLE([TEST_COVERAGE], [turn on code coverage instrumentation], [no])
730 case "$enable_test_coverage" in
731   yes|no) ;;
732   *) AC_MSG_ERROR([bad value ${enable_test_coverga} for test-coverage option]) ;;
733 esac
735 if test "$enable_test_coverage" = yes; then
736   save_WARN_CFLAGS=$WARN_CFLAGS
737   WARN_CFLAGS=
738   gl_WARN_ADD([-fprofile-arcs])
739   gl_WARN_ADD([-ftest-coverage])
740   COVERAGE_FLAGS=$WARN_CFLAGS
741   AC_SUBST([COVERAGE_CFLAGS], [$COVERAGE_FLAGS])
742   AC_SUBST([COVERAGE_LDFLAGS], [$COVERAGE_FLAGS])
743   WARN_CFLAGS=$save_WARN_CFLAGS
746 LIBVIRT_ARG_ENABLE([TEST_OOM], [memory allocation failure checking], [no])
747 case "$enable_test_oom" in
748   yes|no) ;;
749   *) AC_MSG_ERROR([bad value ${enable_test_oom} for test-oom option]) ;;
750 esac
752 if test "$enable_test_oom" = yes; then
753   have_trace=yes
754   AC_CHECK_HEADER([execinfo.h],[],[have_trace=no])
755   AC_CHECK_FUNC([backtrace],[],[have_trace=no])
756   if test "$have_trace" = "yes"; then
757     AC_DEFINE([TEST_OOM_TRACE], 1, [Whether backtrace() is available])
758   fi
759   AC_DEFINE([TEST_OOM], 1, [Whether malloc OOM checking is enabled])
762 LIBVIRT_ARG_ENABLE([TEST_LOCKING], [thread locking tests using CIL], [no])
763 case "$enable_test_locking" in
764   yes|no) ;;
765   *) AC_MSG_ERROR([bad value ${enable_test_locking} for test-locking option]) ;;
766 esac
768 if test "$enable_test_locking" = "yes"; then
769   LOCK_CHECKING_CFLAGS="-save-temps"
770   AC_SUBST([LOCK_CHECKING_CFLAGS])
772 AM_CONDITIONAL([WITH_CIL],[test "$enable_test_locking" = "yes"])
774 dnl Cygwin, MinGW and MSVC checks
775 LIBVIRT_WIN_CHECK_COMMON
776 LIBVIRT_WIN_CHECK_CYGWIN
777 LIBVIRT_WIN_CHECK_MINGW
778 LIBVIRT_WIN_CHECK_SYMBOLS
779 LIBVIRT_WIN_CHECK_WINDRES
782 dnl Driver-Modules library support
783 LIBVIRT_ARG_DRIVER_MODULES
784 LIBVIRT_CHECK_DRIVER_MODULES
787 # Set LV_LIBTOOL_OBJDIR to "." or $lt_cv_objdir, depending on whether
788 # we're building shared libraries.  This is the name of the directory
789 # in which .o files will be created.
790 test "$enable_shared" = no && lt_cv_objdir=.
791 LV_LIBTOOL_OBJDIR=${lt_cv_objdir-.}
792 AC_SUBST([LV_LIBTOOL_OBJDIR])
795 with_nodedev=no;
796 if test "$with_hal" = "yes" || test "$with_udev" = "yes";
797 then
798   with_nodedev=yes
799   AC_DEFINE_UNQUOTED([WITH_NODE_DEVICES], 1, [with node device driver])
801 AM_CONDITIONAL([WITH_NODE_DEVICES], [test "$with_nodedev" = "yes"])
803 dnl GET_VLAN_VID_CMD is required for virNetDevGetVLanID
804 AC_CHECK_DECLS([GET_VLAN_VID_CMD], [], [], [[#include <linux/if_vlan.h>]])
806 # Check for Linux vs. BSD ifreq members
807 AC_CHECK_MEMBERS([struct ifreq.ifr_newname,
808                   struct ifreq.ifr_ifindex,
809                   struct ifreq.ifr_index,
810                   struct ifreq.ifr_hwaddr],
811                  [], [],
812                  [#include <sys/socket.h>
813                   #include <net/if.h>
814                  ])
816 # Check for BSD approach for setting MAC addr
817 AC_LINK_IFELSE([AC_LANG_PROGRAM(
818      [[
819         #include <sys/types.h>
820         #include <sys/socket.h>
821         #include <net/if_dl.h>
822      ]],
823      [[
824         link_addr(0, 0)]])],
825      [AC_DEFINE([HAVE_DECL_LINK_ADDR],
826                 [1],
827                 [whether link_addr is available])])
829 # Check for BSD approach for bridge management
830 AC_CHECK_DECLS([BRDGSFD, BRDGADD, BRDGDEL],
831                [AC_DEFINE([HAVE_BSD_BRIDGE_MGMT],
832                           [1],
833                           [whether BSD style bridge management is available])],
834                [],
835                [#include <stdint.h>
836                 #include <net/if.h>
837                 #include <net/ethernet.h>
838                 #include <net/if_bridgevar.h>
839                ])
841 # Check for BSD CPU affinity availability
842 AC_CHECK_DECLS([cpuset_getaffinity],
843                [AC_DEFINE([HAVE_BSD_CPU_AFFINITY],
844                           [1],
845                           [whether BSD CPU affinity management is available])],
846                [],
847                [#include <sys/param.h>
848                 #include <sys/cpuset.h>
849                ])
851 # Check for BSD kvm (kernel memory interface)
852 if test $with_freebsd = yes; then
853      AC_CHECK_LIB([kvm], [kvm_getprocs], [],
854                   [AC_MSG_ERROR([BSD kernel memory interface library is required to build on FreeBSD])]
855                  )
858 # FreeBSD 10-STABLE requires _IFI_OQDROPS to be defined for if_data.ifi_oqdrops
859 # field be available
860 old_CFLAGS="$CFLAGS"
861 CFLAGS="$CFLAGS -D_IFI_OQDROPS"
863 AC_CHECK_MEMBERS([struct if_data.ifi_oqdrops],
864                  [],
865                  [CFLAGS="$old_CFLAGS"],
866                  [#include <net/if.h>
867                  ])
869 AC_CHECK_DECLS([clock_serv_t, host_get_clock_service, clock_get_time],
870                [AC_DEFINE([HAVE_MACH_CLOCK_ROUTINES],
871                           [1],
872                           [whether Mach clock routines are available])],
873                [],
874                [#include <mach/clock.h>
875                 #include <mach/mach.h>
876                ])
878 # Check if we need to look for ifconfig
879 if test "$want_ifconfig" = "yes"; then
880      AC_PATH_PROG([IFCONFIG_PATH], [ifconfig])
881      if test -z "$IFCONFIG_PATH"; then
882          AC_MSG_ERROR([Failed to find ifconfig.])
883      fi
884      AC_DEFINE_UNQUOTED([IFCONFIG_PATH], "$IFCONFIG_PATH", [path to ifconfig binary])
887 # Detect when running under the clang static analyzer's scan-build driver
888 # or Coverity-prevent's cov-build.  Define STATIC_ANALYSIS accordingly.
889 AC_CACHE_CHECK([whether this build is done by a static analysis tool],
890   [lv_cv_static_analysis], [
891     lv_cv_static_analysis=no
892     if test -n "${CCC_ANALYZER_ANALYSIS+set}" || \
893        test -n "$COVERITY_BUILD_COMMAND$COVERITY_LD_PRELOAD"; then
894       lv_cv_static_analysis=yes
895     fi
896   ])
898 test "x$lv_cv_static_analysis" = xyes && t=1
899 AC_DEFINE_UNQUOTED([STATIC_ANALYSIS], [$t],
900   [Define to 1 when performing static analysis.])
902 # Some GNULIB base64 symbols clash with a kerberos library
903 AC_DEFINE_UNQUOTED([isbase64],[libvirt_gl_isbase64],[Hack to avoid symbol clash])
904 AC_DEFINE_UNQUOTED([base64_encode],[libvirt_gl_base64_encode],[Hack to avoid symbol clash])
905 AC_DEFINE_UNQUOTED([base64_encode_alloc],[libvirt_gl_base64_encode_alloc],[Hack to avoid symbol clash])
907 AC_CONFIG_FILES([run],
908                 [chmod +x,-w run])
909 AC_CONFIG_FILES([\
910         Makefile src/Makefile include/libvirt/Makefile docs/Makefile \
911         gnulib/lib/Makefile \
912         gnulib/tests/Makefile \
913         .color_coded \
914         .ycm_extra_conf.py \
915         libvirt.pc \
916         libvirt-qemu.pc \
917         libvirt-lxc.pc \
918         libvirt-admin.pc \
919         src/libvirt.pc \
920         src/libvirt-qemu.pc \
921         src/libvirt-lxc.pc \
922         libvirt.spec mingw-libvirt.spec \
923         po/Makefile \
924         include/libvirt/libvirt-common.h \
925         examples/Makefile \
926         tests/Makefile \
927         tools/Makefile])
928 AC_OUTPUT
930 AC_MSG_NOTICE([])
931 AC_MSG_NOTICE([Configuration summary])
932 AC_MSG_NOTICE([=====================])
933 AC_MSG_NOTICE([])
934 AC_MSG_NOTICE([Drivers])
935 AC_MSG_NOTICE([])
936 LIBVIRT_DRIVER_RESULT_QEMU
937 LIBVIRT_DRIVER_RESULT_OPENVZ
938 LIBVIRT_DRIVER_RESULT_VMWARE
939 LIBVIRT_DRIVER_RESULT_VBOX
940 LIBVIRT_DRIVER_RESULT_XENAPI
941 LIBVIRT_DRIVER_RESULT_LIBXL
942 LIBVIRT_DRIVER_RESULT_LXC
943 LIBVIRT_DRIVER_RESULT_PHYP
944 LIBVIRT_DRIVER_RESULT_ESX
945 LIBVIRT_DRIVER_RESULT_HYPERV
946 LIBVIRT_DRIVER_RESULT_VZ
947 LIBVIRT_DRIVER_RESULT_BHYVE
948 LIBVIRT_DRIVER_RESULT_TEST
949 LIBVIRT_DRIVER_RESULT_REMOTE
950 LIBVIRT_DRIVER_RESULT_NETWORK
951 LIBVIRT_DRIVER_RESULT_LIBVIRTD
952 LIBVIRT_DRIVER_RESULT_INTERFACE
953 AC_MSG_NOTICE([])
954 AC_MSG_NOTICE([Storage Drivers])
955 AC_MSG_NOTICE([])
956 LIBVIRT_STORAGE_RESULT_DIR
957 LIBVIRT_STORAGE_RESULT_FS
958 LIBVIRT_STORAGE_RESULT_LVM
959 LIBVIRT_STORAGE_RESULT_ISCSI
960 LIBVIRT_STORAGE_RESULT_ISCSI_DIRECT
961 LIBVIRT_STORAGE_RESULT_SCSI
962 LIBVIRT_STORAGE_RESULT_MPATH
963 LIBVIRT_STORAGE_RESULT_DISK
964 LIBVIRT_STORAGE_RESULT_RBD
965 LIBVIRT_STORAGE_RESULT_SHEEPDOG
966 LIBVIRT_STORAGE_RESULT_GLUSTER
967 LIBVIRT_STORAGE_RESULT_ZFS
968 LIBVIRT_STORAGE_RESULT_VSTORAGE
969 AC_MSG_NOTICE([])
970 AC_MSG_NOTICE([Security Drivers])
971 AC_MSG_NOTICE([])
972 LIBVIRT_SECDRIVER_RESULT_SELINUX
973 LIBVIRT_SECDRIVER_RESULT_APPARMOR
974 AC_MSG_NOTICE([])
975 AC_MSG_NOTICE([Driver Loadable Modules])
976 AC_MSG_NOTICE([])
977 LIBVIRT_RESULT_DRIVER_MODULES
978 AC_MSG_NOTICE([])
979 AC_MSG_NOTICE([Libraries])
980 AC_MSG_NOTICE([])
981 LIBVIRT_RESULT_ACL
982 LIBVIRT_RESULT_APPARMOR
983 LIBVIRT_RESULT_ATTR
984 LIBVIRT_RESULT_AUDIT
985 LIBVIRT_RESULT_BASH_COMPLETION
986 LIBVIRT_RESULT_BLKID
987 LIBVIRT_RESULT_CAPNG
988 LIBVIRT_RESULT_CURL
989 LIBVIRT_RESULT_DBUS
990 LIBVIRT_RESULT_DLOPEN
991 LIBVIRT_RESULT_FIREWALLD
992 LIBVIRT_RESULT_FIREWALLD_ZONE
993 LIBVIRT_RESULT_FUSE
994 LIBVIRT_RESULT_GLUSTER
995 LIBVIRT_RESULT_GNUTLS
996 LIBVIRT_RESULT_HAL
997 LIBVIRT_RESULT_LIBISCSI
998 LIBVIRT_RESULT_LIBNL
999 LIBVIRT_RESULT_LIBPCAP
1000 LIBVIRT_RESULT_LIBSSH
1001 LIBVIRT_RESULT_LIBXL
1002 LIBVIRT_RESULT_LIBXML
1003 LIBVIRT_RESULT_MACVTAP
1004 LIBVIRT_RESULT_NETCF
1005 LIBVIRT_RESULT_NLS
1006 LIBVIRT_RESULT_NSS
1007 LIBVIRT_RESULT_NUMACTL
1008 LIBVIRT_RESULT_OPENWSMAN
1009 LIBVIRT_RESULT_PCIACCESS
1010 LIBVIRT_RESULT_PM_UTILS
1011 LIBVIRT_RESULT_POLKIT
1012 LIBVIRT_RESULT_RBD
1013 LIBVIRT_RESULT_READLINE
1014 LIBVIRT_RESULT_SANLOCK
1015 LIBVIRT_RESULT_SASL
1016 LIBVIRT_RESULT_SELINUX
1017 LIBVIRT_RESULT_SSH2
1018 LIBVIRT_RESULT_UDEV
1019 LIBVIRT_RESULT_VIRTUALPORT
1020 LIBVIRT_RESULT_XDR
1021 LIBVIRT_RESULT_XENAPI
1022 LIBVIRT_RESULT_YAJL
1023 AC_MSG_NOTICE([])
1024 AC_MSG_NOTICE([Windows])
1025 AC_MSG_NOTICE([])
1026 LIBVIRT_WIN_RESULT_COMMON
1027 LIBVIRT_WIN_RESULT_WINDRES
1028 AC_MSG_NOTICE([])
1029 AC_MSG_NOTICE([Test suite])
1030 AC_MSG_NOTICE([])
1031 AC_MSG_NOTICE([         Coverage: $enable_test_coverage])
1032 AC_MSG_NOTICE([        Alloc OOM: $enable_test_oom])
1033 AC_MSG_NOTICE([])
1034 AC_MSG_NOTICE([Miscellaneous])
1035 AC_MSG_NOTICE([])
1036 LIBVIRT_RESULT_DEBUG
1037 AC_MSG_NOTICE([       Use -Werror: $enable_werror])
1038 AC_MSG_NOTICE([     Warning Flags: $WARN_CFLAGS])
1039 LIBVIRT_RESULT_DTRACE
1040 LIBVIRT_RESULT_NUMAD
1041 LIBVIRT_RESULT_INIT_SCRIPT
1042 LIBVIRT_RESULT_CHRDEV_LOCK_FILES
1043 LIBVIRT_RESULT_DEFAULT_EDITOR
1044 LIBVIRT_RESULT_LOADER_NVRAM
1045 LIBVIRT_RESULT_LOGIN_SHELL
1046 LIBVIRT_RESULT_HOST_VALIDATE
1047 LIBVIRT_RESULT_TLS_PRIORITY
1048 AC_MSG_NOTICE([])
1049 AC_MSG_NOTICE([Developer Tools])
1050 AC_MSG_NOTICE([])
1051 LIBVIRT_RESULT_WIRESHARK
1052 AC_MSG_NOTICE([])
1053 AC_MSG_NOTICE([Privileges])
1054 AC_MSG_NOTICE([])
1055 LIBVIRT_RESULT_QEMU_PRIVILEGES
1056 AC_MSG_NOTICE([])