[libvirt] [PATCH] configure.ac: Avoid uname, which breaks cross-compilation

When cross-compiling on Linux, configure will misdetect the target as Linux because it uses uname instead of relying on the $host variable. This results in including libvirt_linux.syms into libvirt.syms and therefore trying to export undefined symbols. Replace uname checks with $host checks to fix this. --- configure.ac | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 6ee5b90..5d68dcc 100644 --- a/configure.ac +++ b/configure.ac @@ -210,8 +210,11 @@ if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc' ; then fi dnl lxc and qemu drivers require linux headers -if test `uname -s` != "Linux" -then +case "$host" in + *-*-linux*) + # match linux here so the *) case will match anything non-linux + ;; + *) if test "x$with_lxc" != "xyes" then with_lxc=no @@ -220,7 +223,8 @@ then then with_qemu=no fi -fi + ;; +esac dnl Allow to build without Xen, QEMU/KVM, test or remote driver AC_ARG_WITH([xen], @@ -1983,7 +1987,13 @@ then fi AM_CONDITIONAL([WITH_NODE_DEVICES], [test "$with_nodedev" = "yes"]) -AM_CONDITIONAL([WITH_LINUX], [test `uname -s` = "Linux"]) +with_linux=no +case "$host" in + *-*-linux*) + with_linux=yes + ;; +esac +AM_CONDITIONAL([WITH_LINUX], [test "$with_linux" = "yes"]) AC_ARG_WITH([qemu-user], -- 1.7.0.4

On 05/03/2010 05:41 PM, Matthias Bolte wrote:
When cross-compiling on Linux, configure will misdetect the target as Linux because it uses uname instead of relying on the $host variable. This results in including libvirt_linux.syms into libvirt.syms and therefore trying to export undefined symbols.
Replace uname checks with $host checks to fix this.
ACK -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Tue, May 04, 2010 at 01:41:55AM +0200, Matthias Bolte wrote:
When cross-compiling on Linux, configure will misdetect the target as Linux because it uses uname instead of relying on the $host variable. This results in including libvirt_linux.syms into libvirt.syms and therefore trying to export undefined symbols.
Replace uname checks with $host checks to fix this. --- configure.ac | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac index 6ee5b90..5d68dcc 100644 --- a/configure.ac +++ b/configure.ac @@ -210,8 +210,11 @@ if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc' ; then fi
dnl lxc and qemu drivers require linux headers -if test `uname -s` != "Linux" -then +case "$host" in + *-*-linux*) + # match linux here so the *) case will match anything non-linux + ;; + *) if test "x$with_lxc" != "xyes" then with_lxc=no @@ -220,7 +223,8 @@ then then with_qemu=no fi -fi + ;; +esac
dnl Allow to build without Xen, QEMU/KVM, test or remote driver AC_ARG_WITH([xen], @@ -1983,7 +1987,13 @@ then fi AM_CONDITIONAL([WITH_NODE_DEVICES], [test "$with_nodedev" = "yes"])
-AM_CONDITIONAL([WITH_LINUX], [test `uname -s` = "Linux"]) +with_linux=no +case "$host" in + *-*-linux*) + with_linux=yes + ;; +esac +AM_CONDITIONAL([WITH_LINUX], [test "$with_linux" = "yes"])
AC_ARG_WITH([qemu-user],
ACK, I looked at those recently but completely forgot we were cross-compiling for mingw ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 05/04/2010 02:54 AM, Daniel Veillard wrote:
On Tue, May 04, 2010 at 01:41:55AM +0200, Matthias Bolte wrote:
When cross-compiling on Linux, configure will misdetect the target as Linux because it uses uname instead of relying on the $host variable. This results in including libvirt_linux.syms into libvirt.syms and therefore trying to export undefined symbols.
Replace uname checks with $host checks to fix this.
ACK, I looked at those recently but completely forgot we were cross-compiling for mingw !
I've gotten a lot further with an in-tree run of ./autobuild.sh with this patch: the cross-build to mingw passed; now just creation of mingw32-libvirt rpm fails: Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/eblake/rpmbuild/BUILDROOT/mingw32-libvirt-0.8.1-3.fc12.eblake1272991027.i386 error: Installed (but unpackaged) file(s) found: /usr/i686-pc-mingw32/sys-root/mingw/share/libvirt/cpu_map.xml /usr/i686-pc-mingw32/sys-root/mingw/share/libvirt/schemas/nwfilter.rng Since this has been acked, and autobuild.sh is a prereq to some of my outstanding patches, I've gone ahead and pushed it. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (3)
-
Daniel Veillard
-
Eric Blake
-
Matthias Bolte