17d13299dSbellard#!/bin/sh 27d13299dSbellard# 33ef693a0Sbellard# qemu configure script (c) 2003 Fabrice Bellard 47d13299dSbellard# 57d13299dSbellard# set temporary file name 67d13299dSbellardif test ! -z "$TMPDIR" ; then 77d13299dSbellard TMPDIR1="${TMPDIR}" 87d13299dSbellardelif test ! -z "$TEMPDIR" ; then 97d13299dSbellard TMPDIR1="${TEMPDIR}" 107d13299dSbellardelse 117d13299dSbellard TMPDIR1="/tmp" 127d13299dSbellardfi 137d13299dSbellard 143ef693a0SbellardTMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c" 153ef693a0SbellardTMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o" 163ef693a0SbellardTMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}" 173ef693a0SbellardTMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S" 187d13299dSbellard 197d13299dSbellard# default parameters 2011d9f695Sbellardprefix="" 211e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 2243ce4dfeSbellardstatic="no" 237d13299dSbellardcross_prefix="" 247d13299dSbellardcc="gcc" 25328a4240Spbrookgcc3_search="yes" 26fe8f78e4Sbalroggcc3_list="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32" 27*0c58ac1cSmalcaudio_drv_list="" 28*0c58ac1cSmalcaudio_card_list="" 297d13299dSbellardhost_cc="gcc" 307d13299dSbellardar="ar" 317d13299dSbellardmake="make" 326a882643Spbrookinstall="install" 337d13299dSbellardstrip="strip" 347d13299dSbellardcpu=`uname -m` 355327cf48Sbellardtarget_list="" 367d13299dSbellardcase "$cpu" in 377d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 3897a847bcSbellard cpu="i386" 397d13299dSbellard ;; 40aaa5fa14Saurel32 x86_64|amd64) 41aaa5fa14Saurel32 cpu="x86_64" 42aaa5fa14Saurel32 ;; 43aaa5fa14Saurel32 alpha) 44aaa5fa14Saurel32 cpu="alpha" 45aaa5fa14Saurel32 ;; 46ba68055eSbellard armv*b) 47808c4954Sbellard cpu="armv4b" 48808c4954Sbellard ;; 49ba68055eSbellard armv*l) 507d13299dSbellard cpu="armv4l" 517d13299dSbellard ;; 52aaa5fa14Saurel32 cris) 53aaa5fa14Saurel32 cpu="cris" 547d13299dSbellard ;; 55f54b3f92Saurel32 parisc|parisc64) 56f54b3f92Saurel32 cpu="hppa" 57f54b3f92Saurel32 ;; 58aaa5fa14Saurel32 ia64) 59aaa5fa14Saurel32 cpu="ia64" 60aaa5fa14Saurel32 ;; 61aaa5fa14Saurel32 m68k) 62aaa5fa14Saurel32 cpu="m68k" 637d13299dSbellard ;; 647d13299dSbellard mips) 657d13299dSbellard cpu="mips" 667d13299dSbellard ;; 67fbe4f65bSths mips64) 68fbe4f65bSths cpu="mips64" 69fbe4f65bSths ;; 70aaa5fa14Saurel32 "Power Macintosh"|ppc|ppc64) 71aaa5fa14Saurel32 cpu="powerpc" 72e7daa605Sths ;; 730e7b8a9fSths s390*) 74fb3e5849Sbellard cpu="s390" 75fb3e5849Sbellard ;; 763142255cSblueswir1 sparc|sun4[cdmuv]) 77ae228531Sbellard cpu="sparc" 78ae228531Sbellard ;; 79ae228531Sbellard sparc64) 80ae228531Sbellard cpu="sparc64" 81ae228531Sbellard ;; 827d13299dSbellard *) 837d13299dSbellard cpu="unknown" 847d13299dSbellard ;; 857d13299dSbellardesac 867d13299dSbellardgprof="no" 877d13299dSbellardbigendian="no" 8867b915a5Sbellardmingw32="no" 8967b915a5SbellardEXESUF="" 9067b915a5Sbellardgdbstub="yes" 91443f1376Sbellardslirp="yes" 92102a52e4Sbellardfmod_lib="" 93102a52e4Sbellardfmod_inc="" 948d5d2d4cSthsvnc_tls="yes" 95b1a550a0Spbrookbsd="no" 965327cf48Sbellardlinux="no" 97c9ec1fe4Sbellardkqemu="no" 9805c2a3e7Sbellardprofiler="no" 995b0753e0Sbellardcocoa="no" 10097ccc689Sbellardcheck_gfx="yes" 1011aff381fSbellardcheck_gcc="yes" 1020a8e90f4Spbrooksoftmmu="yes" 103831b7825Sthslinux_user="no" 104831b7825Sthsdarwin_user="no" 105cc8ae6deSpbrookbuild_docs="no" 106c5937220Spbrookuname_release="" 1074d3b6f6eSbalrogcurses="yes" 108bd0c5661Spbrooknptl="yes" 1098ff9cbf7Smalcmixemu="no" 1107d13299dSbellard 1117d13299dSbellard# OS specific 1127d13299dSbellardtargetos=`uname -s` 1137d13299dSbellardcase $targetos in 114c326e0afSbellardCYGWIN*) 115c326e0afSbellardmingw32="yes" 1166f30fa85SthsOS_CFLAGS="-mno-cygwin" 117db8d7dd1Sthsif [ "$cpu" = "i386" ] ; then 118db8d7dd1Sths kqemu="yes" 119db8d7dd1Sthsfi 120c326e0afSbellard;; 12167b915a5SbellardMINGW32*) 12267b915a5Sbellardmingw32="yes" 123db8d7dd1Sthsif [ "$cpu" = "i386" ] ; then 124db8d7dd1Sths kqemu="yes" 125db8d7dd1Sthsfi 12667b915a5Sbellard;; 1275c40d2bdSthsGNU/kFreeBSD) 128*0c58ac1cSmalcaudio_drv_list="oss" 1295c40d2bdSthsif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 1305c40d2bdSths kqemu="yes" 1315c40d2bdSthsfi 1325c40d2bdSths;; 1337d3505c5SbellardFreeBSD) 1347d3505c5Sbellardbsd="yes" 135*0c58ac1cSmalcaudio_drv_list="oss" 136e99f9060Sbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 13707f4ddbfSbellard kqemu="yes" 13807f4ddbfSbellardfi 1397d3505c5Sbellard;; 1407d3505c5SbellardNetBSD) 1417d3505c5Sbellardbsd="yes" 142*0c58ac1cSmalcaudio_drv_list="oss" 1437d3505c5Sbellard;; 1447d3505c5SbellardOpenBSD) 1457d3505c5Sbellardbsd="yes" 146*0c58ac1cSmalcaudio_drv_list="oss" 1477d3505c5Sbellard;; 14883fb7adfSbellardDarwin) 14983fb7adfSbellardbsd="yes" 15083fb7adfSbellarddarwin="yes" 151831b7825Sthsdarwin_user="yes" 152fd677642Sthscocoa="yes" 153*0c58ac1cSmalcaudio_drv_list="coreaudio" 1546f30fa85SthsOS_CFLAGS="-mdynamic-no-pic" 155c2c59c3eSthsOS_LDFLAGS="-framework CoreFoundation -framework IOKit" 15683fb7adfSbellard;; 157ec530c81SbellardSunOS) 158ec530c81Sbellard solaris="yes" 159c2b84fabSths make="gmake" 160c2b84fabSths install="ginstall" 1610475a5caSths needs_libsunmath="no" 162c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 163ef18c883Sths # have to select again, because `uname -m` returns i86pc 164ef18c883Sths # even on an x86_64 box. 165ef18c883Sths solariscpu=`isainfo -k` 166ef18c883Sths if test "${solariscpu}" = "amd64" ; then 167ef18c883Sths cpu="x86_64" 168ef18c883Sths fi 169c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 1700475a5caSths if test "$solarisrev" -le 9 ; then 1710475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 1720475a5caSths needs_libsunmath="yes" 1730475a5caSths else 1740475a5caSths echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" 1750475a5caSths echo "libsunmath from the Sun Studio compilers tools, due to a lack of" 1760475a5caSths echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" 1770475a5caSths echo "Studio 11 can be downloaded from www.sun.com." 1780475a5caSths exit 1 1790475a5caSths fi 1800475a5caSths fi 1810475a5caSths if test "$solarisrev" -ge 9 ; then 182c2b84fabSths kqemu="yes" 183c2b84fabSths fi 18486b2bd93Sths fi 1856b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 186*0c58ac1cSmalc audio_drv_list="oss" 1876b4d2ba1Sths fi 188ec530c81Sbellard;; 189fb065187Sbellard*) 190*0c58ac1cSmalcaudio_drv_list="oss" 1915327cf48Sbellardlinux="yes" 192831b7825Sthslinux_user="yes" 19307f4ddbfSbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 194c9ec1fe4Sbellard kqemu="yes" 195c9ec1fe4Sbellardfi 196fb065187Sbellard;; 1977d13299dSbellardesac 1987d13299dSbellard 1997d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 200b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 2017d3505c5Sbellard make="gmake" 20283fb7adfSbellard fi 2037d3505c5Sbellardfi 2047d3505c5Sbellard 2057d13299dSbellard# find source path 206ad064840Spbrooksource_path=`dirname "$0"` 20759faef3aSbalrogsource_path_used="no" 20859faef3aSbalrogworkdir=`pwd` 209ad064840Spbrookif [ -z "$source_path" ]; then 21059faef3aSbalrog source_path=$workdir 211ad064840Spbrookelse 212ad064840Spbrook source_path=`cd "$source_path"; pwd` 2137d13299dSbellardfi 214724db118Spbrook[ -f "$workdir/vl.c" ] || source_path_used="yes" 2157d13299dSbellard 21685aa5189Sbellardwerror="no" 2170d1e2394Sbellard# generate compile errors on warnings for development builds 2180d1e2394Sbellard#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then 2190d1e2394Sbellard#werror="yes"; 2200d1e2394Sbellard#fi 22185aa5189Sbellard 2227d13299dSbellardfor opt do 223a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 2247d13299dSbellard case "$opt" in 2252efc3265Sbellard --help|-h) show_help=yes 2262efc3265Sbellard ;; 227b1a550a0Spbrook --prefix=*) prefix="$optarg" 2287d13299dSbellard ;; 229b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 23032ce6337Sbellard ;; 231b1a550a0Spbrook --source-path=*) source_path="$optarg" 232ad064840Spbrook source_path_used="yes" 2337d13299dSbellard ;; 234b1a550a0Spbrook --cross-prefix=*) cross_prefix="$optarg" 2357d13299dSbellard ;; 236b1a550a0Spbrook --cc=*) cc="$optarg" 237328a4240Spbrook gcc3_search="no" 2387d13299dSbellard ;; 239b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 24083469015Sbellard ;; 241b1a550a0Spbrook --make=*) make="$optarg" 2427d13299dSbellard ;; 2436a882643Spbrook --install=*) install="$optarg" 2446a882643Spbrook ;; 245b1a550a0Spbrook --extra-cflags=*) CFLAGS="$optarg" 2467d13299dSbellard ;; 247b1a550a0Spbrook --extra-ldflags=*) LDFLAGS="$optarg" 2487d13299dSbellard ;; 249b1a550a0Spbrook --cpu=*) cpu="$optarg" 2507d13299dSbellard ;; 251b1a550a0Spbrook --target-list=*) target_list="$optarg" 252de83cd02Sbellard ;; 2537d13299dSbellard --enable-gprof) gprof="yes" 2547d13299dSbellard ;; 25543ce4dfeSbellard --static) static="yes" 25643ce4dfeSbellard ;; 25797a847bcSbellard --disable-sdl) sdl="no" 25897a847bcSbellard ;; 259b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 260102a52e4Sbellard ;; 261*0c58ac1cSmalc --audio-card-list=*) audio_card_list="$optarg" 262*0c58ac1cSmalc ;; 263*0c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 264*0c58ac1cSmalc ;; 265b1a550a0Spbrook --fmod-inc=*) fmod_inc="$optarg" 266102a52e4Sbellard ;; 2678d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 2688d5d2d4cSths ;; 269b93aebecSbellard --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no" 27067b915a5Sbellard ;; 271443f1376Sbellard --disable-slirp) slirp="no" 272c20709aaSbellard ;; 273c9ec1fe4Sbellard --disable-kqemu) kqemu="no" 274c9ec1fe4Sbellard ;; 2752e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 2762e4d9fb1Saurel32 ;; 27705c2a3e7Sbellard --enable-profiler) profiler="yes" 27805c2a3e7Sbellard ;; 279*0c58ac1cSmalc --enable-cocoa) cocoa="yes" ; sdl="no" ; 2805b0753e0Sbellard ;; 28197ccc689Sbellard --disable-gfx-check) check_gfx="no" 28297ccc689Sbellard ;; 2831aff381fSbellard --disable-gcc-check) check_gcc="no" 2841aff381fSbellard ;; 285cad25d69Spbrook --disable-system) softmmu="no" 2860a8e90f4Spbrook ;; 287cad25d69Spbrook --enable-system) softmmu="yes" 2880a8e90f4Spbrook ;; 289831b7825Sths --disable-linux-user) linux_user="no" 2900a8e90f4Spbrook ;; 291831b7825Sths --enable-linux-user) linux_user="yes" 292831b7825Sths ;; 293831b7825Sths --disable-darwin-user) darwin_user="no" 294831b7825Sths ;; 295831b7825Sths --enable-darwin-user) darwin_user="yes" 2960a8e90f4Spbrook ;; 297c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 298c5937220Spbrook ;; 2993142255cSblueswir1 --sparc_cpu=*) 3003142255cSblueswir1 sparc_cpu="$optarg" 3013142255cSblueswir1 case $sparc_cpu in 3023142255cSblueswir1 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32" 3033142255cSblueswir1 target_cpu="sparc"; cpu="sparc" ;; 3043142255cSblueswir1 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32" 3053142255cSblueswir1 target_cpu="sparc"; cpu="sparc" ;; 3063142255cSblueswir1 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64" 3073142255cSblueswir1 target_cpu="sparc64"; cpu="sparc64" ;; 3083142255cSblueswir1 *) echo "undefined SPARC architecture. Exiting";exit 1;; 3093142255cSblueswir1 esac 3103142255cSblueswir1 ;; 31185aa5189Sbellard --enable-werror) werror="yes" 31285aa5189Sbellard ;; 31385aa5189Sbellard --disable-werror) werror="no" 31485aa5189Sbellard ;; 3154d3b6f6eSbalrog --disable-curses) curses="no" 3164d3b6f6eSbalrog ;; 317bd0c5661Spbrook --disable-nptl) nptl="no" 318bd0c5661Spbrook ;; 3198ff9cbf7Smalc --enable-mixemu) mixemu="yes" 3208ff9cbf7Smalc ;; 3217f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 3227f1559c6Sbalrog ;; 3237d13299dSbellard esac 3247d13299dSbellarddone 3257d13299dSbellard 326209afb9eSthsif [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then 327209afb9eSths AIOLIBS= 328209afb9eSthselse 3294259e1a5Sths # Some Linux architectures (e.g. s390) don't imply -lpthread automatically. 3304259e1a5Sths AIOLIBS="-lrt -lpthread" 331209afb9eSthsfi 332209afb9eSths 3336f30fa85Sths# default flags for all hosts 3346f30fa85SthsCFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing" 3356f30fa85SthsLDFLAGS="$LDFLAGS -g" 33685aa5189Sbellardif test "$werror" = "yes" ; then 33785aa5189SbellardCFLAGS="$CFLAGS -Werror" 33885aa5189Sbellardfi 3396f30fa85Sths 3403142255cSblueswir1# 3413142255cSblueswir1# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right 3423142255cSblueswir1# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) 3433142255cSblueswir1# 34440293e58Sbellardcase "$cpu" in 3453142255cSblueswir1 sparc) if test -z "$sparc_cpu" ; then 3463142255cSblueswir1 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__" 3473142255cSblueswir1 ARCH_LDFLAGS="-m32" 3483142255cSblueswir1 else 3493142255cSblueswir1 ARCH_CFLAGS="${SP_CFLAGS}" 3503142255cSblueswir1 ARCH_LDFLAGS="${SP_LDFLAGS}" 3513142255cSblueswir1 fi 3523142255cSblueswir1 ;; 3533142255cSblueswir1 sparc64) if test -z "$sparc_cpu" ; then 3543142255cSblueswir1 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__" 3553142255cSblueswir1 ARCH_LDFLAGS="-m64" 3563142255cSblueswir1 else 3573142255cSblueswir1 ARCH_CFLAGS="${SP_CFLAGS}" 3583142255cSblueswir1 ARCH_LDFLAGS="${SP_LDFLAGS}" 3593142255cSblueswir1 fi 3603142255cSblueswir1 ;; 36176d83bdeSths s390) 36276d83bdeSths ARCH_CFLAGS="-march=z900" 36376d83bdeSths ;; 36440293e58Sbellard i386) 36540293e58Sbellard ARCH_CFLAGS="-m32" 36640293e58Sbellard ARCH_LDFLAGS="-m32" 36740293e58Sbellard ;; 36840293e58Sbellard x86_64) 36940293e58Sbellard ARCH_CFLAGS="-m64" 37040293e58Sbellard ARCH_LDFLAGS="-m64" 37140293e58Sbellard ;; 3723142255cSblueswir1esac 3733142255cSblueswir1 374af5db58eSpbrookif test x"$show_help" = x"yes" ; then 375af5db58eSpbrookcat << EOF 376af5db58eSpbrook 377af5db58eSpbrookUsage: configure [options] 378af5db58eSpbrookOptions: [defaults in brackets after descriptions] 379af5db58eSpbrook 380af5db58eSpbrookEOF 381af5db58eSpbrookecho "Standard options:" 382af5db58eSpbrookecho " --help print this message" 383af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 384af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 385af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 386af5db58eSpbrookecho " --target-list=LIST set target list [$target_list]" 387af5db58eSpbrookecho "" 388af5db58eSpbrookecho "kqemu kernel acceleration support:" 389af5db58eSpbrookecho " --disable-kqemu disable kqemu support" 390af5db58eSpbrookecho "" 391af5db58eSpbrookecho "Advanced options (experts only):" 392af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 393af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 394af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 395af5db58eSpbrookecho " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc." 396af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 3976a882643Spbrookecho " --install=INSTALL use specified install [$install]" 398af5db58eSpbrookecho " --static enable static build [$static]" 39985aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 400fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 401af5db58eSpbrookecho " --enable-cocoa enable COCOA (Mac OS X only)" 402af5db58eSpbrookecho " --enable-mingw32 enable Win32 cross compilation with mingw32" 403*0c58ac1cSmalcecho " --audio-drv-list set audio drivers list" 404*0c58ac1cSmalcecho " --audio-card-list set list of additional emulated audio cards" 4058ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 4062e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 4078d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 408af896aaaSpbrookecho " --disable-curses disable curses output" 409bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 410af5db58eSpbrookecho " --enable-system enable all system emulation targets" 411af5db58eSpbrookecho " --disable-system disable all system emulation targets" 412831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 413831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 414831b7825Sthsecho " --enable-darwin-user enable all darwin usermode emulation targets" 415831b7825Sthsecho " --disable-darwin-user disable all darwin usermode emulation targets" 416af5db58eSpbrookecho " --fmod-lib path to FMOD library" 417af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 418c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 4193142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 420af5db58eSpbrookecho "" 4215bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 422af5db58eSpbrookexit 1 423af5db58eSpbrookfi 424af5db58eSpbrook 4257d13299dSbellardcc="${cross_prefix}${cc}" 4267d13299dSbellardar="${cross_prefix}${ar}" 4277d13299dSbellardstrip="${cross_prefix}${strip}" 4287d13299dSbellard 429064aae13Spbrook# check that the C compiler works. 430064aae13Spbrookcat > $TMPC <<EOF 431064aae13Spbrookint main(void) {} 432064aae13SpbrookEOF 433064aae13Spbrook 434db7287edSpbrookif $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then 435064aae13Spbrook : C compiler works ok 436064aae13Spbrookelse 437064aae13Spbrook echo "ERROR: \"$cc\" either does not exist or does not work" 438064aae13Spbrook exit 1 439a7350fa1Sbellardfi 440a7350fa1Sbellard 44167b915a5Sbellardif test "$mingw32" = "yes" ; then 4425327cf48Sbellard linux="no" 44367b915a5Sbellard EXESUF=".exe" 4449f059ecaSbellard oss="no" 44567b915a5Sbellardfi 44667b915a5Sbellard 447328a4240Spbrook# Check for gcc4, error if pre-gcc4 448328a4240Spbrookif test "$check_gcc" = "yes" ; then 449328a4240Spbrook cat > $TMPC <<EOF 450328a4240Spbrook#if __GNUC__ < 4 451328a4240Spbrook#error gcc3 452328a4240Spbrook#endif 453328a4240Spbrookint main(){return 0;} 454328a4240SpbrookEOF 455db7287edSpbrook if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then 456328a4240Spbrook echo "WARNING: \"$cc\" looks like gcc 4.x" 457328a4240Spbrook found_compat_cc="no" 458328a4240Spbrook if test "$gcc3_search" = "yes" ; then 459328a4240Spbrook echo "Looking for gcc 3.x" 460328a4240Spbrook for compat_cc in $gcc3_list ; do 461d4af3de2Sbalrog if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then 462328a4240Spbrook echo "Found \"$compat_cc\"" 4631124426aSpbrook cc="$cross_prefix$compat_cc" 464328a4240Spbrook found_compat_cc="yes" 465328a4240Spbrook break 466328a4240Spbrook fi 467328a4240Spbrook done 468328a4240Spbrook if test "$found_compat_cc" = "no" ; then 469328a4240Spbrook echo "gcc 3.x not found!" 470328a4240Spbrook fi 471328a4240Spbrook fi 472328a4240Spbrook if test "$found_compat_cc" = "no" ; then 473328a4240Spbrook echo "QEMU is known to have problems when compiled with gcc 4.x" 474328a4240Spbrook echo "It is recommended that you use gcc 3.x to build QEMU" 475328a4240Spbrook echo "To use this compiler anyway, configure with --disable-gcc-check" 476328a4240Spbrook exit 1; 477328a4240Spbrook fi 478328a4240Spbrook fi 479328a4240Spbrookfi 480328a4240Spbrook 481ec530c81Sbellard# 482ec530c81Sbellard# Solaris specific configure tool chain decisions 483ec530c81Sbellard# 484ec530c81Sbellardif test "$solaris" = "yes" ; then 485ec530c81Sbellard # 486ec530c81Sbellard # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly 487ec530c81Sbellard # override the check with --disable-gcc-check 488ec530c81Sbellard # 489ec530c81Sbellard if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then 490ec530c81Sbellard solgcc=`which $cc` 491ec530c81Sbellard if test "$solgcc" = "/usr/sfw/bin/gcc" ; then 492ec530c81Sbellard echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly." 493ec530c81Sbellard echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3" 494ec530c81Sbellard echo "or get the latest patch from SunSolve for gcc" 495ec530c81Sbellard exit 1 496ec530c81Sbellard fi 497ec530c81Sbellard fi 498ec530c81Sbellard solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"` 499ec530c81Sbellard if test -z "$solinst" ; then 500ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 501ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 502ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 503ec530c81Sbellard exit 1 504ec530c81Sbellard fi 505ec530c81Sbellard if test "$solinst" = "/usr/sbin/install" ; then 506ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 507ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 508ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 509ec530c81Sbellard exit 1 510ec530c81Sbellard fi 511ec530c81Sbellard sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"` 512ec530c81Sbellard if test -z "$sol_ar" ; then 513ec530c81Sbellard echo "Error: No path includes ar" 514ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 515ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 516ec530c81Sbellard fi 517ec530c81Sbellard exit 1 518ec530c81Sbellard fi 519ec530c81Sbellardfi 520ec530c81Sbellard 521ec530c81Sbellard 5225327cf48Sbellardif test -z "$target_list" ; then 5235327cf48Sbellard# these targets are portable 5240a8e90f4Spbrook if [ "$softmmu" = "yes" ] ; then 5252408a527Saurel32 target_list="\ 5262408a527Saurel32i386-softmmu \ 5272408a527Saurel32x86_64-softmmu \ 5282408a527Saurel32arm-softmmu \ 5292408a527Saurel32cris-softmmu \ 5302408a527Saurel32m68k-softmmu \ 5312408a527Saurel32mips-softmmu \ 5322408a527Saurel32mipsel-softmmu \ 5332408a527Saurel32mips64-softmmu \ 5342408a527Saurel32mips64el-softmmu \ 5352408a527Saurel32ppc-softmmu \ 5362408a527Saurel32ppcemb-softmmu \ 5372408a527Saurel32ppc64-softmmu \ 5382408a527Saurel32sh4-softmmu \ 5392408a527Saurel32sh4eb-softmmu \ 5402408a527Saurel32sparc-softmmu \ 5412408a527Saurel32" 5420a8e90f4Spbrook fi 5435327cf48Sbellard# the following are Linux specific 544831b7825Sths if [ "$linux_user" = "yes" ] ; then 5452408a527Saurel32 target_list="${target_list}\ 5462408a527Saurel32i386-linux-user \ 5472408a527Saurel32x86_64-linux-user \ 5482408a527Saurel32alpha-linux-user \ 5492408a527Saurel32arm-linux-user \ 5502408a527Saurel32armeb-linux-user \ 5512408a527Saurel32cris-linux-user \ 5522408a527Saurel32m68k-linux-user \ 5532408a527Saurel32mips-linux-user \ 5542408a527Saurel32mipsel-linux-user \ 5552408a527Saurel32ppc-linux-user \ 5562408a527Saurel32ppc64-linux-user \ 5572408a527Saurel32ppc64abi32-linux-user \ 5582408a527Saurel32sh4-linux-user \ 5592408a527Saurel32sh4eb-linux-user \ 5602408a527Saurel32sparc-linux-user \ 5612408a527Saurel32sparc64-linux-user \ 5622408a527Saurel32sparc32plus-linux-user \ 5632408a527Saurel32" 564831b7825Sths fi 565831b7825Sths# the following are Darwin specific 566831b7825Sths if [ "$darwin_user" = "yes" ] ; then 5672408a527Saurel32 target_list="$target_list i386-darwin-user ppc-darwin-user" 5685327cf48Sbellard fi 5696e20a45fSbellardelse 570b1a550a0Spbrook target_list=`echo "$target_list" | sed -e 's/,/ /g'` 5715327cf48Sbellardfi 5720a8e90f4Spbrookif test -z "$target_list" ; then 5730a8e90f4Spbrook echo "No targets enabled" 5740a8e90f4Spbrook exit 1 5750a8e90f4Spbrookfi 5765327cf48Sbellard 5777d13299dSbellardif test -z "$cross_prefix" ; then 5787d13299dSbellard 5797d13299dSbellard# --- 5807d13299dSbellard# big/little endian test 5817d13299dSbellardcat > $TMPC << EOF 5827d13299dSbellard#include <inttypes.h> 5837d13299dSbellardint main(int argc, char ** argv){ 5847d13299dSbellard volatile uint32_t i=0x01234567; 5857d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 5867d13299dSbellard} 5877d13299dSbellardEOF 5887d13299dSbellard 589db7287edSpbrookif $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then 5907d13299dSbellard$TMPE && bigendian="yes" 5917d13299dSbellardelse 5927d13299dSbellardecho big/little test failed 5937d13299dSbellardfi 5947d13299dSbellard 5957d13299dSbellardelse 5967d13299dSbellard 5977d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 5980938cda5Saurel32if test "$cpu" = "armv4b" \ 599f54b3f92Saurel32 -o "$cpu" = "hppa" \ 6000938cda5Saurel32 -o "$cpu" = "m68k" \ 6010938cda5Saurel32 -o "$cpu" = "mips" \ 6020938cda5Saurel32 -o "$cpu" = "mips64" \ 6030938cda5Saurel32 -o "$cpu" = "powerpc" \ 6040938cda5Saurel32 -o "$cpu" = "s390" \ 6050938cda5Saurel32 -o "$cpu" = "sparc" \ 6060938cda5Saurel32 -o "$cpu" = "sparc64"; then 6077d13299dSbellard bigendian="yes" 6087d13299dSbellardfi 6097d13299dSbellard 6107d13299dSbellardfi 6117d13299dSbellard 612b6853697Sbellard# host long bits test 613b6853697Sbellardhostlongbits="32" 6140938cda5Saurel32if test "$cpu" = "x86_64" \ 6150938cda5Saurel32 -o "$cpu" = "alpha" \ 6160938cda5Saurel32 -o "$cpu" = "ia64" \ 6170938cda5Saurel32 -o "$cpu" = "sparc64"; then 618b6853697Sbellard hostlongbits="64" 619b6853697Sbellardfi 620b6853697Sbellard 621e8cd23deSbellard# check gcc options support 62204369ff2Sbellardcat > $TMPC <<EOF 62304369ff2Sbellardint main(void) { 62404369ff2Sbellard} 62504369ff2SbellardEOF 62604369ff2Sbellard 627bd0c5661Spbrook# Check host NPTL support 628bd0c5661Spbrookcat > $TMPC <<EOF 629bd0c5661Spbrook#include <sched.h> 63030813ceaSpbrook#include <linux/futex.h> 631bd0c5661Spbrookvoid foo() 632bd0c5661Spbrook{ 633bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 634bd0c5661Spbrook#error bork 635bd0c5661Spbrook#endif 636bd0c5661Spbrook} 637bd0c5661SpbrookEOF 638bd0c5661Spbrook 639bd0c5661Spbrookif $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then 640bd0c5661Spbrook : 641bd0c5661Spbrookelse 642bd0c5661Spbrook nptl="no" 643bd0c5661Spbrookfi 644bd0c5661Spbrook 64511d9f695Sbellard########################################## 64611d9f695Sbellard# SDL probe 64711d9f695Sbellard 64811d9f695Sbellardsdl_too_old=no 64911d9f695Sbellard 65011d9f695Sbellardif test -z "$sdl" ; then 651a6e022adSbellard sdl_config="sdl-config" 652a6e022adSbellard sdl=no 6537c1f25b4Sbellard sdl_static=no 654a6e022adSbellard 655a6e022adSbellard if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then 656a6e022adSbellard # win32 cross compilation case 657a6e022adSbellard sdl_config="i386-mingw32msvc-sdl-config" 658a6e022adSbellard sdl=yes 659a6e022adSbellard else 660a6e022adSbellard # normal SDL probe 66111d9f695Sbellardcat > $TMPC << EOF 66211d9f695Sbellard#include <SDL.h> 66311d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 66411d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 66511d9f695SbellardEOF 666db7287edSpbrook if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then 667a6e022adSbellard _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'` 66811d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 66911d9f695Sbellard sdl_too_old=yes 67011d9f695Sbellard else 671fd677642Sths if test "$cocoa" = "no" ; then 67211d9f695Sbellard sdl=yes 67311d9f695Sbellard fi 674fd677642Sths fi 6757c1f25b4Sbellard 6767c1f25b4Sbellard # static link with sdl ? 6777c1f25b4Sbellard if test "$sdl" = "yes" ; then 6787c1f25b4Sbellard aa="no" 679e14a693dSths `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes" 680e14a693dSths sdl_static_libs=`$sdl_config --static-libs 2>/dev/null` 6817c1f25b4Sbellard if [ "$aa" = "yes" ] ; then 682d8d8aa4eSbellard sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`" 68311d9f695Sbellard fi 68411d9f695Sbellard 6858281db4dSths if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then 6867c1f25b4Sbellard sdl_static=yes 6877c1f25b4Sbellard fi 6887c1f25b4Sbellard fi # static link 6897c1f25b4Sbellard fi # sdl compile test 690a6e022adSbellard fi # cross compilation 691fd677642Sthselse 692fd677642Sths # Make sure to disable cocoa if sdl was set 693fd677642Sths if test "$sdl" = "yes" ; then 694fd677642Sths cocoa="no" 695*0c58ac1cSmalc audio_drv_list="echo $audio_drv_list | sed s,coreaudio,,g" 696fd677642Sths fi 697a6e022adSbellardfi # -z $sdl 69811d9f695Sbellard 6998f28f3fbSths########################################## 7008d5d2d4cSths# VNC TLS detection 7018d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 7028d5d2d4cSths `pkg-config gnutls` || vnc_tls="no" 7038d5d2d4cSthsfi 7048d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 7058d5d2d4cSths vnc_tls_cflags=`pkg-config --cflags gnutls` 7068d5d2d4cSths vnc_tls_libs=`pkg-config --libs gnutls` 7078d5d2d4cSthsfi 7088d5d2d4cSths 7098d5d2d4cSths########################################## 7108f28f3fbSths# alsa sound support libraries 7118f28f3fbSths 7128f28f3fbSthsif test "$alsa" = "yes" ; then 7138f28f3fbSths cat > $TMPC << EOF 7148f28f3fbSths#include <alsa/asoundlib.h> 7158f28f3fbSthsint main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); } 7168f28f3fbSthsEOF 717db7287edSpbrook if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lasound 2> /dev/null ; then 7188f28f3fbSths : 7198f28f3fbSths else 7208f28f3fbSths echo 7218f28f3fbSths echo "Error: Could not find alsa" 7228f28f3fbSths echo "Make sure to have the alsa libs and headers installed." 7238f28f3fbSths echo 7248f28f3fbSths exit 1 7258f28f3fbSths fi 7268f28f3fbSthsfi 7278f28f3fbSths 7284d3b6f6eSbalrog########################################## 7292e4d9fb1Saurel32# BrlAPI probe 7302e4d9fb1Saurel32 7312e4d9fb1Saurel32if test -z "$brlapi" ; then 7322e4d9fb1Saurel32 brlapi=no 7332e4d9fb1Saurel32cat > $TMPC << EOF 7342e4d9fb1Saurel32#include <brlapi.h> 7352e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 7362e4d9fb1Saurel32EOF 737a40e56d5Saurel32 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev/null ; then 7382e4d9fb1Saurel32 brlapi=yes 7392e4d9fb1Saurel32 fi # brlapi compile test 7402e4d9fb1Saurel32fi # -z $brlapi 7412e4d9fb1Saurel32 7422e4d9fb1Saurel32########################################## 7434d3b6f6eSbalrog# curses probe 7444d3b6f6eSbalrog 7454d3b6f6eSbalrogif test "$curses" = "yes" ; then 7464d3b6f6eSbalrog curses=no 7474d3b6f6eSbalrog cat > $TMPC << EOF 7484d3b6f6eSbalrog#include <curses.h> 7494d3b6f6eSbalrogint main(void) { return curses_version(); } 7504d3b6f6eSbalrogEOF 751af896aaaSpbrook if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then 7524d3b6f6eSbalrog curses=yes 7534d3b6f6eSbalrog fi 7544d3b6f6eSbalrogfi # test "$curses" 7554d3b6f6eSbalrog 756cc8ae6deSpbrook# Check if tools are available to build documentation. 7576c591867Sthsif [ -x "`which texi2html 2>/dev/null`" ] && \ 7586c591867Sths [ -x "`which pod2man 2>/dev/null`" ]; then 759cc8ae6deSpbrook build_docs="yes" 760cc8ae6deSpbrookfi 761cc8ae6deSpbrook 76211d9f695Sbellardif test "$mingw32" = "yes" ; then 76311d9f695Sbellard if test -z "$prefix" ; then 76411d9f695Sbellard prefix="/c/Program Files/Qemu" 76511d9f695Sbellard fi 766308c3593Spbrook mansuffix="" 767308c3593Spbrook datasuffix="" 768308c3593Spbrook docsuffix="" 769308c3593Spbrook binsuffix="" 77011d9f695Sbellardelse 77111d9f695Sbellard if test -z "$prefix" ; then 77211d9f695Sbellard prefix="/usr/local" 77311d9f695Sbellard fi 774308c3593Spbrook mansuffix="/share/man" 775308c3593Spbrook datasuffix="/share/qemu" 776308c3593Spbrook docsuffix="/share/doc/qemu" 777308c3593Spbrook binsuffix="/bin" 77811d9f695Sbellardfi 7795a67135aSbellard 7807d13299dSbellardecho "Install prefix $prefix" 781308c3593Spbrookecho "BIOS directory $prefix$datasuffix" 782308c3593Spbrookecho "binary directory $prefix$binsuffix" 78311d9f695Sbellardif test "$mingw32" = "no" ; then 784308c3593Spbrookecho "Manual directory $prefix$mansuffix" 78543ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 78611d9f695Sbellardfi 7875a67135aSbellardecho "Source path $source_path" 7887d13299dSbellardecho "C compiler $cc" 78983469015Sbellardecho "Host C compiler $host_cc" 790db7287edSpbrookecho "ARCH_CFLAGS $ARCH_CFLAGS" 7917d13299dSbellardecho "make $make" 7926a882643Spbrookecho "install $install" 793a98fd896Sbellardecho "host CPU $cpu" 794de83cd02Sbellardecho "host big endian $bigendian" 79597a847bcSbellardecho "target list $target_list" 7967d13299dSbellardecho "gprof enabled $gprof" 79705c2a3e7Sbellardecho "profiler $profiler" 79843ce4dfeSbellardecho "static build $static" 79985aa5189Sbellardecho "-Werror enabled $werror" 8005b0753e0Sbellardif test "$darwin" = "yes" ; then 8015b0753e0Sbellard echo "Cocoa support $cocoa" 8025b0753e0Sbellardfi 80397a847bcSbellardecho "SDL support $sdl" 804e4afee97Sbellardif test "$sdl" != "no" ; then 8057c1f25b4Sbellard echo "SDL static link $sdl_static" 806e4afee97Sbellardfi 8074d3b6f6eSbalrogecho "curses support $curses" 80867b915a5Sbellardecho "mingw32 support $mingw32" 809*0c58ac1cSmalcecho "Audio drivers $audio_drv_list" 810*0c58ac1cSmalcecho "Extra audio cards $audio_card_list" 8118ff9cbf7Smalcecho "Mixer emulation $mixemu" 8121d14ffa9Sbellardif test "$fmod" = "yes"; then 8131d14ffa9Sbellard if test -z $fmod_lib || test -z $fmod_inc; then 8141d14ffa9Sbellard echo 8151d14ffa9Sbellard echo "Error: You must specify path to FMOD library and headers" 8161d14ffa9Sbellard echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 8171d14ffa9Sbellard echo 8181d14ffa9Sbellard exit 1 8191d14ffa9Sbellard fi 820b1a550a0Spbrook fmod_support=" (lib='$fmod_lib' include='$fmod_inc')" 821b1a550a0Spbrookelse 822b1a550a0Spbrook fmod_support="" 823102a52e4Sbellardfi 824b1a550a0Spbrookecho "FMOD support $fmod $fmod_support" 8256b4d2ba1Sthsecho "OSS support $oss" 8268d5d2d4cSthsecho "VNC TLS support $vnc_tls" 8278d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 8288d5d2d4cSths echo " TLS CFLAGS $vnc_tls_cflags" 8298d5d2d4cSths echo " TLS LIBS $vnc_tls_libs" 8308d5d2d4cSthsfi 8313142255cSblueswir1if test -n "$sparc_cpu"; then 8323142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 8333142255cSblueswir1fi 83407f4ddbfSbellardecho "kqemu support $kqemu" 8352e4d9fb1Saurel32echo "brlapi support $brlapi" 836cc8ae6deSpbrookecho "Documentation $build_docs" 837c5937220Spbrook[ ! -z "$uname_release" ] && \ 838c5937220Spbrookecho "uname -r $uname_release" 839bd0c5661Spbrookecho "NPTL support $nptl" 84067b915a5Sbellard 84197a847bcSbellardif test $sdl_too_old = "yes"; then 84224b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 843e8cd23deSbellardfi 84420b40c6aSthsif [ -s /tmp/qemu-$$-sdl-config.log ]; then 84520b40c6aSths echo "The error log from compiling the libSDL test is: " 84620b40c6aSths cat /tmp/qemu-$$-sdl-config.log 84720b40c6aSthsfi 84820b40c6aSthsrm -f /tmp/qemu-$$-sdl-config.log 84924b55b96Sbellard#if test "$sdl_static" = "no"; then 85024b55b96Sbellard# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output" 85124b55b96Sbellard#fi 85297a847bcSbellardconfig_mak="config-host.mak" 85397a847bcSbellardconfig_h="config-host.h" 85497a847bcSbellard 8557c1f25b4Sbellard#echo "Creating $config_mak and $config_h" 85697a847bcSbellard 85715d9ca0fSthstest -f $config_h && mv $config_h ${config_h}~ 85815d9ca0fSths 85997a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak 86029517134Spbrookecho "# Configured with: $0 $@" >> $config_mak 86197a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h 86297a847bcSbellard 86397a847bcSbellardecho "prefix=$prefix" >> $config_mak 864308c3593Spbrookecho "bindir=\${prefix}$binsuffix" >> $config_mak 865308c3593Spbrookecho "mandir=\${prefix}$mansuffix" >> $config_mak 866308c3593Spbrookecho "datadir=\${prefix}$datasuffix" >> $config_mak 8674ad5b06dSthsecho "docdir=\${prefix}$docsuffix" >> $config_mak 868308c3593Spbrookecho "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h 86997a847bcSbellardecho "MAKE=$make" >> $config_mak 8706a882643Spbrookecho "INSTALL=$install" >> $config_mak 87197a847bcSbellardecho "CC=$cc" >> $config_mak 87297a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak 87397a847bcSbellardecho "AR=$ar" >> $config_mak 87497a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak 87540293e58Sbellard# XXX: only use CFLAGS and LDFLAGS ? 87640293e58Sbellard# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross 87740293e58Sbellard# compilation of dyngen tool (useful for win32 build on Linux host) 8786f30fa85Sthsecho "OS_CFLAGS=$OS_CFLAGS" >> $config_mak 8793142255cSblueswir1echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak 8803142255cSblueswir1echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak 8813142255cSblueswir1echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak 88297a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak 88397a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak 88467b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak 88570956b77Sthsecho "AIOLIBS=$AIOLIBS" >> $config_mak 8862408a527Saurel32case "$cpu" in 8872408a527Saurel32 i386) 88897a847bcSbellard echo "ARCH=i386" >> $config_mak 88997a847bcSbellard echo "#define HOST_I386 1" >> $config_h 8902408a527Saurel32 ;; 8912408a527Saurel32 x86_64) 8920b0babc6Sbellard echo "ARCH=x86_64" >> $config_mak 8930b0babc6Sbellard echo "#define HOST_X86_64 1" >> $config_h 8942408a527Saurel32 ;; 8952408a527Saurel32 alpha) 8960938cda5Saurel32 echo "ARCH=alpha" >> $config_mak 8970938cda5Saurel32 echo "#define HOST_ALPHA 1" >> $config_h 8982408a527Saurel32 ;; 8992408a527Saurel32 armv4b) 900808c4954Sbellard echo "ARCH=arm" >> $config_mak 901808c4954Sbellard echo "#define HOST_ARM 1" >> $config_h 9022408a527Saurel32 ;; 9032408a527Saurel32 armv4l) 90497a847bcSbellard echo "ARCH=arm" >> $config_mak 90597a847bcSbellard echo "#define HOST_ARM 1" >> $config_h 9062408a527Saurel32 ;; 9072408a527Saurel32 cris) 908e7daa605Sths echo "ARCH=cris" >> $config_mak 909e7daa605Sths echo "#define HOST_CRIS 1" >> $config_h 9102408a527Saurel32 ;; 9112408a527Saurel32 hppa) 912f54b3f92Saurel32 echo "ARCH=hppa" >> $config_mak 913f54b3f92Saurel32 echo "#define HOST_HPPA 1" >> $config_h 9142408a527Saurel32 ;; 9152408a527Saurel32 ia64) 91697a847bcSbellard echo "ARCH=ia64" >> $config_mak 91797a847bcSbellard echo "#define HOST_IA64 1" >> $config_h 9182408a527Saurel32 ;; 9192408a527Saurel32 m68k) 92038ca2abcSbellard echo "ARCH=m68k" >> $config_mak 92138ca2abcSbellard echo "#define HOST_M68K 1" >> $config_h 9222408a527Saurel32 ;; 9232408a527Saurel32 mips) 9240938cda5Saurel32 echo "ARCH=mips" >> $config_mak 9250938cda5Saurel32 echo "#define HOST_MIPS 1" >> $config_h 9262408a527Saurel32 ;; 9272408a527Saurel32 mips64) 9280938cda5Saurel32 echo "ARCH=mips64" >> $config_mak 9290938cda5Saurel32 echo "#define HOST_MIPS64 1" >> $config_h 9302408a527Saurel32 ;; 9312408a527Saurel32 powerpc) 9320938cda5Saurel32 echo "ARCH=ppc" >> $config_mak 9330938cda5Saurel32 echo "#define HOST_PPC 1" >> $config_h 9342408a527Saurel32 ;; 9352408a527Saurel32 s390) 9360938cda5Saurel32 echo "ARCH=s390" >> $config_mak 9370938cda5Saurel32 echo "#define HOST_S390 1" >> $config_h 9382408a527Saurel32 ;; 9392408a527Saurel32 sparc) 9400938cda5Saurel32 echo "ARCH=sparc" >> $config_mak 9410938cda5Saurel32 echo "#define HOST_SPARC 1" >> $config_h 9422408a527Saurel32 ;; 9432408a527Saurel32 sparc64) 9440938cda5Saurel32 echo "ARCH=sparc64" >> $config_mak 9450938cda5Saurel32 echo "#define HOST_SPARC64 1" >> $config_h 9462408a527Saurel32 ;; 9472408a527Saurel32 *) 9483142255cSblueswir1 echo "Unsupported CPU = $cpu" 9497d13299dSbellard exit 1 9502408a527Saurel32 ;; 9512408a527Saurel32esac 9527d13299dSbellardif test "$bigendian" = "yes" ; then 95397a847bcSbellard echo "WORDS_BIGENDIAN=yes" >> $config_mak 95497a847bcSbellard echo "#define WORDS_BIGENDIAN 1" >> $config_h 95597a847bcSbellardfi 956b6853697Sbellardecho "#define HOST_LONG_BITS $hostlongbits" >> $config_h 95767b915a5Sbellardif test "$mingw32" = "yes" ; then 95867b915a5Sbellard echo "CONFIG_WIN32=yes" >> $config_mak 95911d9f695Sbellard echo "#define CONFIG_WIN32 1" >> $config_h 960210fa556Spbrookelse 961210fa556Spbrook cat > $TMPC << EOF 962210fa556Spbrook#include <byteswap.h> 963210fa556Spbrookint main(void) { return bswap_32(0); } 964210fa556SpbrookEOF 965db7287edSpbrook if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then 96697a847bcSbellard echo "#define HAVE_BYTESWAP_H 1" >> $config_h 96767b915a5Sbellard fi 968210fa556Spbrookfi 96983fb7adfSbellardif test "$darwin" = "yes" ; then 97083fb7adfSbellard echo "CONFIG_DARWIN=yes" >> $config_mak 97183fb7adfSbellard echo "#define CONFIG_DARWIN 1" >> $config_h 97283fb7adfSbellardfi 973ec530c81Sbellardif test "$solaris" = "yes" ; then 974ec530c81Sbellard echo "CONFIG_SOLARIS=yes" >> $config_mak 97538cfa06cSbellard echo "#define HOST_SOLARIS $solarisrev" >> $config_h 9760475a5caSths if test "$needs_libsunmath" = "yes" ; then 9770475a5caSths echo "NEEDS_LIBSUNMATH=yes" >> $config_mak 9780475a5caSths echo "#define NEEDS_LIBSUNMATH 1" >> $config_h 9790475a5caSths fi 980ec530c81Sbellardfi 9813142255cSblueswir1if test -n "$sparc_cpu"; then 9823142255cSblueswir1 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak 9833142255cSblueswir1 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h 9843142255cSblueswir1fi 98567b915a5Sbellardif test "$gdbstub" = "yes" ; then 98667b915a5Sbellard echo "CONFIG_GDBSTUB=yes" >> $config_mak 98767b915a5Sbellard echo "#define CONFIG_GDBSTUB 1" >> $config_h 98867b915a5Sbellardfi 98997a847bcSbellardif test "$gprof" = "yes" ; then 99097a847bcSbellard echo "TARGET_GPROF=yes" >> $config_mak 99197a847bcSbellard echo "#define HAVE_GPROF 1" >> $config_h 99297a847bcSbellardfi 99397a847bcSbellardif test "$static" = "yes" ; then 99497a847bcSbellard echo "CONFIG_STATIC=yes" >> $config_mak 99550863472Sbellard echo "#define CONFIG_STATIC 1" >> $config_h 99697a847bcSbellardfi 99705c2a3e7Sbellardif test $profiler = "yes" ; then 99805c2a3e7Sbellard echo "#define CONFIG_PROFILER 1" >> $config_h 99905c2a3e7Sbellardfi 1000c20709aaSbellardif test "$slirp" = "yes" ; then 1001c20709aaSbellard echo "CONFIG_SLIRP=yes" >> $config_mak 1002c20709aaSbellard echo "#define CONFIG_SLIRP 1" >> $config_h 1003c20709aaSbellardfi 1004*0c58ac1cSmalcfor card in $audio_card_list; do 1005*0c58ac1cSmalc def=CONFIG_`echo $card | tr [:lower:] [:upper:]` 1006*0c58ac1cSmalc echo "$def=yes" >> $config_mak 1007*0c58ac1cSmalc echo "#define $def 1" >> $config_h 1008*0c58ac1cSmalcdone 1009*0c58ac1cSmalcecho "#define AUDIO_DRIVERS \\" >> $config_h 1010*0c58ac1cSmalcfor drv in $audio_drv_list; do 1011*0c58ac1cSmalc echo " &${drv}_audio_driver, \\" >>$config_h 1012*0c58ac1cSmalc def=CONFIG_`echo $drv | tr [:lower:] [:upper:]` 1013*0c58ac1cSmalc echo "$def=yes" >> $config_mak 1014*0c58ac1cSmalc if test "$drv" == "fmod"; then 1015*0c58ac1cSmalc echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak 1016*0c58ac1cSmalc echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak 1017fb065187Sbellard fi 1018*0c58ac1cSmalcdone 1019*0c58ac1cSmalcecho "" >>$config_h 10208ff9cbf7Smalcif test "$mixemu" = "yes" ; then 10218ff9cbf7Smalc echo "CONFIG_MIXEMU=yes" >> $config_mak 10228ff9cbf7Smalc echo "#define CONFIG_MIXEMU 1" >> $config_h 10238ff9cbf7Smalcfi 10248d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 10258d5d2d4cSths echo "CONFIG_VNC_TLS=yes" >> $config_mak 10268d5d2d4cSths echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak 10278d5d2d4cSths echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak 10288d5d2d4cSths echo "#define CONFIG_VNC_TLS 1" >> $config_h 10298d5d2d4cSthsfi 1030b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 1031b1a550a0Spbrookecho "VERSION=$qemu_version" >>$config_mak 1032d4b8f039Spbrookecho "#define QEMU_VERSION \"$qemu_version\"" >> $config_h 103397a847bcSbellard 103497a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak 1035ad064840Spbrookif [ "$source_path_used" = "yes" ]; then 1036ad064840Spbrook echo "VPATH=$source_path" >> $config_mak 1037ad064840Spbrookfi 103897a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak 1039cc8ae6deSpbrookif [ "$build_docs" = "yes" ] ; then 1040cc8ae6deSpbrook echo "BUILD_DOCS=yes" >> $config_mak 1041cc8ae6deSpbrookfi 104249ecc3faSbellardif test "$static" = "yes"; then 104349ecc3faSbellard sdl1=$sdl_static 104449ecc3faSbellardelse 104549ecc3faSbellard sdl1=$sdl 104649ecc3faSbellardfi 104749ecc3faSbellardif test "$sdl1" = "yes" ; then 104849ecc3faSbellard echo "#define CONFIG_SDL 1" >> $config_h 104949ecc3faSbellard echo "CONFIG_SDL=yes" >> $config_mak 105049ecc3faSbellard if test "$target_softmmu" = "no" -o "$static" = "yes"; then 105149ecc3faSbellard echo "SDL_LIBS=$sdl_static_libs" >> $config_mak 105249ecc3faSbellard else 105349ecc3faSbellard echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak 105449ecc3faSbellard fi 105549ecc3faSbellard if [ "${aa}" = "yes" ] ; then 105649ecc3faSbellard echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak 105749ecc3faSbellard else 105849ecc3faSbellard echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak 105949ecc3faSbellard fi 106049ecc3faSbellardfi 106149ecc3faSbellardif test "$cocoa" = "yes" ; then 106249ecc3faSbellard echo "#define CONFIG_COCOA 1" >> $config_h 106349ecc3faSbellard echo "CONFIG_COCOA=yes" >> $config_mak 106449ecc3faSbellardfi 10654d3b6f6eSbalrogif test "$curses" = "yes" ; then 10664d3b6f6eSbalrog echo "#define CONFIG_CURSES 1" >> $config_h 10674d3b6f6eSbalrog echo "CONFIG_CURSES=yes" >> $config_mak 10684d3b6f6eSbalrog echo "CURSES_LIBS=-lcurses" >> $config_mak 10694d3b6f6eSbalrogfi 10702e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 10712e4d9fb1Saurel32 echo "CONFIG_BRLAPI=yes" >> $config_mak 10722e4d9fb1Saurel32 echo "#define CONFIG_BRLAPI 1" >> $config_h 10732e4d9fb1Saurel32 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak 10742e4d9fb1Saurel32fi 107597a847bcSbellard 107683fb7adfSbellard# XXX: suppress that 10777d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 107843003046Sbellard echo "#define O_LARGEFILE 0" >> $config_h 107943003046Sbellard echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h 10807d3505c5Sbellard echo "#define _BSD 1" >> $config_h 10817d3505c5Sbellardfi 10827d3505c5Sbellard 1083c5937220Spbrookecho "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h 1084c5937220Spbrook 1085c39e3338Spbrooktools= 1086c39e3338Spbrookif test `expr "$target_list" : ".*softmmu.*"` != 0 ; then 1087c39e3338Spbrook tools="qemu-img\$(EXESUF) $tools" 10887a5ca864Sbellard if [ "$linux" = "yes" ] ; then 10897a5ca864Sbellard tools="qemu-nbd\$(EXESUF) $tools" 10907a5ca864Sbellard fi 1091c39e3338Spbrookfi 1092c39e3338Spbrookecho "TOOLS=$tools" >> $config_mak 1093c39e3338Spbrook 109415d9ca0fSthstest -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h 109515d9ca0fSths 109697a847bcSbellardfor target in $target_list; do 109797a847bcSbellardtarget_dir="$target" 109897a847bcSbellardconfig_mak=$target_dir/config.mak 109997a847bcSbellardconfig_h=$target_dir/config.h 110097a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1` 110197a847bcSbellardtarget_bigendian="no" 1102808c4954Sbellard[ "$target_cpu" = "armeb" ] && target_bigendian=yes 11030938cda5Saurel32[ "$target_cpu" = "m68k" ] && target_bigendian=yes 11040938cda5Saurel32[ "$target_cpu" = "mips" ] && target_bigendian=yes 11050938cda5Saurel32[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes 11060938cda5Saurel32[ "$target_cpu" = "mips64" ] && target_bigendian=yes 110767867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes 1108d4082e95Sj_mayer[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes 110922f8a8b3Sj_mayer[ "$target_cpu" = "ppc64" ] && target_bigendian=yes 1110e85e7c6eSj_mayer[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes 1111908f52b0Spbrook[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes 11120938cda5Saurel32[ "$target_cpu" = "sparc" ] && target_bigendian=yes 11130938cda5Saurel32[ "$target_cpu" = "sparc64" ] && target_bigendian=yes 11140938cda5Saurel32[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes 111597a847bcSbellardtarget_softmmu="no" 1116997344f3Sbellardtarget_user_only="no" 1117831b7825Sthstarget_linux_user="no" 1118831b7825Sthstarget_darwin_user="no" 11199e407a85Spbrookcase "$target" in 11209e407a85Spbrook ${target_cpu}-softmmu) 11219e407a85Spbrook target_softmmu="yes" 11229e407a85Spbrook ;; 11239e407a85Spbrook ${target_cpu}-linux-user) 11249e407a85Spbrook target_user_only="yes" 11259e407a85Spbrook target_linux_user="yes" 11269e407a85Spbrook ;; 11279e407a85Spbrook ${target_cpu}-darwin-user) 11289e407a85Spbrook target_user_only="yes" 1129831b7825Sths target_darwin_user="yes" 11309e407a85Spbrook ;; 11319e407a85Spbrook *) 11329e407a85Spbrook echo "ERROR: Target '$target' not recognised" 11339e407a85Spbrook exit 1 11349e407a85Spbrook ;; 11359e407a85Spbrookesac 1136831b7825Sths 113797ccc689Sbellardif test "$target_user_only" = "no" -a "$check_gfx" = "yes" \ 113897ccc689Sbellard -a "$sdl" = "no" -a "$cocoa" = "no" ; then 113997ccc689Sbellard echo "ERROR: QEMU requires SDL or Cocoa for graphical output" 11409c038506Spbrook echo "To build QEMU without graphical output configure with --disable-gfx-check" 11414d3b6f6eSbalrog echo "Note that this will disable all output from the virtual graphics card" 11424d3b6f6eSbalrog echo "except through VNC or curses." 114397ccc689Sbellard exit 1; 114497ccc689Sbellardfi 114597ccc689Sbellard 11467c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile" 114797a847bcSbellard 114815d9ca0fSthstest -f $config_h && mv $config_h ${config_h}~ 114915d9ca0fSths 115097a847bcSbellardmkdir -p $target_dir 1151158142c2Sbellardmkdir -p $target_dir/fpu 115257fec1feSbellardmkdir -p $target_dir/tcg 1153831b7825Sthsif test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then 115469de927cSbellard mkdir -p $target_dir/nwfpe 115569de927cSbellardfi 115669de927cSbellard 1157ec530c81Sbellard# 1158ec530c81Sbellard# don't use ln -sf as not all "ln -sf" over write the file/link 1159ec530c81Sbellard# 1160ec530c81Sbellardrm -f $target_dir/Makefile 1161ec530c81Sbellardln -s $source_path/Makefile.target $target_dir/Makefile 1162ec530c81Sbellard 116397a847bcSbellard 116497a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak 116597a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h 116697a847bcSbellard 116797a847bcSbellard 116897a847bcSbellardecho "include ../config-host.mak" >> $config_mak 116997a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h 11701e43adfcSbellard 1171e5fe0c52Spbrookbflt="no" 1172cb33da57Sblueswir1elfload32="no" 1173bd0c5661Spbrooktarget_nptl="no" 11741e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"` 11751e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h 117697a847bcSbellard 11772408a527Saurel32case "$target_cpu" in 11782408a527Saurel32 i386) 117997a847bcSbellard echo "TARGET_ARCH=i386" >> $config_mak 118097a847bcSbellard echo "#define TARGET_ARCH \"i386\"" >> $config_h 118197a847bcSbellard echo "#define TARGET_I386 1" >> $config_h 1182da260249Sbellard if test $kqemu = "yes" -a "$target_softmmu" = "yes" 11832408a527Saurel32 then 1184824d560fSbellard echo "#define USE_KQEMU 1" >> $config_h 1185824d560fSbellard fi 1186f2bf094eSaurel32 gcc3minver=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.` 118711d1fdb0Spbrook if test -n "$gcc3minver" && test $gcc3minver -gt 3 1188f2bf094eSaurel32 then 1189f2bf094eSaurel32 echo "HAVE_GT_GCC_3_3=true" >> $config_mak 1190f2bf094eSaurel32 else 1191f2bf094eSaurel32 echo "HAVE_GT_GCC_3_3=false" >> $config_mak 1192f2bf094eSaurel32 fi 11932408a527Saurel32 ;; 11942408a527Saurel32 x86_64) 11950938cda5Saurel32 echo "TARGET_ARCH=x86_64" >> $config_mak 11960938cda5Saurel32 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h 11970938cda5Saurel32 echo "#define TARGET_I386 1" >> $config_h 11980938cda5Saurel32 echo "#define TARGET_X86_64 1" >> $config_h 11992408a527Saurel32 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" 12002408a527Saurel32 then 12010938cda5Saurel32 echo "#define USE_KQEMU 1" >> $config_h 12020938cda5Saurel32 fi 12032408a527Saurel32 ;; 12042408a527Saurel32 alpha) 12050938cda5Saurel32 echo "TARGET_ARCH=alpha" >> $config_mak 1206bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 12070938cda5Saurel32 echo "#define TARGET_ARCH \"alpha\"" >> $config_h 12080938cda5Saurel32 echo "#define TARGET_ALPHA 1" >> $config_h 1209bf6247fbSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 12102408a527Saurel32 ;; 12112408a527Saurel32 arm|armeb) 121297a847bcSbellard echo "TARGET_ARCH=arm" >> $config_mak 121397a847bcSbellard echo "#define TARGET_ARCH \"arm\"" >> $config_h 121497a847bcSbellard echo "#define TARGET_ARM 1" >> $config_h 1215e5fe0c52Spbrook bflt="yes" 1216bd0c5661Spbrook target_nptl="yes" 12172408a527Saurel32 ;; 12182408a527Saurel32 cris) 12190938cda5Saurel32 echo "TARGET_ARCH=cris" >> $config_mak 12200938cda5Saurel32 echo "#define TARGET_ARCH \"cris\"" >> $config_h 12210938cda5Saurel32 echo "#define TARGET_CRIS 1" >> $config_h 12222408a527Saurel32 ;; 12232408a527Saurel32 m68k) 12240938cda5Saurel32 echo "TARGET_ARCH=m68k" >> $config_mak 12250938cda5Saurel32 echo "#define TARGET_ARCH \"m68k\"" >> $config_h 12260938cda5Saurel32 echo "#define TARGET_M68K 1" >> $config_h 12270938cda5Saurel32 bflt="yes" 12282408a527Saurel32 ;; 12292408a527Saurel32 mips|mipsel) 12300938cda5Saurel32 echo "TARGET_ARCH=mips" >> $config_mak 12310938cda5Saurel32 echo "#define TARGET_ARCH \"mips\"" >> $config_h 12320938cda5Saurel32 echo "#define TARGET_MIPS 1" >> $config_h 12330938cda5Saurel32 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h 12342408a527Saurel32 ;; 12352408a527Saurel32 mipsn32|mipsn32el) 12360938cda5Saurel32 echo "TARGET_ARCH=mipsn32" >> $config_mak 12370938cda5Saurel32 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h 12380938cda5Saurel32 echo "#define TARGET_MIPS 1" >> $config_h 12390938cda5Saurel32 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h 12402408a527Saurel32 ;; 12412408a527Saurel32 mips64|mips64el) 12420938cda5Saurel32 echo "TARGET_ARCH=mips64" >> $config_mak 12430938cda5Saurel32 echo "#define TARGET_ARCH \"mips64\"" >> $config_h 12440938cda5Saurel32 echo "#define TARGET_MIPS 1" >> $config_h 12450938cda5Saurel32 echo "#define TARGET_MIPS64 1" >> $config_h 12460938cda5Saurel32 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h 12472408a527Saurel32 ;; 12482408a527Saurel32 ppc) 124967867308Sbellard echo "TARGET_ARCH=ppc" >> $config_mak 1250bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 125167867308Sbellard echo "#define TARGET_ARCH \"ppc\"" >> $config_h 125267867308Sbellard echo "#define TARGET_PPC 1" >> $config_h 1253bf6247fbSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 12542408a527Saurel32 ;; 12552408a527Saurel32 ppcemb) 1256d4082e95Sj_mayer echo "TARGET_ARCH=ppcemb" >> $config_mak 1257e85e7c6eSj_mayer echo "TARGET_ABI_DIR=ppc" >> $config_mak 1258bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 1259d4082e95Sj_mayer echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h 1260d4082e95Sj_mayer echo "#define TARGET_PPC 1" >> $config_h 1261d4082e95Sj_mayer echo "#define TARGET_PPCEMB 1" >> $config_h 1262ec5b78cdSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 12632408a527Saurel32 ;; 12642408a527Saurel32 ppc64) 126522f8a8b3Sj_mayer echo "TARGET_ARCH=ppc64" >> $config_mak 1266f85e9a68Sj_mayer echo "TARGET_ABI_DIR=ppc" >> $config_mak 1267bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 12685e692ecdSj_mayer echo "#define TARGET_ARCH \"ppc64\"" >> $config_h 126922f8a8b3Sj_mayer echo "#define TARGET_PPC 1" >> $config_h 127022f8a8b3Sj_mayer echo "#define TARGET_PPC64 1" >> $config_h 1271bf6247fbSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 12722408a527Saurel32 ;; 12732408a527Saurel32 ppc64abi32) 1274e85e7c6eSj_mayer echo "TARGET_ARCH=ppc64" >> $config_mak 1275e85e7c6eSj_mayer echo "TARGET_ABI_DIR=ppc" >> $config_mak 12760c64b9cdSbellard echo "TARGET_ARCH2=ppc64abi32" >> $config_mak 1277bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 12785e692ecdSj_mayer echo "#define TARGET_ARCH \"ppc64\"" >> $config_h 1279e85e7c6eSj_mayer echo "#define TARGET_PPC 1" >> $config_h 1280e85e7c6eSj_mayer echo "#define TARGET_PPC64 1" >> $config_h 1281e85e7c6eSj_mayer echo "#define TARGET_ABI32 1" >> $config_h 1282bf6247fbSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 12832408a527Saurel32 ;; 12842408a527Saurel32 sh4|sh4eb) 1285fdf9b3e8Sbellard echo "TARGET_ARCH=sh4" >> $config_mak 1286bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 1287fdf9b3e8Sbellard echo "#define TARGET_ARCH \"sh4\"" >> $config_h 1288fdf9b3e8Sbellard echo "#define TARGET_SH4 1" >> $config_h 1289bf6247fbSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 12904dbed897Spbrook bflt="yes" 12912408a527Saurel32 ;; 12922408a527Saurel32 sparc) 12930938cda5Saurel32 echo "TARGET_ARCH=sparc" >> $config_mak 12940938cda5Saurel32 echo "#define TARGET_ARCH \"sparc\"" >> $config_h 12950938cda5Saurel32 echo "#define TARGET_SPARC 1" >> $config_h 12962408a527Saurel32 ;; 12972408a527Saurel32 sparc64) 12980938cda5Saurel32 echo "TARGET_ARCH=sparc64" >> $config_mak 12990938cda5Saurel32 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h 13000938cda5Saurel32 echo "#define TARGET_SPARC 1" >> $config_h 13010938cda5Saurel32 echo "#define TARGET_SPARC64 1" >> $config_h 13020938cda5Saurel32 elfload32="yes" 13032408a527Saurel32 ;; 13042408a527Saurel32 sparc32plus) 13050938cda5Saurel32 echo "TARGET_ARCH=sparc64" >> $config_mak 13060938cda5Saurel32 echo "TARGET_ABI_DIR=sparc" >> $config_mak 13070938cda5Saurel32 echo "TARGET_ARCH2=sparc32plus" >> $config_mak 13080938cda5Saurel32 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h 13090938cda5Saurel32 echo "#define TARGET_SPARC 1" >> $config_h 13100938cda5Saurel32 echo "#define TARGET_SPARC64 1" >> $config_h 13110938cda5Saurel32 echo "#define TARGET_ABI32 1" >> $config_h 13122408a527Saurel32 ;; 13132408a527Saurel32 *) 1314de83cd02Sbellard echo "Unsupported target CPU" 1315de83cd02Sbellard exit 1 13162408a527Saurel32 ;; 13172408a527Saurel32esac 1318de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 131997a847bcSbellard echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak 132097a847bcSbellard echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h 132197a847bcSbellardfi 132297a847bcSbellardif test "$target_softmmu" = "yes" ; then 132397a847bcSbellard echo "CONFIG_SOFTMMU=yes" >> $config_mak 132497a847bcSbellard echo "#define CONFIG_SOFTMMU 1" >> $config_h 1325de83cd02Sbellardfi 1326997344f3Sbellardif test "$target_user_only" = "yes" ; then 1327997344f3Sbellard echo "CONFIG_USER_ONLY=yes" >> $config_mak 1328997344f3Sbellard echo "#define CONFIG_USER_ONLY 1" >> $config_h 1329997344f3Sbellardfi 1330831b7825Sthsif test "$target_linux_user" = "yes" ; then 1331831b7825Sths echo "CONFIG_LINUX_USER=yes" >> $config_mak 1332831b7825Sths echo "#define CONFIG_LINUX_USER 1" >> $config_h 1333831b7825Sthsfi 1334831b7825Sthsif test "$target_darwin_user" = "yes" ; then 1335831b7825Sths echo "CONFIG_DARWIN_USER=yes" >> $config_mak 1336831b7825Sths echo "#define CONFIG_DARWIN_USER 1" >> $config_h 1337831b7825Sthsfi 1338de83cd02Sbellard 13390938cda5Saurel32if test "$target_cpu" = "arm" \ 13400938cda5Saurel32 -o "$target_cpu" = "armeb" \ 13410938cda5Saurel32 -o "$target_cpu" = "m68k" \ 13420938cda5Saurel32 -o "$target_cpu" = "mips" \ 13430938cda5Saurel32 -o "$target_cpu" = "mipsel" \ 13440938cda5Saurel32 -o "$target_cpu" = "mipsn32" \ 13450938cda5Saurel32 -o "$target_cpu" = "mipsn32el" \ 13460938cda5Saurel32 -o "$target_cpu" = "mips64" \ 13470938cda5Saurel32 -o "$target_cpu" = "mips64el" \ 13480938cda5Saurel32 -o "$target_cpu" = "sparc" \ 13490938cda5Saurel32 -o "$target_cpu" = "sparc64" \ 13500938cda5Saurel32 -o "$target_cpu" = "sparc32plus"; then 1351158142c2Sbellard echo "CONFIG_SOFTFLOAT=yes" >> $config_mak 1352158142c2Sbellard echo "#define CONFIG_SOFTFLOAT 1" >> $config_h 1353158142c2Sbellardfi 1354e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 1355e5fe0c52Spbrook echo "TARGET_HAS_BFLT=yes" >> $config_mak 1356e5fe0c52Spbrook echo "#define TARGET_HAS_BFLT 1" >> $config_h 1357e5fe0c52Spbrookfi 1358bd0c5661Spbrookif test "$target_user_only" = "yes" \ 1359bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 1360bd0c5661Spbrook echo "#define USE_NPTL 1" >> $config_h 1361bd0c5661Spbrookfi 1362cb33da57Sblueswir1# 32 bit ELF loader in addition to native 64 bit loader? 1363cb33da57Sblueswir1if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then 1364cb33da57Sblueswir1 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak 1365cb33da57Sblueswir1 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h 1366cb33da57Sblueswir1fi 13675b0753e0Sbellard 136815d9ca0fSthstest -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h 136915d9ca0fSths 137097a847bcSbellarddone # for target in $targets 13717d13299dSbellard 13727d13299dSbellard# build tree in object directory if source path is different from current one 13737d13299dSbellardif test "$source_path_used" = "yes" ; then 137449ecc3faSbellard DIRS="tests tests/cris slirp audio" 13757d13299dSbellard FILES="Makefile tests/Makefile" 1376e7daa605Sths FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit" 1377e1ffb0f1Sedgar_igl FILES="$FILES tests/test-mmap.c" 13787d13299dSbellard for dir in $DIRS ; do 13797d13299dSbellard mkdir -p $dir 13807d13299dSbellard done 1381ec530c81Sbellard # remove the link and recreate it, as not all "ln -sf" overwrite the link 13827d13299dSbellard for f in $FILES ; do 1383ec530c81Sbellard rm -f $f 1384ec530c81Sbellard ln -s $source_path/$f $f 13857d13299dSbellard done 13867d13299dSbellardfi 13877d13299dSbellard 138897a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS 1389