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" 257d13299dSbellardhost_cc="gcc" 267d13299dSbellardar="ar" 277d13299dSbellardmake="make" 286a882643Spbrookinstall="install" 297d13299dSbellardstrip="strip" 307d13299dSbellardcpu=`uname -m` 315327cf48Sbellardtarget_list="" 327d13299dSbellardcase "$cpu" in 337d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 3497a847bcSbellard cpu="i386" 357d13299dSbellard ;; 36ba68055eSbellard armv*b) 37808c4954Sbellard cpu="armv4b" 38808c4954Sbellard ;; 39ba68055eSbellard armv*l) 407d13299dSbellard cpu="armv4l" 417d13299dSbellard ;; 427d13299dSbellard alpha) 437d13299dSbellard cpu="alpha" 447d13299dSbellard ;; 45295defa5Sbellard "Power Macintosh"|ppc|ppc64) 467d13299dSbellard cpu="powerpc" 477d13299dSbellard ;; 487d13299dSbellard mips) 497d13299dSbellard cpu="mips" 507d13299dSbellard ;; 51fb3e5849Sbellard s390) 52fb3e5849Sbellard cpu="s390" 53fb3e5849Sbellard ;; 54ae228531Sbellard sparc) 55ae228531Sbellard cpu="sparc" 56ae228531Sbellard ;; 57ae228531Sbellard sparc64) 58ae228531Sbellard cpu="sparc64" 59ae228531Sbellard ;; 60a8baa8c5Sbellard ia64) 61a8baa8c5Sbellard cpu="ia64" 62a8baa8c5Sbellard ;; 6338e584a0Sbellard m68k) 6438e584a0Sbellard cpu="m68k" 6538e584a0Sbellard ;; 66bc51c5c9Sbellard x86_64|amd64) 670b0babc6Sbellard cpu="x86_64" 68bc51c5c9Sbellard ;; 697d13299dSbellard *) 707d13299dSbellard cpu="unknown" 717d13299dSbellard ;; 727d13299dSbellardesac 737d13299dSbellardgprof="no" 747d13299dSbellardbigendian="no" 7567b915a5Sbellardmingw32="no" 7667b915a5SbellardEXESUF="" 7767b915a5Sbellardgdbstub="yes" 78443f1376Sbellardslirp="yes" 79fb065187Sbellardadlib="no" 80fb065187Sbellardoss="no" 811d14ffa9Sbellarddsound="no" 821d14ffa9Sbellardcoreaudio="no" 831d14ffa9Sbellardalsa="no" 84102a52e4Sbellardfmod="no" 85102a52e4Sbellardfmod_lib="" 86102a52e4Sbellardfmod_inc="" 87b1a550a0Spbrookbsd="no" 885327cf48Sbellardlinux="no" 89c9ec1fe4Sbellardkqemu="no" 9005c2a3e7Sbellardprofiler="no" 91c9ec1fe4Sbellardkernel_path="" 925b0753e0Sbellardcocoa="no" 9397ccc689Sbellardcheck_gfx="yes" 941aff381fSbellardcheck_gcc="yes" 950a8e90f4Spbrooksoftmmu="yes" 960a8e90f4Spbrookuser="no" 977d13299dSbellard 987d13299dSbellard# OS specific 997d13299dSbellardtargetos=`uname -s` 1007d13299dSbellardcase $targetos in 101c326e0afSbellardCYGWIN*) 102c326e0afSbellardmingw32="yes" 103c326e0afSbellardCFLAGS="-O2 -mno-cygwin" 104c326e0afSbellard;; 10567b915a5SbellardMINGW32*) 10667b915a5Sbellardmingw32="yes" 10767b915a5Sbellard;; 1087d3505c5SbellardFreeBSD) 1097d3505c5Sbellardbsd="yes" 110fb065187Sbellardoss="yes" 111e99f9060Sbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 11207f4ddbfSbellard kqemu="yes" 11307f4ddbfSbellardfi 1147d3505c5Sbellard;; 1157d3505c5SbellardNetBSD) 1167d3505c5Sbellardbsd="yes" 117fb065187Sbellardoss="yes" 1187d3505c5Sbellard;; 1197d3505c5SbellardOpenBSD) 1207d3505c5Sbellardbsd="yes" 121fb065187Sbellardoss="yes" 1227d3505c5Sbellard;; 12383fb7adfSbellardDarwin) 12483fb7adfSbellardbsd="yes" 12583fb7adfSbellarddarwin="yes" 12683fb7adfSbellard;; 127fb065187Sbellard*) 128fb065187Sbellardoss="yes" 1295327cf48Sbellardlinux="yes" 1300a8e90f4Spbrookuser="yes" 13107f4ddbfSbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 132c9ec1fe4Sbellard kqemu="yes" 133c9ec1fe4Sbellardfi 134fb065187Sbellard;; 1357d13299dSbellardesac 1367d13299dSbellard 1377d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 138b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 1397d3505c5Sbellard make="gmake" 14083fb7adfSbellard fi 1417d3505c5Sbellardfi 1427d3505c5Sbellard 1437d13299dSbellard# find source path 144ad064840Spbrooksource_path=`dirname "$0"` 145ad064840Spbrookif [ -z "$source_path" ]; then 1467d13299dSbellard source_path=`pwd` 147ad064840Spbrookelse 148ad064840Spbrook source_path=`cd "$source_path"; pwd` 149ad064840Spbrookfi 150ad064840Spbrookif test "$source_path" = `pwd` ; then 1517d13299dSbellard source_path_used="no" 152ad064840Spbrookelse 153ad064840Spbrook source_path_used="yes" 1547d13299dSbellardfi 1557d13299dSbellard 1567d13299dSbellardfor opt do 157b1a550a0Spbrook optarg=`expr "$opt" : '[^=]*=\(.*\)'` 1587d13299dSbellard case "$opt" in 1592efc3265Sbellard --help|-h) show_help=yes 1602efc3265Sbellard ;; 161b1a550a0Spbrook --prefix=*) prefix="$optarg" 1627d13299dSbellard ;; 163b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 16432ce6337Sbellard ;; 165b1a550a0Spbrook --source-path=*) source_path="$optarg" 166ad064840Spbrook source_path_used="yes" 1677d13299dSbellard ;; 168b1a550a0Spbrook --cross-prefix=*) cross_prefix="$optarg" 1697d13299dSbellard ;; 170b1a550a0Spbrook --cc=*) cc="$optarg" 1717d13299dSbellard ;; 172b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 17383469015Sbellard ;; 174b1a550a0Spbrook --make=*) make="$optarg" 1757d13299dSbellard ;; 1766a882643Spbrook --install=*) install="$optarg" 1776a882643Spbrook ;; 178b1a550a0Spbrook --extra-cflags=*) CFLAGS="$optarg" 1797d13299dSbellard ;; 180b1a550a0Spbrook --extra-ldflags=*) LDFLAGS="$optarg" 1817d13299dSbellard ;; 182b1a550a0Spbrook --cpu=*) cpu="$optarg" 1837d13299dSbellard ;; 184b1a550a0Spbrook --target-list=*) target_list="$optarg" 185de83cd02Sbellard ;; 1867d13299dSbellard --enable-gprof) gprof="yes" 1877d13299dSbellard ;; 18843ce4dfeSbellard --static) static="yes" 18943ce4dfeSbellard ;; 19097a847bcSbellard --disable-sdl) sdl="no" 19197a847bcSbellard ;; 1921d14ffa9Sbellard --enable-coreaudio) coreaudio="yes" 1931d14ffa9Sbellard ;; 1941d14ffa9Sbellard --enable-alsa) alsa="yes" 1951d14ffa9Sbellard ;; 1961d14ffa9Sbellard --enable-dsound) dsound="yes" 1971d14ffa9Sbellard ;; 198102a52e4Sbellard --enable-fmod) fmod="yes" 199102a52e4Sbellard ;; 200b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 201102a52e4Sbellard ;; 202b1a550a0Spbrook --fmod-inc=*) fmod_inc="$optarg" 203102a52e4Sbellard ;; 20467b915a5Sbellard --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" 20567b915a5Sbellard ;; 206443f1376Sbellard --disable-slirp) slirp="no" 207c20709aaSbellard ;; 208fb065187Sbellard --enable-adlib) adlib="yes" 209fb065187Sbellard ;; 210c9ec1fe4Sbellard --disable-kqemu) kqemu="no" 211c9ec1fe4Sbellard ;; 21205c2a3e7Sbellard --enable-profiler) profiler="yes" 21305c2a3e7Sbellard ;; 214b1a550a0Spbrook --kernel-path=*) kernel_path="$optarg" 215c9ec1fe4Sbellard ;; 2161d14ffa9Sbellard --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no" 2175b0753e0Sbellard ;; 21897ccc689Sbellard --disable-gfx-check) check_gfx="no" 21997ccc689Sbellard ;; 2201aff381fSbellard --disable-gcc-check) check_gcc="no" 2211aff381fSbellard ;; 222cad25d69Spbrook --disable-system) softmmu="no" 2230a8e90f4Spbrook ;; 224cad25d69Spbrook --enable-system) softmmu="yes" 2250a8e90f4Spbrook ;; 2260a8e90f4Spbrook --disable-user) user="no" 2270a8e90f4Spbrook ;; 2280a8e90f4Spbrook --enable-user) user="yes" 2290a8e90f4Spbrook ;; 2307d13299dSbellard esac 2317d13299dSbellarddone 2327d13299dSbellard 2337d13299dSbellard# Checking for CFLAGS 2347d13299dSbellardif test -z "$CFLAGS"; then 2357d13299dSbellard CFLAGS="-O2" 2367d13299dSbellardfi 2377d13299dSbellard 238af5db58eSpbrookif test x"$show_help" = x"yes" ; then 239af5db58eSpbrookcat << EOF 240af5db58eSpbrook 241af5db58eSpbrookUsage: configure [options] 242af5db58eSpbrookOptions: [defaults in brackets after descriptions] 243af5db58eSpbrook 244af5db58eSpbrookEOF 245af5db58eSpbrookecho "Standard options:" 246af5db58eSpbrookecho " --help print this message" 247af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 248af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 249af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 250af5db58eSpbrookecho " --target-list=LIST set target list [$target_list]" 251af5db58eSpbrookecho "" 252af5db58eSpbrookecho "kqemu kernel acceleration support:" 253af5db58eSpbrookecho " --disable-kqemu disable kqemu support" 254af5db58eSpbrookecho " --kernel-path=PATH set the kernel path (configure probes it)" 255af5db58eSpbrookecho "" 256af5db58eSpbrookecho "Advanced options (experts only):" 257af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 258af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 259af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 260af5db58eSpbrookecho " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc." 261af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 2626a882643Spbrookecho " --install=INSTALL use specified install [$install]" 263af5db58eSpbrookecho " --static enable static build [$static]" 264af5db58eSpbrookecho " --enable-cocoa enable COCOA (Mac OS X only)" 265af5db58eSpbrookecho " --enable-mingw32 enable Win32 cross compilation with mingw32" 266af5db58eSpbrookecho " --enable-adlib enable Adlib emulation" 267af5db58eSpbrookecho " --enable-coreaudio enable Coreaudio audio driver" 268af5db58eSpbrookecho " --enable-alsa enable ALSA audio driver" 269af5db58eSpbrookecho " --enable-fmod enable FMOD audio driver" 270af5db58eSpbrookecho " --enabled-dsound enable DirectSound audio driver" 271af5db58eSpbrookecho " --enable-system enable all system emulation targets" 272af5db58eSpbrookecho " --disable-system disable all system emulation targets" 273af5db58eSpbrookecho " --enable-user enable all linux usermode emulation targets" 274af5db58eSpbrookecho " --disable-user disable all linux usermode emulation targets" 275af5db58eSpbrookecho " --fmod-lib path to FMOD library" 276af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 277af5db58eSpbrookecho "" 278af5db58eSpbrookecho "NOTE: The object files are build at the place where configure is launched" 279af5db58eSpbrookexit 1 280af5db58eSpbrookfi 281af5db58eSpbrook 2827d13299dSbellardcc="${cross_prefix}${cc}" 2837d13299dSbellardar="${cross_prefix}${ar}" 2847d13299dSbellardstrip="${cross_prefix}${strip}" 2857d13299dSbellard 286*a7350fa1Sbellardif [ -z `which $cc` ] ; then 287*a7350fa1Sbellard echo "Compiler $cc could not be found" 288*a7350fa1Sbellard exit 289*a7350fa1Sbellardfi 290*a7350fa1Sbellard 29167b915a5Sbellardif test "$mingw32" = "yes" ; then 2925327cf48Sbellard linux="no" 29367b915a5Sbellard EXESUF=".exe" 29467b915a5Sbellard gdbstub="no" 2959f059ecaSbellard oss="no" 29607f4ddbfSbellard if [ "$cpu" = "i386" ] ; then 29707f4ddbfSbellard kqemu="yes" 29807f4ddbfSbellard fi 29967b915a5Sbellardfi 30067b915a5Sbellard 3015327cf48Sbellardif test -z "$target_list" ; then 3025327cf48Sbellard# these targets are portable 3030a8e90f4Spbrook if [ "$softmmu" = "yes" ] ; then 30438260998Spbrook target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu" 3050a8e90f4Spbrook fi 3065327cf48Sbellard# the following are Linux specific 3070a8e90f4Spbrook if [ "$user" = "yes" ] ; then 308c20eb473Sbellard target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list" 3095327cf48Sbellard fi 3106e20a45fSbellardelse 311b1a550a0Spbrook target_list=`echo "$target_list" | sed -e 's/,/ /g'` 3125327cf48Sbellardfi 3130a8e90f4Spbrookif test -z "$target_list" ; then 3140a8e90f4Spbrook echo "No targets enabled" 3150a8e90f4Spbrook exit 1 3160a8e90f4Spbrookfi 3175327cf48Sbellard 3187d13299dSbellardif test -z "$cross_prefix" ; then 3197d13299dSbellard 3207d13299dSbellard# --- 3217d13299dSbellard# big/little endian test 3227d13299dSbellardcat > $TMPC << EOF 3237d13299dSbellard#include <inttypes.h> 3247d13299dSbellardint main(int argc, char ** argv){ 3257d13299dSbellard volatile uint32_t i=0x01234567; 3267d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 3277d13299dSbellard} 3287d13299dSbellardEOF 3297d13299dSbellard 3307d13299dSbellardif $cc -o $TMPE $TMPC 2>/dev/null ; then 3317d13299dSbellard$TMPE && bigendian="yes" 3327d13299dSbellardelse 3337d13299dSbellardecho big/little test failed 3347d13299dSbellardfi 3357d13299dSbellard 3367d13299dSbellardelse 3377d13299dSbellard 3387d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 339808c4954Sbellardif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then 3407d13299dSbellard bigendian="yes" 3417d13299dSbellardfi 3427d13299dSbellard 3437d13299dSbellardfi 3447d13299dSbellard 345b6853697Sbellard# host long bits test 346b6853697Sbellardhostlongbits="32" 347b6853697Sbellardif test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then 348b6853697Sbellard hostlongbits="64" 349b6853697Sbellardfi 350b6853697Sbellard 351e8cd23deSbellard# check gcc options support 35204369ff2Sbellardcat > $TMPC <<EOF 35304369ff2Sbellardint main(void) { 35404369ff2Sbellard} 35504369ff2SbellardEOF 35604369ff2Sbellard 357e8cd23deSbellardhave_gcc3_options="no" 358e8cd23deSbellardif $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then 359e8cd23deSbellard have_gcc3_options="yes" 36004369ff2Sbellardfi 361ca735206Sbellard 362b1a550a0Spbrook# Check for gcc4, error if pre-gcc4 3631aff381fSbellardif test "$check_gcc" = "yes" ; then 3641aff381fSbellard cat > $TMPC <<EOF 365b1a550a0Spbrook#if __GNUC__ < 4 366b1a550a0Spbrook#error gcc3 3671aff381fSbellard#endif 3681aff381fSbellardint main(){return 0;} 3691aff381fSbellardEOF 370b1a550a0Spbrook if $cc -o $TMPO $TMPC 2>/dev/null ; then 3711aff381fSbellard echo "ERROR: \"$cc\" looks like gcc 4.x" 3721aff381fSbellard echo "QEMU is known to have problems when compiled with gcc 4.x" 3731aff381fSbellard echo "It is recommended that you use gcc 3.x to build QEMU" 3741aff381fSbellard echo "To use this compiler anyway, configure with --disable-gcc-check" 3751aff381fSbellard exit 1; 3761aff381fSbellard fi 3771aff381fSbellardfi 3781aff381fSbellard 37911d9f695Sbellard########################################## 38011d9f695Sbellard# SDL probe 38111d9f695Sbellard 38211d9f695Sbellardsdl_too_old=no 38311d9f695Sbellard 38411d9f695Sbellardif test -z "$sdl" ; then 38511d9f695Sbellard 386a6e022adSbellardsdl_config="sdl-config" 387a6e022adSbellardsdl=no 3887c1f25b4Sbellardsdl_static=no 389a6e022adSbellard 390a6e022adSbellardif test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then 391a6e022adSbellard# win32 cross compilation case 392a6e022adSbellard sdl_config="i386-mingw32msvc-sdl-config" 393a6e022adSbellard sdl=yes 394a6e022adSbellardelse 395a6e022adSbellard# normal SDL probe 39611d9f695Sbellardcat > $TMPC << EOF 39711d9f695Sbellard#include <SDL.h> 39811d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 39911d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 40011d9f695SbellardEOF 40111d9f695Sbellard 402a6e022adSbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then 403a6e022adSbellard_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'` 40411d9f695Sbellardif test "$_sdlversion" -lt 121 ; then 40511d9f695Sbellardsdl_too_old=yes 40611d9f695Sbellardelse 40711d9f695Sbellardsdl=yes 40811d9f695Sbellardfi 4097c1f25b4Sbellard 4107c1f25b4Sbellard# static link with sdl ? 4117c1f25b4Sbellardif test "$sdl" = "yes" ; then 4127c1f25b4Sbellardaa="no" 4137c1f25b4Sbellard`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes" 4147c1f25b4Sbellardsdl_static_libs=`$sdl_config --static-libs` 4157c1f25b4Sbellardif [ "$aa" = "yes" ] ; then 416d8d8aa4eSbellard sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`" 41711d9f695Sbellardfi 41811d9f695Sbellard 4197c1f25b4Sbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then 4207c1f25b4Sbellard sdl_static=yes 4217c1f25b4Sbellardfi 4227c1f25b4Sbellard 4237c1f25b4Sbellardfi # static link 4247c1f25b4Sbellard 4257c1f25b4Sbellardfi # sdl compile test 4267c1f25b4Sbellard 427a6e022adSbellardfi # cross compilation 428a6e022adSbellardfi # -z $sdl 42911d9f695Sbellard 43011d9f695Sbellardif test "$mingw32" = "yes" ; then 43111d9f695Sbellardif test -z "$prefix" ; then 43211d9f695Sbellard prefix="/c/Program Files/Qemu" 43311d9f695Sbellardfi 43411d9f695Sbellardmandir="$prefix" 4357efa4387Sbellarddatadir="$prefix" 4361f50f8d1Sbellarddocdir="$prefix" 43711d9f695Sbellardbindir="$prefix" 43811d9f695Sbellardelse 43911d9f695Sbellardif test -z "$prefix" ; then 44011d9f695Sbellard prefix="/usr/local" 44111d9f695Sbellardfi 4425a67135aSbellardmandir="$prefix/share/man" 4437efa4387Sbellarddatadir="$prefix/share/qemu" 4441f50f8d1Sbellarddocdir="$prefix/share/doc/qemu" 44511d9f695Sbellardbindir="$prefix/bin" 44611d9f695Sbellardfi 4475a67135aSbellard 4487d13299dSbellardecho "Install prefix $prefix" 4497efa4387Sbellardecho "BIOS directory $datadir" 45011d9f695Sbellardecho "binary directory $bindir" 45111d9f695Sbellardif test "$mingw32" = "no" ; then 45211d9f695Sbellardecho "Manual directory $mandir" 45343ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 45411d9f695Sbellardfi 4555a67135aSbellardecho "Source path $source_path" 4567d13299dSbellardecho "C compiler $cc" 45783469015Sbellardecho "Host C compiler $host_cc" 4587d13299dSbellardecho "make $make" 4596a882643Spbrookecho "install $install" 460a98fd896Sbellardecho "host CPU $cpu" 461de83cd02Sbellardecho "host big endian $bigendian" 46297a847bcSbellardecho "target list $target_list" 4637d13299dSbellardecho "gprof enabled $gprof" 46405c2a3e7Sbellardecho "profiler $profiler" 46543ce4dfeSbellardecho "static build $static" 4665b0753e0Sbellardif test "$darwin" = "yes" ; then 4675b0753e0Sbellard echo "Cocoa support $cocoa" 4685b0753e0Sbellardfi 46997a847bcSbellardecho "SDL support $sdl" 470e4afee97Sbellardif test "$sdl" != "no" ; then 4717c1f25b4Sbellard echo "SDL static link $sdl_static" 472e4afee97Sbellardfi 47367b915a5Sbellardecho "mingw32 support $mingw32" 474fb065187Sbellardecho "Adlib support $adlib" 4751d14ffa9Sbellardecho "CoreAudio support $coreaudio" 4761d14ffa9Sbellardecho "ALSA support $alsa" 4771d14ffa9Sbellardecho "DSound support $dsound" 4781d14ffa9Sbellardif test "$fmod" = "yes"; then 4791d14ffa9Sbellard if test -z $fmod_lib || test -z $fmod_inc; then 4801d14ffa9Sbellard echo 4811d14ffa9Sbellard echo "Error: You must specify path to FMOD library and headers" 4821d14ffa9Sbellard echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 4831d14ffa9Sbellard echo 4841d14ffa9Sbellard exit 1 4851d14ffa9Sbellard fi 486b1a550a0Spbrook fmod_support=" (lib='$fmod_lib' include='$fmod_inc')" 487b1a550a0Spbrookelse 488b1a550a0Spbrook fmod_support="" 489102a52e4Sbellardfi 490b1a550a0Spbrookecho "FMOD support $fmod $fmod_support" 49107f4ddbfSbellardecho "kqemu support $kqemu" 49267b915a5Sbellard 49397a847bcSbellardif test $sdl_too_old = "yes"; then 49424b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 495e8cd23deSbellardfi 49624b55b96Sbellard#if test "$sdl_static" = "no"; then 49724b55b96Sbellard# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output" 49824b55b96Sbellard#fi 49997a847bcSbellardconfig_mak="config-host.mak" 50097a847bcSbellardconfig_h="config-host.h" 50197a847bcSbellard 5027c1f25b4Sbellard#echo "Creating $config_mak and $config_h" 50397a847bcSbellard 50497a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak 50529517134Spbrookecho "# Configured with: $0 $@" >> $config_mak 50697a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h 50797a847bcSbellard 50897a847bcSbellardecho "prefix=$prefix" >> $config_mak 50911d9f695Sbellardecho "bindir=$bindir" >> $config_mak 5105a67135aSbellardecho "mandir=$mandir" >> $config_mak 5117efa4387Sbellardecho "datadir=$datadir" >> $config_mak 5121f50f8d1Sbellardecho "docdir=$docdir" >> $config_mak 5137efa4387Sbellardecho "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h 51497a847bcSbellardecho "MAKE=$make" >> $config_mak 5156a882643Spbrookecho "INSTALL=$install" >> $config_mak 51697a847bcSbellardecho "CC=$cc" >> $config_mak 51797a847bcSbellardif test "$have_gcc3_options" = "yes" ; then 51897a847bcSbellard echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak 51997a847bcSbellardfi 52097a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak 52197a847bcSbellardecho "AR=$ar" >> $config_mak 52297a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak 52397a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak 52497a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak 52567b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak 52697a847bcSbellardif test "$cpu" = "i386" ; then 52797a847bcSbellard echo "ARCH=i386" >> $config_mak 52897a847bcSbellard echo "#define HOST_I386 1" >> $config_h 5290b0babc6Sbellardelif test "$cpu" = "x86_64" ; then 5300b0babc6Sbellard echo "ARCH=x86_64" >> $config_mak 5310b0babc6Sbellard echo "#define HOST_X86_64 1" >> $config_h 532808c4954Sbellardelif test "$cpu" = "armv4b" ; then 533808c4954Sbellard echo "ARCH=arm" >> $config_mak 534808c4954Sbellard echo "#define HOST_ARM 1" >> $config_h 5357d13299dSbellardelif test "$cpu" = "armv4l" ; then 53697a847bcSbellard echo "ARCH=arm" >> $config_mak 53797a847bcSbellard echo "#define HOST_ARM 1" >> $config_h 5387d13299dSbellardelif test "$cpu" = "powerpc" ; then 53997a847bcSbellard echo "ARCH=ppc" >> $config_mak 54097a847bcSbellard echo "#define HOST_PPC 1" >> $config_h 5417d13299dSbellardelif test "$cpu" = "mips" ; then 54297a847bcSbellard echo "ARCH=mips" >> $config_mak 54397a847bcSbellard echo "#define HOST_MIPS 1" >> $config_h 544fb3e5849Sbellardelif test "$cpu" = "s390" ; then 54597a847bcSbellard echo "ARCH=s390" >> $config_mak 54697a847bcSbellard echo "#define HOST_S390 1" >> $config_h 547295defa5Sbellardelif test "$cpu" = "alpha" ; then 54897a847bcSbellard echo "ARCH=alpha" >> $config_mak 54997a847bcSbellard echo "#define HOST_ALPHA 1" >> $config_h 550ae228531Sbellardelif test "$cpu" = "sparc" ; then 55197a847bcSbellard echo "ARCH=sparc" >> $config_mak 55297a847bcSbellard echo "#define HOST_SPARC 1" >> $config_h 553ae228531Sbellardelif test "$cpu" = "sparc64" ; then 55497a847bcSbellard echo "ARCH=sparc64" >> $config_mak 55597a847bcSbellard echo "#define HOST_SPARC64 1" >> $config_h 556a8baa8c5Sbellardelif test "$cpu" = "ia64" ; then 55797a847bcSbellard echo "ARCH=ia64" >> $config_mak 55897a847bcSbellard echo "#define HOST_IA64 1" >> $config_h 55938e584a0Sbellardelif test "$cpu" = "m68k" ; then 56038ca2abcSbellard echo "ARCH=m68k" >> $config_mak 56138ca2abcSbellard echo "#define HOST_M68K 1" >> $config_h 5627d13299dSbellardelse 5637d13299dSbellard echo "Unsupported CPU" 5647d13299dSbellard exit 1 5657d13299dSbellardfi 5667d13299dSbellardif test "$bigendian" = "yes" ; then 56797a847bcSbellard echo "WORDS_BIGENDIAN=yes" >> $config_mak 56897a847bcSbellard echo "#define WORDS_BIGENDIAN 1" >> $config_h 56997a847bcSbellardfi 570b6853697Sbellardecho "#define HOST_LONG_BITS $hostlongbits" >> $config_h 57167b915a5Sbellardif test "$mingw32" = "yes" ; then 57267b915a5Sbellard echo "CONFIG_WIN32=yes" >> $config_mak 57311d9f695Sbellard echo "#define CONFIG_WIN32 1" >> $config_h 5747d3505c5Sbellardelif test -f "/usr/include/byteswap.h" ; then 57597a847bcSbellard echo "#define HAVE_BYTESWAP_H 1" >> $config_h 57667b915a5Sbellardfi 57783fb7adfSbellardif test "$darwin" = "yes" ; then 57883fb7adfSbellard echo "CONFIG_DARWIN=yes" >> $config_mak 57983fb7adfSbellard echo "#define CONFIG_DARWIN 1" >> $config_h 58083fb7adfSbellardfi 58167b915a5Sbellardif test "$gdbstub" = "yes" ; then 58267b915a5Sbellard echo "CONFIG_GDBSTUB=yes" >> $config_mak 58367b915a5Sbellard echo "#define CONFIG_GDBSTUB 1" >> $config_h 58467b915a5Sbellardfi 58597a847bcSbellardif test "$gprof" = "yes" ; then 58697a847bcSbellard echo "TARGET_GPROF=yes" >> $config_mak 58797a847bcSbellard echo "#define HAVE_GPROF 1" >> $config_h 58897a847bcSbellardfi 58997a847bcSbellardif test "$static" = "yes" ; then 59097a847bcSbellard echo "CONFIG_STATIC=yes" >> $config_mak 59150863472Sbellard echo "#define CONFIG_STATIC 1" >> $config_h 59297a847bcSbellardfi 59305c2a3e7Sbellardif test $profiler = "yes" ; then 59405c2a3e7Sbellard echo "#define CONFIG_PROFILER 1" >> $config_h 59505c2a3e7Sbellardfi 596c20709aaSbellardif test "$slirp" = "yes" ; then 597c20709aaSbellard echo "CONFIG_SLIRP=yes" >> $config_mak 598c20709aaSbellard echo "#define CONFIG_SLIRP 1" >> $config_h 599c20709aaSbellardfi 600fb065187Sbellardif test "$adlib" = "yes" ; then 601fb065187Sbellard echo "CONFIG_ADLIB=yes" >> $config_mak 602fb065187Sbellard echo "#define CONFIG_ADLIB 1" >> $config_h 603fb065187Sbellardfi 604fb065187Sbellardif test "$oss" = "yes" ; then 605fb065187Sbellard echo "CONFIG_OSS=yes" >> $config_mak 606fb065187Sbellard echo "#define CONFIG_OSS 1" >> $config_h 607fb065187Sbellardfi 6081d14ffa9Sbellardif test "$coreaudio" = "yes" ; then 6091d14ffa9Sbellard echo "CONFIG_COREAUDIO=yes" >> $config_mak 6101d14ffa9Sbellard echo "#define CONFIG_COREAUDIO 1" >> $config_h 6111d14ffa9Sbellardfi 6121d14ffa9Sbellardif test "$alsa" = "yes" ; then 6131d14ffa9Sbellard echo "CONFIG_ALSA=yes" >> $config_mak 6141d14ffa9Sbellard echo "#define CONFIG_ALSA 1" >> $config_h 6151d14ffa9Sbellardfi 6161d14ffa9Sbellardif test "$dsound" = "yes" ; then 6171d14ffa9Sbellard echo "CONFIG_DSOUND=yes" >> $config_mak 6181d14ffa9Sbellard echo "#define CONFIG_DSOUND 1" >> $config_h 6191d14ffa9Sbellardfi 620102a52e4Sbellardif test "$fmod" = "yes" ; then 621102a52e4Sbellard echo "CONFIG_FMOD=yes" >> $config_mak 622102a52e4Sbellard echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak 623102a52e4Sbellard echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak 624102a52e4Sbellard echo "#define CONFIG_FMOD 1" >> $config_h 625102a52e4Sbellardfi 626b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 627b1a550a0Spbrookecho "VERSION=$qemu_version" >>$config_mak 628d4b8f039Spbrookecho "#define QEMU_VERSION \"$qemu_version\"" >> $config_h 62997a847bcSbellard 63097a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak 631ad064840Spbrookif [ "$source_path_used" = "yes" ]; then 632ad064840Spbrook echo "VPATH=$source_path" >> $config_mak 633ad064840Spbrookfi 63497a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak 63597a847bcSbellard 63683fb7adfSbellard# XXX: suppress that 6377d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 63843003046Sbellard echo "#define O_LARGEFILE 0" >> $config_h 63943003046Sbellard echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h 6407d3505c5Sbellard echo "#define _BSD 1" >> $config_h 6417d3505c5Sbellardfi 6427d3505c5Sbellard 64397a847bcSbellardfor target in $target_list; do 64497a847bcSbellardtarget_dir="$target" 64597a847bcSbellardconfig_mak=$target_dir/config.mak 64697a847bcSbellardconfig_h=$target_dir/config.h 64797a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1` 64897a847bcSbellardtarget_bigendian="no" 649808c4954Sbellard[ "$target_cpu" = "armeb" ] && target_bigendian=yes 6501e43adfcSbellard[ "$target_cpu" = "sparc" ] && target_bigendian=yes 65164b3ab24Sbellard[ "$target_cpu" = "sparc64" ] && target_bigendian=yes 65267867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes 653a2458627Sbellard[ "$target_cpu" = "ppc64" ] && target_bigendian=yes 654d3258560Sbellard[ "$target_cpu" = "mips" ] && target_bigendian=yes 65597a847bcSbellardtarget_softmmu="no" 65697a847bcSbellardif expr $target : '.*-softmmu' > /dev/null ; then 65797a847bcSbellard target_softmmu="yes" 6587d13299dSbellardfi 659997344f3Sbellardtarget_user_only="no" 660997344f3Sbellardif expr $target : '.*-user' > /dev/null ; then 661997344f3Sbellard target_user_only="yes" 662997344f3Sbellardfi 663de83cd02Sbellard 66497ccc689Sbellardif test "$target_user_only" = "no" -a "$check_gfx" = "yes" \ 66597ccc689Sbellard -a "$sdl" = "no" -a "$cocoa" = "no" ; then 66697ccc689Sbellard echo "ERROR: QEMU requires SDL or Cocoa for graphical output" 6679c038506Spbrook echo "To build QEMU without graphical output configure with --disable-gfx-check" 66897ccc689Sbellard echo "Note that this will disable all output from the virtual graphics card." 66997ccc689Sbellard exit 1; 67097ccc689Sbellardfi 67197ccc689Sbellard 6727c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile" 67397a847bcSbellard 67497a847bcSbellardmkdir -p $target_dir 675158142c2Sbellardmkdir -p $target_dir/fpu 676808c4954Sbellardif test "$target" = "arm-user" -o "$target" = "armeb-user" ; then 67769de927cSbellard mkdir -p $target_dir/nwfpe 67869de927cSbellardfi 679a7e61ed4Sbellardif test "$target_user_only" = "no" ; then 680a7e61ed4Sbellard mkdir -p $target_dir/slirp 681a7e61ed4Sbellardfi 68269de927cSbellard 68397a847bcSbellardln -sf $source_path/Makefile.target $target_dir/Makefile 68497a847bcSbellard 68597a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak 68697a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h 68797a847bcSbellard 68897a847bcSbellard 68997a847bcSbellardecho "include ../config-host.mak" >> $config_mak 69097a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h 6911e43adfcSbellard 6921e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"` 6931e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h 69497a847bcSbellard 69597a847bcSbellardif test "$target_cpu" = "i386" ; then 69697a847bcSbellard echo "TARGET_ARCH=i386" >> $config_mak 69797a847bcSbellard echo "#define TARGET_ARCH \"i386\"" >> $config_h 69897a847bcSbellard echo "#define TARGET_I386 1" >> $config_h 69907f4ddbfSbellard if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then 700824d560fSbellard echo "#define USE_KQEMU 1" >> $config_h 701824d560fSbellard fi 702808c4954Sbellardelif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then 70397a847bcSbellard echo "TARGET_ARCH=arm" >> $config_mak 70497a847bcSbellard echo "#define TARGET_ARCH \"arm\"" >> $config_h 70597a847bcSbellard echo "#define TARGET_ARM 1" >> $config_h 7061e43adfcSbellardelif test "$target_cpu" = "sparc" ; then 7071e43adfcSbellard echo "TARGET_ARCH=sparc" >> $config_mak 7081e43adfcSbellard echo "#define TARGET_ARCH \"sparc\"" >> $config_h 7091e43adfcSbellard echo "#define TARGET_SPARC 1" >> $config_h 71064b3ab24Sbellardelif test "$target_cpu" = "sparc64" ; then 71164b3ab24Sbellard echo "TARGET_ARCH=sparc64" >> $config_mak 71264b3ab24Sbellard echo "#define TARGET_ARCH \"sparc64\"" >> $config_h 71364b3ab24Sbellard echo "#define TARGET_SPARC 1" >> $config_h 71464b3ab24Sbellard echo "#define TARGET_SPARC64 1" >> $config_h 71567867308Sbellardelif test "$target_cpu" = "ppc" ; then 71667867308Sbellard echo "TARGET_ARCH=ppc" >> $config_mak 71767867308Sbellard echo "#define TARGET_ARCH \"ppc\"" >> $config_h 71867867308Sbellard echo "#define TARGET_PPC 1" >> $config_h 719a2458627Sbellardelif test "$target_cpu" = "ppc64" ; then 720a2458627Sbellard echo "TARGET_ARCH=ppc64" >> $config_mak 721a2458627Sbellard echo "#define TARGET_ARCH \"ppc64\"" >> $config_h 722a2458627Sbellard echo "#define TARGET_PPC 1" >> $config_h 723a2458627Sbellard echo "#define TARGET_PPC64 1" >> $config_h 7240b0babc6Sbellardelif test "$target_cpu" = "x86_64" ; then 7250b0babc6Sbellard echo "TARGET_ARCH=x86_64" >> $config_mak 7260b0babc6Sbellard echo "#define TARGET_ARCH \"x86_64\"" >> $config_h 7270b0babc6Sbellard echo "#define TARGET_I386 1" >> $config_h 7280b0babc6Sbellard echo "#define TARGET_X86_64 1" >> $config_h 72907f4ddbfSbellard if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then 73007f4ddbfSbellard echo "#define USE_KQEMU 1" >> $config_h 73107f4ddbfSbellard fi 732c20eb473Sbellardelif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then 733d3258560Sbellard echo "TARGET_ARCH=mips" >> $config_mak 734d3258560Sbellard echo "#define TARGET_ARCH \"mips\"" >> $config_h 735d3258560Sbellard echo "#define TARGET_MIPS 1" >> $config_h 736de83cd02Sbellardelse 737de83cd02Sbellard echo "Unsupported target CPU" 738de83cd02Sbellard exit 1 739de83cd02Sbellardfi 740de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 74197a847bcSbellard echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak 74297a847bcSbellard echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h 74397a847bcSbellardfi 74497a847bcSbellardif test "$target_softmmu" = "yes" ; then 74597a847bcSbellard echo "CONFIG_SOFTMMU=yes" >> $config_mak 74697a847bcSbellard echo "#define CONFIG_SOFTMMU 1" >> $config_h 747de83cd02Sbellardfi 748997344f3Sbellardif test "$target_user_only" = "yes" ; then 749997344f3Sbellard echo "CONFIG_USER_ONLY=yes" >> $config_mak 750997344f3Sbellard echo "#define CONFIG_USER_ONLY 1" >> $config_h 751997344f3Sbellardfi 752de83cd02Sbellard 753158142c2Sbellardif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then 754158142c2Sbellard echo "CONFIG_SOFTFLOAT=yes" >> $config_mak 755158142c2Sbellard echo "#define CONFIG_SOFTFLOAT 1" >> $config_h 756158142c2Sbellardfi 7577c1f25b4Sbellard# sdl defines 7587c1f25b4Sbellard 7597c1f25b4Sbellardif test "$target_user_only" = "no"; then 7607c1f25b4Sbellard if test "$target_softmmu" = "no" -o "$static" = "yes"; then 761dbb2c921Sbellard sdl1=$sdl_static 7627c1f25b4Sbellard else 763dbb2c921Sbellard sdl1=$sdl 764dbb2c921Sbellard fi 765dbb2c921Sbellard if test "$sdl1" = "yes" ; then 7667c1f25b4Sbellard echo "#define CONFIG_SDL 1" >> $config_h 7677c1f25b4Sbellard echo "CONFIG_SDL=yes" >> $config_mak 768dbb2c921Sbellard if test "$target_softmmu" = "no" -o "$static" = "yes"; then 769dbb2c921Sbellard echo "SDL_LIBS=$sdl_static_libs" >> $config_mak 770dbb2c921Sbellard else 7717c1f25b4Sbellard echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak 7727c1f25b4Sbellard fi 7737c1f25b4Sbellard if [ "${aa}" = "yes" ] ; then 774b1a550a0Spbrook echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak 775b1a550a0Spbrook else 776b1a550a0Spbrook echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak 7777c1f25b4Sbellard fi 7787c1f25b4Sbellard fi 779dbb2c921Sbellardfi 7807c1f25b4Sbellard 7815b0753e0Sbellardif test "$cocoa" = "yes" ; then 7825b0753e0Sbellard echo "#define CONFIG_COCOA 1" >> $config_h 7835b0753e0Sbellard echo "CONFIG_COCOA=yes" >> $config_mak 7845b0753e0Sbellardfi 7855b0753e0Sbellard 78697a847bcSbellarddone # for target in $targets 7877d13299dSbellard 7887d13299dSbellard# build tree in object directory if source path is different from current one 7897d13299dSbellardif test "$source_path_used" = "yes" ; then 7907d13299dSbellard DIRS="tests" 7917d13299dSbellard FILES="Makefile tests/Makefile" 7927d13299dSbellard for dir in $DIRS ; do 7937d13299dSbellard mkdir -p $dir 7947d13299dSbellard done 7957d13299dSbellard for f in $FILES ; do 7967d13299dSbellard ln -sf $source_path/$f $f 7977d13299dSbellard done 7987d13299dSbellardfi 7997d13299dSbellard 80097a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS 801