summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2008-10-07 11:47:24 +0200
committerAvi Kivity <avi@redhat.com>2008-10-07 16:42:46 +0200
commita845a7259724530d3cd39da2d2c2b608ed2c5a6a (patch)
treef69fc56506c93a05e83367d723900022333d93cf /configure
parent842bd806e13ad19741c0a93faa0a401a2fc4ce3f (diff)
kvm: external module: Make KVM compile on split source/object kernel configurations
KVM as is assumes that the kernel obj dir and the kernel source dir are at the same location. This is true for most self-built vanilla kernels, but some distributions split these up (e.g. SUSE). To keep compatible and have users have a good experience on building KVM on any distribution, this patch attempts to rebuild the logic from the kernel Makefile as closely as possible. With it I successfully built KVM on a current SUSE system. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure7
1 files changed, 7 insertions, 0 deletions
diff --git a/configure b/configure
index f6727bf0..3b5d14fa 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,7 @@
#!/bin/bash
prefix=/usr/local
+kernelsourcedir=
kerneldir=/lib/modules/$(uname -r)/build
cc=gcc
ld=ld
@@ -107,6 +108,11 @@ if [ "$arch" = "powerpc" ]; then
qemu_ldflags="$qemu_ldflags -L $PWD/libfdt"
fi
+# see if we have split build and source directories
+if [ -d "$kerneldir/include2" ]; then
+ kernelsourcedir=${kerneldir%/*}/source
+fi
+
#configure user dir
(cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \
--arch="$arch" \
@@ -129,6 +135,7 @@ cat <<EOF > config.mak
ARCH=$arch
PREFIX=$prefix
KERNELDIR=$kerneldir
+KERNELSOURCEDIR=$kernelsourcedir
LIBKVM_KERNELDIR=$libkvm_kerneldir
WANT_MODULE=$want_module
CROSS_COMPILE=$cross_prefix