Revision e205c790 configure

b/configure
113 113
curses=""
114 114
docs=""
115 115
fdt=""
116
kvm=""
117
kvm_para=""
116
kvm="yes"
118 117
nptl=""
119 118
sdl=""
120 119
vnc="yes"
......
130 129
xen_ctrl_version=""
131 130
linux_aio=""
132 131
attr=""
133
vhost_net=""
132
vhost_net="yes"
134 133
xfs=""
135 134

  
136 135
gprof="no"
......
166 165
uname_release=""
167 166
io_thread="no"
168 167
mixemu="no"
169
kerneldir=""
170 168
aix="no"
171 169
blobs="yes"
172 170
pkgversion=""
......
715 713
  ;;
716 714
  --disable-blobs) blobs="no"
717 715
  ;;
718
  --kerneldir=*) kerneldir="$optarg"
719
  ;;
720 716
  --with-pkgversion=*) pkgversion=" ($optarg)"
721 717
  ;;
722 718
  --disable-docs) docs="no"
......
1005 1001
echo "  --enable-attr            enable attr and xattr support"
1006 1002
echo "  --enable-io-thread       enable IO thread"
1007 1003
echo "  --disable-blobs          disable installing provided firmware blobs"
1008
echo "  --kerneldir=PATH         look for kernel includes in PATH"
1009 1004
echo "  --enable-docs            enable documentation build"
1010 1005
echo "  --disable-docs           disable documentation build"
1011 1006
echo "  --disable-vhost-net      disable vhost-net acceleration support"
......
1779 1774
fi
1780 1775

  
1781 1776
##########################################
1782
# kvm probe
1783
if test "$kvm" != "no" ; then
1784
    cat > $TMPC <<EOF
1785
#include <linux/kvm.h>
1786
#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1787
#error Invalid KVM version
1788
#endif
1789
EOF
1790
    must_have_caps="KVM_CAP_USER_MEMORY \
1791
                    KVM_CAP_DESTROY_MEMORY_REGION_WORKS \
1792
                    KVM_CAP_COALESCED_MMIO \
1793
                    KVM_CAP_SYNC_MMU \
1794
                   "
1795
    if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) ; then
1796
      must_have_caps="$caps \
1797
                      KVM_CAP_SET_TSS_ADDR \
1798
                      KVM_CAP_EXT_CPUID \
1799
                      KVM_CAP_CLOCKSOURCE \
1800
                      KVM_CAP_NOP_IO_DELAY \
1801
                      KVM_CAP_PV_MMU \
1802
                      KVM_CAP_MP_STATE \
1803
                      KVM_CAP_USER_NMI \
1804
                     "
1805
    fi
1806
    for c in $must_have_caps ; do
1807
      cat >> $TMPC <<EOF
1808
#if !defined($c)
1809
#error Missing KVM capability $c
1810
#endif
1811
EOF
1812
    done
1813
    cat >> $TMPC <<EOF
1814
int main(void) { return 0; }
1815
EOF
1816
  if test "$kerneldir" != "" ; then
1817
      kvm_cflags=-I"$kerneldir"/include
1818
      if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1819
         -a -d "$kerneldir/arch/x86/include" ; then
1820
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1821
	elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1822
	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1823
	elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
1824
	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
1825
        elif test -d "$kerneldir/arch/$cpu/include" ; then
1826
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1827
      fi
1828
  else
1829
    kvm_cflags=`$pkg_config --cflags kvm-kmod 2>/dev/null`
1830
  fi
1831
  if compile_prog "$kvm_cflags" "" ; then
1832
    kvm=yes
1833
    cat > $TMPC <<EOF
1834
#include <linux/kvm_para.h>
1835
int main(void) { return 0; }
1836
EOF
1837
    if compile_prog "$kvm_cflags" "" ; then
1838
      kvm_para=yes
1839
    fi
1840
  else
1841
    if test "$kvm" = "yes" ; then
1842
      if has awk && has grep; then
1843
        kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
1844
	| grep "error: " \
1845
	| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1846
        if test "$kvmerr" != "" ; then
1847
          echo -e "${kvmerr}\n\
1848
NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1849
recent kvm-kmod from http://sourceforge.net/projects/kvm."
1850
        fi
1851
      fi
1852
      feature_not_found "kvm"
1853
    fi
1854
    kvm=no
1855
  fi
1856
fi
1857

  
1858
##########################################
1859
# test for ppc kvm pvr setting
1860

  
1861
if test "$kvm" = "yes" && test "$cpu" = "ppc" -o "$cpu" = "ppc64"; then
1862
            cat > $TMPC <<EOF
1863
    #include <asm/kvm.h>
1864
    int main(void) { struct kvm_sregs s; s.pvr = 0; return 0; }
1865
EOF
1866
    if compile_prog "$kvm_cflags" "" ; then
1867
        kvm_ppc_pvr=yes
1868
    else
1869
        kvm_ppc_pvr=no
1870
    fi
1871
fi
1872

  
1873
##########################################
1874
# test for vhost net
1875

  
1876
if test "$vhost_net" != "no"; then
1877
    if test "$kvm" != "no"; then
1878
            cat > $TMPC <<EOF
1879
    #include <linux/vhost.h>
1880
    int main(void) { return 0; }
1881
EOF
1882
            if compile_prog "$kvm_cflags" "" ; then
1883
                vhost_net=yes
1884
            else
1885
                if test "$vhost_net" = "yes" ; then
1886
                    feature_not_found "vhost-net"
1887
                fi
1888
                vhost_net=no
1889
            fi
1890
    else
1891
            if test "$vhost_net" = "yes" ; then
1892
                echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
1893
                feature_not_found "vhost-net"
1894
            fi
1895
            vhost_net=no
1896
    fi
1897
fi
1898

  
1899
##########################################
1900 1777
# pthread probe
1901 1778
PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
1902 1779

  
......
3346 3223
      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
3347 3224
      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
3348 3225
      echo "CONFIG_KVM=y" >> $config_target_mak
3349
      echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
3350
      if test "$kvm_para" = "yes"; then
3351
        echo "CONFIG_KVM_PARA=y" >> $config_target_mak
3352
      fi
3226
      echo "CONFIG_KVM_PARA=y" >> $config_target_mak
3353 3227
      if test $vhost_net = "yes" ; then
3354 3228
        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3355 3229
      fi
3356
      if test "$kvm_ppc_pvr" = "yes" ; then
3357
        echo "CONFIG_KVM_PPC_PVR=y" >> $config_target_mak
3358
      fi
3230
      echo "CONFIG_KVM_PPC_PVR=y" >> $config_target_mak
3359 3231
    fi
3360 3232
esac
3361 3233
if test "$target_bigendian" = "yes" ; then
......
3546 3418
  esac
3547 3419
fi
3548 3420

  
3421
# use included Linux headers
3422
includes="-I\$(SRC_PATH)/linux-headers $includes"
3423
mkdir -p linux-headers
3424
case "$cpu" in
3425
i386|x86_64)
3426
  symlink $source_path/linux-headers/asm-x86 linux-headers/asm
3427
  ;;
3428
ppcemb|ppc|ppc64)
3429
  symlink $source_path/linux-headers/asm-x86 linux-headers/asm
3430
  ;;
3431
s390x)
3432
  symlink $source_path/linux-headers/asm-s390 linux-headers/asm
3433
  ;;
3434
esac
3435

  
3549 3436
echo "LDFLAGS+=$ldflags" >> $config_target_mak
3550 3437
echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
3551 3438
echo "QEMU_INCLUDES+=$includes" >> $config_target_mak

Also available in: Unified diff