kvm: libkvm: fix NULL pointer dereference in kvm_destroy_phys_mem()
[kvm-userspace.git] / configure
blobdadda8e0ae195415ce6b2c3caf2594832beda169
1 #!/bin/bash
3 prefix=/usr/local
4 kerneldir=/lib/modules/$(uname -r)/build
5 want_module=1
6 qemu_cc=
7 qemu_cflags=
8 qemu_ldflags=
9 enable_alsa=
10 disable_vnc_tls=
11 disable_gcc_check=
12 cross_prefix=
13 arch=`uname -m`
14 target_exec=
16 usage() {
17 cat <<-EOF
18 Usage: $0 [options]
20 Options include:
21 --arch=ARCH architecture to compile for ($arch)
22 --cross-prefix=PREFIX prefix for cross compile
23 --prefix=PREFIX where to install things ($prefix)
24 --with-patched-kernel don't use external module
25 --kerneldir=DIR kernel build directory ($kerneldir)
26 --qemu-cc=CC specify compiler for qemu (must be gcc-3.x)
27 --qemu-cflags=CFLAGS CFLAGS to add to qemu configuration
28 --qemu-ldflags=LDFLAGS LDFLAGS to add to qemu configuration
29 --enable-alsa enable alsa support for qemu
30 --disable-vnc-tls disable vnc tls support for qemu
31 --disable-gcc-check don't insist on gcc-3.x
32 CAUTION: this will break running without kvm
33 EOF
34 exit 1
37 while [[ "$1" = -* ]]; do
38 opt="$1"; shift
39 arg=
40 if [[ "$opt" = *=* ]]; then
41 arg="${opt#*=}"
42 opt="${opt%%=*}"
44 case "$opt" in
45 --prefix)
46 prefix="$arg"
48 --kerneldir)
49 kerneldir="$arg"
51 --with-patched-kernel)
52 want_module=
54 --qemu-cc)
55 qemu_cc="$arg"
57 --qemu-cflags)
58 qemu_cflags="$arg"
60 --qemu-ldflags)
61 qemu_ldflags="$arg"
63 --enable-alsa)
64 enable_alsa=1
66 --disable-vnc-tls)
67 disable_vnc_tls=1
69 --disable-gcc-check)
70 disable_gcc_check=1
72 --arch)
73 arch="$arg"
75 --cross-prefix)
76 cross_prefix="$arg"
78 --help)
79 usage
82 usage
84 esac
85 done
88 #set kenel directory
89 libkvm_kerneldir="$kerneldir"
90 if (( want_module )); then
91 libkvm_kerneldir=$(readlink -f kernel)
94 #if arch is an x86 arch set to i386
95 if [[ $arch = i?86 ]]; then
96 arch="i386"
99 #set parameters compiling
100 if [ "$arch" = "i386" -o "$arch" = "x86_64" ]; then
101 target_exec="x86_64-softmmu"
102 qemu_cflags="$qemu_cflags -DCONFIG_X86"
105 if [ "$arch" = "ia64" ]; then
106 target_exec="ia64-softmmu"
109 #configure user dir
110 (cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir" \
111 --arch="$arch" \
112 ${cross_prefix:+"--cross-prefix=$cross_prefix"})
114 #configure qemu
115 (cd qemu; ./configure --target-list=$target_exec \
116 --disable-kqemu \
117 --extra-cflags="-I $PWD/../libkvm $qemu_cflags" \
118 --extra-ldflags="-L $PWD/../libkvm $qemu_ldflags" \
119 --enable-kvm --kernel-path="$libkvm_kerneldir" \
120 ${enable_alsa:+"--enable-alsa"} \
121 ${disable_vnc_tls:+"--disable-vnc-tls"} \
122 ${disable_gcc_check:+"--disable-gcc-check"} \
123 --prefix="$prefix" \
124 ${qemu_cc:+"--cc=$qemu_cc"} \
125 ${cross_prefix:+"--cross-prefix=$cross_prefix"} \
126 ${cross_prefix:+"--cpu=$arch"}
130 cat <<EOF > config.mak
131 ARCH=$arch
132 PREFIX=$prefix
133 KERNELDIR=$kerneldir
134 WANT_MODULE=$want_module
135 CROSS_COMPILE=$cross_prefix