kvm: kvmtrace: add kvmtrace format for TDP events
[kvm-userspace.git] / configure
blob39c8c8c178bbd4a7d7afc053d20e071f9a7c53dc
1 #!/bin/bash
3 prefix=/usr/local
4 kerneldir=/lib/modules/$(uname -r)/build
5 cc=cc
6 ld=ld
7 objcopy=objcopy
8 want_module=1
9 qemu_cc=
10 qemu_cflags=
11 qemu_ldflags=
12 qemu_opts=
13 cross_prefix=
14 arch=`uname -m`
15 target_exec=
17 usage() {
18 cat <<-EOF
19 Usage: $0 [options]
21 Options include:
22 --arch=ARCH architecture to compile for ($arch)
23 --cross-prefix=PREFIX prefix for cross compile
24 --prefix=PREFIX where to install things ($prefix)
25 --with-patched-kernel don't use external module
26 --kerneldir=DIR kernel build directory ($kerneldir)
27 --qemu-cc=CC specify compiler for qemu (must be gcc-3.x)
28 --qemu-cflags=CFLAGS CFLAGS to add to qemu configuration
29 --qemu-ldflags=LDFLAGS LDFLAGS to add to qemu configuration
31 Any additional option is given to qemu's configure verbatim; including:
33 --disable-gcc-check don't insist on gcc-3.x
34 CAUTION: this will break running without kvm
35 EOF
36 cd qemu
37 ./configure --help | egrep "enable-|disable-" \
38 | grep -v user | grep -v system | grep -v kqemu | grep -v kvm \
39 | sed -e "s/^ / /g" \
40 | sed -e"s/ enable/enable/g" | sed -e "s/ disable/disable/g"
41 exit 1
44 while [[ "$1" = -* ]]; do
45 opt="$1"; shift
46 arg=
47 if [[ "$opt" = *=* ]]; then
48 arg="${opt#*=}"
49 opt="${opt%%=*}"
51 case "$opt" in
52 --prefix)
53 prefix="$arg"
55 --kerneldir)
56 kerneldir="$arg"
58 --with-patched-kernel)
59 want_module=
61 --qemu-cc)
62 qemu_cc="$arg"
64 --qemu-cflags)
65 qemu_cflags="$arg"
67 --qemu-ldflags)
68 qemu_ldflags="$arg"
70 --arch)
71 arch="$arg"
73 --cross-prefix)
74 cross_prefix="$arg"
76 --help)
77 usage
80 qemu_opts="$qemu_opts $opt"
82 esac
83 done
86 #set kenel directory
87 libkvm_kerneldir=$(readlink -f kernel)
89 #if arch is an x86 arch set to i386
90 if [[ $arch = i?86 ]]; then
91 arch="i386"
94 #set parameters compiling
95 if [ "$arch" = "i386" -o "$arch" = "x86_64" ]; then
96 target_exec="x86_64-softmmu"
97 qemu_cflags="$qemu_cflags -DCONFIG_X86"
100 if [ "$arch" = "ia64" ]; then
101 target_exec="ia64-softmmu"
104 if [ "$arch" = "powerpc" ]; then
105 target_exec="ppcemb-softmmu"
106 qemu_cflags="$qemu_cflags -I $PWD/libfdt"
107 qemu_ldflags="$qemu_ldflags -L $PWD/libfdt"
110 #configure user dir
111 (cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \
112 --arch="$arch" \
113 ${cross_prefix:+"--cross-prefix=$cross_prefix"})
115 #configure qemu
116 (cd qemu; ./configure --target-list=$target_exec \
117 --disable-kqemu \
118 --extra-cflags="-I $PWD/../libkvm $qemu_cflags" \
119 --extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \
120 --kernel-path="$libkvm_kerneldir" \
121 --prefix="$prefix" \
122 ${qemu_cc:+"--cc=$qemu_cc"} \
123 ${cross_prefix:+"--cross-prefix=$cross_prefix"} \
124 ${cross_prefix:+"--cpu=$arch"} $qemu_opts
125 ) || usage
128 cat <<EOF > config.mak
129 ARCH=$arch
130 PREFIX=$prefix
131 KERNELDIR=$kerneldir
132 LIBKVM_KERNELDIR=$libkvm_kerneldir
133 WANT_MODULE=$want_module
134 CROSS_COMPILE=$cross_prefix
135 CC=$cross_prefix$cc
136 LD=$cross_prefix$ld
137 OBJCOPY=$cross_prefix$objcopy