symbian-qemu-0.9.1-12/qemu-symbian-svp/configure
changeset 1 2fb8b9db1c86
equal deleted inserted replaced
0:ffa851df0825 1:2fb8b9db1c86
       
     1 #!/bin/sh
       
     2 #
       
     3 # qemu configure script (c) 2003 Fabrice Bellard
       
     4 #
       
     5 # set temporary file name
       
     6 if test ! -z "$TMPDIR" ; then
       
     7     TMPDIR1="${TMPDIR}"
       
     8 elif test ! -z "$TEMPDIR" ; then
       
     9     TMPDIR1="${TEMPDIR}"
       
    10 else
       
    11     TMPDIR1="/tmp"
       
    12 fi
       
    13 
       
    14 TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
       
    15 TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
       
    16 TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
       
    17 TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
       
    18 TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
       
    19 TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
       
    20 
       
    21 trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
       
    22 
       
    23 # default parameters
       
    24 prefix=""
       
    25 interp_prefix="/usr/gnemul/qemu-%M"
       
    26 static="no"
       
    27 cross_prefix=""
       
    28 cc="gcc"
       
    29 audio_drv_list=""
       
    30 audio_card_list=""
       
    31 host_cc="gcc"
       
    32 ar="ar"
       
    33 make="make"
       
    34 install="install"
       
    35 strip="strip"
       
    36 cpu=`test $(uname -s) = AIX && uname -p || uname -m`
       
    37 target_list=""
       
    38 case "$cpu" in
       
    39   i386|i486|i586|i686|i86pc|BePC)
       
    40     cpu="i386"
       
    41   ;;
       
    42   x86_64|amd64)
       
    43     cpu="x86_64"
       
    44   ;;
       
    45   alpha)
       
    46     cpu="alpha"
       
    47   ;;
       
    48   armv*b)
       
    49     cpu="armv4b"
       
    50   ;;
       
    51   armv*l)
       
    52     cpu="armv4l"
       
    53   ;;
       
    54   cris)
       
    55     cpu="cris"
       
    56   ;;
       
    57   parisc|parisc64)
       
    58     cpu="hppa"
       
    59   ;;
       
    60   ia64)
       
    61     cpu="ia64"
       
    62   ;;
       
    63   m68k)
       
    64     cpu="m68k"
       
    65   ;;
       
    66   mips)
       
    67     cpu="mips"
       
    68   ;;
       
    69   mips64)
       
    70     cpu="mips64"
       
    71   ;;
       
    72   "Power Macintosh"|ppc|ppc64|powerpc)
       
    73     cpu="powerpc"
       
    74   ;;
       
    75   s390*)
       
    76     cpu="s390"
       
    77   ;;
       
    78   sparc|sun4[cdmuv])
       
    79     cpu="sparc"
       
    80   ;;
       
    81   sparc64)
       
    82     cpu="sparc64"
       
    83   ;;
       
    84   *)
       
    85     cpu="unknown"
       
    86   ;;
       
    87 esac
       
    88 gprof="no"
       
    89 sparse="no"
       
    90 bigendian="no"
       
    91 mingw32="no"
       
    92 EXESUF=""
       
    93 gdbstub="yes"
       
    94 slirp="yes"
       
    95 vde="yes"
       
    96 fmod_lib=""
       
    97 fmod_inc=""
       
    98 sdl_config=""
       
    99 libpng_config="libpng-config"
       
   100 oss_lib=""
       
   101 vnc_tls="yes"
       
   102 bsd="no"
       
   103 linux="no"
       
   104 solaris="no"
       
   105 kqemu="no"
       
   106 profiler="no"
       
   107 cocoa="no"
       
   108 check_gfx="yes"
       
   109 softmmu="yes"
       
   110 linux_user="no"
       
   111 darwin_user="no"
       
   112 bsd_user="no"
       
   113 build_docs="no"
       
   114 uname_release=""
       
   115 curses="yes"
       
   116 aio="yes"
       
   117 nptl="yes"
       
   118 mixemu="no"
       
   119 bluez="yes"
       
   120 kvm="yes"
       
   121 kerneldir=""
       
   122 aix="no"
       
   123 blobs="yes"
       
   124 fdt="yes"
       
   125 python_config=
       
   126 pkgversion=""
       
   127 bugurl=""
       
   128 
       
   129 # OS specific
       
   130 targetos=`uname -s`
       
   131 case $targetos in
       
   132 CYGWIN*)
       
   133 mingw32="yes"
       
   134 OS_CFLAGS="-mno-cygwin"
       
   135 if [ "$cpu" = "i386" ] ; then
       
   136     kqemu="yes"
       
   137 fi
       
   138 audio_possible_drivers="sdl"
       
   139 ;;
       
   140 MINGW32*)
       
   141 mingw32="yes"
       
   142 if [ "$cpu" = "i386" ] ; then
       
   143     kqemu="yes"
       
   144 fi
       
   145 audio_possible_drivers="dsound sdl fmod"
       
   146 ;;
       
   147 GNU/kFreeBSD)
       
   148 audio_drv_list="oss"
       
   149 audio_possible_drivers="oss sdl esd pa"
       
   150 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
       
   151     kqemu="yes"
       
   152 fi
       
   153 ;;
       
   154 FreeBSD)
       
   155 bsd="yes"
       
   156 audio_drv_list="oss"
       
   157 audio_possible_drivers="oss sdl esd pa"
       
   158 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
       
   159     kqemu="yes"
       
   160 fi
       
   161 ;;
       
   162 NetBSD)
       
   163 bsd="yes"
       
   164 audio_drv_list="oss"
       
   165 audio_possible_drivers="oss sdl esd"
       
   166 oss_lib="-lossaudio"
       
   167 ;;
       
   168 OpenBSD)
       
   169 bsd="yes"
       
   170 openbsd="yes"
       
   171 audio_drv_list="oss"
       
   172 audio_possible_drivers="oss sdl esd"
       
   173 oss_lib="-lossaudio"
       
   174 ;;
       
   175 Darwin)
       
   176 bsd="yes"
       
   177 darwin="yes"
       
   178 darwin_user="yes"
       
   179 cocoa="yes"
       
   180 audio_drv_list="coreaudio"
       
   181 audio_possible_drivers="coreaudio sdl fmod"
       
   182 OS_CFLAGS="-mdynamic-no-pic"
       
   183 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
       
   184 ;;
       
   185 SunOS)
       
   186     solaris="yes"
       
   187     make="gmake"
       
   188     install="ginstall"
       
   189     needs_libsunmath="no"
       
   190     solarisrev=`uname -r | cut -f2 -d.`
       
   191     # have to select again, because `uname -m` returns i86pc
       
   192     # even on an x86_64 box.
       
   193     solariscpu=`isainfo -k`
       
   194     if test "${solariscpu}" = "amd64" ; then
       
   195         cpu="x86_64"
       
   196     fi
       
   197     if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
       
   198         if test "$solarisrev" -le 9 ; then
       
   199             if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
       
   200                 needs_libsunmath="yes"
       
   201             else
       
   202                 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
       
   203                 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
       
   204                 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
       
   205                 echo "Studio 11 can be downloaded from www.sun.com."
       
   206                 exit 1
       
   207             fi
       
   208         fi
       
   209         if test "$solarisrev" -ge 9 ; then
       
   210             kqemu="yes"
       
   211         fi
       
   212     fi
       
   213     if test -f /usr/include/sys/soundcard.h ; then
       
   214         audio_drv_list="oss"
       
   215     fi
       
   216     audio_possible_drivers="oss sdl"
       
   217 ;;
       
   218 AIX)
       
   219 aix="yes"
       
   220 make="gmake"
       
   221 ;;
       
   222 *)
       
   223 audio_drv_list="oss"
       
   224 audio_possible_drivers="oss alsa sdl esd pa"
       
   225 linux="yes"
       
   226 linux_user="yes"
       
   227 usb="linux"
       
   228 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
       
   229     kqemu="yes"
       
   230     audio_possible_drivers="$audio_possible_drivers fmod"
       
   231 fi
       
   232 ;;
       
   233 esac
       
   234 
       
   235 if [ "$bsd" = "yes" ] ; then
       
   236   if [ "$darwin" != "yes" ] ; then
       
   237     make="gmake"
       
   238     usb="bsd"
       
   239   fi
       
   240   bsd_user="yes"
       
   241 fi
       
   242 
       
   243 # find source path
       
   244 source_path=`dirname "$0"`
       
   245 source_path_used="no"
       
   246 workdir=`pwd`
       
   247 if [ -z "$source_path" ]; then
       
   248     source_path=$workdir
       
   249 else
       
   250     source_path=`cd "$source_path"; pwd`
       
   251 fi
       
   252 [ -f "$workdir/vl.c" ] || source_path_used="yes"
       
   253 
       
   254 werror="no"
       
   255 # generate compile errors on warnings for development builds
       
   256 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
       
   257 #werror="yes";
       
   258 #fi
       
   259 
       
   260 for opt do
       
   261   optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
       
   262   case "$opt" in
       
   263   --help|-h) show_help=yes
       
   264   ;;
       
   265   --prefix=*) prefix="$optarg"
       
   266   ;;
       
   267   --interp-prefix=*) interp_prefix="$optarg"
       
   268   ;;
       
   269   --source-path=*) source_path="$optarg"
       
   270   source_path_used="yes"
       
   271   ;;
       
   272   --cross-prefix=*) cross_prefix="$optarg"
       
   273   ;;
       
   274   --cc=*) cc="$optarg"
       
   275   ;;
       
   276   --host-cc=*) host_cc="$optarg"
       
   277   ;;
       
   278   --make=*) make="$optarg"
       
   279   ;;
       
   280   --install=*) install="$optarg"
       
   281   ;;
       
   282   --extra-cflags=*) CFLAGS="$optarg"
       
   283   ;;
       
   284   --extra-ldflags=*) LDFLAGS="$optarg"
       
   285   ;;
       
   286   --cpu=*) cpu="$optarg"
       
   287   ;;
       
   288   --target-list=*) target_list="$optarg"
       
   289   ;;
       
   290   --enable-gprof) gprof="yes"
       
   291   ;;
       
   292   --static) static="yes"
       
   293   ;;
       
   294   --disable-sdl) sdl="no"
       
   295   ;;
       
   296   --sdl-config=*) sdl_config="$optarg"
       
   297   ;;
       
   298   --png-config=*) libpng_config="$optarg"
       
   299   ;;
       
   300   --python-config=*) python_config="$optarg"
       
   301   ;;
       
   302   --with-python=*) with_python="$optarg"
       
   303   ;;
       
   304   --fmod-lib=*) fmod_lib="$optarg"
       
   305   ;;
       
   306   --fmod-inc=*) fmod_inc="$optarg"
       
   307   ;;
       
   308   --oss-lib=*) oss_lib="$optarg"
       
   309   ;;
       
   310   --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
       
   311   ;;
       
   312   --audio-drv-list=*) audio_drv_list="$optarg"
       
   313   ;;
       
   314   --enable-sparse) sparse="yes"
       
   315   ;;
       
   316   --disable-sparse) sparse="no"
       
   317   ;;
       
   318   --disable-vnc-tls) vnc_tls="no"
       
   319   ;;
       
   320   --disable-slirp) slirp="no"
       
   321   ;;
       
   322   --disable-vde) vde="no"
       
   323   ;;
       
   324   --disable-kqemu) kqemu="no"
       
   325   ;;
       
   326   --disable-brlapi) brlapi="no"
       
   327   ;;
       
   328   --disable-bluez) bluez="no"
       
   329   ;;
       
   330   --disable-kvm) kvm="no"
       
   331   ;;
       
   332   --enable-profiler) profiler="yes"
       
   333   ;;
       
   334   --enable-cocoa)
       
   335       cocoa="yes" ;
       
   336       sdl="no" ;
       
   337       audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
       
   338   ;;
       
   339   --disable-gfx-check) check_gfx="no"
       
   340   ;;
       
   341   --disable-system) softmmu="no"
       
   342   ;;
       
   343   --enable-system) softmmu="yes"
       
   344   ;;
       
   345   --disable-linux-user) linux_user="no"
       
   346   ;;
       
   347   --enable-linux-user) linux_user="yes"
       
   348   ;;
       
   349   --disable-darwin-user) darwin_user="no"
       
   350   ;;
       
   351   --enable-darwin-user) darwin_user="yes"
       
   352   ;;
       
   353   --disable-bsd-user) bsd_user="no"
       
   354   ;;
       
   355   --enable-bsd-user) bsd_user="yes"
       
   356   ;;
       
   357   --enable-uname-release=*) uname_release="$optarg"
       
   358   ;;
       
   359   --sparc_cpu=*)
       
   360       sparc_cpu="$optarg"
       
   361       case $sparc_cpu in
       
   362         v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
       
   363                  target_cpu="sparc"; cpu="sparc" ;;
       
   364         v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
       
   365                  target_cpu="sparc"; cpu="sparc" ;;
       
   366         v9)    SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
       
   367                  target_cpu="sparc64"; cpu="sparc64" ;;
       
   368         *)     echo "undefined SPARC architecture. Exiting";exit 1;;
       
   369       esac
       
   370   ;;
       
   371   --enable-werror) werror="yes"
       
   372   ;;
       
   373   --disable-werror) werror="no"
       
   374   ;;
       
   375   --disable-curses) curses="no"
       
   376   ;;
       
   377   --disable-nptl) nptl="no"
       
   378   ;;
       
   379   --enable-mixemu) mixemu="yes"
       
   380   ;;
       
   381   --disable-aio) aio="no"
       
   382   ;;
       
   383   --disable-blobs) blobs="no"
       
   384   ;;
       
   385   --kerneldir=*) kerneldir="$optarg"
       
   386   ;;
       
   387   --with-pkgversion=*) pkgversion=" ($optarg)"
       
   388   ;;
       
   389   --with-bugurl=*) bugurl="$optarg"
       
   390   ;;
       
   391   esac
       
   392 done
       
   393 
       
   394 # default flags for all hosts
       
   395 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
       
   396 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
       
   397 LDFLAGS="$LDFLAGS -g"
       
   398 if test "$werror" = "yes" ; then
       
   399 CFLAGS="$CFLAGS -Werror"
       
   400 fi
       
   401 
       
   402 if test "$solaris" = "no" ; then
       
   403     if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
       
   404         LDFLAGS="$LDFLAGS -Wl,--warn-common"
       
   405     fi
       
   406 fi
       
   407 
       
   408 #
       
   409 # If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
       
   410 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
       
   411 #
       
   412 case "$cpu" in
       
   413     sparc) if test -z "$sparc_cpu" ; then
       
   414                ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
       
   415                ARCH_LDFLAGS="-m32"
       
   416            else
       
   417                ARCH_CFLAGS="${SP_CFLAGS}"
       
   418                ARCH_LDFLAGS="${SP_LDFLAGS}"
       
   419            fi
       
   420            ;;
       
   421     sparc64) if test -z "$sparc_cpu" ; then
       
   422                ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
       
   423                ARCH_LDFLAGS="-m64"
       
   424            else
       
   425                ARCH_CFLAGS="${SP_CFLAGS}"
       
   426                ARCH_LDFLAGS="${SP_LDFLAGS}"
       
   427            fi
       
   428            ;;
       
   429     s390)
       
   430            ARCH_CFLAGS="-march=z900"
       
   431            ;;
       
   432     i386)
       
   433            ARCH_CFLAGS="-m32"
       
   434            ARCH_LDFLAGS="-m32"
       
   435            ;;
       
   436     x86_64)
       
   437            ARCH_CFLAGS="-m64"
       
   438            ARCH_LDFLAGS="-m64"
       
   439            ;;
       
   440 esac
       
   441 
       
   442 if test x"$show_help" = x"yes" ; then
       
   443 cat << EOF
       
   444 
       
   445 Usage: configure [options]
       
   446 Options: [defaults in brackets after descriptions]
       
   447 
       
   448 EOF
       
   449 echo "Standard options:"
       
   450 echo "  --help                   print this message"
       
   451 echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
       
   452 echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
       
   453 echo "                           use %M for cpu name [$interp_prefix]"
       
   454 echo "  --target-list=LIST       set target list [$target_list]"
       
   455 echo ""
       
   456 echo "kqemu kernel acceleration support:"
       
   457 echo "  --disable-kqemu          disable kqemu support"
       
   458 echo ""
       
   459 echo "Advanced options (experts only):"
       
   460 echo "  --source-path=PATH       path of source code [$source_path]"
       
   461 echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
       
   462 echo "  --cc=CC                  use C compiler CC [$cc]"
       
   463 echo "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
       
   464 echo "  --make=MAKE              use specified make [$make]"
       
   465 echo "  --install=INSTALL        use specified install [$install]"
       
   466 echo "  --static                 enable static build [$static]"
       
   467 echo "  --enable-sparse          enable sparse checker"
       
   468 echo "  --disable-sparse         disable sparse checker (default)"
       
   469 echo "  --disable-werror         disable compilation abort on warning"
       
   470 echo "  --disable-sdl            disable SDL"
       
   471 echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
       
   472 echo "  --audio-drv-list=LIST    set audio drivers list:"
       
   473 echo "                           Available drivers: $audio_possible_drivers"
       
   474 echo "  --audio-card-list=LIST   set list of additional emulated audio cards"
       
   475 echo "                           Available cards: ac97 adlib cs4231a gus"
       
   476 echo "  --enable-mixemu          enable mixer emulation"
       
   477 echo "  --disable-brlapi         disable BrlAPI"
       
   478 echo "  --disable-vnc-tls        disable TLS encryption for VNC server"
       
   479 echo "  --disable-curses         disable curses output"
       
   480 echo "  --disable-bluez          disable bluez stack connectivity"
       
   481 echo "  --disable-kvm            disable KVM acceleration support"
       
   482 echo "  --disable-nptl           disable usermode NPTL support"
       
   483 echo "  --enable-system          enable all system emulation targets"
       
   484 echo "  --disable-system         disable all system emulation targets"
       
   485 echo "  --enable-linux-user      enable all linux usermode emulation targets"
       
   486 echo "  --disable-linux-user     disable all linux usermode emulation targets"
       
   487 echo "  --enable-darwin-user     enable all darwin usermode emulation targets"
       
   488 echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
       
   489 echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
       
   490 echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
       
   491 echo "  --fmod-lib               path to FMOD library"
       
   492 echo "  --fmod-inc               path to FMOD includes"
       
   493 echo "  --oss-lib                path to OSS library"
       
   494 echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
       
   495 echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
       
   496 echo "  --disable-vde            disable support for vde network"
       
   497 echo "  --disable-aio            disable AIO support"
       
   498 echo "  --disable-blobs          disable installing provided firmware blobs"
       
   499 echo "  --kerneldir=PATH         look for kernel includes in PATH"
       
   500 echo ""
       
   501 echo "NOTE: The object files are built at the place where configure is launched"
       
   502 exit 1
       
   503 fi
       
   504 
       
   505 cc="${cross_prefix}${cc}"
       
   506 ar="${cross_prefix}${ar}"
       
   507 strip="${cross_prefix}${strip}"
       
   508 
       
   509 # check that the C compiler works.
       
   510 cat > $TMPC <<EOF
       
   511 int main(void) {}
       
   512 EOF
       
   513 
       
   514 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
       
   515   : C compiler works ok
       
   516 else
       
   517     echo "ERROR: \"$cc\" either does not exist or does not work"
       
   518     exit 1
       
   519 fi
       
   520 
       
   521 # check compiler to see if we're on mingw32
       
   522 cat > $TMPC <<EOF
       
   523 #include <windows.h>
       
   524 #ifndef _WIN32
       
   525 #error not windows
       
   526 #endif
       
   527 int main(void) {}
       
   528 EOF
       
   529 
       
   530 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
       
   531     mingw32="yes"
       
   532 fi
       
   533 
       
   534 if test "$mingw32" = "yes" ; then
       
   535     linux="no"
       
   536     EXESUF=".exe"
       
   537     oss="no"
       
   538     linux_user="no"
       
   539     bsd_user="no"
       
   540     usb="stub"
       
   541 fi
       
   542 
       
   543 if test ! -x "$(which cgcc 2>/dev/null)"; then
       
   544     sparse="no"
       
   545 fi
       
   546 
       
   547 #
       
   548 # Solaris specific configure tool chain decisions
       
   549 #
       
   550 if test "$solaris" = "yes" ; then
       
   551   solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
       
   552   if test -z "$solinst" ; then
       
   553     echo "Solaris install program not found. Use --install=/usr/ucb/install or"
       
   554     echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
       
   555     echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
       
   556     exit 1
       
   557   fi
       
   558   if test "$solinst" = "/usr/sbin/install" ; then
       
   559     echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
       
   560     echo "try ginstall from the GNU fileutils available from www.blastwave.org"
       
   561     echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
       
   562     exit 1
       
   563   fi
       
   564   sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
       
   565   if test -z "$sol_ar" ; then
       
   566     echo "Error: No path includes ar"
       
   567     if test -f /usr/ccs/bin/ar ; then
       
   568       echo "Add /usr/ccs/bin to your path and rerun configure"
       
   569     fi
       
   570     exit 1
       
   571   fi
       
   572 fi
       
   573 
       
   574 
       
   575 if test -z "$target_list" ; then
       
   576 # these targets are portable
       
   577     if [ "$softmmu" = "yes" ] ; then
       
   578         target_list="\
       
   579 i386-softmmu \
       
   580 x86_64-softmmu \
       
   581 arm-softmmu \
       
   582 cris-softmmu \
       
   583 m68k-softmmu \
       
   584 mips-softmmu \
       
   585 mipsel-softmmu \
       
   586 mips64-softmmu \
       
   587 mips64el-softmmu \
       
   588 ppc-softmmu \
       
   589 ppcemb-softmmu \
       
   590 ppc64-softmmu \
       
   591 sh4-softmmu \
       
   592 sh4eb-softmmu \
       
   593 sparc-softmmu \
       
   594 "
       
   595     fi
       
   596 # the following are Linux specific
       
   597     if [ "$linux_user" = "yes" ] ; then
       
   598         target_list="${target_list}\
       
   599 i386-linux-user \
       
   600 x86_64-linux-user \
       
   601 alpha-linux-user \
       
   602 arm-linux-user \
       
   603 armeb-linux-user \
       
   604 cris-linux-user \
       
   605 m68k-linux-user \
       
   606 mips-linux-user \
       
   607 mipsel-linux-user \
       
   608 ppc-linux-user \
       
   609 ppc64-linux-user \
       
   610 ppc64abi32-linux-user \
       
   611 sh4-linux-user \
       
   612 sh4eb-linux-user \
       
   613 sparc-linux-user \
       
   614 sparc64-linux-user \
       
   615 sparc32plus-linux-user \
       
   616 "
       
   617     fi
       
   618 # the following are Darwin specific
       
   619     if [ "$darwin_user" = "yes" ] ; then
       
   620         target_list="$target_list i386-darwin-user ppc-darwin-user"
       
   621     fi
       
   622 # the following are BSD specific
       
   623     if [ "$bsd_user" = "yes" ] ; then
       
   624         target_list="${target_list}\
       
   625 sparc64-bsd-user \
       
   626 "
       
   627     fi
       
   628 else
       
   629     target_list=`echo "$target_list" | sed -e 's/,/ /g'`
       
   630 fi
       
   631 if test -z "$target_list" ; then
       
   632     echo "No targets enabled"
       
   633     exit 1
       
   634 fi
       
   635 
       
   636 if test -z "$cross_prefix" ; then
       
   637 
       
   638 # ---
       
   639 # big/little endian test
       
   640 cat > $TMPC << EOF
       
   641 #include <inttypes.h>
       
   642 int main(int argc, char ** argv){
       
   643         volatile uint32_t i=0x01234567;
       
   644         return (*((uint8_t*)(&i))) == 0x67;
       
   645 }
       
   646 EOF
       
   647 
       
   648 if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC 2> /dev/null ; then
       
   649 $TMPE && bigendian="yes"
       
   650 else
       
   651 echo big/little test failed
       
   652 fi
       
   653 
       
   654 else
       
   655 
       
   656 # if cross compiling, cannot launch a program, so make a static guess
       
   657 if test "$cpu" = "armv4b" \
       
   658      -o "$cpu" = "hppa" \
       
   659      -o "$cpu" = "m68k" \
       
   660      -o "$cpu" = "mips" \
       
   661      -o "$cpu" = "mips64" \
       
   662      -o "$cpu" = "powerpc" \
       
   663      -o "$cpu" = "s390" \
       
   664      -o "$cpu" = "sparc" \
       
   665      -o "$cpu" = "sparc64"; then
       
   666     bigendian="yes"
       
   667 fi
       
   668 
       
   669 fi
       
   670 
       
   671 # host long bits test
       
   672 hostlongbits="32"
       
   673 if test "$cpu" = "x86_64" \
       
   674      -o "$cpu" = "alpha" \
       
   675      -o "$cpu" = "ia64" \
       
   676      -o "$cpu" = "sparc64"; then
       
   677     hostlongbits="64"
       
   678 fi
       
   679 
       
   680 # ppc specific hostlongbits selection
       
   681 if test "$cpu" = "powerpc" ; then
       
   682     if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev/null </dev/null; then
       
   683         grep -q __powerpc64__ $TMPI && hostlongbits=64
       
   684     else
       
   685         echo hostlongbits test failed
       
   686         exit 1
       
   687     fi
       
   688 fi
       
   689 
       
   690 # check gcc options support
       
   691 cat > $TMPC <<EOF
       
   692 int main(void) {
       
   693 }
       
   694 EOF
       
   695 
       
   696 # Check host NPTL support
       
   697 cat > $TMPC <<EOF
       
   698 #include <sched.h>
       
   699 #include <linux/futex.h>
       
   700 void foo()
       
   701 {
       
   702 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
       
   703 #error bork
       
   704 #endif
       
   705 }
       
   706 EOF
       
   707 
       
   708 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
       
   709   :
       
   710 else
       
   711    nptl="no"
       
   712 fi
       
   713 
       
   714 ##########################################
       
   715 # zlib check
       
   716 
       
   717 cat > $TMPC << EOF
       
   718 #include <zlib.h>
       
   719 int main(void) { zlibVersion(); return 0; }
       
   720 EOF
       
   721 if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz 2> /dev/null ; then
       
   722     :
       
   723 else
       
   724     echo
       
   725     echo "Error: zlib check failed"
       
   726     echo "Make sure to have the zlib libs and headers installed."
       
   727     echo
       
   728     exit 1
       
   729 fi
       
   730 
       
   731 ##########################################
       
   732 # expat check
       
   733 
       
   734 cat > $TMPC << EOF
       
   735 #include <expat.h>
       
   736 int main(void) { XML_Parser p = XML_ParserCreate (0); }
       
   737 EOF
       
   738 if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lexpat 2> /dev/null ; then
       
   739     :
       
   740 else
       
   741     echo
       
   742     echo "Error: expat check failed"
       
   743     echo "Make sure to have the expat libs and headers installed."
       
   744     echo
       
   745     exit 1
       
   746 fi
       
   747 
       
   748 ##########################################
       
   749 # SDL probe
       
   750 
       
   751 sdl_too_old=no
       
   752 
       
   753 if test -z "$sdl" ; then
       
   754     [ -z "$sdl_config" ] && sdl_config="sdl-config"
       
   755     sdl=no
       
   756     sdl_static=no
       
   757 
       
   758 cat > $TMPC << EOF
       
   759 #include <SDL.h>
       
   760 #undef main /* We don't want SDL to override our main() */
       
   761 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
       
   762 EOF
       
   763     if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
       
   764         _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
       
   765         if test "$_sdlversion" -lt 121 ; then
       
   766             sdl_too_old=yes
       
   767         else
       
   768             if test "$cocoa" = "no" ; then
       
   769                 sdl=yes
       
   770             fi
       
   771         fi
       
   772 
       
   773         # static link with sdl ?
       
   774         if test "$sdl" = "yes" ; then
       
   775             aa="no"
       
   776             `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
       
   777             sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
       
   778             if [ "$aa" = "yes" ] ; then
       
   779                 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
       
   780             fi
       
   781 
       
   782             if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
       
   783                 sdl_static=yes
       
   784             fi
       
   785         fi # static link
       
   786     fi # sdl compile test
       
   787 else
       
   788     # Make sure to disable cocoa if sdl was set
       
   789     if test "$sdl" = "yes" ; then
       
   790        cocoa="no"
       
   791        audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
       
   792     fi
       
   793 fi # -z $sdl
       
   794 
       
   795 ##########################################
       
   796 # LIBPNG detection
       
   797 
       
   798 libpng=no
       
   799 cat > $TMPC << EOF
       
   800 #include <png.h>
       
   801 int main( void ) { return png_access_version_number(); }
       
   802 EOF
       
   803 # FIXME: libpng_config seems to fail to add the -lz flag itself
       
   804 if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE ${OS_CFLAGS} `$libpng_config --cflags 2> /dev/null` $TMPC `$libpng_config --ldflags 2> /dev/null` > /dev/null -lz 2> /dev/null ; then
       
   805     libpng=yes
       
   806 fi # libpng compile test
       
   807 
       
   808 ##########################################
       
   809 # VNC TLS detection
       
   810 if test "$vnc_tls" = "yes" ; then
       
   811 cat > $TMPC <<EOF
       
   812 #include <gnutls/gnutls.h>
       
   813 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
       
   814 EOF
       
   815     vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
       
   816     vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
       
   817     if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
       
   818            $vnc_tls_libs > /dev/null 2> /dev/null ; then
       
   819 	:
       
   820     else
       
   821 	vnc_tls="no"
       
   822     fi
       
   823 fi
       
   824 
       
   825 ##########################################
       
   826 # vde libraries probe
       
   827 if test "$vde" = "yes" ; then
       
   828   cat > $TMPC << EOF
       
   829 #include <libvdeplug.h>
       
   830 int main(void)
       
   831 {
       
   832     struct vde_open_args a = {0, 0, 0};
       
   833     vde_open("", "", &a);
       
   834     return 0;
       
   835 }
       
   836 EOF
       
   837     if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
       
   838         :
       
   839     else
       
   840         vde="no"
       
   841     fi
       
   842 fi
       
   843 
       
   844 ##########################################
       
   845 # Sound support libraries probe
       
   846 
       
   847 audio_drv_probe()
       
   848 {
       
   849     drv=$1
       
   850     hdr=$2
       
   851     lib=$3
       
   852     exp=$4
       
   853     cfl=$5
       
   854         cat > $TMPC << EOF
       
   855 #include <$hdr>
       
   856 int main(void) { $exp }
       
   857 EOF
       
   858     if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
       
   859         :
       
   860     else
       
   861         echo
       
   862         echo "Error: $drv check failed"
       
   863         echo "Make sure to have the $drv libs and headers installed."
       
   864         echo
       
   865         exit 1
       
   866     fi
       
   867 }
       
   868 
       
   869 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
       
   870 for drv in $audio_drv_list; do
       
   871     case $drv in
       
   872     alsa)
       
   873     audio_drv_probe $drv alsa/asoundlib.h -lasound \
       
   874         "snd_pcm_t **handle; return snd_pcm_close(*handle);"
       
   875     ;;
       
   876 
       
   877     fmod)
       
   878     if test -z $fmod_lib || test -z $fmod_inc; then
       
   879         echo
       
   880         echo "Error: You must specify path to FMOD library and headers"
       
   881         echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
       
   882         echo
       
   883         exit 1
       
   884     fi
       
   885     audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
       
   886     ;;
       
   887 
       
   888     esd)
       
   889     audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
       
   890     ;;
       
   891 
       
   892     pa)
       
   893     audio_drv_probe $drv pulse/simple.h -lpulse-simple \
       
   894         "pa_simple *s = NULL; pa_simple_free(s); return 0;"
       
   895     ;;
       
   896 
       
   897     oss|sdl|core|wav|dsound)
       
   898     # XXX: Probes for CoreAudio, DirectSound, SDL(?)
       
   899     ;;
       
   900 
       
   901     *)
       
   902     echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
       
   903         echo
       
   904         echo "Error: Unknown driver '$drv' selected"
       
   905         echo "Possible drivers are: $audio_possible_drivers"
       
   906         echo
       
   907         exit 1
       
   908     }
       
   909     ;;
       
   910     esac
       
   911 done
       
   912 
       
   913 ##########################################
       
   914 # BrlAPI probe
       
   915 
       
   916 if test -z "$brlapi" ; then
       
   917     brlapi=no
       
   918 cat > $TMPC << EOF
       
   919 #include <brlapi.h>
       
   920 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
       
   921 EOF
       
   922     if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
       
   923 	    brlapi=yes
       
   924     fi # brlapi compile test
       
   925 fi # -z $brlapi
       
   926 
       
   927 ##########################################
       
   928 # curses probe
       
   929 
       
   930 if test "$curses" = "yes" ; then
       
   931   curses=no
       
   932   cat > $TMPC << EOF
       
   933 #include <curses.h>
       
   934 int main(void) { return curses_version(); }
       
   935 EOF
       
   936   if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
       
   937     curses=yes
       
   938   fi
       
   939 fi # test "$curses"
       
   940 
       
   941 ##########################################
       
   942 # bluez support probe
       
   943 if test "$bluez" = "yes" ; then
       
   944   `pkg-config bluez` || bluez="no"
       
   945 fi
       
   946 if test "$bluez" = "yes" ; then
       
   947   cat > $TMPC << EOF
       
   948 #include <bluetooth/bluetooth.h>
       
   949 int main(void) { return bt_error(0); }
       
   950 EOF
       
   951   bluez_cflags=`pkg-config --cflags bluez`
       
   952   bluez_libs=`pkg-config --libs bluez`
       
   953   if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
       
   954       $bluez_libs > /dev/null 2> /dev/null ; then
       
   955     :
       
   956   else
       
   957     bluez="no"
       
   958   fi
       
   959 fi
       
   960 
       
   961 ##########################################
       
   962 # kvm probe
       
   963 if test "$kvm" = "yes" ; then
       
   964     cat > $TMPC <<EOF
       
   965 #include <linux/kvm.h>
       
   966 #if !defined(KVM_API_VERSION) || \
       
   967     KVM_API_VERSION < 12 || \
       
   968     KVM_API_VERSION > 12 || \
       
   969     !defined(KVM_CAP_USER_MEMORY) || \
       
   970     !defined(KVM_CAP_SET_TSS_ADDR) || \
       
   971     !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
       
   972 #error Invalid KVM version
       
   973 #endif
       
   974 int main(void) { return 0; }
       
   975 EOF
       
   976   if test "$kerneldir" != "" ; then
       
   977       kvm_cflags=-I"$kerneldir"/include
       
   978   else
       
   979       kvm_cflags=""
       
   980   fi
       
   981   if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
       
   982       > /dev/null 2>/dev/null ; then
       
   983     :
       
   984   else
       
   985     kvm="no"
       
   986   fi
       
   987 fi
       
   988 
       
   989 ##########################################
       
   990 # AIO probe
       
   991 AIOLIBS=""
       
   992 
       
   993 if test "$aio" = "yes" ; then
       
   994   aio=no
       
   995   cat > $TMPC << EOF
       
   996 #include <pthread.h>
       
   997 int main(void) { pthread_mutex_t lock; return 0; }
       
   998 EOF
       
   999   if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
       
  1000     aio=yes
       
  1001     AIOLIBS="-lpthread"
       
  1002   fi
       
  1003 fi
       
  1004 
       
  1005 ##########################################
       
  1006 # iovec probe
       
  1007 cat > $TMPC <<EOF
       
  1008 #include <sys/uio.h>
       
  1009 int main(void) { struct iovec iov; return 0; }
       
  1010 EOF
       
  1011 iovec=no
       
  1012 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
       
  1013   iovec=yes
       
  1014 fi
       
  1015 
       
  1016 ##########################################
       
  1017 # fdt probe
       
  1018 if test "$fdt" = "yes" ; then
       
  1019     fdt=no
       
  1020     cat > $TMPC << EOF
       
  1021 int main(void) { return 0; }
       
  1022 EOF
       
  1023   if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
       
  1024     fdt=yes
       
  1025   fi
       
  1026 fi
       
  1027 
       
  1028 # Check if tools are available to build documentation.
       
  1029 if [ -x "`which texi2html 2>/dev/null`" ] && \
       
  1030    [ -x "`which pod2man 2>/dev/null`" ]; then
       
  1031   build_docs="yes"
       
  1032 fi
       
  1033 
       
  1034 ##########################################
       
  1035 # Python probe
       
  1036 if [ -n "$with_python" ] ; then
       
  1037   # Hardcoded hack for windows.
       
  1038   PYTHON_CFLAGS="-I$with_python/include"
       
  1039   PYTHON_LIBS="-L$with_python/lib -lpython26"
       
  1040   have_python=yes
       
  1041 else
       
  1042   if [ -z "$python_config" ] ; then
       
  1043     python_config=`which python-config 2>/dev/null | grep -v "no python-config in"`
       
  1044   fi
       
  1045   if [ -z $python_config ] ; then
       
  1046     have_python=no
       
  1047   else
       
  1048     PYTHON_CFLAGS=`$python_config --includes`
       
  1049     PYTHON_LIBS=`$python_config --ldflags`
       
  1050     have_python=yes
       
  1051   fi
       
  1052 fi
       
  1053 if [ "$have_python" = "yes" ] ; then
       
  1054   cat > $TMPC <<EOF
       
  1055 #include "Python.h"
       
  1056 int main(void) { Py_Initialize (); }
       
  1057 EOF
       
  1058   if $cc $ARCH_CFLAGS $PYTHON_CFLAGS -o $TMPE $TMPC $PYTHON_LIBS > /dev/null 2> /dev/null ; then
       
  1059     have_python=yes
       
  1060   else
       
  1061     have_python=no
       
  1062   fi
       
  1063 fi
       
  1064 
       
  1065 
       
  1066 ##########################################
       
  1067 # Do we need librt
       
  1068 cat > $TMPC <<EOF
       
  1069 #include <signal.h>
       
  1070 #include <time.h>
       
  1071 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
       
  1072 EOF
       
  1073 
       
  1074 rt=no
       
  1075 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
       
  1076   :
       
  1077 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
       
  1078   rt=yes
       
  1079 fi
       
  1080 
       
  1081 if test "$rt" = "yes" ; then
       
  1082   # Hack, we should have a general purpose LIBS for this sort of thing
       
  1083   AIOLIBS="$AIOLIBS -lrt"
       
  1084 fi
       
  1085 
       
  1086 if test "$mingw32" = "yes" ; then
       
  1087   if test -z "$prefix" ; then
       
  1088       prefix="c:\\\\Program Files\\\\Qemu"
       
  1089   fi
       
  1090   mansuffix=""
       
  1091   datasuffix=""
       
  1092   docsuffix=""
       
  1093   binsuffix=""
       
  1094 else
       
  1095   if test -z "$prefix" ; then
       
  1096       prefix="/usr/local"
       
  1097   fi
       
  1098   mansuffix="/share/man"
       
  1099   datasuffix="/share/qemu"
       
  1100   docsuffix="/share/doc/qemu"
       
  1101   binsuffix="/bin"
       
  1102 fi
       
  1103 
       
  1104 echo "Install prefix    $prefix"
       
  1105 echo "BIOS directory    $prefix$datasuffix"
       
  1106 echo "binary directory  $prefix$binsuffix"
       
  1107 if test "$mingw32" = "no" ; then
       
  1108 echo "Manual directory  $prefix$mansuffix"
       
  1109 echo "ELF interp prefix $interp_prefix"
       
  1110 fi
       
  1111 echo "Source path       $source_path"
       
  1112 echo "C compiler        $cc"
       
  1113 echo "Host C compiler   $host_cc"
       
  1114 echo "ARCH_CFLAGS       $ARCH_CFLAGS"
       
  1115 echo "make              $make"
       
  1116 echo "install           $install"
       
  1117 echo "host CPU          $cpu"
       
  1118 echo "host big endian   $bigendian"
       
  1119 echo "target list       $target_list"
       
  1120 echo "gprof enabled     $gprof"
       
  1121 echo "sparse enabled    $sparse"
       
  1122 echo "profiler          $profiler"
       
  1123 echo "static build      $static"
       
  1124 echo "-Werror enabled   $werror"
       
  1125 if test "$darwin" = "yes" ; then
       
  1126     echo "Cocoa support     $cocoa"
       
  1127 fi
       
  1128 echo "SDL support       $sdl"
       
  1129 if test "$sdl" != "no" ; then
       
  1130     echo "SDL static link   $sdl_static"
       
  1131 fi
       
  1132 echo "libpng support    $libpng"
       
  1133 echo "curses support    $curses"
       
  1134 echo "mingw32 support   $mingw32"
       
  1135 echo "Audio drivers     $audio_drv_list"
       
  1136 echo "Extra audio cards $audio_card_list"
       
  1137 echo "Mixer emulation   $mixemu"
       
  1138 echo "VNC TLS support   $vnc_tls"
       
  1139 if test "$vnc_tls" = "yes" ; then
       
  1140     echo "    TLS CFLAGS    $vnc_tls_cflags"
       
  1141     echo "    TLS LIBS      $vnc_tls_libs"
       
  1142 fi
       
  1143 if test -n "$sparc_cpu"; then
       
  1144     echo "Target Sparc Arch $sparc_cpu"
       
  1145 fi
       
  1146 echo "kqemu support     $kqemu"
       
  1147 echo "brlapi support    $brlapi"
       
  1148 echo "Documentation     $build_docs"
       
  1149 [ ! -z "$uname_release" ] && \
       
  1150 echo "uname -r          $uname_release"
       
  1151 echo "NPTL support      $nptl"
       
  1152 echo "vde support       $vde"
       
  1153 echo "AIO support       $aio"
       
  1154 echo "Install blobs     $blobs"
       
  1155 echo "KVM support       $kvm"
       
  1156 echo "fdt support       $fdt"
       
  1157 echo "Python support    $have_python"
       
  1158 
       
  1159 if test $sdl_too_old = "yes"; then
       
  1160 echo "-> Your SDL version is too old - please upgrade to have SDL support"
       
  1161 fi
       
  1162 if [ -s $TMPSDLLOG ]; then
       
  1163   echo "The error log from compiling the libSDL test is: "
       
  1164   cat $TMPSDLLOG
       
  1165 fi
       
  1166 #if test "$sdl_static" = "no"; then
       
  1167 #  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
       
  1168 #fi
       
  1169 config_mak="config-host.mak"
       
  1170 config_h="config-host.h"
       
  1171 
       
  1172 #echo "Creating $config_mak and $config_h"
       
  1173 
       
  1174 test -f $config_h && mv $config_h ${config_h}~
       
  1175 
       
  1176 echo "# Automatically generated by configure - do not modify" > $config_mak
       
  1177 printf "# Configured with:" >> $config_mak
       
  1178 printf " '%s'" "$0" "$@" >> $config_mak
       
  1179 echo >> $config_mak
       
  1180 echo "/* Automatically generated by configure - do not modify */" > $config_h
       
  1181 
       
  1182 echo "prefix=$prefix" >> $config_mak
       
  1183 echo "bindir=\${prefix}$binsuffix" >> $config_mak
       
  1184 echo "mandir=\${prefix}$mansuffix" >> $config_mak
       
  1185 echo "datadir=\${prefix}$datasuffix" >> $config_mak
       
  1186 echo "docdir=\${prefix}$docsuffix" >> $config_mak
       
  1187 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
       
  1188 echo "MAKE=$make" >> $config_mak
       
  1189 echo "INSTALL=$install" >> $config_mak
       
  1190 echo "CC=$cc" >> $config_mak
       
  1191 echo "HOST_CC=$host_cc" >> $config_mak
       
  1192 echo "AR=$ar" >> $config_mak
       
  1193 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
       
  1194 # XXX: only use CFLAGS and LDFLAGS ?  
       
  1195 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
       
  1196 # compilation of dyngen tool (useful for win32 build on Linux host)
       
  1197 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
       
  1198 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
       
  1199 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
       
  1200 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
       
  1201 echo "CFLAGS=$CFLAGS" >> $config_mak
       
  1202 echo "LDFLAGS=$LDFLAGS" >> $config_mak
       
  1203 echo "EXESUF=$EXESUF" >> $config_mak
       
  1204 echo "AIOLIBS=$AIOLIBS" >> $config_mak
       
  1205 case "$cpu" in
       
  1206   i386)
       
  1207     echo "ARCH=i386" >> $config_mak
       
  1208     echo "#define HOST_I386 1" >> $config_h
       
  1209   ;;
       
  1210   x86_64)
       
  1211     echo "ARCH=x86_64" >> $config_mak
       
  1212     echo "#define HOST_X86_64 1" >> $config_h
       
  1213   ;;
       
  1214   alpha)
       
  1215     echo "ARCH=alpha" >> $config_mak
       
  1216     echo "#define HOST_ALPHA 1" >> $config_h
       
  1217   ;;
       
  1218   armv4b)
       
  1219     echo "ARCH=arm" >> $config_mak
       
  1220     echo "#define HOST_ARM 1" >> $config_h
       
  1221   ;;
       
  1222   armv4l)
       
  1223     echo "ARCH=arm" >> $config_mak
       
  1224     echo "#define HOST_ARM 1" >> $config_h
       
  1225   ;;
       
  1226   cris)
       
  1227     echo "ARCH=cris" >> $config_mak
       
  1228     echo "#define HOST_CRIS 1" >> $config_h
       
  1229   ;;
       
  1230   hppa)
       
  1231     echo "ARCH=hppa" >> $config_mak
       
  1232     echo "#define HOST_HPPA 1" >> $config_h
       
  1233   ;;
       
  1234   ia64)
       
  1235     echo "ARCH=ia64" >> $config_mak
       
  1236     echo "#define HOST_IA64 1" >> $config_h
       
  1237   ;;
       
  1238   m68k)
       
  1239     echo "ARCH=m68k" >> $config_mak
       
  1240     echo "#define HOST_M68K 1" >> $config_h
       
  1241   ;;
       
  1242   mips)
       
  1243     echo "ARCH=mips" >> $config_mak
       
  1244     echo "#define HOST_MIPS 1" >> $config_h
       
  1245   ;;
       
  1246   mips64)
       
  1247     echo "ARCH=mips64" >> $config_mak
       
  1248     echo "#define HOST_MIPS64 1" >> $config_h
       
  1249   ;;
       
  1250   powerpc)
       
  1251   if test "$hostlongbits" = "32"; then
       
  1252       echo "ARCH=ppc" >> $config_mak
       
  1253       echo "#define HOST_PPC 1" >> $config_h
       
  1254   else
       
  1255       echo "ARCH=ppc64" >> $config_mak
       
  1256       echo "#define HOST_PPC64 1" >> $config_h
       
  1257   fi
       
  1258   ;;
       
  1259   s390)
       
  1260     echo "ARCH=s390" >> $config_mak
       
  1261     echo "#define HOST_S390 1" >> $config_h
       
  1262   ;;
       
  1263   sparc)
       
  1264     echo "ARCH=sparc" >> $config_mak
       
  1265     echo "#define HOST_SPARC 1" >> $config_h
       
  1266   ;;
       
  1267   sparc64)
       
  1268     echo "ARCH=sparc64" >> $config_mak
       
  1269     echo "#define HOST_SPARC64 1" >> $config_h
       
  1270   ;;
       
  1271   *)
       
  1272     echo "Unsupported CPU = $cpu"
       
  1273     exit 1
       
  1274   ;;
       
  1275 esac
       
  1276 if test "$sparse" = "yes" ; then
       
  1277   echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_mak
       
  1278   echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_mak
       
  1279   echo "CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
       
  1280 fi
       
  1281 if test "$bigendian" = "yes" ; then
       
  1282   echo "WORDS_BIGENDIAN=yes" >> $config_mak
       
  1283   echo "#define WORDS_BIGENDIAN 1" >> $config_h
       
  1284 fi
       
  1285 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
       
  1286 if test "$mingw32" = "yes" ; then
       
  1287   echo "CONFIG_WIN32=yes" >> $config_mak
       
  1288   echo "#define CONFIG_WIN32 1" >> $config_h
       
  1289 else
       
  1290   cat > $TMPC << EOF
       
  1291 #include <byteswap.h>
       
  1292 int main(void) { return bswap_32(0); }
       
  1293 EOF
       
  1294   if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
       
  1295     echo "#define HAVE_BYTESWAP_H 1" >> $config_h
       
  1296   fi
       
  1297   cat > $TMPC << EOF
       
  1298 #include <sys/endian.h>
       
  1299 #include <sys/types.h>
       
  1300 #include <machine/bswap.h>
       
  1301 int main(void) { return bswap32(0); }
       
  1302 EOF
       
  1303   if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
       
  1304     echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
       
  1305   fi
       
  1306 fi
       
  1307 
       
  1308 if [ "$openbsd" = "yes" ] ; then
       
  1309   echo "#define ENOTSUP 4096" >> $config_h
       
  1310 fi
       
  1311 
       
  1312 if test "$darwin" = "yes" ; then
       
  1313   echo "CONFIG_DARWIN=yes" >> $config_mak
       
  1314   echo "#define CONFIG_DARWIN 1" >> $config_h
       
  1315 fi
       
  1316 
       
  1317 if test "$aix" = "yes" ; then
       
  1318   echo "CONFIG_AIX=yes" >> $config_mak
       
  1319   echo "#define CONFIG_AIX 1" >> $config_h
       
  1320 fi
       
  1321 
       
  1322 if test "$solaris" = "yes" ; then
       
  1323   echo "CONFIG_SOLARIS=yes" >> $config_mak
       
  1324   echo "#define HOST_SOLARIS $solarisrev" >> $config_h
       
  1325   if test "$needs_libsunmath" = "yes" ; then
       
  1326     echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
       
  1327     echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
       
  1328   fi
       
  1329 fi
       
  1330 if test -n "$sparc_cpu"; then
       
  1331   echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
       
  1332   echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
       
  1333 fi
       
  1334 if test "$gdbstub" = "yes" ; then
       
  1335   echo "CONFIG_GDBSTUB=yes" >> $config_mak
       
  1336   echo "#define CONFIG_GDBSTUB 1" >> $config_h
       
  1337 fi
       
  1338 if test "$gprof" = "yes" ; then
       
  1339   echo "TARGET_GPROF=yes" >> $config_mak
       
  1340   echo "#define HAVE_GPROF 1" >> $config_h
       
  1341 fi
       
  1342 if test "$static" = "yes" ; then
       
  1343   echo "CONFIG_STATIC=yes" >> $config_mak
       
  1344   echo "#define CONFIG_STATIC 1" >> $config_h
       
  1345 fi
       
  1346 if test $profiler = "yes" ; then
       
  1347   echo "#define CONFIG_PROFILER 1" >> $config_h
       
  1348 fi
       
  1349 if test "$slirp" = "yes" ; then
       
  1350   echo "CONFIG_SLIRP=yes" >> $config_mak
       
  1351   echo "#define CONFIG_SLIRP 1" >> $config_h
       
  1352 fi
       
  1353 if test "$vde" = "yes" ; then
       
  1354   echo "CONFIG_VDE=yes" >> $config_mak
       
  1355   echo "#define CONFIG_VDE 1" >> $config_h
       
  1356   echo "VDE_LIBS=-lvdeplug" >> $config_mak
       
  1357 fi
       
  1358 for card in $audio_card_list; do
       
  1359     def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
       
  1360     echo "$def=yes" >> $config_mak
       
  1361     echo "#define $def 1" >> $config_h
       
  1362 done
       
  1363 echo "#define AUDIO_DRIVERS \\" >> $config_h
       
  1364 for drv in $audio_drv_list; do
       
  1365     echo "    &${drv}_audio_driver, \\" >>$config_h
       
  1366     def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
       
  1367     echo "$def=yes" >> $config_mak
       
  1368     if test "$drv" = "fmod"; then
       
  1369         echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
       
  1370         echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
       
  1371     elif test "$drv" = "oss"; then
       
  1372         echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
       
  1373     fi
       
  1374 done
       
  1375 echo "" >>$config_h
       
  1376 if test "$mixemu" = "yes" ; then
       
  1377   echo "CONFIG_MIXEMU=yes" >> $config_mak
       
  1378   echo "#define CONFIG_MIXEMU 1" >> $config_h
       
  1379 fi
       
  1380 if test "$vnc_tls" = "yes" ; then
       
  1381   echo "CONFIG_VNC_TLS=yes" >> $config_mak
       
  1382   echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
       
  1383   echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
       
  1384   echo "#define CONFIG_VNC_TLS 1" >> $config_h
       
  1385 fi
       
  1386 qemu_version=`head $source_path/VERSION`
       
  1387 echo "VERSION=$qemu_version" >>$config_mak
       
  1388 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
       
  1389 
       
  1390 echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
       
  1391 if test ! -z "$bugurl" ; then
       
  1392   echo "#define QEMU_BUGURL \"$bugurl\"" >> $config_h
       
  1393 fi
       
  1394 
       
  1395 echo "SRC_PATH=$source_path" >> $config_mak
       
  1396 if [ "$source_path_used" = "yes" ]; then
       
  1397   echo "VPATH=$source_path" >> $config_mak
       
  1398 fi
       
  1399 echo "TARGET_DIRS=$target_list" >> $config_mak
       
  1400 if [ "$build_docs" = "yes" ] ; then
       
  1401   echo "BUILD_DOCS=yes" >> $config_mak
       
  1402 fi
       
  1403 if test "$static" = "yes"; then
       
  1404   sdl1=$sdl_static
       
  1405 else
       
  1406   sdl1=$sdl
       
  1407 fi
       
  1408 if test "$sdl1" = "yes" ; then
       
  1409   echo "#define CONFIG_SDL 1" >> $config_h
       
  1410   echo "CONFIG_SDL=yes" >> $config_mak
       
  1411   if test "$target_softmmu" = "no" -o "$static" = "yes"; then
       
  1412     echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
       
  1413   else
       
  1414     echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
       
  1415   fi
       
  1416   if [ "${aa}" = "yes" ] ; then
       
  1417     echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
       
  1418   else
       
  1419     echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
       
  1420   fi
       
  1421 fi
       
  1422 if test "$libpng" = "yes" ; then
       
  1423   echo "#define CONFIG_PNG 1" >> $config_h
       
  1424   echo "CONFIG_PNG=yes" >> $config_mak
       
  1425   echo "PNG_LIBS=`$libpng_config --ldflags`" >> $config_mak
       
  1426   echo "PNG_CFLAGS=`$libpng_config --cflags`" >> $config_mak
       
  1427 fi
       
  1428 if test "$cocoa" = "yes" ; then
       
  1429   echo "#define CONFIG_COCOA 1" >> $config_h
       
  1430   echo "CONFIG_COCOA=yes" >> $config_mak
       
  1431 fi
       
  1432 if test "$curses" = "yes" ; then
       
  1433   echo "#define CONFIG_CURSES 1" >> $config_h
       
  1434   echo "CONFIG_CURSES=yes" >> $config_mak
       
  1435   echo "CURSES_LIBS=-lcurses" >> $config_mak
       
  1436 fi
       
  1437 if test "$brlapi" = "yes" ; then
       
  1438   echo "CONFIG_BRLAPI=yes" >> $config_mak
       
  1439   echo "#define CONFIG_BRLAPI 1" >> $config_h
       
  1440   echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
       
  1441 fi
       
  1442 if test "$bluez" = "yes" ; then
       
  1443   echo "CONFIG_BLUEZ=yes" >> $config_mak
       
  1444   echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
       
  1445   echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
       
  1446   echo "#define CONFIG_BLUEZ 1" >> $config_h
       
  1447 fi
       
  1448 if test "$aio" = "yes" ; then
       
  1449   echo "#define CONFIG_AIO 1" >> $config_h
       
  1450   echo "CONFIG_AIO=yes" >> $config_mak
       
  1451 fi
       
  1452 if test "$blobs" = "yes" ; then
       
  1453   echo "INSTALL_BLOBS=yes" >> $config_mak
       
  1454 fi
       
  1455 if test "$iovec" = "yes" ; then
       
  1456   echo "#define HAVE_IOVEC 1" >> $config_h
       
  1457 fi
       
  1458 if test "$fdt" = "yes" ; then
       
  1459   echo "#define HAVE_FDT 1" >> $config_h
       
  1460   echo "FDT_LIBS=-lfdt" >> $config_mak
       
  1461 fi
       
  1462 if test "$have_python" = "yes" ; then
       
  1463   echo "#define HAVE_PYTHON 1" >> $config_h
       
  1464   echo "CONFIG_PYTHON=yes" >> $config_mak
       
  1465   echo "PYTHON_CFLAGS=$PYTHON_CFLAGS" >> $config_mak
       
  1466   echo "PYTHON_LIBS=$PYTHON_LIBS" >> $config_mak
       
  1467 
       
  1468 fi
       
  1469 
       
  1470 # XXX: suppress that
       
  1471 if [ "$bsd" = "yes" ] ; then
       
  1472   echo "#define O_LARGEFILE 0" >> $config_h
       
  1473   echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
       
  1474   echo "#define _BSD 1" >> $config_h
       
  1475 fi
       
  1476 
       
  1477 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
       
  1478 
       
  1479 # USB host support
       
  1480 case "$usb" in
       
  1481 linux)
       
  1482   echo "HOST_USB=linux" >> $config_mak
       
  1483 ;;
       
  1484 bsd)
       
  1485   echo "HOST_USB=bsd" >> $config_mak
       
  1486 ;;
       
  1487 *)
       
  1488   echo "HOST_USB=stub" >> $config_mak
       
  1489 ;;
       
  1490 esac
       
  1491 
       
  1492 tools=
       
  1493 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
       
  1494   tools="qemu-img\$(EXESUF) $tools"
       
  1495   if [ "$linux" = "yes" ] ; then
       
  1496       tools="qemu-nbd\$(EXESUF) $tools"
       
  1497   fi
       
  1498 fi
       
  1499 echo "TOOLS=$tools" >> $config_mak
       
  1500 
       
  1501 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
       
  1502 
       
  1503 for target in $target_list; do
       
  1504 target_dir="$target"
       
  1505 config_mak=$target_dir/config.mak
       
  1506 config_h=$target_dir/config.h
       
  1507 target_cpu=`echo $target | cut -d '-' -f 1`
       
  1508 target_bigendian="no"
       
  1509 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
       
  1510 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
       
  1511 [ "$target_cpu" = "mips" ] && target_bigendian=yes
       
  1512 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
       
  1513 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
       
  1514 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
       
  1515 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
       
  1516 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
       
  1517 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
       
  1518 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
       
  1519 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
       
  1520 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
       
  1521 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
       
  1522 target_softmmu="no"
       
  1523 target_user_only="no"
       
  1524 target_linux_user="no"
       
  1525 target_darwin_user="no"
       
  1526 target_bsd_user="no"
       
  1527 case "$target" in
       
  1528   ${target_cpu}-softmmu)
       
  1529     target_softmmu="yes"
       
  1530     ;;
       
  1531   ${target_cpu}-linux-user)
       
  1532     target_user_only="yes"
       
  1533     target_linux_user="yes"
       
  1534     ;;
       
  1535   ${target_cpu}-darwin-user)
       
  1536     target_user_only="yes"
       
  1537     target_darwin_user="yes"
       
  1538     ;;
       
  1539   ${target_cpu}-bsd-user)
       
  1540     target_user_only="yes"
       
  1541     target_bsd_user="yes"
       
  1542     ;;
       
  1543   *)
       
  1544     echo "ERROR: Target '$target' not recognised"
       
  1545     exit 1
       
  1546     ;;
       
  1547 esac
       
  1548 
       
  1549 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
       
  1550         -a "$sdl" = "no" -a "$cocoa" = "no" ; then
       
  1551     echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
       
  1552     echo "To build QEMU without graphical output configure with --disable-gfx-check"
       
  1553     echo "Note that this will disable all output from the virtual graphics card"
       
  1554     echo "except through VNC or curses."
       
  1555     exit 1;
       
  1556 fi
       
  1557 
       
  1558 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
       
  1559 
       
  1560 test -f $config_h && mv $config_h ${config_h}~
       
  1561 
       
  1562 mkdir -p $target_dir
       
  1563 mkdir -p $target_dir/fpu
       
  1564 mkdir -p $target_dir/tcg
       
  1565 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
       
  1566   mkdir -p $target_dir/nwfpe
       
  1567 fi
       
  1568 
       
  1569 #
       
  1570 # don't use ln -sf as not all "ln -sf" over write the file/link
       
  1571 #
       
  1572 rm -f $target_dir/Makefile
       
  1573 ln -s $source_path/Makefile.target $target_dir/Makefile
       
  1574 
       
  1575 
       
  1576 echo "# Automatically generated by configure - do not modify" > $config_mak
       
  1577 echo "/* Automatically generated by configure - do not modify */" > $config_h
       
  1578 
       
  1579 
       
  1580 echo "include ../config-host.mak" >> $config_mak
       
  1581 echo "#include \"../config-host.h\"" >> $config_h
       
  1582 
       
  1583 bflt="no"
       
  1584 elfload32="no"
       
  1585 target_nptl="no"
       
  1586 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
       
  1587 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
       
  1588 gdb_xml_files=""
       
  1589 
       
  1590 # Make sure the target and host cpus are compatible
       
  1591 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
       
  1592   \( "$target_cpu" = "ppcemb" -a "$cpu" = "powerpc" \) -o \
       
  1593   \( "$target_cpu" = "x86_64" -a "$cpu" = "i386"   \) -o \
       
  1594   \( "$target_cpu" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
       
  1595   kvm="no"
       
  1596 fi
       
  1597 # Disable KVM for linux-user
       
  1598 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
       
  1599   kvm="no"
       
  1600 fi
       
  1601 
       
  1602 case "$target_cpu" in
       
  1603   i386)
       
  1604     echo "TARGET_ARCH=i386" >> $config_mak
       
  1605     echo "#define TARGET_ARCH \"i386\"" >> $config_h
       
  1606     echo "#define TARGET_I386 1" >> $config_h
       
  1607     if test $kqemu = "yes" -a "$target_softmmu" = "yes"
       
  1608     then
       
  1609       echo "#define USE_KQEMU 1" >> $config_h
       
  1610     fi
       
  1611     if test "$kvm" = "yes" ; then
       
  1612       echo "CONFIG_KVM=yes" >> $config_mak
       
  1613       echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
       
  1614       echo "#define CONFIG_KVM 1" >> $config_h
       
  1615     fi
       
  1616   ;;
       
  1617   x86_64)
       
  1618     echo "TARGET_ARCH=x86_64" >> $config_mak
       
  1619     echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
       
  1620     echo "#define TARGET_I386 1" >> $config_h
       
  1621     echo "#define TARGET_X86_64 1" >> $config_h
       
  1622     if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
       
  1623     then
       
  1624       echo "#define USE_KQEMU 1" >> $config_h
       
  1625     fi
       
  1626     if test "$kvm" = "yes" ; then
       
  1627       echo "CONFIG_KVM=yes" >> $config_mak
       
  1628       echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
       
  1629       echo "#define CONFIG_KVM 1" >> $config_h
       
  1630     fi
       
  1631   ;;
       
  1632   alpha)
       
  1633     echo "TARGET_ARCH=alpha" >> $config_mak
       
  1634     echo "#define TARGET_ARCH \"alpha\"" >> $config_h
       
  1635     echo "#define TARGET_ALPHA 1" >> $config_h
       
  1636   ;;
       
  1637   arm|armeb)
       
  1638     echo "TARGET_ARCH=arm" >> $config_mak
       
  1639     echo "#define TARGET_ARCH \"arm\"" >> $config_h
       
  1640     echo "#define TARGET_ARM 1" >> $config_h
       
  1641     bflt="yes"
       
  1642     target_nptl="yes"
       
  1643     gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
       
  1644   ;;
       
  1645   cris)
       
  1646     echo "TARGET_ARCH=cris" >> $config_mak
       
  1647     echo "#define TARGET_ARCH \"cris\"" >> $config_h
       
  1648     echo "#define TARGET_CRIS 1" >> $config_h
       
  1649   ;;
       
  1650   m68k)
       
  1651     echo "TARGET_ARCH=m68k" >> $config_mak
       
  1652     echo "#define TARGET_ARCH \"m68k\"" >> $config_h
       
  1653     echo "#define TARGET_M68K 1" >> $config_h
       
  1654     bflt="yes"
       
  1655     gdb_xml_files="cf-core.xml cf-fp.xml"
       
  1656   ;;
       
  1657   mips|mipsel)
       
  1658     echo "TARGET_ARCH=mips" >> $config_mak
       
  1659     echo "#define TARGET_ARCH \"mips\"" >> $config_h
       
  1660     echo "#define TARGET_MIPS 1" >> $config_h
       
  1661     echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
       
  1662   ;;
       
  1663   mipsn32|mipsn32el)
       
  1664     echo "TARGET_ARCH=mipsn32" >> $config_mak
       
  1665     echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
       
  1666     echo "#define TARGET_MIPS 1" >> $config_h
       
  1667     echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
       
  1668   ;;
       
  1669   mips64|mips64el)
       
  1670     echo "TARGET_ARCH=mips64" >> $config_mak
       
  1671     echo "#define TARGET_ARCH \"mips64\"" >> $config_h
       
  1672     echo "#define TARGET_MIPS 1" >> $config_h
       
  1673     echo "#define TARGET_MIPS64 1" >> $config_h
       
  1674     echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
       
  1675   ;;
       
  1676   ppc)
       
  1677     echo "TARGET_ARCH=ppc" >> $config_mak
       
  1678     echo "#define TARGET_ARCH \"ppc\"" >> $config_h
       
  1679     echo "#define TARGET_PPC 1" >> $config_h
       
  1680   ;;
       
  1681   ppcemb)
       
  1682     echo "TARGET_ARCH=ppcemb" >> $config_mak
       
  1683     echo "TARGET_ABI_DIR=ppc" >> $config_mak
       
  1684     echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
       
  1685     echo "#define TARGET_PPC 1" >> $config_h
       
  1686     echo "#define TARGET_PPCEMB 1" >> $config_h
       
  1687     if test "$kvm" = "yes" ; then
       
  1688       echo "CONFIG_KVM=yes" >> $config_mak
       
  1689       echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
       
  1690       echo "#define CONFIG_KVM 1" >> $config_h
       
  1691     fi
       
  1692   ;;
       
  1693   ppc64)
       
  1694     echo "TARGET_ARCH=ppc64" >> $config_mak
       
  1695     echo "TARGET_ABI_DIR=ppc" >> $config_mak
       
  1696     echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
       
  1697     echo "#define TARGET_PPC 1" >> $config_h
       
  1698     echo "#define TARGET_PPC64 1" >> $config_h
       
  1699   ;;
       
  1700   ppc64abi32)
       
  1701     echo "TARGET_ARCH=ppc64" >> $config_mak
       
  1702     echo "TARGET_ABI_DIR=ppc" >> $config_mak
       
  1703     echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
       
  1704     echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
       
  1705     echo "#define TARGET_PPC 1" >> $config_h
       
  1706     echo "#define TARGET_PPC64 1" >> $config_h
       
  1707     echo "#define TARGET_ABI32 1" >> $config_h
       
  1708   ;;
       
  1709   sh4|sh4eb)
       
  1710     echo "TARGET_ARCH=sh4" >> $config_mak
       
  1711     echo "#define TARGET_ARCH \"sh4\"" >> $config_h
       
  1712     echo "#define TARGET_SH4 1" >> $config_h
       
  1713     bflt="yes"
       
  1714     target_nptl="yes"
       
  1715   ;;
       
  1716   sparc)
       
  1717     echo "TARGET_ARCH=sparc" >> $config_mak
       
  1718     echo "#define TARGET_ARCH \"sparc\"" >> $config_h
       
  1719     echo "#define TARGET_SPARC 1" >> $config_h
       
  1720   ;;
       
  1721   sparc64)
       
  1722     echo "TARGET_ARCH=sparc64" >> $config_mak
       
  1723     echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
       
  1724     echo "#define TARGET_SPARC 1" >> $config_h
       
  1725     echo "#define TARGET_SPARC64 1" >> $config_h
       
  1726     elfload32="yes"
       
  1727   ;;
       
  1728   sparc32plus)
       
  1729     echo "TARGET_ARCH=sparc64" >> $config_mak
       
  1730     echo "TARGET_ABI_DIR=sparc" >> $config_mak
       
  1731     echo "TARGET_ARCH2=sparc32plus" >> $config_mak
       
  1732     echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
       
  1733     echo "#define TARGET_SPARC 1" >> $config_h
       
  1734     echo "#define TARGET_SPARC64 1" >> $config_h
       
  1735     echo "#define TARGET_ABI32 1" >> $config_h
       
  1736   ;;
       
  1737   *)
       
  1738     echo "Unsupported target CPU"
       
  1739     exit 1
       
  1740   ;;
       
  1741 esac
       
  1742 list=""
       
  1743 if test ! -z "$gdb_xml_files" ; then
       
  1744   for x in $gdb_xml_files; do
       
  1745     list="$list $source_path/gdbstub/$x"
       
  1746   done
       
  1747 fi
       
  1748 echo "TARGET_XML_FILES=$list" >> $config_mak
       
  1749 if test "$target_bigendian" = "yes" ; then
       
  1750   echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
       
  1751   echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
       
  1752 fi
       
  1753 if test "$target_softmmu" = "yes" ; then
       
  1754   echo "CONFIG_SOFTMMU=yes" >> $config_mak
       
  1755   echo "#define CONFIG_SOFTMMU 1" >> $config_h
       
  1756 fi
       
  1757 if test "$target_user_only" = "yes" ; then
       
  1758   echo "CONFIG_USER_ONLY=yes" >> $config_mak
       
  1759   echo "#define CONFIG_USER_ONLY 1" >> $config_h
       
  1760 fi
       
  1761 if test "$target_linux_user" = "yes" ; then
       
  1762   echo "CONFIG_LINUX_USER=yes" >> $config_mak
       
  1763   echo "#define CONFIG_LINUX_USER 1" >> $config_h
       
  1764 fi
       
  1765 if test "$target_darwin_user" = "yes" ; then
       
  1766   echo "CONFIG_DARWIN_USER=yes" >> $config_mak
       
  1767   echo "#define CONFIG_DARWIN_USER 1" >> $config_h
       
  1768 fi
       
  1769 list=""
       
  1770 if test ! -z "$gdb_xml_files" ; then
       
  1771   for x in $gdb_xml_files; do
       
  1772     list="$list $source_path/gdb-xml/$x"
       
  1773   done
       
  1774 fi
       
  1775 echo "TARGET_XML_FILES=$list" >> $config_mak
       
  1776 
       
  1777 if test "$target_cpu" = "arm" \
       
  1778      -o "$target_cpu" = "armeb" \
       
  1779      -o "$target_cpu" = "m68k" \
       
  1780      -o "$target_cpu" = "mips" \
       
  1781      -o "$target_cpu" = "mipsel" \
       
  1782      -o "$target_cpu" = "mipsn32" \
       
  1783      -o "$target_cpu" = "mipsn32el" \
       
  1784      -o "$target_cpu" = "mips64" \
       
  1785      -o "$target_cpu" = "mips64el" \
       
  1786      -o "$target_cpu" = "ppc" \
       
  1787      -o "$target_cpu" = "ppc64" \
       
  1788      -o "$target_cpu" = "ppc64abi32" \
       
  1789      -o "$target_cpu" = "ppcemb" \
       
  1790      -o "$target_cpu" = "sparc" \
       
  1791      -o "$target_cpu" = "sparc64" \
       
  1792      -o "$target_cpu" = "sparc32plus"; then
       
  1793   echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
       
  1794   echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
       
  1795 fi
       
  1796 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
       
  1797   echo "TARGET_HAS_BFLT=yes" >> $config_mak
       
  1798   echo "#define TARGET_HAS_BFLT 1" >> $config_h
       
  1799 fi
       
  1800 if test "$target_user_only" = "yes" \
       
  1801         -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
       
  1802   echo "#define USE_NPTL 1" >> $config_h
       
  1803 fi
       
  1804 # 32 bit ELF loader in addition to native 64 bit loader?
       
  1805 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
       
  1806   echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
       
  1807   echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
       
  1808 fi
       
  1809 if test "$target_bsd_user" = "yes" ; then
       
  1810   echo "CONFIG_BSD_USER=yes" >> $config_mak
       
  1811   echo "#define CONFIG_BSD_USER 1" >> $config_h
       
  1812 fi
       
  1813 
       
  1814 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
       
  1815 
       
  1816 done # for target in $targets
       
  1817 
       
  1818 # build tree in object directory if source path is different from current one
       
  1819 if test "$source_path_used" = "yes" ; then
       
  1820     DIRS="tests tests/cris slirp audio"
       
  1821     FILES="Makefile tests/Makefile"
       
  1822     FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
       
  1823     FILES="$FILES tests/test-mmap.c"
       
  1824     for dir in $DIRS ; do
       
  1825             mkdir -p $dir
       
  1826     done
       
  1827     # remove the link and recreate it, as not all "ln -sf" overwrite the link
       
  1828     for f in $FILES ; do
       
  1829         rm -f $f
       
  1830         ln -s $source_path/$f $f
       
  1831     done
       
  1832 fi