You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1061 lines
29 KiB

  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl Copyright (C) 2005-2015 Red Hat, Inc.
  3. dnl
  4. dnl This library is free software; you can redistribute it and/or
  5. dnl modify it under the terms of the GNU Lesser General Public
  6. dnl License as published by the Free Software Foundation; either
  7. dnl version 2.1 of the License, or (at your option) any later version.
  8. dnl
  9. dnl This library is distributed in the hope that it will be useful,
  10. dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. dnl Lesser General Public License for more details.
  13. dnl
  14. dnl You should have received a copy of the GNU Lesser General Public
  15. dnl License along with this library. If not, see
  16. dnl <http://www.gnu.org/licenses/>.
  17. AC_INIT([libvirt], [6.5.0], [libvir-list@redhat.com], [], [https://libvirt.org])
  18. if test $srcdir = "."
  19. then
  20. AC_MSG_ERROR([Build directory must be different from source directory])
  21. fi
  22. AC_CONFIG_SRCDIR([src/libvirt.c])
  23. AC_CONFIG_AUX_DIR([build-aux])
  24. AC_CONFIG_HEADERS([config.h])
  25. AH_BOTTOM([#include <config-post.h>])
  26. AC_CONFIG_MACRO_DIR([m4])
  27. dnl Make automake keep quiet about wildcards & other GNUmake-isms
  28. AM_INIT_AUTOMAKE([
  29. foreign
  30. -Wno-portability
  31. tar-pax
  32. no-dist-gzip
  33. dist-xz
  34. subdir-objects
  35. ])
  36. dnl older automake's default of ARFLAGS=cru is noisy on newer binutils;
  37. dnl we don't really need the 'u' even in older toolchains. Then there is
  38. dnl older libtool, which spelled it AR_FLAGS
  39. m4_divert_text([DEFAULTS], [: "${ARFLAGS=cr} ${AR_FLAGS=cr}"])
  40. # Default to using the silent-rules feature when possible. Formatting
  41. # chosen to bypass 'grep' checks that cause older automake to warn.
  42. # Users (include rpm) can still change the default at configure time.
  43. m4_ifndef([AM_SILENT_RULES],
  44. [m4_define([AM_SILENT_RULES],[])])AM_SILENT_RULES([yes])
  45. AC_CANONICAL_HOST
  46. AC_USE_SYSTEM_EXTENSIONS
  47. # First extract pieces from the version number string
  48. LIBVIRT_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'`
  49. LIBVIRT_MINOR_VERSION=`echo $VERSION | awk -F. '{print $2}'`
  50. LIBVIRT_MICRO_VERSION=`echo $VERSION | awk -F. '{print $3}'`
  51. LIBVIRT_VERSION=$LIBVIRT_MAJOR_VERSION.$LIBVIRT_MINOR_VERSION.$LIBVIRT_MICRO_VERSION$LIBVIRT_MICRO_VERSION_SUFFIX
  52. LIBVIRT_VERSION_NUMBER=`expr $LIBVIRT_MAJOR_VERSION \* 1000000 + $LIBVIRT_MINOR_VERSION \* 1000 + $LIBVIRT_MICRO_VERSION`
  53. # In libtool terminology we need to figure out:
  54. #
  55. # CURRENT
  56. # The most recent interface number that this library implements.
  57. #
  58. # REVISION
  59. # The implementation number of the CURRENT interface.
  60. #
  61. # AGE
  62. # The difference between the newest and oldest interfaces that this
  63. # library implements.
  64. #
  65. # In other words, the library implements all the interface numbers
  66. # in the range from number `CURRENT - AGE' to `CURRENT'.
  67. #
  68. # Libtool assigns the soname version from `CURRENT - AGE', and we
  69. # don't want that to ever change in libvirt. ie it must always be
  70. # zero, to produce libvirt.so.0.
  71. #
  72. # We would, however, like the libvirt version number reflected
  73. # in the so version'd symlinks, and this is based on AGE.REVISION
  74. # eg libvirt.so.0.AGE.REVISION
  75. #
  76. # Assuming we do ever want to break soname version, this can
  77. # toggled. But seriously, don't ever touch this.
  78. LIBVIRT_SONUM=0
  79. # The following examples show what libtool will do
  80. #
  81. # Input: 0.9.14 -> libvirt.so.0.9.14
  82. # Input: 1.0.0 -> libvirt.so.0.1000.0
  83. # Input: 2.5.8 -> libvirt.so.0.2005.8
  84. #
  85. AGE=`expr $LIBVIRT_MAJOR_VERSION '*' 1000 + $LIBVIRT_MINOR_VERSION`
  86. REVISION=$LIBVIRT_MICRO_VERSION
  87. CURRENT=`expr $LIBVIRT_SONUM + $AGE`
  88. LIBVIRT_VERSION_INFO=$CURRENT:$REVISION:$AGE
  89. AC_SUBST([LIBVIRT_MAJOR_VERSION])
  90. AC_SUBST([LIBVIRT_MINOR_VERSION])
  91. AC_SUBST([LIBVIRT_MICRO_VERSION])
  92. AC_SUBST([LIBVIRT_SONUM])
  93. AC_SUBST([LIBVIRT_VERSION])
  94. AC_SUBST([LIBVIRT_VERSION_INFO])
  95. AC_SUBST([LIBVIRT_VERSION_NUMBER])
  96. LIBVIRT_ARG_WITH([PACKAGER], [Extra packager name], [no])
  97. LIBVIRT_ARG_WITH([PACKAGER_VERSION], [Extra packager version], [no])
  98. if test "x$with_packager" != "xno"
  99. then
  100. AC_DEFINE_UNQUOTED([PACKAGER], ["$with_packager"],
  101. [Extra package name])
  102. fi
  103. if test "x$with_packager_version" != "xno"
  104. then
  105. AC_DEFINE_UNQUOTED([PACKAGER_VERSION], ["$with_packager_version"],
  106. [Extra package version])
  107. fi
  108. dnl Where we look for daemons and admin binaries during configure
  109. LIBVIRT_SBIN_PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin"
  110. dnl Checks for C compiler.
  111. AC_PROG_CC
  112. AC_PROG_INSTALL
  113. AC_PROG_CPP
  114. dnl autoconf 2.70 adds a --runstatedir option so that downstreams
  115. dnl can point to /run instead of the historic /var/run, but
  116. dnl autoconf hasn't had a release since 2012.
  117. if test "x$runstatedir" = x; then
  118. AC_SUBST([runstatedir], ['${localstatedir}/run'])
  119. fi
  120. dnl we introduce --with-runstatedir and then overwrite the
  121. dnl value of $runstatedir so configmake.h is more useful
  122. AC_ARG_WITH(
  123. [runstatedir],
  124. [AS_HELP_STRING(
  125. [--with-runstatedir],
  126. [State directory for temporary sockets, pid files, etc])])
  127. if test -n "$with_runstatedir"
  128. then
  129. runstatedir=$with_runstatedir
  130. fi
  131. dnl get 64-int interfaces on 32-bit platforms
  132. AC_SYS_LARGEFILE
  133. AC_TYPE_UID_T
  134. dnl Support building Win32 DLLs (must appear *before* AM_PROG_LIBTOOL)
  135. AC_LIBTOOL_WIN32_DLL
  136. AC_HEADER_MAJOR
  137. m4_ifndef([LT_INIT], [
  138. AM_PROG_LIBTOOL
  139. ], [
  140. LT_INIT([shared disable-static])
  141. ])
  142. AM_PROG_CC_C_O
  143. AM_PROG_LD
  144. AC_MSG_CHECKING([for how to mark DSO non-deletable at runtime])
  145. LIBVIRT_NODELETE=
  146. `$LD --help 2>&1 | grep -- "-z nodelete" >/dev/null` && \
  147. LIBVIRT_NODELETE="-Wl,-z -Wl,nodelete"
  148. AC_MSG_RESULT([$LIBVIRT_NODELETE])
  149. AC_SUBST([LIBVIRT_NODELETE])
  150. AC_MSG_CHECKING([for how to set DSO symbol versions])
  151. case "$host" in
  152. *-*-mingw* | *-*-msvc* )
  153. # mingw's ld has the --version-script parameter, but it requires a .def file
  154. # instead to work properly, therefore clear --version-script here and use
  155. # -Wl, to pass the .def file to the linker
  156. VERSION_SCRIPT_FLAGS="-Wl,"
  157. ;;
  158. * )
  159. VERSION_SCRIPT_FLAGS=-Wl,--version-script=
  160. `$LD --help 2>&1 | grep -- --version-script >/dev/null` || \
  161. VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
  162. ;;
  163. esac
  164. AC_MSG_RESULT([$VERSION_SCRIPT_FLAGS])
  165. AC_SUBST([VERSION_SCRIPT_FLAGS])
  166. dnl Specify if we rely on ifconfig instead of iproute2 (e.g. in case
  167. dnl we're working on BSD)
  168. want_ifconfig=no
  169. dnl Make some notes about which OS we're compiling for, as the lxc and qemu
  170. dnl drivers require linux headers, and storage_mpath, dtrace, and nwfilter
  171. dnl are also linux specific. The "network" and storage_fs drivers are known
  172. dnl to not work on macOS presently, so we also make a note if compiling
  173. dnl for that
  174. with_linux=no with_macos=no with_freebsd=no with_win=no
  175. case $host in
  176. *-*-linux*) with_linux=yes ;;
  177. *-*-darwin*) with_macos=yes ;;
  178. *-*-freebsd*) with_freebsd=yes ;;
  179. *-*-mingw* | *-*-msvc* ) with_win=yes ;;
  180. esac
  181. if test $with_linux = no; then
  182. if test "x$with_lxc" != xyes
  183. then
  184. with_lxc=no
  185. fi
  186. with_dtrace=no
  187. with_storage_scsi=no
  188. fi
  189. if test $with_freebsd = yes; then
  190. want_ifconfig=yes
  191. with_firewalld=no
  192. fi
  193. AM_CONDITIONAL([WITH_LINUX], [test "$with_linux" = "yes"])
  194. AM_CONDITIONAL([WITH_FREEBSD], [test "$with_freebsd" = "yes"])
  195. AM_CONDITIONAL([WITH_MACOS], [test "$with_macos" = "yes"])
  196. if test "$with_win" = "yes" ; then
  197. # We don't support the daemon yet
  198. with_libvirtd=no
  199. # For AI_ADDRCONFIG
  200. AC_DEFINE([_WIN32_WINNT], [0x0600], [Win Vista / Server 2008])
  201. AC_DEFINE([WINVER], [0x0600], [Win Vista / Server 2008])
  202. fi
  203. # The daemon requires remote support. Likewise, if we are not using
  204. # RPC, we don't need several libraries.
  205. if test "$with_remote" = "no" ; then
  206. with_libvirtd=no
  207. with_ssh2=no
  208. with_sasl=no
  209. with_libssh=no
  210. fi
  211. # Stateful drivers are useful only when building the daemon.
  212. if test "$with_libvirtd" = "no" ; then
  213. with_qemu=no
  214. with_lxc=no
  215. with_libxl=no
  216. with_vbox=no
  217. fi
  218. # Check for compiler and library settings.
  219. LIBVIRT_COMPILE_WARNINGS
  220. LIBVIRT_COMPILE_PIE
  221. LIBVIRT_LINKER_RELRO
  222. LIBVIRT_LINKER_NO_INDIRECT
  223. LIBVIRT_LINKER_NO_UNDEFINED
  224. LIBVIRT_ARG_APPARMOR
  225. LIBVIRT_ARG_ATTR
  226. LIBVIRT_ARG_AUDIT
  227. LIBVIRT_ARG_BASH_COMPLETION
  228. LIBVIRT_ARG_BLKID
  229. LIBVIRT_ARG_CAPNG
  230. LIBVIRT_ARG_CURL
  231. LIBVIRT_ARG_DBUS
  232. LIBVIRT_ARG_FIREWALLD
  233. LIBVIRT_ARG_FIREWALLD_ZONE
  234. LIBVIRT_ARG_FUSE
  235. LIBVIRT_ARG_GLUSTER
  236. LIBVIRT_ARG_HAL
  237. LIBVIRT_ARG_LIBISCSI
  238. LIBVIRT_ARG_LIBPCAP
  239. LIBVIRT_ARG_LIBSSH
  240. LIBVIRT_ARG_LIBXML
  241. LIBVIRT_ARG_MACVTAP
  242. LIBVIRT_ARG_NETCF
  243. LIBVIRT_ARG_NLS
  244. LIBVIRT_ARG_NSS
  245. LIBVIRT_ARG_NUMACTL
  246. LIBVIRT_ARG_OPENWSMAN
  247. LIBVIRT_ARG_PCIACCESS
  248. LIBVIRT_ARG_PM_UTILS
  249. LIBVIRT_ARG_POLKIT
  250. LIBVIRT_ARG_READLINE
  251. LIBVIRT_ARG_SANLOCK
  252. LIBVIRT_ARG_SASL
  253. LIBVIRT_ARG_SELINUX
  254. LIBVIRT_ARG_SSH2
  255. LIBVIRT_ARG_UDEV
  256. LIBVIRT_ARG_VIRTUALPORT
  257. LIBVIRT_ARG_WIRESHARK
  258. LIBVIRT_ARG_YAJL
  259. LIBVIRT_CHECK_ACL
  260. LIBVIRT_CHECK_APPARMOR
  261. LIBVIRT_CHECK_ATTR
  262. LIBVIRT_CHECK_AUDIT
  263. LIBVIRT_CHECK_BASH_COMPLETION
  264. LIBVIRT_CHECK_BLKID
  265. LIBVIRT_CHECK_CAPNG
  266. LIBVIRT_CHECK_CURL
  267. LIBVIRT_CHECK_DBUS
  268. LIBVIRT_CHECK_DEVMAPPER
  269. LIBVIRT_CHECK_DLOPEN
  270. LIBVIRT_CHECK_FIREWALLD
  271. LIBVIRT_CHECK_FIREWALLD_ZONE
  272. LIBVIRT_CHECK_FUSE
  273. LIBVIRT_CHECK_GLIB
  274. LIBVIRT_CHECK_GLUSTER
  275. LIBVIRT_CHECK_GNUTLS
  276. LIBVIRT_CHECK_HAL
  277. LIBVIRT_CHECK_LIBISCSI
  278. LIBVIRT_CHECK_LIBNL
  279. LIBVIRT_CHECK_LIBPARTED
  280. LIBVIRT_CHECK_LIBPCAP
  281. LIBVIRT_CHECK_LIBSSH
  282. LIBVIRT_CHECK_LIBXML
  283. LIBVIRT_CHECK_MACVTAP
  284. LIBVIRT_CHECK_NETCF
  285. LIBVIRT_CHECK_NLS
  286. LIBVIRT_CHECK_NUMACTL
  287. LIBVIRT_CHECK_NWFILTER
  288. LIBVIRT_CHECK_OPENWSMAN
  289. LIBVIRT_CHECK_PCIACCESS
  290. LIBVIRT_CHECK_PM_UTILS
  291. LIBVIRT_CHECK_POLKIT
  292. LIBVIRT_CHECK_PTHREAD
  293. LIBVIRT_CHECK_READLINE
  294. LIBVIRT_CHECK_SANLOCK
  295. LIBVIRT_CHECK_SASL
  296. LIBVIRT_CHECK_SELINUX
  297. LIBVIRT_CHECK_SSH2
  298. LIBVIRT_CHECK_UDEV
  299. LIBVIRT_CHECK_VIRTUALPORT
  300. LIBVIRT_CHECK_WIRESHARK
  301. LIBVIRT_CHECK_XDR
  302. LIBVIRT_CHECK_YAJL
  303. AC_CHECK_SIZEOF([long])
  304. dnl Availability of various common functions (non-fatal if missing),
  305. dnl and various less common threadsafe functions
  306. AC_CHECK_FUNCS_ONCE([\
  307. fallocate \
  308. getegid \
  309. geteuid \
  310. getgid \
  311. getifaddrs \
  312. getmntent_r \
  313. getpwuid_r \
  314. getrlimit \
  315. getuid \
  316. getutxid \
  317. if_indextoname \
  318. mmap \
  319. newlocale \
  320. posix_fallocate \
  321. posix_memalign \
  322. pipe2 \
  323. prlimit \
  324. sched_getaffinity \
  325. sched_setscheduler \
  326. setgroups \
  327. setns \
  328. setrlimit \
  329. symlink \
  330. sysctlbyname \
  331. unshare \
  332. ])
  333. dnl Availability of various common headers (non-fatal if missing).
  334. AC_CHECK_HEADERS([\
  335. ifaddrs.h \
  336. libtasn1.h \
  337. util.h \
  338. libutil.h \
  339. linux/magic.h \
  340. mntent.h \
  341. net/ethernet.h \
  342. net/if.h \
  343. pty.h \
  344. pwd.h \
  345. stdarg.h \
  346. syslog.h \
  347. sys/ioctl.h \
  348. sys/mount.h \
  349. sys/syscall.h \
  350. sys/sysctl.h \
  351. sys/ucred.h \
  352. xlocale.h \
  353. ])
  354. dnl Check whether endian provides handy macros.
  355. AC_CHECK_DECLS([htole64], [], [], [[#include <endian.h>]])
  356. AC_CHECK_FUNCS([stat stat64 __xstat __xstat64 lstat lstat64 __lxstat __lxstat64])
  357. AC_CHECK_TYPE([struct ifreq],
  358. [AC_DEFINE([HAVE_STRUCT_IFREQ],[1],
  359. [Defined if struct ifreq exists in net/if.h])],
  360. [], [[#include <sys/socket.h>
  361. #include <net/if.h>
  362. ]])
  363. AC_CHECK_TYPE([struct sockpeercred],
  364. [AC_DEFINE([HAVE_STRUCT_SOCKPEERCRED], [1],
  365. [Defined if struct sockpeercred is available])],
  366. [], [[#include <sys/socket.h>
  367. ]])
  368. AC_CHECK_DECLS([ETH_FLAG_TXVLAN, ETH_FLAG_NTUPLE, ETH_FLAG_RXHASH, ETH_FLAG_LRO,
  369. ETHTOOL_GGSO, ETHTOOL_GGRO, ETHTOOL_GFLAGS, ETHTOOL_GFEATURES,
  370. ETHTOOL_SCOALESCE, ETHTOOL_GCOALESCE],
  371. [], [], [[#include <linux/ethtool.h>
  372. ]])
  373. AC_CHECK_DECLS([SEEK_HOLE], [], [],
  374. [#include <sys/types.h>
  375. #include <unistd.h>])
  376. dnl Our only use of libtasn1.h is in the testsuite, and can be skipped
  377. dnl if the header is not present. Assume -ltasn1 is present if the
  378. dnl header could be found.
  379. AM_CONDITIONAL([HAVE_LIBTASN1], [test "x$ac_cv_header_libtasn1_h" = "xyes"])
  380. AC_CHECK_LIB([intl],[gettext],[])
  381. AC_CHECK_LIB([util],[openpty],[])
  382. dnl
  383. dnl Check for external programs
  384. dnl
  385. LIBVIRT_CHECK_EXTERNAL_PROGRAMS
  386. dnl if --prefix is /usr, don't use /usr/var for localstatedir
  387. dnl or /usr/etc for sysconfdir
  388. dnl as this makes a lot of things break in testing situations
  389. if test "$prefix" = "/usr" && test "$localstatedir" = '${prefix}/var' ; then
  390. localstatedir='/var'
  391. fi
  392. if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc' ; then
  393. sysconfdir='/etc'
  394. fi
  395. dnl
  396. dnl Virtualization drivers check
  397. dnl
  398. LIBVIRT_DRIVER_ARG_QEMU
  399. LIBVIRT_DRIVER_ARG_OPENVZ
  400. LIBVIRT_DRIVER_ARG_VMWARE
  401. LIBVIRT_DRIVER_ARG_LIBXL
  402. LIBVIRT_DRIVER_ARG_VBOX
  403. LIBVIRT_DRIVER_ARG_LXC
  404. LIBVIRT_DRIVER_ARG_VZ
  405. LIBVIRT_DRIVER_ARG_BHYVE
  406. LIBVIRT_DRIVER_ARG_ESX
  407. LIBVIRT_DRIVER_ARG_HYPERV
  408. LIBVIRT_DRIVER_ARG_TEST
  409. LIBVIRT_DRIVER_ARG_REMOTE
  410. LIBVIRT_DRIVER_ARG_LIBVIRTD
  411. LIBVIRT_DRIVER_ARG_NETWORK
  412. LIBVIRT_DRIVER_ARG_INTERFACE
  413. LIBVIRT_DRIVER_CHECK_QEMU
  414. LIBVIRT_DRIVER_CHECK_OPENVZ
  415. LIBVIRT_DRIVER_CHECK_VMWARE
  416. LIBVIRT_DRIVER_CHECK_LIBXL
  417. LIBVIRT_DRIVER_CHECK_VBOX
  418. LIBVIRT_DRIVER_CHECK_LXC
  419. LIBVIRT_DRIVER_CHECK_VZ
  420. LIBVIRT_DRIVER_CHECK_BHYVE
  421. LIBVIRT_DRIVER_CHECK_ESX
  422. LIBVIRT_DRIVER_CHECK_HYPERV
  423. LIBVIRT_DRIVER_CHECK_TEST
  424. LIBVIRT_DRIVER_CHECK_REMOTE
  425. LIBVIRT_DRIVER_CHECK_LIBVIRTD
  426. LIBVIRT_DRIVER_CHECK_NETWORK
  427. LIBVIRT_DRIVER_CHECK_INTERFACE
  428. dnl
  429. dnl in case someone want to build static binaries
  430. dnl STATIC_BINARIES="-static"
  431. dnl
  432. STATIC_BINARIES=
  433. AC_SUBST([STATIC_BINARIES])
  434. dnl
  435. dnl Miscellaneous checks
  436. dnl
  437. LIBVIRT_ARG_DEBUG
  438. LIBVIRT_ARG_DTRACE
  439. LIBVIRT_ARG_NUMAD
  440. LIBVIRT_ARG_INIT_SCRIPT
  441. LIBVIRT_ARG_CHRDEV_LOCK_FILES
  442. LIBVIRT_ARG_DEFAULT_EDITOR
  443. LIBVIRT_ARG_LOADER_NVRAM
  444. LIBVIRT_ARG_LOGIN_SHELL
  445. LIBVIRT_ARG_HOST_VALIDATE
  446. LIBVIRT_ARG_TLS_PRIORITY
  447. LIBVIRT_ARG_SYSCTL_CONFIG
  448. LIBVIRT_CHECK_DEBUG
  449. LIBVIRT_CHECK_DTRACE
  450. LIBVIRT_CHECK_NUMAD
  451. LIBVIRT_CHECK_INIT_SCRIPT
  452. LIBVIRT_CHECK_CHRDEV_LOCK_FILES
  453. LIBVIRT_CHECK_DEFAULT_EDITOR
  454. LIBVIRT_CHECK_LOADER_NVRAM
  455. LIBVIRT_CHECK_LOGIN_SHELL
  456. LIBVIRT_CHECK_HOST_VALIDATE
  457. LIBVIRT_CHECK_TLS_PRIORITY
  458. LIBVIRT_CHECK_SYSCTL_CONFIG
  459. LIBVIRT_CHECK_NSS
  460. dnl
  461. dnl check for kvm headers
  462. dnl
  463. AC_CHECK_HEADERS([linux/kvm.h])
  464. dnl
  465. dnl check for kernel headers required by src/bridge.c
  466. dnl
  467. if test "$with_linux" = "yes"; then
  468. # Various kernel versions have headers that are not self-standing, but
  469. # yet are incompatible with the corresponding glibc headers. In order
  470. # to guarantee compilation across a wide range of versions (from RHEL 5
  471. # to rawhide), we first have to probe whether glibc and kernel can be
  472. # used in tandem; and if not, provide workarounds that ensure that
  473. # ABI-compatible IPv6 types are present for use by the kernel headers.
  474. # These probes mirror the usage in virnetdevbridge.c
  475. AC_CACHE_CHECK(
  476. [whether <linux/*.h> and <netinet/*.h> headers are compatible],
  477. [lv_cv_netinet_linux_compatible],
  478. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  479. #include <netinet/in.h>
  480. #include <linux/in6.h>
  481. ]])],
  482. [lv_cv_netinet_linux_compatible=yes],
  483. [lv_cv_netinet_linux_compatible=no])])
  484. if test "x$lv_cv_netinet_linux_compatible" != xyes; then
  485. AC_DEFINE([NETINET_LINUX_WORKAROUND], [1],
  486. [define to 1 if Linux kernel headers require a workaround to avoid
  487. compilation errors when mixed with glibc netinet headers])
  488. fi
  489. AC_CHECK_HEADERS([linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h],,
  490. [AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt with QEMU or LXC support])],
  491. [[#include <netinet/in.h>
  492. #if NETINET_LINUX_WORKAROUND
  493. # define in6_addr in6_addr_
  494. # define sockaddr_in6 sockaddr_in6_
  495. # define ipv6_mreq ipv6_mreq_
  496. # define in6addr_any in6addr_any_
  497. # define in6addr_loopback in6addr_loopback_
  498. #endif
  499. #include <linux/in6.h>
  500. ]])
  501. fi
  502. dnl Need to test if pkg-config exists
  503. PKG_PROG_PKG_CONFIG
  504. dnl Security driver checks
  505. LIBVIRT_SECDRIVER_ARG_SELINUX
  506. LIBVIRT_SECDRIVER_ARG_APPARMOR
  507. LIBVIRT_SECDRIVER_CHECK_SELINUX
  508. LIBVIRT_SECDRIVER_CHECK_APPARMOR
  509. LIBVIRT_ARG_WITH_FEATURE([SECRETS], [local secrets management driver], [yes])
  510. if test "$with_libvirtd" = "no"; then
  511. with_secrets=no
  512. fi
  513. if test "$with_secrets" = "yes" ; then
  514. AC_DEFINE_UNQUOTED([WITH_SECRETS], 1, [whether local secrets management driver is available])
  515. fi
  516. AM_CONDITIONAL([WITH_SECRETS], [test "$with_secrets" = "yes"])
  517. dnl
  518. dnl Storage driver checks
  519. dnl
  520. LIBVIRT_STORAGE_ARG_DIR
  521. LIBVIRT_STORAGE_ARG_FS
  522. LIBVIRT_STORAGE_ARG_LVM
  523. LIBVIRT_STORAGE_ARG_ISCSI
  524. LIBVIRT_STORAGE_ARG_ISCSI_DIRECT
  525. LIBVIRT_STORAGE_ARG_SCSI
  526. LIBVIRT_STORAGE_ARG_MPATH
  527. LIBVIRT_STORAGE_ARG_DISK
  528. LIBVIRT_STORAGE_ARG_RBD
  529. LIBVIRT_STORAGE_ARG_SHEEPDOG
  530. LIBVIRT_STORAGE_ARG_GLUSTER
  531. LIBVIRT_STORAGE_ARG_ZFS
  532. LIBVIRT_STORAGE_ARG_VSTORAGE
  533. if test "$with_libvirtd" = "no"; then
  534. with_storage_dir=no
  535. with_storage_fs=no
  536. with_storage_lvm=no
  537. with_storage_iscsi=no
  538. with_storage_iscsi_direct=no
  539. with_storage_scsi=no
  540. with_storage_mpath=no
  541. with_storage_disk=no
  542. with_storage_rbd=no
  543. with_storage_sheepdog=no
  544. with_storage_gluster=no
  545. with_storage_zfs=no
  546. with_storage_vstorage=no
  547. fi
  548. dnl storage-fs does not work on macOS
  549. if test "$with_macos" = "yes"; then
  550. with_storage_fs=no
  551. fi
  552. LIBVIRT_STORAGE_CHECK_DIR
  553. LIBVIRT_STORAGE_CHECK_FS
  554. LIBVIRT_STORAGE_CHECK_LVM
  555. LIBVIRT_STORAGE_CHECK_ISCSI
  556. LIBVIRT_STORAGE_CHECK_ISCSI_DIRECT
  557. LIBVIRT_STORAGE_CHECK_SCSI
  558. LIBVIRT_STORAGE_CHECK_MPATH
  559. LIBVIRT_STORAGE_CHECK_DISK
  560. LIBVIRT_STORAGE_CHECK_RBD
  561. LIBVIRT_STORAGE_CHECK_SHEEPDOG
  562. LIBVIRT_STORAGE_CHECK_GLUSTER
  563. LIBVIRT_STORAGE_CHECK_ZFS
  564. LIBVIRT_STORAGE_CHECK_VSTORAGE
  565. with_storage=no
  566. for backend in dir fs lvm iscsi iscsi_direct scsi mpath rbd disk; do
  567. if eval test \$with_storage_$backend = yes; then
  568. with_storage=yes
  569. break
  570. fi
  571. done
  572. if test $with_storage = yes; then
  573. AC_DEFINE([WITH_STORAGE], [1],
  574. [Define to 1 if at least one storage backend is in use])
  575. fi
  576. AM_CONDITIONAL([WITH_STORAGE], [test "$with_storage" = "yes"])
  577. dnl
  578. dnl check for kernel headers required by btrfs ioctl
  579. dnl
  580. if test "$with_linux" = "yes"; then
  581. AC_CHECK_HEADERS([linux/btrfs.h])
  582. fi
  583. dnl
  584. dnl check for xfs dev headers required by xfs ioctl
  585. dnl
  586. if test "$with_linux" = "yes"; then
  587. AC_CHECK_HEADERS([xfs/xfs.h])
  588. fi
  589. dnl
  590. dnl check for DEVLINK_CMD_ESWITCH_GET
  591. dnl
  592. dnl Assume DEVLINK_ESWITCH_MODE_SWITCHDEV is also
  593. dnl available, as it was introudced in kernel 4.8
  594. dnl along with the original spelling of this constant
  595. dnl (DEVLINK_CMD_ESWITCH_MODE_GET, not supported by libvirt)
  596. dnl
  597. if test "$with_linux" = "yes"; then
  598. AC_CHECK_HEADERS([linux/devlink.h])
  599. AC_CHECK_DECLS([DEVLINK_CMD_ESWITCH_GET], [], [],
  600. [[#include <linux/devlink.h>]])
  601. fi
  602. dnl
  603. dnl check for VHOST_VSOCK_SET_GUEST_CID
  604. dnl
  605. if test "$with_linux" = "yes"; then
  606. AC_CHECK_DECLS([VHOST_VSOCK_SET_GUEST_CID], [], [],
  607. [[#include <linux/vhost.h>]])
  608. fi
  609. dnl Allow perl/python overrides
  610. AC_PATH_PROGS([PYTHON], [python3])
  611. if test -z "$PYTHON"; then
  612. AC_MSG_ERROR(['python3' binary is required to build libvirt])
  613. fi
  614. AC_DEFINE_UNQUOTED([PYTHON], "$PYTHON", [path to python binary])
  615. AC_PATH_PROG([FLAKE8], [flake8])
  616. if test -z "$FLAKE8"; then
  617. AC_MSG_WARN(['flake8' binary is required to check python code style])
  618. fi
  619. dnl Python3 < 3.7 treats the C locale as 7-bit only.
  620. dnl We must force env vars so it treats it as UTF-8
  621. dnl regardless of the user's locale.
  622. RUNUTF8="LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8"
  623. AC_SUBST(RUNUTF8)
  624. AC_PATH_PROG([PERL], [perl])
  625. if test -z "$PERL"; then
  626. AC_MSG_ERROR(['perl' binary is required to build libvirt])
  627. fi
  628. LIBVIRT_ARG_WITH([TEST_SUITE], [build test suite by default], [check])
  629. case "$with_test_suite" in
  630. yes|no|check) ;;
  631. *) AC_MSG_ERROR([bad value ${withval} for tests option]) ;;
  632. esac
  633. AC_MSG_CHECKING([Whether to build test suite by default])
  634. if test "$with_test_suite" = "check" ; then
  635. if test -d $srcdir/.git ; then
  636. with_test_suite=yes
  637. else
  638. with_test_suite=no
  639. fi
  640. fi
  641. AC_MSG_RESULT([$with_test_suite])
  642. AM_CONDITIONAL([WITH_TESTS], [test "$with_test_suite" = "yes"])
  643. LIBVIRT_ARG_ENABLE([EXPENSIVE_TESTS],
  644. [set the default for enabling expensive tests ]
  645. [(long timeouts), use VIR_TEST_EXPENSIVE to ]
  646. [override during make],
  647. [check])
  648. case "$enable_expensive_tests" in
  649. 0|no) VIR_TEST_EXPENSIVE_DEFAULT=0 ;;
  650. 1|yes) VIR_TEST_EXPENSIVE_DEFAULT=1 ;;
  651. check) ;;
  652. *) AC_MSG_ERROR([bad value ${enable_expensive_tests} for enable-expensive-tests option]) ;;
  653. esac
  654. if test "$enable_expensive_tests" = check; then
  655. if test -d $srcdir/.git ; then
  656. VIR_TEST_EXPENSIVE_DEFAULT=0
  657. else
  658. VIR_TEST_EXPENSIVE_DEFAULT=1
  659. fi
  660. fi
  661. AC_SUBST([VIR_TEST_EXPENSIVE_DEFAULT])
  662. AM_CONDITIONAL([WITH_EXPENSIVE_TESTS], [test $VIR_TEST_EXPENSIVE_DEFAULT = 1])
  663. LIBVIRT_ARG_ENABLE([TEST_COVERAGE], [turn on code coverage instrumentation], [no])
  664. case "$enable_test_coverage" in
  665. yes|no) ;;
  666. *) AC_MSG_ERROR([bad value ${enable_test_coverga} for test-coverage option]) ;;
  667. esac
  668. if test "$enable_test_coverage" = yes; then
  669. save_WARN_CFLAGS=$WARN_CFLAGS
  670. WARN_CFLAGS=
  671. gl_WARN_ADD([-fprofile-arcs])
  672. gl_WARN_ADD([-ftest-coverage])
  673. COVERAGE_FLAGS=$WARN_CFLAGS
  674. AC_SUBST([COVERAGE_CFLAGS], [$COVERAGE_FLAGS])
  675. AC_SUBST([COVERAGE_LDFLAGS], [$COVERAGE_FLAGS])
  676. WARN_CFLAGS=$save_WARN_CFLAGS
  677. fi
  678. dnl MinGW checks
  679. LIBVIRT_WIN_CHECK_COMMON
  680. LIBVIRT_WIN_CHECK_MINGW
  681. LIBVIRT_WIN_CHECK_SYMBOLS
  682. LIBVIRT_WIN_CHECK_WINDRES
  683. dnl Driver-Modules library support
  684. LIBVIRT_ARG_DRIVER_MODULES
  685. LIBVIRT_CHECK_DRIVER_MODULES
  686. # Set LV_LIBTOOL_OBJDIR to "." or $lt_cv_objdir, depending on whether
  687. # we're building shared libraries. This is the name of the directory
  688. # in which .o files will be created.
  689. test "$enable_shared" = no && lt_cv_objdir=.
  690. LV_LIBTOOL_OBJDIR=${lt_cv_objdir-.}
  691. AC_SUBST([LV_LIBTOOL_OBJDIR])
  692. with_nodedev=no;
  693. if test "$with_hal" = "yes" || test "$with_udev" = "yes";
  694. then
  695. with_nodedev=yes
  696. AC_DEFINE_UNQUOTED([WITH_NODE_DEVICES], 1, [with node device driver])
  697. fi
  698. AM_CONDITIONAL([WITH_NODE_DEVICES], [test "$with_nodedev" = "yes"])
  699. dnl GET_VLAN_VID_CMD is required for virNetDevGetVLanID
  700. AC_CHECK_DECLS([GET_VLAN_VID_CMD], [], [], [[#include <linux/if_vlan.h>]])
  701. # Check for Linux vs. BSD ifreq members
  702. AC_CHECK_MEMBERS([struct ifreq.ifr_newname,
  703. struct ifreq.ifr_ifindex,
  704. struct ifreq.ifr_index,
  705. struct ifreq.ifr_hwaddr],
  706. [], [],
  707. [#include <sys/socket.h>
  708. #include <net/if.h>
  709. ])
  710. # Check for BSD approach for setting MAC addr
  711. AC_LINK_IFELSE([AC_LANG_PROGRAM(
  712. [[
  713. #include <sys/types.h>
  714. #include <sys/socket.h>
  715. #include <net/if_dl.h>
  716. ]],
  717. [[
  718. link_addr(0, 0)]])],
  719. [AC_DEFINE([HAVE_DECL_LINK_ADDR],
  720. [1],
  721. [whether link_addr is available])])
  722. # Check for BSD approach for bridge management
  723. AC_CHECK_DECLS([BRDGSFD, BRDGADD, BRDGDEL],
  724. [AC_DEFINE([HAVE_BSD_BRIDGE_MGMT],
  725. [1],
  726. [whether BSD style bridge management is available])],
  727. [],
  728. [#include <stdint.h>
  729. #include <net/if.h>
  730. #include <net/ethernet.h>
  731. #include <net/if_bridgevar.h>
  732. ])
  733. # Check for BSD CPU affinity availability
  734. AC_CHECK_DECLS([cpuset_getaffinity],
  735. [AC_DEFINE([HAVE_BSD_CPU_AFFINITY],
  736. [1],
  737. [whether BSD CPU affinity management is available])],
  738. [],
  739. [#include <sys/param.h>
  740. #include <sys/cpuset.h>
  741. ])
  742. # Check for BSD kvm (kernel memory interface)
  743. if test $with_freebsd = yes; then
  744. AC_CHECK_LIB([kvm], [kvm_getprocs], [],
  745. [AC_MSG_ERROR([BSD kernel memory interface library is required to build on FreeBSD])]
  746. )
  747. fi
  748. # FreeBSD 10-STABLE requires _IFI_OQDROPS to be defined for if_data.ifi_oqdrops
  749. # field be available
  750. old_CFLAGS="$CFLAGS"
  751. CFLAGS="$CFLAGS -D_IFI_OQDROPS"
  752. AC_CHECK_MEMBERS([struct if_data.ifi_oqdrops],
  753. [],
  754. [CFLAGS="$old_CFLAGS"],
  755. [#include <net/if.h>
  756. ])
  757. AC_CHECK_DECLS([clock_serv_t, host_get_clock_service, clock_get_time],
  758. [AC_DEFINE([HAVE_MACH_CLOCK_ROUTINES],
  759. [1],
  760. [whether Mach clock routines are available])],
  761. [],
  762. [#include <mach/clock.h>
  763. #include <mach/mach.h>
  764. ])
  765. # Check if we have new enough kernel to support BPF devices for cgroups v2
  766. if test "$with_linux" = "yes"; then
  767. AC_CHECK_DECLS([BPF_PROG_QUERY, BPF_CGROUP_DEVICE],
  768. [], [], [#include <linux/bpf.h>])
  769. fi
  770. # Check if we need to look for ifconfig
  771. if test "$want_ifconfig" = "yes"; then
  772. AC_PATH_PROG([IFCONFIG_PATH], [ifconfig])
  773. if test -z "$IFCONFIG_PATH"; then
  774. AC_MSG_ERROR([Failed to find ifconfig.])
  775. fi
  776. AC_DEFINE_UNQUOTED([IFCONFIG_PATH], "$IFCONFIG_PATH", [path to ifconfig binary])
  777. fi
  778. # Detect when running under the clang static analyzer's scan-build driver
  779. # or Coverity-prevent's cov-build. Define STATIC_ANALYSIS accordingly.
  780. AC_CACHE_CHECK([whether this build is done by a static analysis tool],
  781. [lv_cv_static_analysis], [
  782. lv_cv_static_analysis=no
  783. if test -n "${CCC_ANALYZER_ANALYSIS+set}" || \
  784. test -n "$COVERITY_BUILD_COMMAND$COVERITY_LD_PRELOAD"; then
  785. lv_cv_static_analysis=yes
  786. fi
  787. ])
  788. t=0
  789. test "x$lv_cv_static_analysis" = xyes && t=1
  790. AC_DEFINE_UNQUOTED([STATIC_ANALYSIS], [$t],
  791. [Define to 1 when performing static analysis.])
  792. GNUmakefile=GNUmakefile
  793. m4_if(m4_version_compare([2.61a.100],
  794. m4_defn([m4_PACKAGE_VERSION])), [1], [],
  795. [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
  796. [GNUmakefile=$GNUmakefile])])
  797. AC_CONFIG_FILES([run],
  798. [chmod +x,-w run])
  799. AC_CONFIG_FILES([\
  800. Makefile src/Makefile include/libvirt/Makefile docs/Makefile \
  801. .color_coded \
  802. .ycm_extra_conf.py \
  803. libvirt.pc \
  804. libvirt-qemu.pc \
  805. libvirt-lxc.pc \
  806. libvirt-admin.pc \
  807. src/libvirt.pc \
  808. src/libvirt-qemu.pc \
  809. src/libvirt-lxc.pc \
  810. libvirt.spec mingw-libvirt.spec \
  811. po/Makefile \
  812. include/libvirt/libvirt-common.h \
  813. examples/Makefile \
  814. tests/Makefile \
  815. tools/Makefile])
  816. AC_OUTPUT
  817. AC_MSG_NOTICE([])
  818. AC_MSG_NOTICE([Configuration summary])
  819. AC_MSG_NOTICE([=====================])
  820. AC_MSG_NOTICE([])
  821. AC_MSG_NOTICE([Drivers])
  822. AC_MSG_NOTICE([])
  823. LIBVIRT_DRIVER_RESULT_QEMU
  824. LIBVIRT_DRIVER_RESULT_OPENVZ
  825. LIBVIRT_DRIVER_RESULT_VMWARE
  826. LIBVIRT_DRIVER_RESULT_VBOX
  827. LIBVIRT_DRIVER_RESULT_LIBXL
  828. LIBVIRT_DRIVER_RESULT_LXC
  829. LIBVIRT_DRIVER_RESULT_ESX
  830. LIBVIRT_DRIVER_RESULT_HYPERV
  831. LIBVIRT_DRIVER_RESULT_VZ
  832. LIBVIRT_DRIVER_RESULT_BHYVE
  833. LIBVIRT_DRIVER_RESULT_TEST
  834. LIBVIRT_DRIVER_RESULT_REMOTE
  835. LIBVIRT_DRIVER_RESULT_NETWORK
  836. LIBVIRT_DRIVER_RESULT_LIBVIRTD
  837. LIBVIRT_DRIVER_RESULT_INTERFACE
  838. AC_MSG_NOTICE([])
  839. AC_MSG_NOTICE([Storage Drivers])
  840. AC_MSG_NOTICE([])
  841. LIBVIRT_STORAGE_RESULT_DIR
  842. LIBVIRT_STORAGE_RESULT_FS
  843. LIBVIRT_STORAGE_RESULT_LVM
  844. LIBVIRT_STORAGE_RESULT_ISCSI
  845. LIBVIRT_STORAGE_RESULT_ISCSI_DIRECT
  846. LIBVIRT_STORAGE_RESULT_SCSI
  847. LIBVIRT_STORAGE_RESULT_MPATH
  848. LIBVIRT_STORAGE_RESULT_DISK
  849. LIBVIRT_STORAGE_RESULT_RBD
  850. LIBVIRT_STORAGE_RESULT_SHEEPDOG
  851. LIBVIRT_STORAGE_RESULT_GLUSTER
  852. LIBVIRT_STORAGE_RESULT_ZFS
  853. LIBVIRT_STORAGE_RESULT_VSTORAGE
  854. AC_MSG_NOTICE([])
  855. AC_MSG_NOTICE([Security Drivers])
  856. AC_MSG_NOTICE([])
  857. LIBVIRT_SECDRIVER_RESULT_SELINUX
  858. LIBVIRT_SECDRIVER_RESULT_APPARMOR
  859. AC_MSG_NOTICE([])
  860. AC_MSG_NOTICE([Driver Loadable Modules])
  861. AC_MSG_NOTICE([])
  862. LIBVIRT_RESULT_DRIVER_MODULES
  863. AC_MSG_NOTICE([])
  864. AC_MSG_NOTICE([Libraries])
  865. AC_MSG_NOTICE([])
  866. LIBVIRT_RESULT_ACL
  867. LIBVIRT_RESULT_APPARMOR
  868. LIBVIRT_RESULT_ATTR
  869. LIBVIRT_RESULT_AUDIT
  870. LIBVIRT_RESULT_BASH_COMPLETION
  871. LIBVIRT_RESULT_BLKID
  872. LIBVIRT_RESULT_CAPNG
  873. LIBVIRT_RESULT_CURL
  874. LIBVIRT_RESULT_DBUS
  875. LIBVIRT_RESULT_DLOPEN
  876. LIBVIRT_RESULT_FIREWALLD
  877. LIBVIRT_RESULT_FIREWALLD_ZONE
  878. LIBVIRT_RESULT_FUSE
  879. LIBVIRT_RESULT_GLIB
  880. LIBVIRT_RESULT_GLUSTER
  881. LIBVIRT_RESULT_GNUTLS
  882. LIBVIRT_RESULT_HAL
  883. LIBVIRT_RESULT_LIBISCSI
  884. LIBVIRT_RESULT_LIBNL
  885. LIBVIRT_RESULT_LIBPCAP
  886. LIBVIRT_RESULT_LIBSSH
  887. LIBVIRT_RESULT_LIBXL
  888. LIBVIRT_RESULT_LIBXML
  889. LIBVIRT_RESULT_MACVTAP
  890. LIBVIRT_RESULT_NETCF
  891. LIBVIRT_RESULT_NLS
  892. LIBVIRT_RESULT_NSS
  893. LIBVIRT_RESULT_NUMACTL
  894. LIBVIRT_RESULT_OPENWSMAN
  895. LIBVIRT_RESULT_PCIACCESS
  896. LIBVIRT_RESULT_PM_UTILS
  897. LIBVIRT_RESULT_POLKIT
  898. LIBVIRT_RESULT_RBD
  899. LIBVIRT_RESULT_READLINE
  900. LIBVIRT_RESULT_SANLOCK
  901. LIBVIRT_RESULT_SASL
  902. LIBVIRT_RESULT_SELINUX
  903. LIBVIRT_RESULT_SSH2
  904. LIBVIRT_RESULT_UDEV
  905. LIBVIRT_RESULT_VIRTUALPORT
  906. LIBVIRT_RESULT_XDR
  907. LIBVIRT_RESULT_YAJL
  908. AC_MSG_NOTICE([])
  909. AC_MSG_NOTICE([Windows])
  910. AC_MSG_NOTICE([])
  911. LIBVIRT_WIN_RESULT_COMMON
  912. LIBVIRT_WIN_RESULT_WINDRES
  913. AC_MSG_NOTICE([])
  914. AC_MSG_NOTICE([Test suite])
  915. AC_MSG_NOTICE([])
  916. LIBVIRT_RESULT([Coverage], [$enable_test_coverage])
  917. AC_MSG_NOTICE([])
  918. AC_MSG_NOTICE([Miscellaneous])
  919. AC_MSG_NOTICE([])
  920. LIBVIRT_RESULT_DEBUG
  921. LIBVIRT_RESULT([Use -Werror], [$enable_werror])
  922. LIBVIRT_RESULT([Warning Flags], [$WARN_CFLAGS])
  923. LIBVIRT_RESULT_DTRACE
  924. LIBVIRT_RESULT_NUMAD
  925. LIBVIRT_RESULT_INIT_SCRIPT
  926. LIBVIRT_RESULT_CHRDEV_LOCK_FILES
  927. LIBVIRT_RESULT_DEFAULT_EDITOR
  928. LIBVIRT_RESULT_LOADER_NVRAM
  929. LIBVIRT_RESULT_LOGIN_SHELL
  930. LIBVIRT_RESULT_HOST_VALIDATE
  931. LIBVIRT_RESULT_TLS_PRIORITY
  932. AC_MSG_NOTICE([])
  933. AC_MSG_NOTICE([Developer Tools])
  934. AC_MSG_NOTICE([])
  935. LIBVIRT_RESULT_WIRESHARK
  936. AC_MSG_NOTICE([])
  937. AC_MSG_NOTICE([Privileges])
  938. AC_MSG_NOTICE([])
  939. LIBVIRT_RESULT_QEMU_PRIVILEGES
  940. AC_MSG_NOTICE([])