Hardware convenience library
[qemu] / configure
index 4111e7c..8fdbc1c 100755 (executable)
--- a/configure
+++ b/configure
@@ -1724,6 +1724,7 @@ fi
 echo "TOOLS=$tools" >> $config_mak
 
 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
+config_host_mak=${config_mak}
 
 for target in $target_list; do
 target_dir="$target"
@@ -1844,6 +1845,7 @@ case "$target_cpu" in
       echo "CONFIG_XEN=yes" >> $config_mak
       echo "#define CONFIG_XEN 1" >> $config_h
     fi
+    target_phys_bits=32
   ;;
   x86_64)
     echo "TARGET_ARCH=x86_64" >> $config_mak
@@ -1865,11 +1867,13 @@ case "$target_cpu" in
       echo "CONFIG_XEN=yes" >> $config_mak
       echo "#define CONFIG_XEN 1" >> $config_h
     fi
+    target_phys_bits=64
   ;;
   alpha)
     echo "TARGET_ARCH=alpha" >> $config_mak
     echo "#define TARGET_ARCH \"alpha\"" >> $config_h
     echo "#define TARGET_ALPHA 1" >> $config_h
+    target_phys_bits=64
   ;;
   arm|armeb)
     echo "TARGET_ARCH=arm" >> $config_mak
@@ -1878,12 +1882,14 @@ case "$target_cpu" in
     bflt="yes"
     target_nptl="yes"
     gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
+    target_phys_bits=32
   ;;
   cris)
     echo "TARGET_ARCH=cris" >> $config_mak
     echo "#define TARGET_ARCH \"cris\"" >> $config_h
     echo "#define TARGET_CRIS 1" >> $config_h
     target_nptl="yes"
+    target_phys_bits=32
   ;;
   m68k)
     echo "TARGET_ARCH=m68k" >> $config_mak
@@ -1891,18 +1897,21 @@ case "$target_cpu" in
     echo "#define TARGET_M68K 1" >> $config_h
     bflt="yes"
     gdb_xml_files="cf-core.xml cf-fp.xml"
+    target_phys_bits=32
   ;;
   mips|mipsel)
     echo "TARGET_ARCH=mips" >> $config_mak
     echo "#define TARGET_ARCH \"mips\"" >> $config_h
     echo "#define TARGET_MIPS 1" >> $config_h
     echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
+    target_phys_bits=64
   ;;
   mipsn32|mipsn32el)
     echo "TARGET_ARCH=mipsn32" >> $config_mak
     echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
     echo "#define TARGET_MIPS 1" >> $config_h
     echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
+    target_phys_bits=64
   ;;
   mips64|mips64el)
     echo "TARGET_ARCH=mips64" >> $config_mak
@@ -1910,12 +1919,14 @@ case "$target_cpu" in
     echo "#define TARGET_MIPS 1" >> $config_h
     echo "#define TARGET_MIPS64 1" >> $config_h
     echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
+    target_phys_bits=64
   ;;
   ppc)
     echo "TARGET_ARCH=ppc" >> $config_mak
     echo "#define TARGET_ARCH \"ppc\"" >> $config_h
     echo "#define TARGET_PPC 1" >> $config_h
     gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
+    target_phys_bits=32
   ;;
   ppcemb)
     echo "TARGET_ARCH=ppcemb" >> $config_mak
@@ -1929,6 +1940,7 @@ case "$target_cpu" in
       echo "#define CONFIG_KVM 1" >> $config_h
     fi
     gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
+    target_phys_bits=64
   ;;
   ppc64)
     echo "TARGET_ARCH=ppc64" >> $config_mak
@@ -1937,6 +1949,7 @@ case "$target_cpu" in
     echo "#define TARGET_PPC 1" >> $config_h
     echo "#define TARGET_PPC64 1" >> $config_h
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
+    target_phys_bits=64
   ;;
   ppc64abi32)
     echo "TARGET_ARCH=ppc64" >> $config_mak
@@ -1947,6 +1960,7 @@ case "$target_cpu" in
     echo "#define TARGET_PPC64 1" >> $config_h
     echo "#define TARGET_ABI32 1" >> $config_h
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
+    target_phys_bits=64
   ;;
   sh4|sh4eb)
     echo "TARGET_ARCH=sh4" >> $config_mak
@@ -1954,11 +1968,13 @@ case "$target_cpu" in
     echo "#define TARGET_SH4 1" >> $config_h
     bflt="yes"
     target_nptl="yes"
+    target_phys_bits=32
   ;;
   sparc)
     echo "TARGET_ARCH=sparc" >> $config_mak
     echo "#define TARGET_ARCH \"sparc\"" >> $config_h
     echo "#define TARGET_SPARC 1" >> $config_h
+    target_phys_bits=64
   ;;
   sparc64)
     echo "TARGET_ARCH=sparc64" >> $config_mak
@@ -1966,6 +1982,7 @@ case "$target_cpu" in
     echo "#define TARGET_SPARC 1" >> $config_h
     echo "#define TARGET_SPARC64 1" >> $config_h
     elfload32="yes"
+    target_phys_bits=64
   ;;
   sparc32plus)
     echo "TARGET_ARCH=sparc64" >> $config_mak
@@ -1975,12 +1992,19 @@ case "$target_cpu" in
     echo "#define TARGET_SPARC 1" >> $config_h
     echo "#define TARGET_SPARC64 1" >> $config_h
     echo "#define TARGET_ABI32 1" >> $config_h
+    target_phys_bits=64
   ;;
   *)
     echo "Unsupported target CPU"
     exit 1
   ;;
 esac
+if [ $target_phys_bits -lt $hostlongbits ] ; then
+  target_phys_bits=$hostlongbits
+fi
+echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
+echo "#define TARGET_PHYS_ADDR_BITS $target_phys_bits" >> $config_h
+echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
 if test "$target_bigendian" = "yes" ; then
   echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
   echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
@@ -2065,3 +2089,12 @@ if test "$source_path_used" = "yes" ; then
         ln -s $source_path/$f $f
     done
 fi
+
+for hwlib in 32 64; do
+  d=libhw$hwlib
+  mkdir -p $d
+  rm -f $d/Makefile
+  ln -s $source_path/Makefile.hw $d/Makefile
+  echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
+  echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
+done