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" 277d13299dSbellardhost_cc="gcc" 287d13299dSbellardar="ar" 297d13299dSbellardmake="make" 306a882643Spbrookinstall="install" 317d13299dSbellardstrip="strip" 327d13299dSbellardcpu=`uname -m` 335327cf48Sbellardtarget_list="" 347d13299dSbellardcase "$cpu" in 357d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 3697a847bcSbellard cpu="i386" 377d13299dSbellard ;; 38aaa5fa14Saurel32 x86_64|amd64) 39aaa5fa14Saurel32 cpu="x86_64" 40aaa5fa14Saurel32 ;; 41aaa5fa14Saurel32 alpha) 42aaa5fa14Saurel32 cpu="alpha" 43aaa5fa14Saurel32 ;; 44ba68055eSbellard armv*b) 45808c4954Sbellard cpu="armv4b" 46808c4954Sbellard ;; 47ba68055eSbellard armv*l) 487d13299dSbellard cpu="armv4l" 497d13299dSbellard ;; 50aaa5fa14Saurel32 cris) 51aaa5fa14Saurel32 cpu="cris" 527d13299dSbellard ;; 53f54b3f92Saurel32 parisc|parisc64) 54f54b3f92Saurel32 cpu="hppa" 55f54b3f92Saurel32 ;; 56aaa5fa14Saurel32 ia64) 57aaa5fa14Saurel32 cpu="ia64" 58aaa5fa14Saurel32 ;; 59aaa5fa14Saurel32 m68k) 60aaa5fa14Saurel32 cpu="m68k" 617d13299dSbellard ;; 627d13299dSbellard mips) 637d13299dSbellard cpu="mips" 647d13299dSbellard ;; 65fbe4f65bSths mips64) 66fbe4f65bSths cpu="mips64" 67fbe4f65bSths ;; 68aaa5fa14Saurel32 "Power Macintosh"|ppc|ppc64) 69aaa5fa14Saurel32 cpu="powerpc" 70e7daa605Sths ;; 710e7b8a9fSths s390*) 72fb3e5849Sbellard cpu="s390" 73fb3e5849Sbellard ;; 743142255cSblueswir1 sparc|sun4[cdmuv]) 75ae228531Sbellard cpu="sparc" 76ae228531Sbellard ;; 77ae228531Sbellard sparc64) 78ae228531Sbellard cpu="sparc64" 79ae228531Sbellard ;; 807d13299dSbellard *) 817d13299dSbellard cpu="unknown" 827d13299dSbellard ;; 837d13299dSbellardesac 847d13299dSbellardgprof="no" 857d13299dSbellardbigendian="no" 8667b915a5Sbellardmingw32="no" 8767b915a5SbellardEXESUF="" 8867b915a5Sbellardgdbstub="yes" 89443f1376Sbellardslirp="yes" 90fb065187Sbellardadlib="no" 91e5c9a13eSbalrogac97="no" 92423d65f4Sbalroggus="no" 93*cc53d26dSmalccs4231a="no" 94fb065187Sbellardoss="no" 951d14ffa9Sbellarddsound="no" 961d14ffa9Sbellardcoreaudio="no" 971d14ffa9Sbellardalsa="no" 98ca9cc28cSbalrogesd="no" 99102a52e4Sbellardfmod="no" 100102a52e4Sbellardfmod_lib="" 101102a52e4Sbellardfmod_inc="" 1028d5d2d4cSthsvnc_tls="yes" 103b1a550a0Spbrookbsd="no" 1045327cf48Sbellardlinux="no" 105c9ec1fe4Sbellardkqemu="no" 10605c2a3e7Sbellardprofiler="no" 1075b0753e0Sbellardcocoa="no" 10897ccc689Sbellardcheck_gfx="yes" 1091aff381fSbellardcheck_gcc="yes" 1100a8e90f4Spbrooksoftmmu="yes" 111831b7825Sthslinux_user="no" 112831b7825Sthsdarwin_user="no" 113cc8ae6deSpbrookbuild_docs="no" 114c5937220Spbrookuname_release="" 1154d3b6f6eSbalrogcurses="yes" 116bd0c5661Spbrooknptl="yes" 1177d13299dSbellard 1187d13299dSbellard# OS specific 1197d13299dSbellardtargetos=`uname -s` 1207d13299dSbellardcase $targetos in 121c326e0afSbellardCYGWIN*) 122c326e0afSbellardmingw32="yes" 1236f30fa85SthsOS_CFLAGS="-mno-cygwin" 124db8d7dd1Sthsif [ "$cpu" = "i386" ] ; then 125db8d7dd1Sths kqemu="yes" 126db8d7dd1Sthsfi 127c326e0afSbellard;; 12867b915a5SbellardMINGW32*) 12967b915a5Sbellardmingw32="yes" 130db8d7dd1Sthsif [ "$cpu" = "i386" ] ; then 131db8d7dd1Sths kqemu="yes" 132db8d7dd1Sthsfi 13367b915a5Sbellard;; 1345c40d2bdSthsGNU/kFreeBSD) 1355c40d2bdSthsoss="yes" 1365c40d2bdSthsif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 1375c40d2bdSths kqemu="yes" 1385c40d2bdSthsfi 1395c40d2bdSths;; 1407d3505c5SbellardFreeBSD) 1417d3505c5Sbellardbsd="yes" 142fb065187Sbellardoss="yes" 143e99f9060Sbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 14407f4ddbfSbellard kqemu="yes" 14507f4ddbfSbellardfi 1467d3505c5Sbellard;; 1477d3505c5SbellardNetBSD) 1487d3505c5Sbellardbsd="yes" 149fb065187Sbellardoss="yes" 1507d3505c5Sbellard;; 1517d3505c5SbellardOpenBSD) 1527d3505c5Sbellardbsd="yes" 153fb065187Sbellardoss="yes" 1547d3505c5Sbellard;; 15583fb7adfSbellardDarwin) 15683fb7adfSbellardbsd="yes" 15783fb7adfSbellarddarwin="yes" 158831b7825Sthsdarwin_user="yes" 159fd677642Sthscocoa="yes" 160fd677642Sthscoreaudio="yes" 1616f30fa85SthsOS_CFLAGS="-mdynamic-no-pic" 162c2c59c3eSthsOS_LDFLAGS="-framework CoreFoundation -framework IOKit" 16383fb7adfSbellard;; 164ec530c81SbellardSunOS) 165ec530c81Sbellard solaris="yes" 166c2b84fabSths make="gmake" 167c2b84fabSths install="ginstall" 1680475a5caSths needs_libsunmath="no" 169c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 170ef18c883Sths # have to select again, because `uname -m` returns i86pc 171ef18c883Sths # even on an x86_64 box. 172ef18c883Sths solariscpu=`isainfo -k` 173ef18c883Sths if test "${solariscpu}" = "amd64" ; then 174ef18c883Sths cpu="x86_64" 175ef18c883Sths fi 176c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 1770475a5caSths if test "$solarisrev" -le 9 ; then 1780475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 1790475a5caSths needs_libsunmath="yes" 1800475a5caSths else 1810475a5caSths echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" 1820475a5caSths echo "libsunmath from the Sun Studio compilers tools, due to a lack of" 1830475a5caSths echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" 1840475a5caSths echo "Studio 11 can be downloaded from www.sun.com." 1850475a5caSths exit 1 1860475a5caSths fi 1870475a5caSths fi 1880475a5caSths if test "$solarisrev" -ge 9 ; then 189c2b84fabSths kqemu="yes" 190c2b84fabSths fi 19186b2bd93Sths fi 1926b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 1936b4d2ba1Sths oss=yes 1946b4d2ba1Sths fi 195ec530c81Sbellard;; 196fb065187Sbellard*) 197fb065187Sbellardoss="yes" 1985327cf48Sbellardlinux="yes" 199831b7825Sthslinux_user="yes" 20007f4ddbfSbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 201c9ec1fe4Sbellard kqemu="yes" 202c9ec1fe4Sbellardfi 203fb065187Sbellard;; 2047d13299dSbellardesac 2057d13299dSbellard 2067d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 207b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 2087d3505c5Sbellard make="gmake" 20983fb7adfSbellard fi 2107d3505c5Sbellardfi 2117d3505c5Sbellard 2127d13299dSbellard# find source path 213ad064840Spbrooksource_path=`dirname "$0"` 21459faef3aSbalrogsource_path_used="no" 21559faef3aSbalrogworkdir=`pwd` 216ad064840Spbrookif [ -z "$source_path" ]; then 21759faef3aSbalrog source_path=$workdir 218ad064840Spbrookelse 219ad064840Spbrook source_path=`cd "$source_path"; pwd` 2207d13299dSbellardfi 221724db118Spbrook[ -f "$workdir/vl.c" ] || source_path_used="yes" 2227d13299dSbellard 22385aa5189Sbellardwerror="no" 2240d1e2394Sbellard# generate compile errors on warnings for development builds 2250d1e2394Sbellard#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then 2260d1e2394Sbellard#werror="yes"; 2270d1e2394Sbellard#fi 22885aa5189Sbellard 2297d13299dSbellardfor opt do 230a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 2317d13299dSbellard case "$opt" in 2322efc3265Sbellard --help|-h) show_help=yes 2332efc3265Sbellard ;; 234b1a550a0Spbrook --prefix=*) prefix="$optarg" 2357d13299dSbellard ;; 236b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 23732ce6337Sbellard ;; 238b1a550a0Spbrook --source-path=*) source_path="$optarg" 239ad064840Spbrook source_path_used="yes" 2407d13299dSbellard ;; 241b1a550a0Spbrook --cross-prefix=*) cross_prefix="$optarg" 2427d13299dSbellard ;; 243b1a550a0Spbrook --cc=*) cc="$optarg" 244328a4240Spbrook gcc3_search="no" 2457d13299dSbellard ;; 246b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 24783469015Sbellard ;; 248b1a550a0Spbrook --make=*) make="$optarg" 2497d13299dSbellard ;; 2506a882643Spbrook --install=*) install="$optarg" 2516a882643Spbrook ;; 252b1a550a0Spbrook --extra-cflags=*) CFLAGS="$optarg" 2537d13299dSbellard ;; 254b1a550a0Spbrook --extra-ldflags=*) LDFLAGS="$optarg" 2557d13299dSbellard ;; 256b1a550a0Spbrook --cpu=*) cpu="$optarg" 2577d13299dSbellard ;; 258b1a550a0Spbrook --target-list=*) target_list="$optarg" 259de83cd02Sbellard ;; 2607d13299dSbellard --enable-gprof) gprof="yes" 2617d13299dSbellard ;; 26243ce4dfeSbellard --static) static="yes" 26343ce4dfeSbellard ;; 26497a847bcSbellard --disable-sdl) sdl="no" 26597a847bcSbellard ;; 2661d14ffa9Sbellard --enable-coreaudio) coreaudio="yes" 2671d14ffa9Sbellard ;; 2681d14ffa9Sbellard --enable-alsa) alsa="yes" 2691d14ffa9Sbellard ;; 270ca9cc28cSbalrog --enable-esd) esd="yes" 271ca9cc28cSbalrog ;; 2721d14ffa9Sbellard --enable-dsound) dsound="yes" 2731d14ffa9Sbellard ;; 274102a52e4Sbellard --enable-fmod) fmod="yes" 275102a52e4Sbellard ;; 276b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 277102a52e4Sbellard ;; 278b1a550a0Spbrook --fmod-inc=*) fmod_inc="$optarg" 279102a52e4Sbellard ;; 2808d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 2818d5d2d4cSths ;; 282b93aebecSbellard --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no" 28367b915a5Sbellard ;; 284443f1376Sbellard --disable-slirp) slirp="no" 285c20709aaSbellard ;; 286fb065187Sbellard --enable-adlib) adlib="yes" 287fb065187Sbellard ;; 288e5c9a13eSbalrog --enable-ac97) ac97="yes" 289e5c9a13eSbalrog ;; 290423d65f4Sbalrog --enable-gus) gus="yes" 291423d65f4Sbalrog ;; 292*cc53d26dSmalc --enable-cs4231a) cs4231a="yes" 293*cc53d26dSmalc ;; 294c9ec1fe4Sbellard --disable-kqemu) kqemu="no" 295c9ec1fe4Sbellard ;; 2962e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 2972e4d9fb1Saurel32 ;; 29805c2a3e7Sbellard --enable-profiler) profiler="yes" 29905c2a3e7Sbellard ;; 3001d14ffa9Sbellard --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no" 3015b0753e0Sbellard ;; 30297ccc689Sbellard --disable-gfx-check) check_gfx="no" 30397ccc689Sbellard ;; 3041aff381fSbellard --disable-gcc-check) check_gcc="no" 3051aff381fSbellard ;; 306cad25d69Spbrook --disable-system) softmmu="no" 3070a8e90f4Spbrook ;; 308cad25d69Spbrook --enable-system) softmmu="yes" 3090a8e90f4Spbrook ;; 310831b7825Sths --disable-linux-user) linux_user="no" 3110a8e90f4Spbrook ;; 312831b7825Sths --enable-linux-user) linux_user="yes" 313831b7825Sths ;; 314831b7825Sths --disable-darwin-user) darwin_user="no" 315831b7825Sths ;; 316831b7825Sths --enable-darwin-user) darwin_user="yes" 3170a8e90f4Spbrook ;; 318c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 319c5937220Spbrook ;; 3203142255cSblueswir1 --sparc_cpu=*) 3213142255cSblueswir1 sparc_cpu="$optarg" 3223142255cSblueswir1 case $sparc_cpu in 3233142255cSblueswir1 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32" 3243142255cSblueswir1 target_cpu="sparc"; cpu="sparc" ;; 3253142255cSblueswir1 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32" 3263142255cSblueswir1 target_cpu="sparc"; cpu="sparc" ;; 3273142255cSblueswir1 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64" 3283142255cSblueswir1 target_cpu="sparc64"; cpu="sparc64" ;; 3293142255cSblueswir1 *) echo "undefined SPARC architecture. Exiting";exit 1;; 3303142255cSblueswir1 esac 3313142255cSblueswir1 ;; 33285aa5189Sbellard --enable-werror) werror="yes" 33385aa5189Sbellard ;; 33485aa5189Sbellard --disable-werror) werror="no" 33585aa5189Sbellard ;; 3364d3b6f6eSbalrog --disable-curses) curses="no" 3374d3b6f6eSbalrog ;; 338bd0c5661Spbrook --disable-nptl) nptl="no" 339bd0c5661Spbrook ;; 3407f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 3417f1559c6Sbalrog ;; 3427d13299dSbellard esac 3437d13299dSbellarddone 3447d13299dSbellard 345209afb9eSthsif [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then 346209afb9eSths AIOLIBS= 347209afb9eSthselse 3484259e1a5Sths # Some Linux architectures (e.g. s390) don't imply -lpthread automatically. 3494259e1a5Sths AIOLIBS="-lrt -lpthread" 350209afb9eSthsfi 351209afb9eSths 3526f30fa85Sths# default flags for all hosts 3536f30fa85SthsCFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing" 3546f30fa85SthsLDFLAGS="$LDFLAGS -g" 35585aa5189Sbellardif test "$werror" = "yes" ; then 35685aa5189SbellardCFLAGS="$CFLAGS -Werror" 35785aa5189Sbellardfi 3586f30fa85Sths 3593142255cSblueswir1# 3603142255cSblueswir1# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right 3613142255cSblueswir1# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) 3623142255cSblueswir1# 36340293e58Sbellardcase "$cpu" in 3643142255cSblueswir1 sparc) if test -z "$sparc_cpu" ; then 3653142255cSblueswir1 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__" 3663142255cSblueswir1 ARCH_LDFLAGS="-m32" 3673142255cSblueswir1 else 3683142255cSblueswir1 ARCH_CFLAGS="${SP_CFLAGS}" 3693142255cSblueswir1 ARCH_LDFLAGS="${SP_LDFLAGS}" 3703142255cSblueswir1 fi 3713142255cSblueswir1 ;; 3723142255cSblueswir1 sparc64) if test -z "$sparc_cpu" ; then 3733142255cSblueswir1 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__" 3743142255cSblueswir1 ARCH_LDFLAGS="-m64" 3753142255cSblueswir1 else 3763142255cSblueswir1 ARCH_CFLAGS="${SP_CFLAGS}" 3773142255cSblueswir1 ARCH_LDFLAGS="${SP_LDFLAGS}" 3783142255cSblueswir1 fi 3793142255cSblueswir1 ;; 38076d83bdeSths s390) 38176d83bdeSths ARCH_CFLAGS="-march=z900" 38276d83bdeSths ;; 38340293e58Sbellard i386) 38440293e58Sbellard ARCH_CFLAGS="-m32" 38540293e58Sbellard ARCH_LDFLAGS="-m32" 38640293e58Sbellard ;; 38740293e58Sbellard x86_64) 38840293e58Sbellard ARCH_CFLAGS="-m64" 38940293e58Sbellard ARCH_LDFLAGS="-m64" 39040293e58Sbellard ;; 3913142255cSblueswir1esac 3923142255cSblueswir1 393af5db58eSpbrookif test x"$show_help" = x"yes" ; then 394af5db58eSpbrookcat << EOF 395af5db58eSpbrook 396af5db58eSpbrookUsage: configure [options] 397af5db58eSpbrookOptions: [defaults in brackets after descriptions] 398af5db58eSpbrook 399af5db58eSpbrookEOF 400af5db58eSpbrookecho "Standard options:" 401af5db58eSpbrookecho " --help print this message" 402af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 403af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 404af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 405af5db58eSpbrookecho " --target-list=LIST set target list [$target_list]" 406af5db58eSpbrookecho "" 407af5db58eSpbrookecho "kqemu kernel acceleration support:" 408af5db58eSpbrookecho " --disable-kqemu disable kqemu support" 409af5db58eSpbrookecho "" 410af5db58eSpbrookecho "Advanced options (experts only):" 411af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 412af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 413af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 414af5db58eSpbrookecho " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc." 415af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 4166a882643Spbrookecho " --install=INSTALL use specified install [$install]" 417af5db58eSpbrookecho " --static enable static build [$static]" 41885aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 419fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 420af5db58eSpbrookecho " --enable-cocoa enable COCOA (Mac OS X only)" 421af5db58eSpbrookecho " --enable-mingw32 enable Win32 cross compilation with mingw32" 422af5db58eSpbrookecho " --enable-adlib enable Adlib emulation" 423e5c9a13eSbalrogecho " --enable-ac97 enable AC97 emulation" 424423d65f4Sbalrogecho " --enable-gus enable Gravis Ultrasound emulation" 425*cc53d26dSmalcecho " --enable-cs4231a enable CS4231A emulation" 426af5db58eSpbrookecho " --enable-coreaudio enable Coreaudio audio driver" 427af5db58eSpbrookecho " --enable-alsa enable ALSA audio driver" 428ca9cc28cSbalrogecho " --enable-esd enable EsoundD audio driver" 429af5db58eSpbrookecho " --enable-fmod enable FMOD audio driver" 430ed5065e1Sthsecho " --enable-dsound enable DirectSound audio driver" 4312e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 4328d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 433af896aaaSpbrookecho " --disable-curses disable curses output" 434bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 435af5db58eSpbrookecho " --enable-system enable all system emulation targets" 436af5db58eSpbrookecho " --disable-system disable all system emulation targets" 437831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 438831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 439831b7825Sthsecho " --enable-darwin-user enable all darwin usermode emulation targets" 440831b7825Sthsecho " --disable-darwin-user disable all darwin usermode emulation targets" 441af5db58eSpbrookecho " --fmod-lib path to FMOD library" 442af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 443c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 4443142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 445af5db58eSpbrookecho "" 4465bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 447af5db58eSpbrookexit 1 448af5db58eSpbrookfi 449af5db58eSpbrook 4507d13299dSbellardcc="${cross_prefix}${cc}" 4517d13299dSbellardar="${cross_prefix}${ar}" 4527d13299dSbellardstrip="${cross_prefix}${strip}" 4537d13299dSbellard 454064aae13Spbrook# check that the C compiler works. 455064aae13Spbrookcat > $TMPC <<EOF 456064aae13Spbrookint main(void) {} 457064aae13SpbrookEOF 458064aae13Spbrook 459db7287edSpbrookif $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then 460064aae13Spbrook : C compiler works ok 461064aae13Spbrookelse 462064aae13Spbrook echo "ERROR: \"$cc\" either does not exist or does not work" 463064aae13Spbrook exit 1 464a7350fa1Sbellardfi 465a7350fa1Sbellard 46667b915a5Sbellardif test "$mingw32" = "yes" ; then 4675327cf48Sbellard linux="no" 46867b915a5Sbellard EXESUF=".exe" 4699f059ecaSbellard oss="no" 47067b915a5Sbellardfi 47167b915a5Sbellard 472328a4240Spbrook# Check for gcc4, error if pre-gcc4 473328a4240Spbrookif test "$check_gcc" = "yes" ; then 474328a4240Spbrook cat > $TMPC <<EOF 475328a4240Spbrook#if __GNUC__ < 4 476328a4240Spbrook#error gcc3 477328a4240Spbrook#endif 478328a4240Spbrookint main(){return 0;} 479328a4240SpbrookEOF 480db7287edSpbrook if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then 481328a4240Spbrook echo "WARNING: \"$cc\" looks like gcc 4.x" 482328a4240Spbrook found_compat_cc="no" 483328a4240Spbrook if test "$gcc3_search" = "yes" ; then 484328a4240Spbrook echo "Looking for gcc 3.x" 485328a4240Spbrook for compat_cc in $gcc3_list ; do 486d4af3de2Sbalrog if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then 487328a4240Spbrook echo "Found \"$compat_cc\"" 4881124426aSpbrook cc="$cross_prefix$compat_cc" 489328a4240Spbrook found_compat_cc="yes" 490328a4240Spbrook break 491328a4240Spbrook fi 492328a4240Spbrook done 493328a4240Spbrook if test "$found_compat_cc" = "no" ; then 494328a4240Spbrook echo "gcc 3.x not found!" 495328a4240Spbrook fi 496328a4240Spbrook fi 497328a4240Spbrook if test "$found_compat_cc" = "no" ; then 498328a4240Spbrook echo "QEMU is known to have problems when compiled with gcc 4.x" 499328a4240Spbrook echo "It is recommended that you use gcc 3.x to build QEMU" 500328a4240Spbrook echo "To use this compiler anyway, configure with --disable-gcc-check" 501328a4240Spbrook exit 1; 502328a4240Spbrook fi 503328a4240Spbrook fi 504328a4240Spbrookfi 505328a4240Spbrook 506ec530c81Sbellard# 507ec530c81Sbellard# Solaris specific configure tool chain decisions 508ec530c81Sbellard# 509ec530c81Sbellardif test "$solaris" = "yes" ; then 510ec530c81Sbellard # 511ec530c81Sbellard # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly 512ec530c81Sbellard # override the check with --disable-gcc-check 513ec530c81Sbellard # 514ec530c81Sbellard if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then 515ec530c81Sbellard solgcc=`which $cc` 516ec530c81Sbellard if test "$solgcc" = "/usr/sfw/bin/gcc" ; then 517ec530c81Sbellard echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly." 518ec530c81Sbellard echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3" 519ec530c81Sbellard echo "or get the latest patch from SunSolve for gcc" 520ec530c81Sbellard exit 1 521ec530c81Sbellard fi 522ec530c81Sbellard fi 523ec530c81Sbellard solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"` 524ec530c81Sbellard if test -z "$solinst" ; then 525ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 526ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 527ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 528ec530c81Sbellard exit 1 529ec530c81Sbellard fi 530ec530c81Sbellard if test "$solinst" = "/usr/sbin/install" ; then 531ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 532ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 533ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 534ec530c81Sbellard exit 1 535ec530c81Sbellard fi 536ec530c81Sbellard sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"` 537ec530c81Sbellard if test -z "$sol_ar" ; then 538ec530c81Sbellard echo "Error: No path includes ar" 539ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 540ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 541ec530c81Sbellard fi 542ec530c81Sbellard exit 1 543ec530c81Sbellard fi 544ec530c81Sbellardfi 545ec530c81Sbellard 546ec530c81Sbellard 5475327cf48Sbellardif test -z "$target_list" ; then 5485327cf48Sbellard# these targets are portable 5490a8e90f4Spbrook if [ "$softmmu" = "yes" ] ; then 5502408a527Saurel32 target_list="\ 5512408a527Saurel32i386-softmmu \ 5522408a527Saurel32x86_64-softmmu \ 5532408a527Saurel32arm-softmmu \ 5542408a527Saurel32cris-softmmu \ 5552408a527Saurel32m68k-softmmu \ 5562408a527Saurel32mips-softmmu \ 5572408a527Saurel32mipsel-softmmu \ 5582408a527Saurel32mips64-softmmu \ 5592408a527Saurel32mips64el-softmmu \ 5602408a527Saurel32ppc-softmmu \ 5612408a527Saurel32ppcemb-softmmu \ 5622408a527Saurel32ppc64-softmmu \ 5632408a527Saurel32sh4-softmmu \ 5642408a527Saurel32sh4eb-softmmu \ 5652408a527Saurel32sparc-softmmu \ 5662408a527Saurel32" 5670a8e90f4Spbrook fi 5685327cf48Sbellard# the following are Linux specific 569831b7825Sths if [ "$linux_user" = "yes" ] ; then 5702408a527Saurel32 target_list="${target_list}\ 5712408a527Saurel32i386-linux-user \ 5722408a527Saurel32x86_64-linux-user \ 5732408a527Saurel32alpha-linux-user \ 5742408a527Saurel32arm-linux-user \ 5752408a527Saurel32armeb-linux-user \ 5762408a527Saurel32cris-linux-user \ 5772408a527Saurel32m68k-linux-user \ 5782408a527Saurel32mips-linux-user \ 5792408a527Saurel32mipsel-linux-user \ 5802408a527Saurel32ppc-linux-user \ 5812408a527Saurel32ppc64-linux-user \ 5822408a527Saurel32ppc64abi32-linux-user \ 5832408a527Saurel32sh4-linux-user \ 5842408a527Saurel32sh4eb-linux-user \ 5852408a527Saurel32sparc-linux-user \ 5862408a527Saurel32sparc64-linux-user \ 5872408a527Saurel32sparc32plus-linux-user \ 5882408a527Saurel32" 589831b7825Sths fi 590831b7825Sths# the following are Darwin specific 591831b7825Sths if [ "$darwin_user" = "yes" ] ; then 5922408a527Saurel32 target_list="$target_list i386-darwin-user ppc-darwin-user" 5935327cf48Sbellard fi 5946e20a45fSbellardelse 595b1a550a0Spbrook target_list=`echo "$target_list" | sed -e 's/,/ /g'` 5965327cf48Sbellardfi 5970a8e90f4Spbrookif test -z "$target_list" ; then 5980a8e90f4Spbrook echo "No targets enabled" 5990a8e90f4Spbrook exit 1 6000a8e90f4Spbrookfi 6015327cf48Sbellard 6027d13299dSbellardif test -z "$cross_prefix" ; then 6037d13299dSbellard 6047d13299dSbellard# --- 6057d13299dSbellard# big/little endian test 6067d13299dSbellardcat > $TMPC << EOF 6077d13299dSbellard#include <inttypes.h> 6087d13299dSbellardint main(int argc, char ** argv){ 6097d13299dSbellard volatile uint32_t i=0x01234567; 6107d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 6117d13299dSbellard} 6127d13299dSbellardEOF 6137d13299dSbellard 614db7287edSpbrookif $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then 6157d13299dSbellard$TMPE && bigendian="yes" 6167d13299dSbellardelse 6177d13299dSbellardecho big/little test failed 6187d13299dSbellardfi 6197d13299dSbellard 6207d13299dSbellardelse 6217d13299dSbellard 6227d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 6230938cda5Saurel32if test "$cpu" = "armv4b" \ 624f54b3f92Saurel32 -o "$cpu" = "hppa" \ 6250938cda5Saurel32 -o "$cpu" = "m68k" \ 6260938cda5Saurel32 -o "$cpu" = "mips" \ 6270938cda5Saurel32 -o "$cpu" = "mips64" \ 6280938cda5Saurel32 -o "$cpu" = "powerpc" \ 6290938cda5Saurel32 -o "$cpu" = "s390" \ 6300938cda5Saurel32 -o "$cpu" = "sparc" \ 6310938cda5Saurel32 -o "$cpu" = "sparc64"; then 6327d13299dSbellard bigendian="yes" 6337d13299dSbellardfi 6347d13299dSbellard 6357d13299dSbellardfi 6367d13299dSbellard 637b6853697Sbellard# host long bits test 638b6853697Sbellardhostlongbits="32" 6390938cda5Saurel32if test "$cpu" = "x86_64" \ 6400938cda5Saurel32 -o "$cpu" = "alpha" \ 6410938cda5Saurel32 -o "$cpu" = "ia64" \ 6420938cda5Saurel32 -o "$cpu" = "sparc64"; then 643b6853697Sbellard hostlongbits="64" 644b6853697Sbellardfi 645b6853697Sbellard 646e8cd23deSbellard# check gcc options support 64704369ff2Sbellardcat > $TMPC <<EOF 64804369ff2Sbellardint main(void) { 64904369ff2Sbellard} 65004369ff2SbellardEOF 65104369ff2Sbellard 652bd0c5661Spbrook# Check host NPTL support 653bd0c5661Spbrookcat > $TMPC <<EOF 654bd0c5661Spbrook#include <sched.h> 65530813ceaSpbrook#include <linux/futex.h> 656bd0c5661Spbrookvoid foo() 657bd0c5661Spbrook{ 658bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 659bd0c5661Spbrook#error bork 660bd0c5661Spbrook#endif 661bd0c5661Spbrook} 662bd0c5661SpbrookEOF 663bd0c5661Spbrook 664bd0c5661Spbrookif $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then 665bd0c5661Spbrook : 666bd0c5661Spbrookelse 667bd0c5661Spbrook nptl="no" 668bd0c5661Spbrookfi 669bd0c5661Spbrook 67011d9f695Sbellard########################################## 67111d9f695Sbellard# SDL probe 67211d9f695Sbellard 67311d9f695Sbellardsdl_too_old=no 67411d9f695Sbellard 67511d9f695Sbellardif test -z "$sdl" ; then 676a6e022adSbellard sdl_config="sdl-config" 677a6e022adSbellard sdl=no 6787c1f25b4Sbellard sdl_static=no 679a6e022adSbellard 680a6e022adSbellard if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then 681a6e022adSbellard # win32 cross compilation case 682a6e022adSbellard sdl_config="i386-mingw32msvc-sdl-config" 683a6e022adSbellard sdl=yes 684a6e022adSbellard else 685a6e022adSbellard # normal SDL probe 68611d9f695Sbellardcat > $TMPC << EOF 68711d9f695Sbellard#include <SDL.h> 68811d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 68911d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 69011d9f695SbellardEOF 691db7287edSpbrook 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 692a6e022adSbellard _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'` 69311d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 69411d9f695Sbellard sdl_too_old=yes 69511d9f695Sbellard else 696fd677642Sths if test "$cocoa" = "no" ; then 69711d9f695Sbellard sdl=yes 69811d9f695Sbellard fi 699fd677642Sths fi 7007c1f25b4Sbellard 7017c1f25b4Sbellard # static link with sdl ? 7027c1f25b4Sbellard if test "$sdl" = "yes" ; then 7037c1f25b4Sbellard aa="no" 704e14a693dSths `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes" 705e14a693dSths sdl_static_libs=`$sdl_config --static-libs 2>/dev/null` 7067c1f25b4Sbellard if [ "$aa" = "yes" ] ; then 707d8d8aa4eSbellard sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`" 70811d9f695Sbellard fi 70911d9f695Sbellard 7108281db4dSths if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then 7117c1f25b4Sbellard sdl_static=yes 7127c1f25b4Sbellard fi 7137c1f25b4Sbellard fi # static link 7147c1f25b4Sbellard fi # sdl compile test 715a6e022adSbellard fi # cross compilation 716fd677642Sthselse 717fd677642Sths # Make sure to disable cocoa if sdl was set 718fd677642Sths if test "$sdl" = "yes" ; then 719fd677642Sths cocoa="no" 720fd677642Sths coreaudio="no" 721fd677642Sths fi 722a6e022adSbellardfi # -z $sdl 72311d9f695Sbellard 7248f28f3fbSths########################################## 7258d5d2d4cSths# VNC TLS detection 7268d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 7278d5d2d4cSths `pkg-config gnutls` || vnc_tls="no" 7288d5d2d4cSthsfi 7298d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 7308d5d2d4cSths vnc_tls_cflags=`pkg-config --cflags gnutls` 7318d5d2d4cSths vnc_tls_libs=`pkg-config --libs gnutls` 7328d5d2d4cSthsfi 7338d5d2d4cSths 7348d5d2d4cSths########################################## 7358f28f3fbSths# alsa sound support libraries 7368f28f3fbSths 7378f28f3fbSthsif test "$alsa" = "yes" ; then 7388f28f3fbSths cat > $TMPC << EOF 7398f28f3fbSths#include <alsa/asoundlib.h> 7408f28f3fbSthsint main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); } 7418f28f3fbSthsEOF 742db7287edSpbrook if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lasound 2> /dev/null ; then 7438f28f3fbSths : 7448f28f3fbSths else 7458f28f3fbSths echo 7468f28f3fbSths echo "Error: Could not find alsa" 7478f28f3fbSths echo "Make sure to have the alsa libs and headers installed." 7488f28f3fbSths echo 7498f28f3fbSths exit 1 7508f28f3fbSths fi 7518f28f3fbSthsfi 7528f28f3fbSths 7534d3b6f6eSbalrog########################################## 7542e4d9fb1Saurel32# BrlAPI probe 7552e4d9fb1Saurel32 7562e4d9fb1Saurel32if test -z "$brlapi" ; then 7572e4d9fb1Saurel32 brlapi=no 7582e4d9fb1Saurel32cat > $TMPC << EOF 7592e4d9fb1Saurel32#include <brlapi.h> 7602e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 7612e4d9fb1Saurel32EOF 762a40e56d5Saurel32 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev/null ; then 7632e4d9fb1Saurel32 brlapi=yes 7642e4d9fb1Saurel32 fi # brlapi compile test 7652e4d9fb1Saurel32fi # -z $brlapi 7662e4d9fb1Saurel32 7672e4d9fb1Saurel32########################################## 7684d3b6f6eSbalrog# curses probe 7694d3b6f6eSbalrog 7704d3b6f6eSbalrogif test "$curses" = "yes" ; then 7714d3b6f6eSbalrog curses=no 7724d3b6f6eSbalrog cat > $TMPC << EOF 7734d3b6f6eSbalrog#include <curses.h> 7744d3b6f6eSbalrogint main(void) { return curses_version(); } 7754d3b6f6eSbalrogEOF 776af896aaaSpbrook if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then 7774d3b6f6eSbalrog curses=yes 7784d3b6f6eSbalrog fi 7794d3b6f6eSbalrogfi # test "$curses" 7804d3b6f6eSbalrog 781cc8ae6deSpbrook# Check if tools are available to build documentation. 7826c591867Sthsif [ -x "`which texi2html 2>/dev/null`" ] && \ 7836c591867Sths [ -x "`which pod2man 2>/dev/null`" ]; then 784cc8ae6deSpbrook build_docs="yes" 785cc8ae6deSpbrookfi 786cc8ae6deSpbrook 78711d9f695Sbellardif test "$mingw32" = "yes" ; then 78811d9f695Sbellard if test -z "$prefix" ; then 78911d9f695Sbellard prefix="/c/Program Files/Qemu" 79011d9f695Sbellard fi 791308c3593Spbrook mansuffix="" 792308c3593Spbrook datasuffix="" 793308c3593Spbrook docsuffix="" 794308c3593Spbrook binsuffix="" 79511d9f695Sbellardelse 79611d9f695Sbellard if test -z "$prefix" ; then 79711d9f695Sbellard prefix="/usr/local" 79811d9f695Sbellard fi 799308c3593Spbrook mansuffix="/share/man" 800308c3593Spbrook datasuffix="/share/qemu" 801308c3593Spbrook docsuffix="/share/doc/qemu" 802308c3593Spbrook binsuffix="/bin" 80311d9f695Sbellardfi 8045a67135aSbellard 8057d13299dSbellardecho "Install prefix $prefix" 806308c3593Spbrookecho "BIOS directory $prefix$datasuffix" 807308c3593Spbrookecho "binary directory $prefix$binsuffix" 80811d9f695Sbellardif test "$mingw32" = "no" ; then 809308c3593Spbrookecho "Manual directory $prefix$mansuffix" 81043ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 81111d9f695Sbellardfi 8125a67135aSbellardecho "Source path $source_path" 8137d13299dSbellardecho "C compiler $cc" 81483469015Sbellardecho "Host C compiler $host_cc" 815db7287edSpbrookecho "ARCH_CFLAGS $ARCH_CFLAGS" 8167d13299dSbellardecho "make $make" 8176a882643Spbrookecho "install $install" 818a98fd896Sbellardecho "host CPU $cpu" 819de83cd02Sbellardecho "host big endian $bigendian" 82097a847bcSbellardecho "target list $target_list" 8217d13299dSbellardecho "gprof enabled $gprof" 82205c2a3e7Sbellardecho "profiler $profiler" 82343ce4dfeSbellardecho "static build $static" 82485aa5189Sbellardecho "-Werror enabled $werror" 8255b0753e0Sbellardif test "$darwin" = "yes" ; then 8265b0753e0Sbellard echo "Cocoa support $cocoa" 8275b0753e0Sbellardfi 82897a847bcSbellardecho "SDL support $sdl" 829e4afee97Sbellardif test "$sdl" != "no" ; then 8307c1f25b4Sbellard echo "SDL static link $sdl_static" 831e4afee97Sbellardfi 8324d3b6f6eSbalrogecho "curses support $curses" 83367b915a5Sbellardecho "mingw32 support $mingw32" 834fb065187Sbellardecho "Adlib support $adlib" 835e5c9a13eSbalrogecho "AC97 support $ac97" 836423d65f4Sbalrogecho "GUS support $gus" 837*cc53d26dSmalcecho "CS4231A support $cs4231a" 8381d14ffa9Sbellardecho "CoreAudio support $coreaudio" 8391d14ffa9Sbellardecho "ALSA support $alsa" 840ca9cc28cSbalrogecho "EsounD support $esd" 8411d14ffa9Sbellardecho "DSound support $dsound" 8421d14ffa9Sbellardif test "$fmod" = "yes"; then 8431d14ffa9Sbellard if test -z $fmod_lib || test -z $fmod_inc; then 8441d14ffa9Sbellard echo 8451d14ffa9Sbellard echo "Error: You must specify path to FMOD library and headers" 8461d14ffa9Sbellard echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 8471d14ffa9Sbellard echo 8481d14ffa9Sbellard exit 1 8491d14ffa9Sbellard fi 850b1a550a0Spbrook fmod_support=" (lib='$fmod_lib' include='$fmod_inc')" 851b1a550a0Spbrookelse 852b1a550a0Spbrook fmod_support="" 853102a52e4Sbellardfi 854b1a550a0Spbrookecho "FMOD support $fmod $fmod_support" 8556b4d2ba1Sthsecho "OSS support $oss" 8568d5d2d4cSthsecho "VNC TLS support $vnc_tls" 8578d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 8588d5d2d4cSths echo " TLS CFLAGS $vnc_tls_cflags" 8598d5d2d4cSths echo " TLS LIBS $vnc_tls_libs" 8608d5d2d4cSthsfi 8613142255cSblueswir1if test -n "$sparc_cpu"; then 8623142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 8633142255cSblueswir1fi 86407f4ddbfSbellardecho "kqemu support $kqemu" 8652e4d9fb1Saurel32echo "brlapi support $brlapi" 866cc8ae6deSpbrookecho "Documentation $build_docs" 867c5937220Spbrook[ ! -z "$uname_release" ] && \ 868c5937220Spbrookecho "uname -r $uname_release" 869bd0c5661Spbrookecho "NPTL support $nptl" 87067b915a5Sbellard 87197a847bcSbellardif test $sdl_too_old = "yes"; then 87224b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 873e8cd23deSbellardfi 87420b40c6aSthsif [ -s /tmp/qemu-$$-sdl-config.log ]; then 87520b40c6aSths echo "The error log from compiling the libSDL test is: " 87620b40c6aSths cat /tmp/qemu-$$-sdl-config.log 87720b40c6aSthsfi 87820b40c6aSthsrm -f /tmp/qemu-$$-sdl-config.log 87924b55b96Sbellard#if test "$sdl_static" = "no"; then 88024b55b96Sbellard# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output" 88124b55b96Sbellard#fi 88297a847bcSbellardconfig_mak="config-host.mak" 88397a847bcSbellardconfig_h="config-host.h" 88497a847bcSbellard 8857c1f25b4Sbellard#echo "Creating $config_mak and $config_h" 88697a847bcSbellard 88715d9ca0fSthstest -f $config_h && mv $config_h ${config_h}~ 88815d9ca0fSths 88997a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak 89029517134Spbrookecho "# Configured with: $0 $@" >> $config_mak 89197a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h 89297a847bcSbellard 89397a847bcSbellardecho "prefix=$prefix" >> $config_mak 894308c3593Spbrookecho "bindir=\${prefix}$binsuffix" >> $config_mak 895308c3593Spbrookecho "mandir=\${prefix}$mansuffix" >> $config_mak 896308c3593Spbrookecho "datadir=\${prefix}$datasuffix" >> $config_mak 8974ad5b06dSthsecho "docdir=\${prefix}$docsuffix" >> $config_mak 898308c3593Spbrookecho "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h 89997a847bcSbellardecho "MAKE=$make" >> $config_mak 9006a882643Spbrookecho "INSTALL=$install" >> $config_mak 90197a847bcSbellardecho "CC=$cc" >> $config_mak 90297a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak 90397a847bcSbellardecho "AR=$ar" >> $config_mak 90497a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak 90540293e58Sbellard# XXX: only use CFLAGS and LDFLAGS ? 90640293e58Sbellard# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross 90740293e58Sbellard# compilation of dyngen tool (useful for win32 build on Linux host) 9086f30fa85Sthsecho "OS_CFLAGS=$OS_CFLAGS" >> $config_mak 9093142255cSblueswir1echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak 9103142255cSblueswir1echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak 9113142255cSblueswir1echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak 91297a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak 91397a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak 91467b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak 91570956b77Sthsecho "AIOLIBS=$AIOLIBS" >> $config_mak 9162408a527Saurel32case "$cpu" in 9172408a527Saurel32 i386) 91897a847bcSbellard echo "ARCH=i386" >> $config_mak 91997a847bcSbellard echo "#define HOST_I386 1" >> $config_h 9202408a527Saurel32 ;; 9212408a527Saurel32 x86_64) 9220b0babc6Sbellard echo "ARCH=x86_64" >> $config_mak 9230b0babc6Sbellard echo "#define HOST_X86_64 1" >> $config_h 9242408a527Saurel32 ;; 9252408a527Saurel32 alpha) 9260938cda5Saurel32 echo "ARCH=alpha" >> $config_mak 9270938cda5Saurel32 echo "#define HOST_ALPHA 1" >> $config_h 9282408a527Saurel32 ;; 9292408a527Saurel32 armv4b) 930808c4954Sbellard echo "ARCH=arm" >> $config_mak 931808c4954Sbellard echo "#define HOST_ARM 1" >> $config_h 9322408a527Saurel32 ;; 9332408a527Saurel32 armv4l) 93497a847bcSbellard echo "ARCH=arm" >> $config_mak 93597a847bcSbellard echo "#define HOST_ARM 1" >> $config_h 9362408a527Saurel32 ;; 9372408a527Saurel32 cris) 938e7daa605Sths echo "ARCH=cris" >> $config_mak 939e7daa605Sths echo "#define HOST_CRIS 1" >> $config_h 9402408a527Saurel32 ;; 9412408a527Saurel32 hppa) 942f54b3f92Saurel32 echo "ARCH=hppa" >> $config_mak 943f54b3f92Saurel32 echo "#define HOST_HPPA 1" >> $config_h 9442408a527Saurel32 ;; 9452408a527Saurel32 ia64) 94697a847bcSbellard echo "ARCH=ia64" >> $config_mak 94797a847bcSbellard echo "#define HOST_IA64 1" >> $config_h 9482408a527Saurel32 ;; 9492408a527Saurel32 m68k) 95038ca2abcSbellard echo "ARCH=m68k" >> $config_mak 95138ca2abcSbellard echo "#define HOST_M68K 1" >> $config_h 9522408a527Saurel32 ;; 9532408a527Saurel32 mips) 9540938cda5Saurel32 echo "ARCH=mips" >> $config_mak 9550938cda5Saurel32 echo "#define HOST_MIPS 1" >> $config_h 9562408a527Saurel32 ;; 9572408a527Saurel32 mips64) 9580938cda5Saurel32 echo "ARCH=mips64" >> $config_mak 9590938cda5Saurel32 echo "#define HOST_MIPS64 1" >> $config_h 9602408a527Saurel32 ;; 9612408a527Saurel32 powerpc) 9620938cda5Saurel32 echo "ARCH=ppc" >> $config_mak 9630938cda5Saurel32 echo "#define HOST_PPC 1" >> $config_h 9642408a527Saurel32 ;; 9652408a527Saurel32 s390) 9660938cda5Saurel32 echo "ARCH=s390" >> $config_mak 9670938cda5Saurel32 echo "#define HOST_S390 1" >> $config_h 9682408a527Saurel32 ;; 9692408a527Saurel32 sparc) 9700938cda5Saurel32 echo "ARCH=sparc" >> $config_mak 9710938cda5Saurel32 echo "#define HOST_SPARC 1" >> $config_h 9722408a527Saurel32 ;; 9732408a527Saurel32 sparc64) 9740938cda5Saurel32 echo "ARCH=sparc64" >> $config_mak 9750938cda5Saurel32 echo "#define HOST_SPARC64 1" >> $config_h 9762408a527Saurel32 ;; 9772408a527Saurel32 *) 9783142255cSblueswir1 echo "Unsupported CPU = $cpu" 9797d13299dSbellard exit 1 9802408a527Saurel32 ;; 9812408a527Saurel32esac 9827d13299dSbellardif test "$bigendian" = "yes" ; then 98397a847bcSbellard echo "WORDS_BIGENDIAN=yes" >> $config_mak 98497a847bcSbellard echo "#define WORDS_BIGENDIAN 1" >> $config_h 98597a847bcSbellardfi 986b6853697Sbellardecho "#define HOST_LONG_BITS $hostlongbits" >> $config_h 98767b915a5Sbellardif test "$mingw32" = "yes" ; then 98867b915a5Sbellard echo "CONFIG_WIN32=yes" >> $config_mak 98911d9f695Sbellard echo "#define CONFIG_WIN32 1" >> $config_h 990210fa556Spbrookelse 991210fa556Spbrook cat > $TMPC << EOF 992210fa556Spbrook#include <byteswap.h> 993210fa556Spbrookint main(void) { return bswap_32(0); } 994210fa556SpbrookEOF 995db7287edSpbrook if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then 99697a847bcSbellard echo "#define HAVE_BYTESWAP_H 1" >> $config_h 99767b915a5Sbellard fi 998210fa556Spbrookfi 99983fb7adfSbellardif test "$darwin" = "yes" ; then 100083fb7adfSbellard echo "CONFIG_DARWIN=yes" >> $config_mak 100183fb7adfSbellard echo "#define CONFIG_DARWIN 1" >> $config_h 100283fb7adfSbellardfi 1003ec530c81Sbellardif test "$solaris" = "yes" ; then 1004ec530c81Sbellard echo "CONFIG_SOLARIS=yes" >> $config_mak 100538cfa06cSbellard echo "#define HOST_SOLARIS $solarisrev" >> $config_h 10060475a5caSths if test "$needs_libsunmath" = "yes" ; then 10070475a5caSths echo "NEEDS_LIBSUNMATH=yes" >> $config_mak 10080475a5caSths echo "#define NEEDS_LIBSUNMATH 1" >> $config_h 10090475a5caSths fi 1010ec530c81Sbellardfi 10113142255cSblueswir1if test -n "$sparc_cpu"; then 10123142255cSblueswir1 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak 10133142255cSblueswir1 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h 10143142255cSblueswir1fi 101567b915a5Sbellardif test "$gdbstub" = "yes" ; then 101667b915a5Sbellard echo "CONFIG_GDBSTUB=yes" >> $config_mak 101767b915a5Sbellard echo "#define CONFIG_GDBSTUB 1" >> $config_h 101867b915a5Sbellardfi 101997a847bcSbellardif test "$gprof" = "yes" ; then 102097a847bcSbellard echo "TARGET_GPROF=yes" >> $config_mak 102197a847bcSbellard echo "#define HAVE_GPROF 1" >> $config_h 102297a847bcSbellardfi 102397a847bcSbellardif test "$static" = "yes" ; then 102497a847bcSbellard echo "CONFIG_STATIC=yes" >> $config_mak 102550863472Sbellard echo "#define CONFIG_STATIC 1" >> $config_h 102697a847bcSbellardfi 102705c2a3e7Sbellardif test $profiler = "yes" ; then 102805c2a3e7Sbellard echo "#define CONFIG_PROFILER 1" >> $config_h 102905c2a3e7Sbellardfi 1030c20709aaSbellardif test "$slirp" = "yes" ; then 1031c20709aaSbellard echo "CONFIG_SLIRP=yes" >> $config_mak 1032c20709aaSbellard echo "#define CONFIG_SLIRP 1" >> $config_h 1033c20709aaSbellardfi 1034fb065187Sbellardif test "$adlib" = "yes" ; then 1035fb065187Sbellard echo "CONFIG_ADLIB=yes" >> $config_mak 1036fb065187Sbellard echo "#define CONFIG_ADLIB 1" >> $config_h 1037fb065187Sbellardfi 1038e5c9a13eSbalrogif test "$ac97" = "yes" ; then 1039e5c9a13eSbalrog echo "CONFIG_AC97=yes" >> $config_mak 1040e5c9a13eSbalrog echo "#define CONFIG_AC97 1" >> $config_h 1041e5c9a13eSbalrogfi 1042423d65f4Sbalrogif test "$gus" = "yes" ; then 1043423d65f4Sbalrog echo "CONFIG_GUS=yes" >> $config_mak 1044423d65f4Sbalrog echo "#define CONFIG_GUS 1" >> $config_h 1045423d65f4Sbalrogfi 1046*cc53d26dSmalcif test "$cs4231a" = "yes" ; then 1047*cc53d26dSmalc echo "CONFIG_CS4231A=yes" >> $config_mak 1048*cc53d26dSmalc echo "#define CONFIG_CS4231A 1" >> $config_h 1049*cc53d26dSmalcfi 1050fb065187Sbellardif test "$oss" = "yes" ; then 1051fb065187Sbellard echo "CONFIG_OSS=yes" >> $config_mak 1052fb065187Sbellard echo "#define CONFIG_OSS 1" >> $config_h 1053fb065187Sbellardfi 10541d14ffa9Sbellardif test "$coreaudio" = "yes" ; then 10551d14ffa9Sbellard echo "CONFIG_COREAUDIO=yes" >> $config_mak 10561d14ffa9Sbellard echo "#define CONFIG_COREAUDIO 1" >> $config_h 10571d14ffa9Sbellardfi 10581d14ffa9Sbellardif test "$alsa" = "yes" ; then 10591d14ffa9Sbellard echo "CONFIG_ALSA=yes" >> $config_mak 10601d14ffa9Sbellard echo "#define CONFIG_ALSA 1" >> $config_h 10611d14ffa9Sbellardfi 1062ca9cc28cSbalrogif test "$esd" = "yes" ; then 1063ca9cc28cSbalrog echo "CONFIG_ESD=yes" >> $config_mak 1064ca9cc28cSbalrog echo "#define CONFIG_ESD 1" >> $config_h 1065ca9cc28cSbalrogfi 10661d14ffa9Sbellardif test "$dsound" = "yes" ; then 10671d14ffa9Sbellard echo "CONFIG_DSOUND=yes" >> $config_mak 10681d14ffa9Sbellard echo "#define CONFIG_DSOUND 1" >> $config_h 10691d14ffa9Sbellardfi 1070102a52e4Sbellardif test "$fmod" = "yes" ; then 1071102a52e4Sbellard echo "CONFIG_FMOD=yes" >> $config_mak 1072102a52e4Sbellard echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak 1073102a52e4Sbellard echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak 1074102a52e4Sbellard echo "#define CONFIG_FMOD 1" >> $config_h 1075102a52e4Sbellardfi 10768d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 10778d5d2d4cSths echo "CONFIG_VNC_TLS=yes" >> $config_mak 10788d5d2d4cSths echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak 10798d5d2d4cSths echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak 10808d5d2d4cSths echo "#define CONFIG_VNC_TLS 1" >> $config_h 10818d5d2d4cSthsfi 1082b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 1083b1a550a0Spbrookecho "VERSION=$qemu_version" >>$config_mak 1084d4b8f039Spbrookecho "#define QEMU_VERSION \"$qemu_version\"" >> $config_h 108597a847bcSbellard 108697a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak 1087ad064840Spbrookif [ "$source_path_used" = "yes" ]; then 1088ad064840Spbrook echo "VPATH=$source_path" >> $config_mak 1089ad064840Spbrookfi 109097a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak 1091cc8ae6deSpbrookif [ "$build_docs" = "yes" ] ; then 1092cc8ae6deSpbrook echo "BUILD_DOCS=yes" >> $config_mak 1093cc8ae6deSpbrookfi 109449ecc3faSbellardif test "$static" = "yes"; then 109549ecc3faSbellard sdl1=$sdl_static 109649ecc3faSbellardelse 109749ecc3faSbellard sdl1=$sdl 109849ecc3faSbellardfi 109949ecc3faSbellardif test "$sdl1" = "yes" ; then 110049ecc3faSbellard echo "#define CONFIG_SDL 1" >> $config_h 110149ecc3faSbellard echo "CONFIG_SDL=yes" >> $config_mak 110249ecc3faSbellard if test "$target_softmmu" = "no" -o "$static" = "yes"; then 110349ecc3faSbellard echo "SDL_LIBS=$sdl_static_libs" >> $config_mak 110449ecc3faSbellard else 110549ecc3faSbellard echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak 110649ecc3faSbellard fi 110749ecc3faSbellard if [ "${aa}" = "yes" ] ; then 110849ecc3faSbellard echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak 110949ecc3faSbellard else 111049ecc3faSbellard echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak 111149ecc3faSbellard fi 111249ecc3faSbellardfi 111349ecc3faSbellardif test "$cocoa" = "yes" ; then 111449ecc3faSbellard echo "#define CONFIG_COCOA 1" >> $config_h 111549ecc3faSbellard echo "CONFIG_COCOA=yes" >> $config_mak 111649ecc3faSbellardfi 11174d3b6f6eSbalrogif test "$curses" = "yes" ; then 11184d3b6f6eSbalrog echo "#define CONFIG_CURSES 1" >> $config_h 11194d3b6f6eSbalrog echo "CONFIG_CURSES=yes" >> $config_mak 11204d3b6f6eSbalrog echo "CURSES_LIBS=-lcurses" >> $config_mak 11214d3b6f6eSbalrogfi 11222e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 11232e4d9fb1Saurel32 echo "CONFIG_BRLAPI=yes" >> $config_mak 11242e4d9fb1Saurel32 echo "#define CONFIG_BRLAPI 1" >> $config_h 11252e4d9fb1Saurel32 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak 11262e4d9fb1Saurel32fi 112797a847bcSbellard 112883fb7adfSbellard# XXX: suppress that 11297d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 113043003046Sbellard echo "#define O_LARGEFILE 0" >> $config_h 113143003046Sbellard echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h 11327d3505c5Sbellard echo "#define _BSD 1" >> $config_h 11337d3505c5Sbellardfi 11347d3505c5Sbellard 1135c5937220Spbrookecho "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h 1136c5937220Spbrook 1137c39e3338Spbrooktools= 1138c39e3338Spbrookif test `expr "$target_list" : ".*softmmu.*"` != 0 ; then 1139c39e3338Spbrook tools="qemu-img\$(EXESUF) $tools" 11407a5ca864Sbellard if [ "$linux" = "yes" ] ; then 11417a5ca864Sbellard tools="qemu-nbd\$(EXESUF) $tools" 11427a5ca864Sbellard fi 1143c39e3338Spbrookfi 1144c39e3338Spbrookecho "TOOLS=$tools" >> $config_mak 1145c39e3338Spbrook 114615d9ca0fSthstest -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h 114715d9ca0fSths 114897a847bcSbellardfor target in $target_list; do 114997a847bcSbellardtarget_dir="$target" 115097a847bcSbellardconfig_mak=$target_dir/config.mak 115197a847bcSbellardconfig_h=$target_dir/config.h 115297a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1` 115397a847bcSbellardtarget_bigendian="no" 1154808c4954Sbellard[ "$target_cpu" = "armeb" ] && target_bigendian=yes 11550938cda5Saurel32[ "$target_cpu" = "m68k" ] && target_bigendian=yes 11560938cda5Saurel32[ "$target_cpu" = "mips" ] && target_bigendian=yes 11570938cda5Saurel32[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes 11580938cda5Saurel32[ "$target_cpu" = "mips64" ] && target_bigendian=yes 115967867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes 1160d4082e95Sj_mayer[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes 116122f8a8b3Sj_mayer[ "$target_cpu" = "ppc64" ] && target_bigendian=yes 1162e85e7c6eSj_mayer[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes 1163908f52b0Spbrook[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes 11640938cda5Saurel32[ "$target_cpu" = "sparc" ] && target_bigendian=yes 11650938cda5Saurel32[ "$target_cpu" = "sparc64" ] && target_bigendian=yes 11660938cda5Saurel32[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes 116797a847bcSbellardtarget_softmmu="no" 1168997344f3Sbellardtarget_user_only="no" 1169831b7825Sthstarget_linux_user="no" 1170831b7825Sthstarget_darwin_user="no" 11719e407a85Spbrookcase "$target" in 11729e407a85Spbrook ${target_cpu}-softmmu) 11739e407a85Spbrook target_softmmu="yes" 11749e407a85Spbrook ;; 11759e407a85Spbrook ${target_cpu}-linux-user) 11769e407a85Spbrook target_user_only="yes" 11779e407a85Spbrook target_linux_user="yes" 11789e407a85Spbrook ;; 11799e407a85Spbrook ${target_cpu}-darwin-user) 11809e407a85Spbrook target_user_only="yes" 1181831b7825Sths target_darwin_user="yes" 11829e407a85Spbrook ;; 11839e407a85Spbrook *) 11849e407a85Spbrook echo "ERROR: Target '$target' not recognised" 11859e407a85Spbrook exit 1 11869e407a85Spbrook ;; 11879e407a85Spbrookesac 1188831b7825Sths 118997ccc689Sbellardif test "$target_user_only" = "no" -a "$check_gfx" = "yes" \ 119097ccc689Sbellard -a "$sdl" = "no" -a "$cocoa" = "no" ; then 119197ccc689Sbellard echo "ERROR: QEMU requires SDL or Cocoa for graphical output" 11929c038506Spbrook echo "To build QEMU without graphical output configure with --disable-gfx-check" 11934d3b6f6eSbalrog echo "Note that this will disable all output from the virtual graphics card" 11944d3b6f6eSbalrog echo "except through VNC or curses." 119597ccc689Sbellard exit 1; 119697ccc689Sbellardfi 119797ccc689Sbellard 11987c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile" 119997a847bcSbellard 120015d9ca0fSthstest -f $config_h && mv $config_h ${config_h}~ 120115d9ca0fSths 120297a847bcSbellardmkdir -p $target_dir 1203158142c2Sbellardmkdir -p $target_dir/fpu 120457fec1feSbellardmkdir -p $target_dir/tcg 1205831b7825Sthsif test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then 120669de927cSbellard mkdir -p $target_dir/nwfpe 120769de927cSbellardfi 120869de927cSbellard 1209ec530c81Sbellard# 1210ec530c81Sbellard# don't use ln -sf as not all "ln -sf" over write the file/link 1211ec530c81Sbellard# 1212ec530c81Sbellardrm -f $target_dir/Makefile 1213ec530c81Sbellardln -s $source_path/Makefile.target $target_dir/Makefile 1214ec530c81Sbellard 121597a847bcSbellard 121697a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak 121797a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h 121897a847bcSbellard 121997a847bcSbellard 122097a847bcSbellardecho "include ../config-host.mak" >> $config_mak 122197a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h 12221e43adfcSbellard 1223e5fe0c52Spbrookbflt="no" 1224cb33da57Sblueswir1elfload32="no" 1225bd0c5661Spbrooktarget_nptl="no" 12261e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"` 12271e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h 122897a847bcSbellard 12292408a527Saurel32case "$target_cpu" in 12302408a527Saurel32 i386) 123197a847bcSbellard echo "TARGET_ARCH=i386" >> $config_mak 123297a847bcSbellard echo "#define TARGET_ARCH \"i386\"" >> $config_h 123397a847bcSbellard echo "#define TARGET_I386 1" >> $config_h 1234da260249Sbellard if test $kqemu = "yes" -a "$target_softmmu" = "yes" 12352408a527Saurel32 then 1236824d560fSbellard echo "#define USE_KQEMU 1" >> $config_h 1237824d560fSbellard fi 1238f2bf094eSaurel32 gcc3minver=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.` 123911d1fdb0Spbrook if test -n "$gcc3minver" && test $gcc3minver -gt 3 1240f2bf094eSaurel32 then 1241f2bf094eSaurel32 echo "HAVE_GT_GCC_3_3=true" >> $config_mak 1242f2bf094eSaurel32 else 1243f2bf094eSaurel32 echo "HAVE_GT_GCC_3_3=false" >> $config_mak 1244f2bf094eSaurel32 fi 12452408a527Saurel32 ;; 12462408a527Saurel32 x86_64) 12470938cda5Saurel32 echo "TARGET_ARCH=x86_64" >> $config_mak 12480938cda5Saurel32 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h 12490938cda5Saurel32 echo "#define TARGET_I386 1" >> $config_h 12500938cda5Saurel32 echo "#define TARGET_X86_64 1" >> $config_h 12512408a527Saurel32 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" 12522408a527Saurel32 then 12530938cda5Saurel32 echo "#define USE_KQEMU 1" >> $config_h 12540938cda5Saurel32 fi 12552408a527Saurel32 ;; 12562408a527Saurel32 alpha) 12570938cda5Saurel32 echo "TARGET_ARCH=alpha" >> $config_mak 1258bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 12590938cda5Saurel32 echo "#define TARGET_ARCH \"alpha\"" >> $config_h 12600938cda5Saurel32 echo "#define TARGET_ALPHA 1" >> $config_h 1261bf6247fbSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 12622408a527Saurel32 ;; 12632408a527Saurel32 arm|armeb) 126497a847bcSbellard echo "TARGET_ARCH=arm" >> $config_mak 126597a847bcSbellard echo "#define TARGET_ARCH \"arm\"" >> $config_h 126697a847bcSbellard echo "#define TARGET_ARM 1" >> $config_h 1267e5fe0c52Spbrook bflt="yes" 1268bd0c5661Spbrook target_nptl="yes" 12692408a527Saurel32 ;; 12702408a527Saurel32 cris) 12710938cda5Saurel32 echo "TARGET_ARCH=cris" >> $config_mak 12720938cda5Saurel32 echo "#define TARGET_ARCH \"cris\"" >> $config_h 12730938cda5Saurel32 echo "#define TARGET_CRIS 1" >> $config_h 12742408a527Saurel32 ;; 12752408a527Saurel32 m68k) 12760938cda5Saurel32 echo "TARGET_ARCH=m68k" >> $config_mak 12770938cda5Saurel32 echo "#define TARGET_ARCH \"m68k\"" >> $config_h 12780938cda5Saurel32 echo "#define TARGET_M68K 1" >> $config_h 12790938cda5Saurel32 bflt="yes" 12802408a527Saurel32 ;; 12812408a527Saurel32 mips|mipsel) 12820938cda5Saurel32 echo "TARGET_ARCH=mips" >> $config_mak 1283bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 12840938cda5Saurel32 echo "#define TARGET_ARCH \"mips\"" >> $config_h 12850938cda5Saurel32 echo "#define TARGET_MIPS 1" >> $config_h 12860938cda5Saurel32 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h 1287bf6247fbSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 12882408a527Saurel32 ;; 12892408a527Saurel32 mipsn32|mipsn32el) 12900938cda5Saurel32 echo "TARGET_ARCH=mipsn32" >> $config_mak 1291bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 12920938cda5Saurel32 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h 12930938cda5Saurel32 echo "#define TARGET_MIPS 1" >> $config_h 12940938cda5Saurel32 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h 1295bf6247fbSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 12962408a527Saurel32 ;; 12972408a527Saurel32 mips64|mips64el) 12980938cda5Saurel32 echo "TARGET_ARCH=mips64" >> $config_mak 1299bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 13000938cda5Saurel32 echo "#define TARGET_ARCH \"mips64\"" >> $config_h 13010938cda5Saurel32 echo "#define TARGET_MIPS 1" >> $config_h 13020938cda5Saurel32 echo "#define TARGET_MIPS64 1" >> $config_h 13030938cda5Saurel32 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h 1304bf6247fbSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 13052408a527Saurel32 ;; 13062408a527Saurel32 ppc) 130767867308Sbellard echo "TARGET_ARCH=ppc" >> $config_mak 1308bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 130967867308Sbellard echo "#define TARGET_ARCH \"ppc\"" >> $config_h 131067867308Sbellard echo "#define TARGET_PPC 1" >> $config_h 1311bf6247fbSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 13122408a527Saurel32 ;; 13132408a527Saurel32 ppcemb) 1314d4082e95Sj_mayer echo "TARGET_ARCH=ppcemb" >> $config_mak 1315e85e7c6eSj_mayer echo "TARGET_ABI_DIR=ppc" >> $config_mak 1316bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 1317d4082e95Sj_mayer echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h 1318d4082e95Sj_mayer echo "#define TARGET_PPC 1" >> $config_h 1319d4082e95Sj_mayer echo "#define TARGET_PPCEMB 1" >> $config_h 1320ec5b78cdSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 13212408a527Saurel32 ;; 13222408a527Saurel32 ppc64) 132322f8a8b3Sj_mayer echo "TARGET_ARCH=ppc64" >> $config_mak 1324f85e9a68Sj_mayer echo "TARGET_ABI_DIR=ppc" >> $config_mak 1325bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 13265e692ecdSj_mayer echo "#define TARGET_ARCH \"ppc64\"" >> $config_h 132722f8a8b3Sj_mayer echo "#define TARGET_PPC 1" >> $config_h 132822f8a8b3Sj_mayer echo "#define TARGET_PPC64 1" >> $config_h 1329bf6247fbSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 13302408a527Saurel32 ;; 13312408a527Saurel32 ppc64abi32) 1332e85e7c6eSj_mayer echo "TARGET_ARCH=ppc64" >> $config_mak 1333e85e7c6eSj_mayer echo "TARGET_ABI_DIR=ppc" >> $config_mak 13340c64b9cdSbellard echo "TARGET_ARCH2=ppc64abi32" >> $config_mak 1335bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 13365e692ecdSj_mayer echo "#define TARGET_ARCH \"ppc64\"" >> $config_h 1337e85e7c6eSj_mayer echo "#define TARGET_PPC 1" >> $config_h 1338e85e7c6eSj_mayer echo "#define TARGET_PPC64 1" >> $config_h 1339e85e7c6eSj_mayer echo "#define TARGET_ABI32 1" >> $config_h 1340bf6247fbSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 13412408a527Saurel32 ;; 13422408a527Saurel32 sh4|sh4eb) 1343fdf9b3e8Sbellard echo "TARGET_ARCH=sh4" >> $config_mak 1344bf6247fbSblueswir1 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak 1345fdf9b3e8Sbellard echo "#define TARGET_ARCH \"sh4\"" >> $config_h 1346fdf9b3e8Sbellard echo "#define TARGET_SH4 1" >> $config_h 1347bf6247fbSblueswir1 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h 13484dbed897Spbrook bflt="yes" 13492408a527Saurel32 ;; 13502408a527Saurel32 sparc) 13510938cda5Saurel32 echo "TARGET_ARCH=sparc" >> $config_mak 13520938cda5Saurel32 echo "#define TARGET_ARCH \"sparc\"" >> $config_h 13530938cda5Saurel32 echo "#define TARGET_SPARC 1" >> $config_h 13542408a527Saurel32 ;; 13552408a527Saurel32 sparc64) 13560938cda5Saurel32 echo "TARGET_ARCH=sparc64" >> $config_mak 13570938cda5Saurel32 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h 13580938cda5Saurel32 echo "#define TARGET_SPARC 1" >> $config_h 13590938cda5Saurel32 echo "#define TARGET_SPARC64 1" >> $config_h 13600938cda5Saurel32 elfload32="yes" 13612408a527Saurel32 ;; 13622408a527Saurel32 sparc32plus) 13630938cda5Saurel32 echo "TARGET_ARCH=sparc64" >> $config_mak 13640938cda5Saurel32 echo "TARGET_ABI_DIR=sparc" >> $config_mak 13650938cda5Saurel32 echo "TARGET_ARCH2=sparc32plus" >> $config_mak 13660938cda5Saurel32 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h 13670938cda5Saurel32 echo "#define TARGET_SPARC 1" >> $config_h 13680938cda5Saurel32 echo "#define TARGET_SPARC64 1" >> $config_h 13690938cda5Saurel32 echo "#define TARGET_ABI32 1" >> $config_h 13702408a527Saurel32 ;; 13712408a527Saurel32 *) 1372de83cd02Sbellard echo "Unsupported target CPU" 1373de83cd02Sbellard exit 1 13742408a527Saurel32 ;; 13752408a527Saurel32esac 1376de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 137797a847bcSbellard echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak 137897a847bcSbellard echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h 137997a847bcSbellardfi 138097a847bcSbellardif test "$target_softmmu" = "yes" ; then 138197a847bcSbellard echo "CONFIG_SOFTMMU=yes" >> $config_mak 138297a847bcSbellard echo "#define CONFIG_SOFTMMU 1" >> $config_h 1383de83cd02Sbellardfi 1384997344f3Sbellardif test "$target_user_only" = "yes" ; then 1385997344f3Sbellard echo "CONFIG_USER_ONLY=yes" >> $config_mak 1386997344f3Sbellard echo "#define CONFIG_USER_ONLY 1" >> $config_h 1387997344f3Sbellardfi 1388831b7825Sthsif test "$target_linux_user" = "yes" ; then 1389831b7825Sths echo "CONFIG_LINUX_USER=yes" >> $config_mak 1390831b7825Sths echo "#define CONFIG_LINUX_USER 1" >> $config_h 1391831b7825Sthsfi 1392831b7825Sthsif test "$target_darwin_user" = "yes" ; then 1393831b7825Sths echo "CONFIG_DARWIN_USER=yes" >> $config_mak 1394831b7825Sths echo "#define CONFIG_DARWIN_USER 1" >> $config_h 1395831b7825Sthsfi 1396de83cd02Sbellard 13970938cda5Saurel32if test "$target_cpu" = "arm" \ 13980938cda5Saurel32 -o "$target_cpu" = "armeb" \ 13990938cda5Saurel32 -o "$target_cpu" = "m68k" \ 14000938cda5Saurel32 -o "$target_cpu" = "mips" \ 14010938cda5Saurel32 -o "$target_cpu" = "mipsel" \ 14020938cda5Saurel32 -o "$target_cpu" = "mipsn32" \ 14030938cda5Saurel32 -o "$target_cpu" = "mipsn32el" \ 14040938cda5Saurel32 -o "$target_cpu" = "mips64" \ 14050938cda5Saurel32 -o "$target_cpu" = "mips64el" \ 14060938cda5Saurel32 -o "$target_cpu" = "sparc" \ 14070938cda5Saurel32 -o "$target_cpu" = "sparc64" \ 14080938cda5Saurel32 -o "$target_cpu" = "sparc32plus"; then 1409158142c2Sbellard echo "CONFIG_SOFTFLOAT=yes" >> $config_mak 1410158142c2Sbellard echo "#define CONFIG_SOFTFLOAT 1" >> $config_h 1411158142c2Sbellardfi 1412e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 1413e5fe0c52Spbrook echo "TARGET_HAS_BFLT=yes" >> $config_mak 1414e5fe0c52Spbrook echo "#define TARGET_HAS_BFLT 1" >> $config_h 1415e5fe0c52Spbrookfi 1416bd0c5661Spbrookif test "$target_user_only" = "yes" \ 1417bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 1418bd0c5661Spbrook echo "#define USE_NPTL 1" >> $config_h 1419bd0c5661Spbrookfi 1420cb33da57Sblueswir1# 32 bit ELF loader in addition to native 64 bit loader? 1421cb33da57Sblueswir1if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then 1422cb33da57Sblueswir1 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak 1423cb33da57Sblueswir1 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h 1424cb33da57Sblueswir1fi 14255b0753e0Sbellard 142615d9ca0fSthstest -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h 142715d9ca0fSths 142897a847bcSbellarddone # for target in $targets 14297d13299dSbellard 14307d13299dSbellard# build tree in object directory if source path is different from current one 14317d13299dSbellardif test "$source_path_used" = "yes" ; then 143249ecc3faSbellard DIRS="tests tests/cris slirp audio" 14337d13299dSbellard FILES="Makefile tests/Makefile" 1434e7daa605Sths FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit" 1435e1ffb0f1Sedgar_igl FILES="$FILES tests/test-mmap.c" 14367d13299dSbellard for dir in $DIRS ; do 14377d13299dSbellard mkdir -p $dir 14387d13299dSbellard done 1439ec530c81Sbellard # remove the link and recreate it, as not all "ln -sf" overwrite the link 14407d13299dSbellard for f in $FILES ; do 1441ec530c81Sbellard rm -f $f 1442ec530c81Sbellard ln -s $source_path/$f $f 14437d13299dSbellard done 14447d13299dSbellardfi 14457d13299dSbellard 144697a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS 1447