[libvirt] [PATCH] build: hoist system-specific checks before library checks

Eric Blake eblake at redhat.com
Tue Sep 17 16:29:32 UTC 2013


Commit f92c7e3 fixed a regression for native builds, but introduced
a regression for cross-compilation builds; in particular,
./autobuild.sh on a Fedora system with mingw cross-compiler fails
with:

checking for qemu-kvm... /usr/bin/qemu-kvm
checking for yajl_parse_complete in -lyajl... no
checking for yajl_tree_parse in -lyajl... no
configure: error: You must install the libyajl library & headers to compile libvirt

Since we default $with_qemu to 'yes' rather than 'check', and then
flip that default based on platform-specific checks, those platform
specifics need to come prior to any library checks that depend on
the value of $with_qemu.

* configure.ac: Ensure system defaults are sane before checking
for things that make decisions based on system default.

Signed-off-by: Eric Blake <eblake at redhat.com>
---

I'm tempted to push this under the build-breaker rule, so that
I can get a successful ./autobuild.sh run.

 configure.ac | 85 +++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 44 insertions(+), 41 deletions(-)

diff --git a/configure.ac b/configure.ac
index 39b5fd5..69a01ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -160,6 +160,50 @@ VERSION_SCRIPT_FLAGS=-Wl,--version-script=
     VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
 AC_MSG_RESULT([$VERSION_SCRIPT_FLAGS])

+dnl Specify if we rely on ifconfig instead of iproute2 (e.g. in case
+dnl we're working on BSD)
+want_ifconfig=no
+
+dnl Make some notes about which OS we're compiling for, as the lxc and qemu
+dnl drivers require linux headers, and storage_mpath, dtrace, and nwfilter
+dnl are also linux specific.  The "network" and storage_fs drivers are known
+dnl to not work on MacOS X presently, so we also make a note if compiling
+dnl for that
+
+with_linux=no with_osx=no with_freebsd=no
+case $host in
+  *-*-linux*) with_linux=yes ;;
+  *-*-darwin*) with_osx=yes ;;
+  *-*-freebsd*) with_freebsd=yes ;;
+esac
+
+if test $with_linux = no; then
+    if test "x$with_lxc" != xyes
+    then
+        with_lxc=no
+    fi
+    with_dtrace=no
+fi
+
+if test $with_freebsd = yes; then
+   want_ifconfig=yes
+
+   with_firewalld=no
+fi
+
+if test $with_osx = yes; then
+   with_qemu=no
+fi
+
+AM_CONDITIONAL([WITH_LINUX], [test "$with_linux" = "yes"])
+AM_CONDITIONAL([WITH_FREEBSD], [test "$with_freebsd" = "yes"])
+
+if test "$with_libvirtd" = "no" ; then
+  with_qemu=no
+fi
+
+# Check for compiler and library settings.
+
 LIBVIRT_COMPILE_WARNINGS
 LIBVIRT_COMPILE_PIE
 LIBVIRT_LINKER_RELRO
@@ -391,44 +435,6 @@ if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc' ; then
     sysconfdir='/etc'
 fi

-dnl Specify if we rely on ifconfig instead of iproute2 (e.g. in case
-dnl we're working on BSD)
-want_ifconfig=no
-
-dnl Make some notes about which OS we're compiling for, as the lxc and qemu
-dnl drivers require linux headers, and storage_mpath, dtrace, and nwfilter
-dnl are also linux specific.  The "network" and storage_fs drivers are known
-dnl to not work on MacOS X presently, so we also make a note if compiling
-dnl for that
-
-with_linux=no with_osx=no with_freebsd=no
-case $host in
-  *-*-linux*) with_linux=yes ;;
-  *-*-darwin*) with_osx=yes ;;
-  *-*-freebsd*) with_freebsd=yes ;;
-esac
-
-if test $with_linux = no; then
-    if test "x$with_lxc" != xyes
-    then
-        with_lxc=no
-    fi
-    with_dtrace=no
-fi
-
-if test $with_freebsd = yes; then
-   want_ifconfig=yes
-
-   with_firewalld=no
-fi
-
-if test $with_osx = yes; then
-   with_qemu=no
-fi
-
-AM_CONDITIONAL([WITH_LINUX], [test "$with_linux" = "yes"])
-AM_CONDITIONAL([WITH_FREEBSD], [test "$with_freebsd" = "yes"])
-
 dnl Allow to build without Xen, QEMU/KVM, test or remote driver
 AC_ARG_WITH([xen],
   [AS_HELP_STRING([--with-xen],
@@ -721,9 +727,6 @@ if test "x$with_vbox" = "xyes"; then
 fi
 AM_CONDITIONAL([WITH_VBOX], [test "$with_vbox" = "yes"])

-if test "$with_libvirtd" = "no" ; then
-  with_qemu=no
-fi
 if test "$with_qemu" = "yes" ; then
     AC_DEFINE_UNQUOTED([WITH_QEMU], 1, [whether QEMU driver is enabled])
 fi
-- 
1.8.3.1




More information about the libvir-list mailing list