xref: /openbmc/qemu/configure (revision e99f9060)
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"
102*e99f9060Sbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; 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  ;;
15683469015Sbellard  --host-cc=*) host_cc=`echo $opt | cut -d '=' -f 2`
15783469015Sbellard  ;;
1587d13299dSbellard  --make=*) make=`echo $opt | cut -d '=' -f 2`
1597d13299dSbellard  ;;
1607d13299dSbellard  --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
1617d13299dSbellard  ;;
1627d13299dSbellard  --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}"
1637d13299dSbellard  ;;
1647d13299dSbellard  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
1657d13299dSbellard  ;;
16697a847bcSbellard  --target-list=*) target_list=${opt#--target-list=}
167de83cd02Sbellard  ;;
1687d13299dSbellard  --enable-gprof) gprof="yes"
1697d13299dSbellard  ;;
17043ce4dfeSbellard  --static) static="yes"
17143ce4dfeSbellard  ;;
17297a847bcSbellard  --disable-sdl) sdl="no"
17397a847bcSbellard  ;;
174102a52e4Sbellard  --enable-fmod) fmod="yes"
175102a52e4Sbellard  ;;
176102a52e4Sbellard  --fmod-lib=*) fmod_lib=${opt#--fmod-lib=}
177102a52e4Sbellard  ;;
178102a52e4Sbellard  --fmod-inc=*) fmod_inc=${opt#--fmod-inc=}
179102a52e4Sbellard  ;;
18067b915a5Sbellard  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
18167b915a5Sbellard  ;;
182443f1376Sbellard  --disable-slirp) slirp="no"
183c20709aaSbellard  ;;
184fb065187Sbellard  --enable-adlib) adlib="yes"
185fb065187Sbellard  ;;
186c9ec1fe4Sbellard  --disable-kqemu) kqemu="no"
187c9ec1fe4Sbellard  ;;
188c9ec1fe4Sbellard  --kernel-path=*) kernel_path=${opt#--kernel-path=}
189c9ec1fe4Sbellard  ;;
1905b0753e0Sbellard  --enable-cocoa) cocoa="yes" ; sdl="no"
1915b0753e0Sbellard  ;;
19297ccc689Sbellard  --disable-gfx-check) check_gfx="no"
19397ccc689Sbellard  ;;
1947d13299dSbellard  esac
1957d13299dSbellarddone
1967d13299dSbellard
1977d13299dSbellard# Checking for CFLAGS
1987d13299dSbellardif test -z "$CFLAGS"; then
1997d13299dSbellard    CFLAGS="-O2"
2007d13299dSbellardfi
2017d13299dSbellard
2027d13299dSbellardcc="${cross_prefix}${cc}"
2037d13299dSbellardar="${cross_prefix}${ar}"
2047d13299dSbellardstrip="${cross_prefix}${strip}"
2057d13299dSbellard
20667b915a5Sbellardif test "$mingw32" = "yes" ; then
2075327cf48Sbellard    linux="no"
20867b915a5Sbellard    EXESUF=".exe"
20967b915a5Sbellard    gdbstub="no"
2109f059ecaSbellard    oss="no"
21107f4ddbfSbellard    if [ "$cpu" = "i386" ] ; then
21207f4ddbfSbellard        kqemu="yes"
21307f4ddbfSbellard    fi
21467b915a5Sbellardfi
21567b915a5Sbellard
2165327cf48Sbellardif test -z "$target_list" ; then
2175327cf48Sbellard# these targets are portable
218d3258560Sbellard    target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu"
2195327cf48Sbellard# the following are Linux specific
2205327cf48Sbellard    if [ "$linux" = "yes" ] ; then
221a20b5524Sbellard        target_list="i386-user arm-user armeb-user sparc-user ppc-user $target_list"
2225327cf48Sbellard    fi
2236e20a45fSbellardelse
2246e20a45fSbellard    target_list=$(echo "$target_list" | sed -e 's/,/ /g')
2255327cf48Sbellardfi
2265327cf48Sbellard
2277d13299dSbellardif test -z "$cross_prefix" ; then
2287d13299dSbellard
2297d13299dSbellard# ---
2307d13299dSbellard# big/little endian test
2317d13299dSbellardcat > $TMPC << EOF
2327d13299dSbellard#include <inttypes.h>
2337d13299dSbellardint main(int argc, char ** argv){
2347d13299dSbellard	volatile uint32_t i=0x01234567;
2357d13299dSbellard	return (*((uint8_t*)(&i))) == 0x67;
2367d13299dSbellard}
2377d13299dSbellardEOF
2387d13299dSbellard
2397d13299dSbellardif $cc -o $TMPE $TMPC 2>/dev/null ; then
2407d13299dSbellard$TMPE && bigendian="yes"
2417d13299dSbellardelse
2427d13299dSbellardecho big/little test failed
2437d13299dSbellardfi
2447d13299dSbellard
2457d13299dSbellardelse
2467d13299dSbellard
2477d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
248808c4954Sbellardif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
2497d13299dSbellard    bigendian="yes"
2507d13299dSbellardfi
2517d13299dSbellard
2527d13299dSbellardfi
2537d13299dSbellard
254b6853697Sbellard# host long bits test
255b6853697Sbellardhostlongbits="32"
256b6853697Sbellardif test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
257b6853697Sbellard    hostlongbits="64"
258b6853697Sbellardfi
259b6853697Sbellard
260e8cd23deSbellard# check gcc options support
26104369ff2Sbellardcat > $TMPC <<EOF
26204369ff2Sbellardint main(void) {
26304369ff2Sbellard}
26404369ff2SbellardEOF
26504369ff2Sbellard
266e8cd23deSbellardhave_gcc3_options="no"
267e8cd23deSbellardif $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
268e8cd23deSbellard   have_gcc3_options="yes"
26904369ff2Sbellardfi
270ca735206Sbellard
27111d9f695Sbellard##########################################
27211d9f695Sbellard# SDL probe
27311d9f695Sbellard
27411d9f695Sbellardsdl_too_old=no
27511d9f695Sbellard
27611d9f695Sbellardif test -z "$sdl" ; then
27711d9f695Sbellard
278a6e022adSbellardsdl_config="sdl-config"
279a6e022adSbellardsdl=no
2807c1f25b4Sbellardsdl_static=no
281a6e022adSbellard
282a6e022adSbellardif test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
283a6e022adSbellard# win32 cross compilation case
284a6e022adSbellard    sdl_config="i386-mingw32msvc-sdl-config"
285a6e022adSbellard    sdl=yes
286a6e022adSbellardelse
287a6e022adSbellard# normal SDL probe
28811d9f695Sbellardcat > $TMPC << EOF
28911d9f695Sbellard#include <SDL.h>
29011d9f695Sbellard#undef main /* We don't want SDL to override our main() */
29111d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
29211d9f695SbellardEOF
29311d9f695Sbellard
294a6e022adSbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
295a6e022adSbellard_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
29611d9f695Sbellardif test "$_sdlversion" -lt 121 ; then
29711d9f695Sbellardsdl_too_old=yes
29811d9f695Sbellardelse
29911d9f695Sbellardsdl=yes
30011d9f695Sbellardfi
3017c1f25b4Sbellard
3027c1f25b4Sbellard# static link with sdl ?
3037c1f25b4Sbellardif test "$sdl" = "yes" ; then
3047c1f25b4Sbellardaa="no"
3057c1f25b4Sbellard`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
3067c1f25b4Sbellardsdl_static_libs=`$sdl_config --static-libs`
3077c1f25b4Sbellardif [ "$aa" = "yes" ] ; then
308d8d8aa4eSbellard  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
30911d9f695Sbellardfi
31011d9f695Sbellard
3117c1f25b4Sbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
3127c1f25b4Sbellard  sdl_static=yes
3137c1f25b4Sbellardfi
3147c1f25b4Sbellard
3157c1f25b4Sbellardfi # static link
3167c1f25b4Sbellard
3177c1f25b4Sbellardfi # sdl compile test
3187c1f25b4Sbellard
319a6e022adSbellardfi # cross compilation
320a6e022adSbellardfi # -z $sdl
32111d9f695Sbellard
3227d13299dSbellardif test x"$1" = x"-h" -o x"$1" = x"--help" ; then
3237d13299dSbellardcat << EOF
3247d13299dSbellard
3257d13299dSbellardUsage: configure [options]
3267d13299dSbellardOptions: [defaults in brackets after descriptions]
3277d13299dSbellard
3287d13299dSbellardEOF
3297d13299dSbellardecho "Standard options:"
3307d13299dSbellardecho "  --help                   print this message"
3317d13299dSbellardecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
3321e43adfcSbellardecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
3331e43adfcSbellardecho "                           use %M for cpu name [$interp_prefix]"
33497a847bcSbellardecho "  --target-list=LIST       set target list [$target_list]"
3357d13299dSbellardecho ""
336c9ec1fe4Sbellardecho "kqemu kernel acceleration support:"
337c9ec1fe4Sbellardecho "  --disable-kqemu          disable kqemu build"
338c9ec1fe4Sbellardecho "  --kernel-path=PATH       set the kernel path (configure probes it)"
339c9ec1fe4Sbellardecho ""
3407d13299dSbellardecho "Advanced options (experts only):"
3417d13299dSbellardecho "  --source-path=PATH       path of source code [$source_path]"
3427d13299dSbellardecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
3437d13299dSbellardecho "  --cc=CC                  use C compiler CC [$cc]"
34483469015Sbellardecho "  --host-cc=CC             use C compiler CC [$cc] for dyngen etc."
3457d13299dSbellardecho "  --make=MAKE              use specified make [$make]"
34643ce4dfeSbellardecho "  --static                 enable static build [$static]"
34767b915a5Sbellardecho "  --enable-mingw32         enable Win32 cross compilation with mingw32"
348d37282adSbellardecho "  --enable-adlib           enable Adlib emulation"
349102a52e4Sbellardecho "  --enable-fmod            enable FMOD audio output driver"
350102a52e4Sbellardecho "  --fmod-lib               path to FMOD library"
351102a52e4Sbellardecho "  --fmod-inc               path to FMOD includes"
3527d13299dSbellardecho ""
3537d13299dSbellardecho "NOTE: The object files are build at the place where configure is launched"
3547d13299dSbellardexit 1
3557d13299dSbellardfi
3567d13299dSbellard
35711d9f695Sbellardif test "$mingw32" = "yes" ; then
35811d9f695Sbellardif test -z "$prefix" ; then
35911d9f695Sbellard    prefix="/c/Program Files/Qemu"
36011d9f695Sbellardfi
36111d9f695Sbellardmandir="$prefix"
3627efa4387Sbellarddatadir="$prefix"
3631f50f8d1Sbellarddocdir="$prefix"
36411d9f695Sbellardbindir="$prefix"
36511d9f695Sbellardelse
36611d9f695Sbellardif test -z "$prefix" ; then
36711d9f695Sbellard    prefix="/usr/local"
36811d9f695Sbellardfi
3695a67135aSbellardmandir="$prefix/share/man"
3707efa4387Sbellarddatadir="$prefix/share/qemu"
3711f50f8d1Sbellarddocdir="$prefix/share/doc/qemu"
37211d9f695Sbellardbindir="$prefix/bin"
37311d9f695Sbellardfi
3745a67135aSbellard
37507f4ddbfSbellard# kqemu support
376c9ec1fe4Sbellardif test $kqemu = "yes" ; then
377441c72baSbellard    # test if the source code is installed
378441c72baSbellard    if test '!' -f "kqemu/Makefile" ; then
379441c72baSbellard        kqemu="no"
380441c72baSbellard    fi
381441c72baSbellardfi
382441c72baSbellard
38307f4ddbfSbellard# Linux specific kqemu configuration
38407f4ddbfSbellardif test $kqemu = "yes" -a $linux = "yes" ; then
385c9ec1fe4Sbellard# find the kernel path
386c9ec1fe4Sbellardif test -z "$kernel_path" ; then
387c9ec1fe4Sbellardkernel_version=`uname -r`
388c9ec1fe4Sbellardkernel_path="/lib/modules/$kernel_version/build"
389c9ec1fe4Sbellardif test '!' -d "$kernel_path/include" ; then
390c9ec1fe4Sbellard    kernel_path="/usr/src/linux"
391c9ec1fe4Sbellard    if test '!' -d "$kernel_path/include" ; then
392c9ec1fe4Sbellard        echo "Could not find kernel includes in /lib/modules or /usr/src/linux - cannot build the kqemu module"
393c9ec1fe4Sbellard        kqemu="no"
394c9ec1fe4Sbellard    fi
395c9ec1fe4Sbellardfi
396c9ec1fe4Sbellardfi
397c9ec1fe4Sbellard
398c9ec1fe4Sbellardif test $kqemu = "yes" ; then
399c9ec1fe4Sbellard
400c9ec1fe4Sbellard# test that the kernel config is present
401c9ec1fe4Sbellardif test '!' -f "$kernel_path/Makefile" ; then
402f94daeddSbellard    echo "No Makefile file present in $kernel_path - kqemu cannot be built"
403c9ec1fe4Sbellard    kqemu="no"
404c9ec1fe4Sbellardfi
405c9ec1fe4Sbellard
406c9ec1fe4Sbellard# find build system (2.6 or legacy)
407c9ec1fe4Sbellardkbuild26="yes"
408c9ec1fe4Sbellardif grep -q "PATCHLEVEL = 4" $kernel_path/Makefile ; then
409c9ec1fe4Sbellardkbuild26="no"
410c9ec1fe4Sbellardfi
411c9ec1fe4Sbellard
412c9ec1fe4Sbellardfi # kqemu
413c9ec1fe4Sbellard
41407f4ddbfSbellardfi # kqemu and linux
415c9ec1fe4Sbellard
416c9ec1fe4Sbellard
4177d13299dSbellardecho "Install prefix    $prefix"
4187efa4387Sbellardecho "BIOS directory    $datadir"
41911d9f695Sbellardecho "binary directory  $bindir"
42011d9f695Sbellardif test "$mingw32" = "no" ; then
42111d9f695Sbellardecho "Manual directory  $mandir"
42243ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
42311d9f695Sbellardfi
4245a67135aSbellardecho "Source path       $source_path"
4257d13299dSbellardecho "C compiler        $cc"
42683469015Sbellardecho "Host C compiler   $host_cc"
4277d13299dSbellardecho "make              $make"
428a98fd896Sbellardecho "host CPU          $cpu"
429de83cd02Sbellardecho "host big endian   $bigendian"
43097a847bcSbellardecho "target list       $target_list"
4317d13299dSbellardecho "gprof enabled     $gprof"
43243ce4dfeSbellardecho "static build      $static"
4335b0753e0Sbellardif test "$darwin" = "yes" ; then
4345b0753e0Sbellard    echo "Cocoa support     $cocoa"
4355b0753e0Sbellardfi
43697a847bcSbellardecho "SDL support       $sdl"
437e4afee97Sbellardif test "$sdl" != "no" ; then
4387c1f25b4Sbellard    echo "SDL static link   $sdl_static"
439e4afee97Sbellardfi
44067b915a5Sbellardecho "mingw32 support   $mingw32"
441fb065187Sbellardecho "Adlib support     $adlib"
442102a52e4Sbellardecho -n "FMOD support      $fmod"
443102a52e4Sbellardif test $fmod = "yes"; then
444102a52e4Sbellard    echo -n " (lib='$fmod_lib' include='$fmod_inc')"
445102a52e4Sbellardfi
446102a52e4Sbellardecho ""
44707f4ddbfSbellardecho "kqemu support     $kqemu"
44807f4ddbfSbellardif test $kqemu = "yes" -a $linux = "yes" ; then
449c9ec1fe4Sbellardecho ""
45007f4ddbfSbellardecho "KQEMU Linux module configuration:"
451c9ec1fe4Sbellardecho "kernel sources    $kernel_path"
452c9ec1fe4Sbellardecho -n "kbuild type       "
453c9ec1fe4Sbellardif test $kbuild26 = "yes"; then
454c9ec1fe4Sbellardecho "2.6"
455c9ec1fe4Sbellardelse
456c9ec1fe4Sbellardecho "2.4"
457c9ec1fe4Sbellardfi
458c9ec1fe4Sbellardfi
45967b915a5Sbellard
46097a847bcSbellardif test $sdl_too_old = "yes"; then
46124b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
462e8cd23deSbellardfi
46324b55b96Sbellard#if test "$sdl_static" = "no"; then
46424b55b96Sbellard#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
46524b55b96Sbellard#fi
46697a847bcSbellard
46797a847bcSbellardconfig_mak="config-host.mak"
46897a847bcSbellardconfig_h="config-host.h"
46997a847bcSbellard
4707c1f25b4Sbellard#echo "Creating $config_mak and $config_h"
47197a847bcSbellard
47297a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
47397a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
47497a847bcSbellard
47597a847bcSbellardecho "prefix=$prefix" >> $config_mak
47611d9f695Sbellardecho "bindir=$bindir" >> $config_mak
4775a67135aSbellardecho "mandir=$mandir" >> $config_mak
4787efa4387Sbellardecho "datadir=$datadir" >> $config_mak
4791f50f8d1Sbellardecho "docdir=$docdir" >> $config_mak
4807efa4387Sbellardecho "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
48197a847bcSbellardecho "MAKE=$make" >> $config_mak
48297a847bcSbellardecho "CC=$cc" >> $config_mak
48397a847bcSbellardif test "$have_gcc3_options" = "yes" ; then
48497a847bcSbellard  echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
48597a847bcSbellardfi
48697a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak
48797a847bcSbellardecho "AR=$ar" >> $config_mak
48897a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak
48997a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak
49097a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak
49167b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak
49297a847bcSbellardif test "$cpu" = "i386" ; then
49397a847bcSbellard  echo "ARCH=i386" >> $config_mak
49497a847bcSbellard  echo "#define HOST_I386 1" >> $config_h
4950b0babc6Sbellardelif test "$cpu" = "x86_64" ; then
4960b0babc6Sbellard  echo "ARCH=x86_64" >> $config_mak
4970b0babc6Sbellard  echo "#define HOST_X86_64 1" >> $config_h
498808c4954Sbellardelif test "$cpu" = "armv4b" ; then
499808c4954Sbellard  echo "ARCH=arm" >> $config_mak
500808c4954Sbellard  echo "#define HOST_ARM 1" >> $config_h
5017d13299dSbellardelif test "$cpu" = "armv4l" ; then
50297a847bcSbellard  echo "ARCH=arm" >> $config_mak
50397a847bcSbellard  echo "#define HOST_ARM 1" >> $config_h
5047d13299dSbellardelif test "$cpu" = "powerpc" ; then
50597a847bcSbellard  echo "ARCH=ppc" >> $config_mak
50697a847bcSbellard  echo "#define HOST_PPC 1" >> $config_h
5077d13299dSbellardelif test "$cpu" = "mips" ; then
50897a847bcSbellard  echo "ARCH=mips" >> $config_mak
50997a847bcSbellard  echo "#define HOST_MIPS 1" >> $config_h
510fb3e5849Sbellardelif test "$cpu" = "s390" ; then
51197a847bcSbellard  echo "ARCH=s390" >> $config_mak
51297a847bcSbellard  echo "#define HOST_S390 1" >> $config_h
513295defa5Sbellardelif test "$cpu" = "alpha" ; then
51497a847bcSbellard  echo "ARCH=alpha" >> $config_mak
51597a847bcSbellard  echo "#define HOST_ALPHA 1" >> $config_h
516ae228531Sbellardelif test "$cpu" = "sparc" ; then
51797a847bcSbellard  echo "ARCH=sparc" >> $config_mak
51897a847bcSbellard  echo "#define HOST_SPARC 1" >> $config_h
519ae228531Sbellardelif test "$cpu" = "sparc64" ; then
52097a847bcSbellard  echo "ARCH=sparc64" >> $config_mak
52197a847bcSbellard  echo "#define HOST_SPARC64 1" >> $config_h
522a8baa8c5Sbellardelif test "$cpu" = "ia64" ; then
52397a847bcSbellard  echo "ARCH=ia64" >> $config_mak
52497a847bcSbellard  echo "#define HOST_IA64 1" >> $config_h
52538e584a0Sbellardelif test "$cpu" = "m68k" ; then
52638ca2abcSbellard  echo "ARCH=m68k" >> $config_mak
52738ca2abcSbellard  echo "#define HOST_M68K 1" >> $config_h
5287d13299dSbellardelse
5297d13299dSbellard  echo "Unsupported CPU"
5307d13299dSbellard  exit 1
5317d13299dSbellardfi
5327d13299dSbellardif test "$bigendian" = "yes" ; then
53397a847bcSbellard  echo "WORDS_BIGENDIAN=yes" >> $config_mak
53497a847bcSbellard  echo "#define WORDS_BIGENDIAN 1" >> $config_h
53597a847bcSbellardfi
536b6853697Sbellardecho "#define HOST_LONG_BITS $hostlongbits" >> $config_h
53767b915a5Sbellardif test "$mingw32" = "yes" ; then
53867b915a5Sbellard  echo "CONFIG_WIN32=yes" >> $config_mak
53911d9f695Sbellard  echo "#define CONFIG_WIN32 1" >> $config_h
5407d3505c5Sbellardelif test -f "/usr/include/byteswap.h" ; then
54197a847bcSbellard  echo "#define HAVE_BYTESWAP_H 1" >> $config_h
54267b915a5Sbellardfi
54383fb7adfSbellardif test "$darwin" = "yes" ; then
54483fb7adfSbellard  echo "CONFIG_DARWIN=yes" >> $config_mak
54583fb7adfSbellard  echo "#define CONFIG_DARWIN 1" >> $config_h
54683fb7adfSbellardfi
54767b915a5Sbellardif test "$gdbstub" = "yes" ; then
54867b915a5Sbellard  echo "CONFIG_GDBSTUB=yes" >> $config_mak
54967b915a5Sbellard  echo "#define CONFIG_GDBSTUB 1" >> $config_h
55067b915a5Sbellardfi
55197a847bcSbellardif test "$gprof" = "yes" ; then
55297a847bcSbellard  echo "TARGET_GPROF=yes" >> $config_mak
55397a847bcSbellard  echo "#define HAVE_GPROF 1" >> $config_h
55497a847bcSbellardfi
55597a847bcSbellardif test "$static" = "yes" ; then
55697a847bcSbellard  echo "CONFIG_STATIC=yes" >> $config_mak
55750863472Sbellard  echo "#define CONFIG_STATIC 1" >> $config_h
55897a847bcSbellardfi
559c20709aaSbellardif test "$slirp" = "yes" ; then
560c20709aaSbellard  echo "CONFIG_SLIRP=yes" >> $config_mak
561c20709aaSbellard  echo "#define CONFIG_SLIRP 1" >> $config_h
562c20709aaSbellardfi
563fb065187Sbellardif test "$adlib" = "yes" ; then
564fb065187Sbellard  echo "CONFIG_ADLIB=yes" >> $config_mak
565fb065187Sbellard  echo "#define CONFIG_ADLIB 1" >> $config_h
566fb065187Sbellardfi
567fb065187Sbellardif test "$oss" = "yes" ; then
568fb065187Sbellard  echo "CONFIG_OSS=yes" >> $config_mak
569fb065187Sbellard  echo "#define CONFIG_OSS 1" >> $config_h
570fb065187Sbellardfi
571102a52e4Sbellardif test "$fmod" = "yes" ; then
572102a52e4Sbellard  echo "CONFIG_FMOD=yes" >> $config_mak
573102a52e4Sbellard  echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
574102a52e4Sbellard  echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
575102a52e4Sbellard  echo "#define CONFIG_FMOD 1" >> $config_h
576102a52e4Sbellardfi
57797a847bcSbellardecho -n "VERSION=" >>$config_mak
57897a847bcSbellardhead $source_path/VERSION >>$config_mak
57997a847bcSbellardecho "" >>$config_mak
58097a847bcSbellardecho -n "#define QEMU_VERSION \"" >> $config_h
58197a847bcSbellardhead $source_path/VERSION >> $config_h
58297a847bcSbellardecho "\"" >> $config_h
58397a847bcSbellard
584c9ec1fe4Sbellardif test $kqemu = "yes" ; then
585c9ec1fe4Sbellard  echo "CONFIG_KQEMU=yes" >> $config_mak
5861026f133Sbellard  if test $linux = "yes" ; then
587c9ec1fe4Sbellard    echo "KERNEL_PATH=$kernel_path" >> $config_mak
588c9ec1fe4Sbellard    if test $kbuild26 = "yes" ; then
589c9ec1fe4Sbellard      echo "CONFIG_KBUILD26=yes" >> $config_mak
590c9ec1fe4Sbellard    fi
591c9ec1fe4Sbellard  fi
5921026f133Sbellardfi
59397a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak
59497a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak
59597a847bcSbellard
59683fb7adfSbellard# XXX: suppress that
5977d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
59843003046Sbellard  echo "#define O_LARGEFILE 0" >> $config_h
59943003046Sbellard  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
6007d3505c5Sbellard  echo "#define _BSD 1" >> $config_h
6017d3505c5Sbellardfi
6027d3505c5Sbellard
60397a847bcSbellardfor target in $target_list; do
60497a847bcSbellard
60597a847bcSbellardtarget_dir="$target"
60697a847bcSbellardconfig_mak=$target_dir/config.mak
60797a847bcSbellardconfig_h=$target_dir/config.h
60897a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1`
60997a847bcSbellardtarget_bigendian="no"
610808c4954Sbellard[ "$target_cpu" = "armeb" ] && target_bigendian=yes
6111e43adfcSbellard[ "$target_cpu" = "sparc" ] && target_bigendian=yes
61264b3ab24Sbellard[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
61367867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes
614a2458627Sbellard[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
615d3258560Sbellard[ "$target_cpu" = "mips" ] && target_bigendian=yes
61697a847bcSbellardtarget_softmmu="no"
61797a847bcSbellardif expr $target : '.*-softmmu' > /dev/null ; then
61897a847bcSbellard  target_softmmu="yes"
6197d13299dSbellardfi
620997344f3Sbellardtarget_user_only="no"
621997344f3Sbellardif expr $target : '.*-user' > /dev/null ; then
622997344f3Sbellard  target_user_only="yes"
623997344f3Sbellardfi
624de83cd02Sbellard
62597ccc689Sbellardif test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
62697ccc689Sbellard	-a "$sdl" = "no" -a "$cocoa" = "no" ; then
62797ccc689Sbellard    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
62897ccc689Sbellard    echo "To build QEMU with graphical output configure with --disable-gfx-check"
62997ccc689Sbellard    echo "Note that this will disable all output from the virtual graphics card."
63097ccc689Sbellard    exit 1;
63197ccc689Sbellardfi
63297ccc689Sbellard
6337c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
63497a847bcSbellard
63597a847bcSbellardmkdir -p $target_dir
636158142c2Sbellardmkdir -p $target_dir/fpu
637808c4954Sbellardif test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
63869de927cSbellard  mkdir -p $target_dir/nwfpe
63969de927cSbellardfi
640a7e61ed4Sbellardif test "$target_user_only" = "no" ; then
641a7e61ed4Sbellard  mkdir -p $target_dir/slirp
642a7e61ed4Sbellardfi
64369de927cSbellard
64497a847bcSbellardln -sf $source_path/Makefile.target $target_dir/Makefile
64597a847bcSbellard
64697a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
64797a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
64897a847bcSbellard
64997a847bcSbellard
65097a847bcSbellardecho "include ../config-host.mak" >> $config_mak
65197a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h
6521e43adfcSbellard
6531e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
6541e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
65597a847bcSbellard
65697a847bcSbellardif test "$target_cpu" = "i386" ; then
65797a847bcSbellard  echo "TARGET_ARCH=i386" >> $config_mak
65897a847bcSbellard  echo "#define TARGET_ARCH \"i386\"" >> $config_h
65997a847bcSbellard  echo "#define TARGET_I386 1" >> $config_h
66007f4ddbfSbellard  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
661824d560fSbellard    echo "#define USE_KQEMU 1" >> $config_h
662824d560fSbellard  fi
663808c4954Sbellardelif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
66497a847bcSbellard  echo "TARGET_ARCH=arm" >> $config_mak
66597a847bcSbellard  echo "#define TARGET_ARCH \"arm\"" >> $config_h
66697a847bcSbellard  echo "#define TARGET_ARM 1" >> $config_h
6671e43adfcSbellardelif test "$target_cpu" = "sparc" ; then
6681e43adfcSbellard  echo "TARGET_ARCH=sparc" >> $config_mak
6691e43adfcSbellard  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
6701e43adfcSbellard  echo "#define TARGET_SPARC 1" >> $config_h
67164b3ab24Sbellardelif test "$target_cpu" = "sparc64" ; then
67264b3ab24Sbellard  echo "TARGET_ARCH=sparc64" >> $config_mak
67364b3ab24Sbellard  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
67464b3ab24Sbellard  echo "#define TARGET_SPARC 1" >> $config_h
67564b3ab24Sbellard  echo "#define TARGET_SPARC64 1" >> $config_h
67667867308Sbellardelif test "$target_cpu" = "ppc" ; then
67767867308Sbellard  echo "TARGET_ARCH=ppc" >> $config_mak
67867867308Sbellard  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
67967867308Sbellard  echo "#define TARGET_PPC 1" >> $config_h
680a2458627Sbellardelif test "$target_cpu" = "ppc64" ; then
681a2458627Sbellard  echo "TARGET_ARCH=ppc64" >> $config_mak
682a2458627Sbellard  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
683a2458627Sbellard  echo "#define TARGET_PPC 1" >> $config_h
684a2458627Sbellard  echo "#define TARGET_PPC64 1" >> $config_h
6850b0babc6Sbellardelif test "$target_cpu" = "x86_64" ; then
6860b0babc6Sbellard  echo "TARGET_ARCH=x86_64" >> $config_mak
6870b0babc6Sbellard  echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
6880b0babc6Sbellard  echo "#define TARGET_I386 1" >> $config_h
6890b0babc6Sbellard  echo "#define TARGET_X86_64 1" >> $config_h
69007f4ddbfSbellard  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
69107f4ddbfSbellard    echo "#define USE_KQEMU 1" >> $config_h
69207f4ddbfSbellard  fi
693d3258560Sbellardelif test "$target_cpu" = "mips" ; then
694d3258560Sbellard  echo "TARGET_ARCH=mips" >> $config_mak
695d3258560Sbellard  echo "#define TARGET_ARCH \"mips\"" >> $config_h
696d3258560Sbellard  echo "#define TARGET_MIPS 1" >> $config_h
697de83cd02Sbellardelse
698de83cd02Sbellard  echo "Unsupported target CPU"
699de83cd02Sbellard  exit 1
700de83cd02Sbellardfi
701de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
70297a847bcSbellard  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
70397a847bcSbellard  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
70497a847bcSbellardfi
70597a847bcSbellardif test "$target_softmmu" = "yes" ; then
70697a847bcSbellard  echo "CONFIG_SOFTMMU=yes" >> $config_mak
70797a847bcSbellard  echo "#define CONFIG_SOFTMMU 1" >> $config_h
708de83cd02Sbellardfi
709997344f3Sbellardif test "$target_user_only" = "yes" ; then
710997344f3Sbellard  echo "CONFIG_USER_ONLY=yes" >> $config_mak
711997344f3Sbellard  echo "#define CONFIG_USER_ONLY 1" >> $config_h
712997344f3Sbellardfi
713de83cd02Sbellard
714158142c2Sbellardif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
715158142c2Sbellard  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
716158142c2Sbellard  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
717158142c2Sbellardfi
7187c1f25b4Sbellard# sdl defines
7197c1f25b4Sbellard
7207c1f25b4Sbellardif test "$target_user_only" = "no"; then
7217c1f25b4Sbellard    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
722dbb2c921Sbellard        sdl1=$sdl_static
7237c1f25b4Sbellard    else
724dbb2c921Sbellard        sdl1=$sdl
725dbb2c921Sbellard    fi
726dbb2c921Sbellard    if test "$sdl1" = "yes" ; then
7277c1f25b4Sbellard        echo "#define CONFIG_SDL 1" >> $config_h
7287c1f25b4Sbellard        echo "CONFIG_SDL=yes" >> $config_mak
729dbb2c921Sbellard        if test "$target_softmmu" = "no" -o "$static" = "yes"; then
730dbb2c921Sbellard            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
731dbb2c921Sbellard        else
7327c1f25b4Sbellard            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
7337c1f25b4Sbellard        fi
7347c1f25b4Sbellard        echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
7357c1f25b4Sbellard        if [ "${aa}" = "yes" ] ; then
7367c1f25b4Sbellard            echo -n " `aalib-config --cflags`" >> $config_mak ;
7377c1f25b4Sbellard        fi
7387c1f25b4Sbellard        echo "" >> $config_mak
7397c1f25b4Sbellard    fi
740dbb2c921Sbellardfi
7417c1f25b4Sbellard
7425b0753e0Sbellardif test "$cocoa" = "yes" ; then
7435b0753e0Sbellard    echo "#define CONFIG_COCOA 1" >> $config_h
7445b0753e0Sbellard    echo "CONFIG_COCOA=yes" >> $config_mak
7455b0753e0Sbellardfi
7465b0753e0Sbellard
74797a847bcSbellarddone # for target in $targets
7487d13299dSbellard
7497d13299dSbellard# build tree in object directory if source path is different from current one
7507d13299dSbellardif test "$source_path_used" = "yes" ; then
7517d13299dSbellard    DIRS="tests"
7527d13299dSbellard    FILES="Makefile tests/Makefile"
7537d13299dSbellard    for dir in $DIRS ; do
7547d13299dSbellard            mkdir -p $dir
7557d13299dSbellard    done
7567d13299dSbellard    for f in $FILES ; do
7577d13299dSbellard        ln -sf $source_path/$f $f
7587d13299dSbellard    done
7597d13299dSbellardfi
7607d13299dSbellard
76197a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS
762