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" 287d13299dSbellardstrip="strip" 297d13299dSbellardcpu=`uname -m` 305327cf48Sbellardtarget_list="" 317d13299dSbellardcase "$cpu" in 327d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 3397a847bcSbellard cpu="i386" 347d13299dSbellard ;; 35ba68055eSbellard armv*b) 36808c4954Sbellard cpu="armv4b" 37808c4954Sbellard ;; 38ba68055eSbellard armv*l) 397d13299dSbellard cpu="armv4l" 407d13299dSbellard ;; 417d13299dSbellard alpha) 427d13299dSbellard cpu="alpha" 437d13299dSbellard ;; 44295defa5Sbellard "Power Macintosh"|ppc|ppc64) 457d13299dSbellard cpu="powerpc" 467d13299dSbellard ;; 477d13299dSbellard mips) 487d13299dSbellard cpu="mips" 497d13299dSbellard ;; 50fb3e5849Sbellard s390) 51fb3e5849Sbellard cpu="s390" 52fb3e5849Sbellard ;; 53ae228531Sbellard sparc) 54ae228531Sbellard cpu="sparc" 55ae228531Sbellard ;; 56ae228531Sbellard sparc64) 57ae228531Sbellard cpu="sparc64" 58ae228531Sbellard ;; 59a8baa8c5Sbellard ia64) 60a8baa8c5Sbellard cpu="ia64" 61a8baa8c5Sbellard ;; 6238e584a0Sbellard m68k) 6338e584a0Sbellard cpu="m68k" 6438e584a0Sbellard ;; 65bc51c5c9Sbellard x86_64|amd64) 660b0babc6Sbellard cpu="x86_64" 67bc51c5c9Sbellard ;; 687d13299dSbellard *) 697d13299dSbellard cpu="unknown" 707d13299dSbellard ;; 717d13299dSbellardesac 727d13299dSbellardgprof="no" 737d13299dSbellardbigendian="no" 7467b915a5Sbellardmingw32="no" 7567b915a5SbellardEXESUF="" 7667b915a5Sbellardgdbstub="yes" 77443f1376Sbellardslirp="yes" 78fb065187Sbellardadlib="no" 79fb065187Sbellardoss="no" 80102a52e4Sbellardfmod="no" 81102a52e4Sbellardfmod_lib="" 82102a52e4Sbellardfmod_inc="" 835327cf48Sbellardlinux="no" 84c9ec1fe4Sbellardkqemu="no" 85c9ec1fe4Sbellardkernel_path="" 865b0753e0Sbellardcocoa="no" 8797ccc689Sbellardcheck_gfx="yes" 887d13299dSbellard 897d13299dSbellard# OS specific 907d13299dSbellardtargetos=`uname -s` 917d13299dSbellardcase $targetos in 92c326e0afSbellardCYGWIN*) 93c326e0afSbellardmingw32="yes" 94c326e0afSbellardCFLAGS="-O2 -mno-cygwin" 95c326e0afSbellard;; 9667b915a5SbellardMINGW32*) 9767b915a5Sbellardmingw32="yes" 9867b915a5Sbellard;; 997d3505c5SbellardFreeBSD) 1007d3505c5Sbellardbsd="yes" 101fb065187Sbellardoss="yes" 10207f4ddbfSbellardif [ "$cpu" = "i386" ] ; then 10307f4ddbfSbellard kqemu="yes" 10407f4ddbfSbellardfi 1057d3505c5Sbellard;; 1067d3505c5SbellardNetBSD) 1077d3505c5Sbellardbsd="yes" 108fb065187Sbellardoss="yes" 1097d3505c5Sbellard;; 1107d3505c5SbellardOpenBSD) 1117d3505c5Sbellardbsd="yes" 112fb065187Sbellardoss="yes" 1137d3505c5Sbellard;; 11483fb7adfSbellardDarwin) 11583fb7adfSbellardbsd="yes" 11683fb7adfSbellarddarwin="yes" 11783fb7adfSbellard;; 118fb065187Sbellard*) 119fb065187Sbellardoss="yes" 1205327cf48Sbellardlinux="yes" 12107f4ddbfSbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 122c9ec1fe4Sbellard kqemu="yes" 123c9ec1fe4Sbellardfi 124fb065187Sbellard;; 1257d13299dSbellardesac 1267d13299dSbellard 1277d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 12883fb7adfSbellard if [ ! "$darwin" = "yes" ] ; then 1297d3505c5Sbellard make="gmake" 13083fb7adfSbellard fi 1317d3505c5Sbellardfi 1327d3505c5Sbellard 1337d13299dSbellard# find source path 1347d13299dSbellard# XXX: we assume an absolute path is given when launching configure, 1357d13299dSbellard# except in './configure' case. 1367d13299dSbellardsource_path=${0%configure} 1377d13299dSbellardsource_path=${source_path%/} 1387d13299dSbellardsource_path_used="yes" 1397d13299dSbellardif test -z "$source_path" -o "$source_path" = "." ; then 1407d13299dSbellard source_path=`pwd` 1417d13299dSbellard source_path_used="no" 1427d13299dSbellardfi 1437d13299dSbellard 1447d13299dSbellardfor opt do 1457d13299dSbellard case "$opt" in 1467d13299dSbellard --prefix=*) prefix=`echo $opt | cut -d '=' -f 2` 1477d13299dSbellard ;; 14832ce6337Sbellard --interp-prefix=*) interp_prefix=`echo $opt | cut -d '=' -f 2` 14932ce6337Sbellard ;; 1507d13299dSbellard --source-path=*) source_path=`echo $opt | cut -d '=' -f 2` 1517d13299dSbellard ;; 1527d13299dSbellard --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2` 1537d13299dSbellard ;; 1547d13299dSbellard --cc=*) cc=`echo $opt | cut -d '=' -f 2` 1557d13299dSbellard ;; 1567d13299dSbellard --make=*) make=`echo $opt | cut -d '=' -f 2` 1577d13299dSbellard ;; 1587d13299dSbellard --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}" 1597d13299dSbellard ;; 1607d13299dSbellard --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}" 1617d13299dSbellard ;; 1627d13299dSbellard --cpu=*) cpu=`echo $opt | cut -d '=' -f 2` 1637d13299dSbellard ;; 16497a847bcSbellard --target-list=*) target_list=${opt#--target-list=} 165de83cd02Sbellard ;; 1667d13299dSbellard --enable-gprof) gprof="yes" 1677d13299dSbellard ;; 16843ce4dfeSbellard --static) static="yes" 16943ce4dfeSbellard ;; 17097a847bcSbellard --disable-sdl) sdl="no" 17197a847bcSbellard ;; 172102a52e4Sbellard --enable-fmod) fmod="yes" 173102a52e4Sbellard ;; 174102a52e4Sbellard --fmod-lib=*) fmod_lib=${opt#--fmod-lib=} 175102a52e4Sbellard ;; 176102a52e4Sbellard --fmod-inc=*) fmod_inc=${opt#--fmod-inc=} 177102a52e4Sbellard ;; 17867b915a5Sbellard --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" 17967b915a5Sbellard ;; 180443f1376Sbellard --disable-slirp) slirp="no" 181c20709aaSbellard ;; 182fb065187Sbellard --enable-adlib) adlib="yes" 183fb065187Sbellard ;; 184c9ec1fe4Sbellard --disable-kqemu) kqemu="no" 185c9ec1fe4Sbellard ;; 186c9ec1fe4Sbellard --kernel-path=*) kernel_path=${opt#--kernel-path=} 187c9ec1fe4Sbellard ;; 1885b0753e0Sbellard --enable-cocoa) cocoa="yes" ; sdl="no" 1895b0753e0Sbellard ;; 19097ccc689Sbellard --disable-gfx-check) check_gfx="no" 19197ccc689Sbellard ;; 1927d13299dSbellard esac 1937d13299dSbellarddone 1947d13299dSbellard 1957d13299dSbellard# Checking for CFLAGS 1967d13299dSbellardif test -z "$CFLAGS"; then 1977d13299dSbellard CFLAGS="-O2" 1987d13299dSbellardfi 1997d13299dSbellard 2007d13299dSbellardcc="${cross_prefix}${cc}" 2017d13299dSbellardar="${cross_prefix}${ar}" 2027d13299dSbellardstrip="${cross_prefix}${strip}" 2037d13299dSbellard 20467b915a5Sbellardif test "$mingw32" = "yes" ; then 2055327cf48Sbellard linux="no" 20667b915a5Sbellard EXESUF=".exe" 20767b915a5Sbellard gdbstub="no" 2089f059ecaSbellard oss="no" 20907f4ddbfSbellard if [ "$cpu" = "i386" ] ; then 21007f4ddbfSbellard kqemu="yes" 21107f4ddbfSbellard fi 21267b915a5Sbellardfi 21367b915a5Sbellard 2145327cf48Sbellardif test -z "$target_list" ; then 2155327cf48Sbellard# these targets are portable 216*d3258560Sbellard target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu" 2175327cf48Sbellard# the following are Linux specific 2185327cf48Sbellard if [ "$linux" = "yes" ] ; then 219a20b5524Sbellard target_list="i386-user arm-user armeb-user sparc-user ppc-user $target_list" 2205327cf48Sbellard fi 2216e20a45fSbellardelse 2226e20a45fSbellard target_list=$(echo "$target_list" | sed -e 's/,/ /g') 2235327cf48Sbellardfi 2245327cf48Sbellard 2257d13299dSbellardif test -z "$cross_prefix" ; then 2267d13299dSbellard 2277d13299dSbellard# --- 2287d13299dSbellard# big/little endian test 2297d13299dSbellardcat > $TMPC << EOF 2307d13299dSbellard#include <inttypes.h> 2317d13299dSbellardint main(int argc, char ** argv){ 2327d13299dSbellard volatile uint32_t i=0x01234567; 2337d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 2347d13299dSbellard} 2357d13299dSbellardEOF 2367d13299dSbellard 2377d13299dSbellardif $cc -o $TMPE $TMPC 2>/dev/null ; then 2387d13299dSbellard$TMPE && bigendian="yes" 2397d13299dSbellardelse 2407d13299dSbellardecho big/little test failed 2417d13299dSbellardfi 2427d13299dSbellard 2437d13299dSbellardelse 2447d13299dSbellard 2457d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 246808c4954Sbellardif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then 2477d13299dSbellard bigendian="yes" 2487d13299dSbellardfi 2497d13299dSbellard 2507d13299dSbellardfi 2517d13299dSbellard 252b6853697Sbellard# host long bits test 253b6853697Sbellardhostlongbits="32" 254b6853697Sbellardif test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then 255b6853697Sbellard hostlongbits="64" 256b6853697Sbellardfi 257b6853697Sbellard 258e8cd23deSbellard# check gcc options support 25904369ff2Sbellardcat > $TMPC <<EOF 26004369ff2Sbellardint main(void) { 26104369ff2Sbellard} 26204369ff2SbellardEOF 26304369ff2Sbellard 264e8cd23deSbellardhave_gcc3_options="no" 265e8cd23deSbellardif $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then 266e8cd23deSbellard have_gcc3_options="yes" 26704369ff2Sbellardfi 268ca735206Sbellard 26911d9f695Sbellard########################################## 27011d9f695Sbellard# SDL probe 27111d9f695Sbellard 27211d9f695Sbellardsdl_too_old=no 27311d9f695Sbellard 27411d9f695Sbellardif test -z "$sdl" ; then 27511d9f695Sbellard 276a6e022adSbellardsdl_config="sdl-config" 277a6e022adSbellardsdl=no 2787c1f25b4Sbellardsdl_static=no 279a6e022adSbellard 280a6e022adSbellardif test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then 281a6e022adSbellard# win32 cross compilation case 282a6e022adSbellard sdl_config="i386-mingw32msvc-sdl-config" 283a6e022adSbellard sdl=yes 284a6e022adSbellardelse 285a6e022adSbellard# normal SDL probe 28611d9f695Sbellardcat > $TMPC << EOF 28711d9f695Sbellard#include <SDL.h> 28811d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 28911d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 29011d9f695SbellardEOF 29111d9f695Sbellard 292a6e022adSbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then 293a6e022adSbellard_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'` 29411d9f695Sbellardif test "$_sdlversion" -lt 121 ; then 29511d9f695Sbellardsdl_too_old=yes 29611d9f695Sbellardelse 29711d9f695Sbellardsdl=yes 29811d9f695Sbellardfi 2997c1f25b4Sbellard 3007c1f25b4Sbellard# static link with sdl ? 3017c1f25b4Sbellardif test "$sdl" = "yes" ; then 3027c1f25b4Sbellardaa="no" 3037c1f25b4Sbellard`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes" 3047c1f25b4Sbellardsdl_static_libs=`$sdl_config --static-libs` 3057c1f25b4Sbellardif [ "$aa" = "yes" ] ; then 306d8d8aa4eSbellard sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`" 30711d9f695Sbellardfi 30811d9f695Sbellard 3097c1f25b4Sbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then 3107c1f25b4Sbellard sdl_static=yes 3117c1f25b4Sbellardfi 3127c1f25b4Sbellard 3137c1f25b4Sbellardfi # static link 3147c1f25b4Sbellard 3157c1f25b4Sbellardfi # sdl compile test 3167c1f25b4Sbellard 317a6e022adSbellardfi # cross compilation 318a6e022adSbellardfi # -z $sdl 31911d9f695Sbellard 3207d13299dSbellardif test x"$1" = x"-h" -o x"$1" = x"--help" ; then 3217d13299dSbellardcat << EOF 3227d13299dSbellard 3237d13299dSbellardUsage: configure [options] 3247d13299dSbellardOptions: [defaults in brackets after descriptions] 3257d13299dSbellard 3267d13299dSbellardEOF 3277d13299dSbellardecho "Standard options:" 3287d13299dSbellardecho " --help print this message" 3297d13299dSbellardecho " --prefix=PREFIX install in PREFIX [$prefix]" 3301e43adfcSbellardecho " --interp-prefix=PREFIX where to find shared libraries, etc." 3311e43adfcSbellardecho " use %M for cpu name [$interp_prefix]" 33297a847bcSbellardecho " --target-list=LIST set target list [$target_list]" 3337d13299dSbellardecho "" 334c9ec1fe4Sbellardecho "kqemu kernel acceleration support:" 335c9ec1fe4Sbellardecho " --disable-kqemu disable kqemu build" 336c9ec1fe4Sbellardecho " --kernel-path=PATH set the kernel path (configure probes it)" 337c9ec1fe4Sbellardecho "" 3387d13299dSbellardecho "Advanced options (experts only):" 3397d13299dSbellardecho " --source-path=PATH path of source code [$source_path]" 3407d13299dSbellardecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 3417d13299dSbellardecho " --cc=CC use C compiler CC [$cc]" 3427d13299dSbellardecho " --make=MAKE use specified make [$make]" 34343ce4dfeSbellardecho " --static enable static build [$static]" 34467b915a5Sbellardecho " --enable-mingw32 enable Win32 cross compilation with mingw32" 345d37282adSbellardecho " --enable-adlib enable Adlib emulation" 346102a52e4Sbellardecho " --enable-fmod enable FMOD audio output driver" 347102a52e4Sbellardecho " --fmod-lib path to FMOD library" 348102a52e4Sbellardecho " --fmod-inc path to FMOD includes" 3497d13299dSbellardecho "" 3507d13299dSbellardecho "NOTE: The object files are build at the place where configure is launched" 3517d13299dSbellardexit 1 3527d13299dSbellardfi 3537d13299dSbellard 35411d9f695Sbellardif test "$mingw32" = "yes" ; then 35511d9f695Sbellardif test -z "$prefix" ; then 35611d9f695Sbellard prefix="/c/Program Files/Qemu" 35711d9f695Sbellardfi 35811d9f695Sbellardmandir="$prefix" 3597efa4387Sbellarddatadir="$prefix" 3601f50f8d1Sbellarddocdir="$prefix" 36111d9f695Sbellardbindir="$prefix" 36211d9f695Sbellardelse 36311d9f695Sbellardif test -z "$prefix" ; then 36411d9f695Sbellard prefix="/usr/local" 36511d9f695Sbellardfi 3665a67135aSbellardmandir="$prefix/share/man" 3677efa4387Sbellarddatadir="$prefix/share/qemu" 3681f50f8d1Sbellarddocdir="$prefix/share/doc/qemu" 36911d9f695Sbellardbindir="$prefix/bin" 37011d9f695Sbellardfi 3715a67135aSbellard 37207f4ddbfSbellard# kqemu support 373c9ec1fe4Sbellardif test $kqemu = "yes" ; then 374441c72baSbellard # test if the source code is installed 375441c72baSbellard if test '!' -f "kqemu/Makefile" ; then 376441c72baSbellard kqemu="no" 377441c72baSbellard fi 378441c72baSbellardfi 379441c72baSbellard 38007f4ddbfSbellard# Linux specific kqemu configuration 38107f4ddbfSbellardif test $kqemu = "yes" -a $linux = "yes" ; then 382c9ec1fe4Sbellard# find the kernel path 383c9ec1fe4Sbellardif test -z "$kernel_path" ; then 384c9ec1fe4Sbellardkernel_version=`uname -r` 385c9ec1fe4Sbellardkernel_path="/lib/modules/$kernel_version/build" 386c9ec1fe4Sbellardif test '!' -d "$kernel_path/include" ; then 387c9ec1fe4Sbellard kernel_path="/usr/src/linux" 388c9ec1fe4Sbellard if test '!' -d "$kernel_path/include" ; then 389c9ec1fe4Sbellard echo "Could not find kernel includes in /lib/modules or /usr/src/linux - cannot build the kqemu module" 390c9ec1fe4Sbellard kqemu="no" 391c9ec1fe4Sbellard fi 392c9ec1fe4Sbellardfi 393c9ec1fe4Sbellardfi 394c9ec1fe4Sbellard 395c9ec1fe4Sbellardif test $kqemu = "yes" ; then 396c9ec1fe4Sbellard 397c9ec1fe4Sbellard# test that the kernel config is present 398c9ec1fe4Sbellardif test '!' -f "$kernel_path/Makefile" ; then 399f94daeddSbellard echo "No Makefile file present in $kernel_path - kqemu cannot be built" 400c9ec1fe4Sbellard kqemu="no" 401c9ec1fe4Sbellardfi 402c9ec1fe4Sbellard 403c9ec1fe4Sbellard# find build system (2.6 or legacy) 404c9ec1fe4Sbellardkbuild26="yes" 405c9ec1fe4Sbellardif grep -q "PATCHLEVEL = 4" $kernel_path/Makefile ; then 406c9ec1fe4Sbellardkbuild26="no" 407c9ec1fe4Sbellardfi 408c9ec1fe4Sbellard 409c9ec1fe4Sbellardfi # kqemu 410c9ec1fe4Sbellard 41107f4ddbfSbellardfi # kqemu and linux 412c9ec1fe4Sbellard 413c9ec1fe4Sbellard 4147d13299dSbellardecho "Install prefix $prefix" 4157efa4387Sbellardecho "BIOS directory $datadir" 41611d9f695Sbellardecho "binary directory $bindir" 41711d9f695Sbellardif test "$mingw32" = "no" ; then 41811d9f695Sbellardecho "Manual directory $mandir" 41943ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 42011d9f695Sbellardfi 4215a67135aSbellardecho "Source path $source_path" 4227d13299dSbellardecho "C compiler $cc" 4237d13299dSbellardecho "make $make" 424a98fd896Sbellardecho "host CPU $cpu" 425de83cd02Sbellardecho "host big endian $bigendian" 42697a847bcSbellardecho "target list $target_list" 4277d13299dSbellardecho "gprof enabled $gprof" 42843ce4dfeSbellardecho "static build $static" 4295b0753e0Sbellardif test "$darwin" = "yes" ; then 4305b0753e0Sbellard echo "Cocoa support $cocoa" 4315b0753e0Sbellardfi 43297a847bcSbellardecho "SDL support $sdl" 433e4afee97Sbellardif test "$sdl" != "no" ; then 4347c1f25b4Sbellard echo "SDL static link $sdl_static" 435e4afee97Sbellardfi 43667b915a5Sbellardecho "mingw32 support $mingw32" 437fb065187Sbellardecho "Adlib support $adlib" 438102a52e4Sbellardecho -n "FMOD support $fmod" 439102a52e4Sbellardif test $fmod = "yes"; then 440102a52e4Sbellard echo -n " (lib='$fmod_lib' include='$fmod_inc')" 441102a52e4Sbellardfi 442102a52e4Sbellardecho "" 44307f4ddbfSbellardecho "kqemu support $kqemu" 44407f4ddbfSbellardif test $kqemu = "yes" -a $linux = "yes" ; then 445c9ec1fe4Sbellardecho "" 44607f4ddbfSbellardecho "KQEMU Linux module configuration:" 447c9ec1fe4Sbellardecho "kernel sources $kernel_path" 448c9ec1fe4Sbellardecho -n "kbuild type " 449c9ec1fe4Sbellardif test $kbuild26 = "yes"; then 450c9ec1fe4Sbellardecho "2.6" 451c9ec1fe4Sbellardelse 452c9ec1fe4Sbellardecho "2.4" 453c9ec1fe4Sbellardfi 454c9ec1fe4Sbellardfi 45567b915a5Sbellard 45697a847bcSbellardif test $sdl_too_old = "yes"; then 45724b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 458e8cd23deSbellardfi 45924b55b96Sbellard#if test "$sdl_static" = "no"; then 46024b55b96Sbellard# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output" 46124b55b96Sbellard#fi 46297a847bcSbellard 46397a847bcSbellardconfig_mak="config-host.mak" 46497a847bcSbellardconfig_h="config-host.h" 46597a847bcSbellard 4667c1f25b4Sbellard#echo "Creating $config_mak and $config_h" 46797a847bcSbellard 46897a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak 46997a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h 47097a847bcSbellard 47197a847bcSbellardecho "prefix=$prefix" >> $config_mak 47211d9f695Sbellardecho "bindir=$bindir" >> $config_mak 4735a67135aSbellardecho "mandir=$mandir" >> $config_mak 4747efa4387Sbellardecho "datadir=$datadir" >> $config_mak 4751f50f8d1Sbellardecho "docdir=$docdir" >> $config_mak 4767efa4387Sbellardecho "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h 47797a847bcSbellardecho "MAKE=$make" >> $config_mak 47897a847bcSbellardecho "CC=$cc" >> $config_mak 47997a847bcSbellardif test "$have_gcc3_options" = "yes" ; then 48097a847bcSbellard echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak 48197a847bcSbellardfi 48297a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak 48397a847bcSbellardecho "AR=$ar" >> $config_mak 48497a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak 48597a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak 48697a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak 48767b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak 48897a847bcSbellardif test "$cpu" = "i386" ; then 48997a847bcSbellard echo "ARCH=i386" >> $config_mak 49097a847bcSbellard echo "#define HOST_I386 1" >> $config_h 4910b0babc6Sbellardelif test "$cpu" = "x86_64" ; then 4920b0babc6Sbellard echo "ARCH=x86_64" >> $config_mak 4930b0babc6Sbellard echo "#define HOST_X86_64 1" >> $config_h 494808c4954Sbellardelif test "$cpu" = "armv4b" ; then 495808c4954Sbellard echo "ARCH=arm" >> $config_mak 496808c4954Sbellard echo "#define HOST_ARM 1" >> $config_h 4977d13299dSbellardelif test "$cpu" = "armv4l" ; then 49897a847bcSbellard echo "ARCH=arm" >> $config_mak 49997a847bcSbellard echo "#define HOST_ARM 1" >> $config_h 5007d13299dSbellardelif test "$cpu" = "powerpc" ; then 50197a847bcSbellard echo "ARCH=ppc" >> $config_mak 50297a847bcSbellard echo "#define HOST_PPC 1" >> $config_h 5037d13299dSbellardelif test "$cpu" = "mips" ; then 50497a847bcSbellard echo "ARCH=mips" >> $config_mak 50597a847bcSbellard echo "#define HOST_MIPS 1" >> $config_h 506fb3e5849Sbellardelif test "$cpu" = "s390" ; then 50797a847bcSbellard echo "ARCH=s390" >> $config_mak 50897a847bcSbellard echo "#define HOST_S390 1" >> $config_h 509295defa5Sbellardelif test "$cpu" = "alpha" ; then 51097a847bcSbellard echo "ARCH=alpha" >> $config_mak 51197a847bcSbellard echo "#define HOST_ALPHA 1" >> $config_h 512ae228531Sbellardelif test "$cpu" = "sparc" ; then 51397a847bcSbellard echo "ARCH=sparc" >> $config_mak 51497a847bcSbellard echo "#define HOST_SPARC 1" >> $config_h 515ae228531Sbellardelif test "$cpu" = "sparc64" ; then 51697a847bcSbellard echo "ARCH=sparc64" >> $config_mak 51797a847bcSbellard echo "#define HOST_SPARC64 1" >> $config_h 518a8baa8c5Sbellardelif test "$cpu" = "ia64" ; then 51997a847bcSbellard echo "ARCH=ia64" >> $config_mak 52097a847bcSbellard echo "#define HOST_IA64 1" >> $config_h 52138e584a0Sbellardelif test "$cpu" = "m68k" ; then 52238ca2abcSbellard echo "ARCH=m68k" >> $config_mak 52338ca2abcSbellard echo "#define HOST_M68K 1" >> $config_h 5247d13299dSbellardelse 5257d13299dSbellard echo "Unsupported CPU" 5267d13299dSbellard exit 1 5277d13299dSbellardfi 5287d13299dSbellardif test "$bigendian" = "yes" ; then 52997a847bcSbellard echo "WORDS_BIGENDIAN=yes" >> $config_mak 53097a847bcSbellard echo "#define WORDS_BIGENDIAN 1" >> $config_h 53197a847bcSbellardfi 532b6853697Sbellardecho "#define HOST_LONG_BITS $hostlongbits" >> $config_h 53367b915a5Sbellardif test "$mingw32" = "yes" ; then 53467b915a5Sbellard echo "CONFIG_WIN32=yes" >> $config_mak 53511d9f695Sbellard echo "#define CONFIG_WIN32 1" >> $config_h 5367d3505c5Sbellardelif test -f "/usr/include/byteswap.h" ; then 53797a847bcSbellard echo "#define HAVE_BYTESWAP_H 1" >> $config_h 53867b915a5Sbellardfi 53983fb7adfSbellardif test "$darwin" = "yes" ; then 54083fb7adfSbellard echo "CONFIG_DARWIN=yes" >> $config_mak 54183fb7adfSbellard echo "#define CONFIG_DARWIN 1" >> $config_h 54283fb7adfSbellardfi 54367b915a5Sbellardif test "$gdbstub" = "yes" ; then 54467b915a5Sbellard echo "CONFIG_GDBSTUB=yes" >> $config_mak 54567b915a5Sbellard echo "#define CONFIG_GDBSTUB 1" >> $config_h 54667b915a5Sbellardfi 54797a847bcSbellardif test "$gprof" = "yes" ; then 54897a847bcSbellard echo "TARGET_GPROF=yes" >> $config_mak 54997a847bcSbellard echo "#define HAVE_GPROF 1" >> $config_h 55097a847bcSbellardfi 55197a847bcSbellardif test "$static" = "yes" ; then 55297a847bcSbellard echo "CONFIG_STATIC=yes" >> $config_mak 55350863472Sbellard echo "#define CONFIG_STATIC 1" >> $config_h 55497a847bcSbellardfi 555c20709aaSbellardif test "$slirp" = "yes" ; then 556c20709aaSbellard echo "CONFIG_SLIRP=yes" >> $config_mak 557c20709aaSbellard echo "#define CONFIG_SLIRP 1" >> $config_h 558c20709aaSbellardfi 559fb065187Sbellardif test "$adlib" = "yes" ; then 560fb065187Sbellard echo "CONFIG_ADLIB=yes" >> $config_mak 561fb065187Sbellard echo "#define CONFIG_ADLIB 1" >> $config_h 562fb065187Sbellardfi 563fb065187Sbellardif test "$oss" = "yes" ; then 564fb065187Sbellard echo "CONFIG_OSS=yes" >> $config_mak 565fb065187Sbellard echo "#define CONFIG_OSS 1" >> $config_h 566fb065187Sbellardfi 567102a52e4Sbellardif test "$fmod" = "yes" ; then 568102a52e4Sbellard echo "CONFIG_FMOD=yes" >> $config_mak 569102a52e4Sbellard echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak 570102a52e4Sbellard echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak 571102a52e4Sbellard echo "#define CONFIG_FMOD 1" >> $config_h 572102a52e4Sbellardfi 57397a847bcSbellardecho -n "VERSION=" >>$config_mak 57497a847bcSbellardhead $source_path/VERSION >>$config_mak 57597a847bcSbellardecho "" >>$config_mak 57697a847bcSbellardecho -n "#define QEMU_VERSION \"" >> $config_h 57797a847bcSbellardhead $source_path/VERSION >> $config_h 57897a847bcSbellardecho "\"" >> $config_h 57997a847bcSbellard 580c9ec1fe4Sbellardif test $kqemu = "yes" ; then 581c9ec1fe4Sbellard echo "CONFIG_KQEMU=yes" >> $config_mak 5821026f133Sbellard if test $linux = "yes" ; then 583c9ec1fe4Sbellard echo "KERNEL_PATH=$kernel_path" >> $config_mak 584c9ec1fe4Sbellard if test $kbuild26 = "yes" ; then 585c9ec1fe4Sbellard echo "CONFIG_KBUILD26=yes" >> $config_mak 586c9ec1fe4Sbellard fi 587c9ec1fe4Sbellard fi 5881026f133Sbellardfi 58997a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak 59097a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak 59197a847bcSbellard 59283fb7adfSbellard# XXX: suppress that 5937d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 59443003046Sbellard echo "#define O_LARGEFILE 0" >> $config_h 59543003046Sbellard echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h 5967d3505c5Sbellard echo "#define _BSD 1" >> $config_h 5977d3505c5Sbellardfi 5987d3505c5Sbellard 59997a847bcSbellardfor target in $target_list; do 60097a847bcSbellard 60197a847bcSbellardtarget_dir="$target" 60297a847bcSbellardconfig_mak=$target_dir/config.mak 60397a847bcSbellardconfig_h=$target_dir/config.h 60497a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1` 60597a847bcSbellardtarget_bigendian="no" 606808c4954Sbellard[ "$target_cpu" = "armeb" ] && target_bigendian=yes 6071e43adfcSbellard[ "$target_cpu" = "sparc" ] && target_bigendian=yes 60864b3ab24Sbellard[ "$target_cpu" = "sparc64" ] && target_bigendian=yes 60967867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes 610*d3258560Sbellard[ "$target_cpu" = "mips" ] && target_bigendian=yes 61197a847bcSbellardtarget_softmmu="no" 61297a847bcSbellardif expr $target : '.*-softmmu' > /dev/null ; then 61397a847bcSbellard target_softmmu="yes" 6147d13299dSbellardfi 615997344f3Sbellardtarget_user_only="no" 616997344f3Sbellardif expr $target : '.*-user' > /dev/null ; then 617997344f3Sbellard target_user_only="yes" 618997344f3Sbellardfi 619de83cd02Sbellard 62097ccc689Sbellardif test "$target_user_only" = "no" -a "$check_gfx" = "yes" \ 62197ccc689Sbellard -a "$sdl" = "no" -a "$cocoa" = "no" ; then 62297ccc689Sbellard echo "ERROR: QEMU requires SDL or Cocoa for graphical output" 62397ccc689Sbellard echo "To build QEMU with graphical output configure with --disable-gfx-check" 62497ccc689Sbellard echo "Note that this will disable all output from the virtual graphics card." 62597ccc689Sbellard exit 1; 62697ccc689Sbellardfi 62797ccc689Sbellard 6287c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile" 62997a847bcSbellard 63097a847bcSbellardmkdir -p $target_dir 631158142c2Sbellardmkdir -p $target_dir/fpu 632808c4954Sbellardif test "$target" = "arm-user" -o "$target" = "armeb-user" ; then 63369de927cSbellard mkdir -p $target_dir/nwfpe 63469de927cSbellardfi 635a7e61ed4Sbellardif test "$target_user_only" = "no" ; then 636a7e61ed4Sbellard mkdir -p $target_dir/slirp 637a7e61ed4Sbellardfi 63869de927cSbellard 63997a847bcSbellardln -sf $source_path/Makefile.target $target_dir/Makefile 64097a847bcSbellard 64197a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak 64297a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h 64397a847bcSbellard 64497a847bcSbellard 64597a847bcSbellardecho "include ../config-host.mak" >> $config_mak 64697a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h 6471e43adfcSbellard 6481e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"` 6491e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h 65097a847bcSbellard 65197a847bcSbellardif test "$target_cpu" = "i386" ; then 65297a847bcSbellard echo "TARGET_ARCH=i386" >> $config_mak 65397a847bcSbellard echo "#define TARGET_ARCH \"i386\"" >> $config_h 65497a847bcSbellard echo "#define TARGET_I386 1" >> $config_h 65507f4ddbfSbellard if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then 656824d560fSbellard echo "#define USE_KQEMU 1" >> $config_h 657824d560fSbellard fi 658808c4954Sbellardelif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then 65997a847bcSbellard echo "TARGET_ARCH=arm" >> $config_mak 66097a847bcSbellard echo "#define TARGET_ARCH \"arm\"" >> $config_h 66197a847bcSbellard echo "#define TARGET_ARM 1" >> $config_h 6621e43adfcSbellardelif test "$target_cpu" = "sparc" ; then 6631e43adfcSbellard echo "TARGET_ARCH=sparc" >> $config_mak 6641e43adfcSbellard echo "#define TARGET_ARCH \"sparc\"" >> $config_h 6651e43adfcSbellard echo "#define TARGET_SPARC 1" >> $config_h 66664b3ab24Sbellardelif test "$target_cpu" = "sparc64" ; then 66764b3ab24Sbellard echo "TARGET_ARCH=sparc64" >> $config_mak 66864b3ab24Sbellard echo "#define TARGET_ARCH \"sparc64\"" >> $config_h 66964b3ab24Sbellard echo "#define TARGET_SPARC 1" >> $config_h 67064b3ab24Sbellard echo "#define TARGET_SPARC64 1" >> $config_h 67167867308Sbellardelif test "$target_cpu" = "ppc" ; then 67267867308Sbellard echo "TARGET_ARCH=ppc" >> $config_mak 67367867308Sbellard echo "#define TARGET_ARCH \"ppc\"" >> $config_h 67467867308Sbellard echo "#define TARGET_PPC 1" >> $config_h 6750b0babc6Sbellardelif test "$target_cpu" = "x86_64" ; then 6760b0babc6Sbellard echo "TARGET_ARCH=x86_64" >> $config_mak 6770b0babc6Sbellard echo "#define TARGET_ARCH \"x86_64\"" >> $config_h 6780b0babc6Sbellard echo "#define TARGET_I386 1" >> $config_h 6790b0babc6Sbellard echo "#define TARGET_X86_64 1" >> $config_h 68007f4ddbfSbellard if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then 68107f4ddbfSbellard echo "#define USE_KQEMU 1" >> $config_h 68207f4ddbfSbellard fi 683*d3258560Sbellardelif test "$target_cpu" = "mips" ; then 684*d3258560Sbellard echo "TARGET_ARCH=mips" >> $config_mak 685*d3258560Sbellard echo "#define TARGET_ARCH \"mips\"" >> $config_h 686*d3258560Sbellard echo "#define TARGET_MIPS 1" >> $config_h 687de83cd02Sbellardelse 688de83cd02Sbellard echo "Unsupported target CPU" 689de83cd02Sbellard exit 1 690de83cd02Sbellardfi 691de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 69297a847bcSbellard echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak 69397a847bcSbellard echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h 69497a847bcSbellardfi 69597a847bcSbellardif test "$target_softmmu" = "yes" ; then 69697a847bcSbellard echo "CONFIG_SOFTMMU=yes" >> $config_mak 69797a847bcSbellard echo "#define CONFIG_SOFTMMU 1" >> $config_h 698de83cd02Sbellardfi 699997344f3Sbellardif test "$target_user_only" = "yes" ; then 700997344f3Sbellard echo "CONFIG_USER_ONLY=yes" >> $config_mak 701997344f3Sbellard echo "#define CONFIG_USER_ONLY 1" >> $config_h 702997344f3Sbellardfi 703de83cd02Sbellard 704158142c2Sbellardif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then 705158142c2Sbellard echo "CONFIG_SOFTFLOAT=yes" >> $config_mak 706158142c2Sbellard echo "#define CONFIG_SOFTFLOAT 1" >> $config_h 707158142c2Sbellardfi 7087c1f25b4Sbellard# sdl defines 7097c1f25b4Sbellard 7107c1f25b4Sbellardif test "$target_user_only" = "no"; then 7117c1f25b4Sbellard if test "$target_softmmu" = "no" -o "$static" = "yes"; then 712dbb2c921Sbellard sdl1=$sdl_static 7137c1f25b4Sbellard else 714dbb2c921Sbellard sdl1=$sdl 715dbb2c921Sbellard fi 716dbb2c921Sbellard if test "$sdl1" = "yes" ; then 7177c1f25b4Sbellard echo "#define CONFIG_SDL 1" >> $config_h 7187c1f25b4Sbellard echo "CONFIG_SDL=yes" >> $config_mak 719dbb2c921Sbellard if test "$target_softmmu" = "no" -o "$static" = "yes"; then 720dbb2c921Sbellard echo "SDL_LIBS=$sdl_static_libs" >> $config_mak 721dbb2c921Sbellard else 7227c1f25b4Sbellard echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak 7237c1f25b4Sbellard fi 7247c1f25b4Sbellard echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak 7257c1f25b4Sbellard if [ "${aa}" = "yes" ] ; then 7267c1f25b4Sbellard echo -n " `aalib-config --cflags`" >> $config_mak ; 7277c1f25b4Sbellard fi 7287c1f25b4Sbellard echo "" >> $config_mak 7297c1f25b4Sbellard fi 730dbb2c921Sbellardfi 7317c1f25b4Sbellard 7325b0753e0Sbellardif test "$cocoa" = "yes" ; then 7335b0753e0Sbellard echo "#define CONFIG_COCOA 1" >> $config_h 7345b0753e0Sbellard echo "CONFIG_COCOA=yes" >> $config_mak 7355b0753e0Sbellardfi 7365b0753e0Sbellard 73797a847bcSbellarddone # for target in $targets 7387d13299dSbellard 7397d13299dSbellard# build tree in object directory if source path is different from current one 7407d13299dSbellardif test "$source_path_used" = "yes" ; then 7417d13299dSbellard DIRS="tests" 7427d13299dSbellard FILES="Makefile tests/Makefile" 7437d13299dSbellard for dir in $DIRS ; do 7447d13299dSbellard mkdir -p $dir 7457d13299dSbellard done 7467d13299dSbellard for f in $FILES ; do 7477d13299dSbellard ln -sf $source_path/$f $f 7487d13299dSbellard done 7497d13299dSbellardfi 7507d13299dSbellard 75197a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS 752