kvm: qemu: add missing include for ia64
[kvm-userspace.git] / configure
blob249c743f66395ea1aa1e992a76c965c3910a0ee1
1 #!/bin/bash
3 prefix=/usr/local
4 kerneldir=/lib/modules/$(uname -r)/build
5 cc=gcc
6 ld=ld
7 objcopy=objcopy
8 ar=ar
9 want_module=1
10 qemu_cflags=
11 qemu_ldflags=
12 kvm_trace=
13 qemu_opts=()
14 cross_prefix=
15 arch=`uname -m`
16 target_exec=
17 # don't use uname if kerneldir is set
18 no_uname=
19 if [ -z "TMPDIR" ] ; then
20 TMPDIR=.
23 if [ ! -e kernel/Makefile ]; then
24 want_module=
27 usage() {
28 cat <<-EOF
29 Usage: $0 [options]
31 Options include:
32 --arch=ARCH architecture to compile for ($arch)
33 --cross-prefix=PREFIX prefix for cross compile
34 --prefix=PREFIX where to install things ($prefix)
35 --with-patched-kernel don't use external module
36 --with-kvm-trace Enable kvm_trace
37 --kerneldir=DIR kernel build directory ($kerneldir)
38 --qemu-cflags=CFLAGS CFLAGS to add to qemu configuration
39 --qemu-ldflags=LDFLAGS LDFLAGS to add to qemu configuration
41 Any additional option is given to qemu's configure verbatim; including:
43 EOF
44 cd qemu
45 ./configure --help | egrep "enable-|disable-" \
46 | grep -v user | grep -v system | grep -v kqemu | grep -v kvm \
47 | sed -e "s/^ / /g" \
48 | sed -e"s/ enable/enable/g" | sed -e "s/ disable/disable/g"
49 exit 1
52 while [[ "$1" = -* ]]; do
53 opt="$1"; shift
54 arg=
55 hasarg=
56 if [[ "$opt" = *=* ]]; then
57 arg="${opt#*=}"
58 opt="${opt%%=*}"
59 hasarg=1
61 case "$opt" in
62 --prefix)
63 prefix="$arg"
65 --kerneldir)
66 kerneldir="$arg"
67 no_uname=1
69 --with-patched-kernel)
70 want_module=
72 --with-kvm-trace)
73 kvm_trace=y
75 --qemu-cflags)
76 qemu_cflags="$arg"
78 --qemu-ldflags)
79 qemu_ldflags="$arg"
81 --arch)
82 arch="$arg"
84 --cross-prefix)
85 cross_prefix="$arg"
87 --help)
88 usage
91 qemu_opts=("${qemu_opts[@]}" "$opt${hasarg:+=$arg}")
93 esac
94 done
97 #set kenel directory
98 libkvm_kerneldir=$(readlink -f kernel)
100 case $arch in
101 i?86*|x86_64*)
102 arch=${arch/#i?86/i386}
103 target_exec="x86_64-softmmu"
104 qemu_cflags="$qemu_cflags -DCONFIG_X86"
106 ia64*)
107 target_exec="ia64-softmmu"
109 powerpc*)
110 target_exec="ppcemb-softmmu"
111 qemu_cflags="$qemu_cflags -I $PWD/libfdt"
112 qemu_ldflags="$qemu_ldflags -L $PWD/libfdt"
114 esac
116 processor=${arch#*-}
117 arch=${arch%%-*}
119 #configure kernel module
120 [ -e kernel/Makefile ] && (cd kernel;
121 ./configure \
122 --kerneldir="$kerneldir" \
123 --arch="$arch" \
124 $([ -z ${want_module} ] && echo "--with-patched-kernel") \
125 ${cross_prefix:+"--cross-prefix=$cross_prefix"} \
126 ${kvm_trace:+"--with-kvm-trace"}
129 #configure user dir
130 (cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \
131 --arch="$arch" --processor="$processor" \
132 ${cross_prefix:+"--cross-prefix=$cross_prefix"})
134 #configure qemu
135 (cd qemu; ./configure --target-list=$target_exec \
136 --disable-kqemu \
137 --extra-cflags="-I $PWD/../libkvm $qemu_cflags" \
138 --extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \
139 --kerneldir="$libkvm_kerneldir" \
140 --prefix="$prefix" \
141 ${cross_prefix:+"--cross-prefix=$cross_prefix"} \
142 ${cross_prefix:+"--cpu=$arch"} "${qemu_opts[@]}"
143 ) || usage
146 cat <<EOF > config.mak
147 ARCH=$arch
148 PROCESSOR=$processor
149 PREFIX=$prefix
150 KERNELDIR=$kerneldir
151 KERNELSOURCEDIR=$kernelsourcedir
152 LIBKVM_KERNELDIR=$libkvm_kerneldir
153 WANT_MODULE=$want_module
154 CROSS_COMPILE=$cross_prefix
155 CC=$cross_prefix$cc
156 LD=$cross_prefix$ld
157 OBJCOPY=$cross_prefix$objcopy
158 AR=$cross_prefix$ar