Restore kvm-17 code to use the host's cpuid vendor string
[qemu-kvm/fedora.git] / kvm / configure
blobe4d1ec609161d3b49d9aed9e42e828cff3621a9e
1 #!/bin/bash
3 prefix=/usr/local
4 kerneldir=/lib/modules/$(uname -r)/build
5 want_module=1
6 qemu_cc=$(ls /usr/bin/gcc3* /usr/bin/gcc-3* 2>/dev/null | tail -n1)
7 disable_gcc_check=
9 usage() {
10 cat <<-EOF
11 Usage: $0 [options]
13 Options include:
15 --prefix=PREFIX where to install things ($prefix)
16 --with-patched-kernel don't use external module
17 --kerneldir=DIR kernel build directory ($kerneldir)
18 --qemu-cc="$qemu_cc" compiler for qemu (needs gcc3.x) ($qemu_cc)
19 --disable-gcc-check don't insist on gcc-3.x
20 - this will break running without kvm
21 EOF
22 exit 1
26 # prefer gcc if its version is 3.* ( over a compat-gcc )
27 # do it before parsing command line arguments to enable the user
28 # to specify a specific gcc he/she likes.
29 if gcc -v 2>&1 | grep -q 'gcc *version *3\.[2-4]\.[0-9]'; then
30 qemu_cc=gcc
33 while [[ "$1" = -* ]]; do
34 opt="$1"; shift
35 arg=
36 if [[ "$opt" = *=* ]]; then
37 arg="${opt#*=}"
38 opt="${opt%%=*}"
40 case "$opt" in
41 --prefix)
42 prefix="$arg"
44 --kerneldir)
45 kerneldir="$arg"
47 --with-patched-kernel)
48 want_module=
50 --qemu-cc)
51 qemu_cc="$arg"
53 --disable-gcc-check)
54 disable_gcc_check=1
56 --help)
57 usage
60 usage
62 esac
63 done
65 if [[ -z "$qemu_cc" ]]; then
66 echo "$0: cannot locate gcc 3.x. please install it or specify with --qemu-cc"
67 exit 1
70 libkvm_kerneldir="$kerneldir"
71 if (( want_module )); then
72 libkvm_kerneldir=$(readlink -f kernel)
75 target_cpu() {
76 if [[ $(uname -m) = i?86 ]]; then
77 echo i386
78 else
79 uname -m
83 (cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir")
84 (cd qemu; ./configure --target-list=$(target_cpu)-softmmu --cc="$qemu_cc" \
85 --disable-kqemu --extra-cflags="-I $PWD/../user" \
86 --extra-ldflags="-L $PWD/../user" \
87 --enable-kvm --kernel-path="$libkvm_kerneldir" \
88 --enable-alsa \
89 ${disable_gcc_check:+"--disable-gcc-check"} \
90 --prefix="$prefix"
95 cat <<EOF > config.mak
96 PREFIX=$prefix
97 KERNELDIR=$kerneldir
98 WANT_MODULE=$want_module
99 EOF