xref: /openbmc/qemu/configure (revision 8d5d2d4c)
17d13299dSbellard#!/bin/sh
27d13299dSbellard#
33ef693a0Sbellard# qemu configure script (c) 2003 Fabrice Bellard
47d13299dSbellard#
57d13299dSbellard# set temporary file name
67d13299dSbellardif test ! -z "$TMPDIR" ; then
77d13299dSbellard    TMPDIR1="${TMPDIR}"
87d13299dSbellardelif test ! -z "$TEMPDIR" ; then
97d13299dSbellard    TMPDIR1="${TEMPDIR}"
107d13299dSbellardelse
117d13299dSbellard    TMPDIR1="/tmp"
127d13299dSbellardfi
137d13299dSbellard
143ef693a0SbellardTMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
153ef693a0SbellardTMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
163ef693a0SbellardTMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
173ef693a0SbellardTMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
187d13299dSbellard
197d13299dSbellard# default parameters
2011d9f695Sbellardprefix=""
211e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M"
2243ce4dfeSbellardstatic="no"
237d13299dSbellardcross_prefix=""
247d13299dSbellardcc="gcc"
25328a4240Spbrookgcc3_search="yes"
26d4af3de2Sbalroggcc3_list="gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
277d13299dSbellardhost_cc="gcc"
287d13299dSbellardar="ar"
297d13299dSbellardmake="make"
306a882643Spbrookinstall="install"
317d13299dSbellardstrip="strip"
327d13299dSbellardcpu=`uname -m`
335327cf48Sbellardtarget_list=""
347d13299dSbellardcase "$cpu" in
357d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
3697a847bcSbellard    cpu="i386"
377d13299dSbellard  ;;
38ba68055eSbellard  armv*b)
39808c4954Sbellard    cpu="armv4b"
40808c4954Sbellard  ;;
41ba68055eSbellard  armv*l)
427d13299dSbellard    cpu="armv4l"
437d13299dSbellard  ;;
447d13299dSbellard  alpha)
457d13299dSbellard    cpu="alpha"
467d13299dSbellard  ;;
47295defa5Sbellard  "Power Macintosh"|ppc|ppc64)
487d13299dSbellard    cpu="powerpc"
497d13299dSbellard  ;;
507d13299dSbellard  mips)
517d13299dSbellard    cpu="mips"
527d13299dSbellard  ;;
53fbe4f65bSths  mips64)
54fbe4f65bSths    cpu="mips64"
55fbe4f65bSths  ;;
560e7b8a9fSths  s390*)
57fb3e5849Sbellard    cpu="s390"
58fb3e5849Sbellard  ;;
593142255cSblueswir1  sparc|sun4[cdmuv])
60ae228531Sbellard    cpu="sparc"
61ae228531Sbellard  ;;
62ae228531Sbellard  sparc64)
63ae228531Sbellard    cpu="sparc64"
64ae228531Sbellard  ;;
65a8baa8c5Sbellard  ia64)
66a8baa8c5Sbellard    cpu="ia64"
67a8baa8c5Sbellard  ;;
6838e584a0Sbellard  m68k)
6938e584a0Sbellard    cpu="m68k"
7038e584a0Sbellard  ;;
71bc51c5c9Sbellard  x86_64|amd64)
720b0babc6Sbellard    cpu="x86_64"
73bc51c5c9Sbellard  ;;
747d13299dSbellard  *)
757d13299dSbellard    cpu="unknown"
767d13299dSbellard  ;;
777d13299dSbellardesac
787d13299dSbellardgprof="no"
797d13299dSbellardbigendian="no"
8067b915a5Sbellardmingw32="no"
8167b915a5SbellardEXESUF=""
8267b915a5Sbellardgdbstub="yes"
83443f1376Sbellardslirp="yes"
84fb065187Sbellardadlib="no"
85fb065187Sbellardoss="no"
861d14ffa9Sbellarddsound="no"
871d14ffa9Sbellardcoreaudio="no"
881d14ffa9Sbellardalsa="no"
89102a52e4Sbellardfmod="no"
90102a52e4Sbellardfmod_lib=""
91102a52e4Sbellardfmod_inc=""
92*8d5d2d4cSthsvnc_tls="yes"
93b1a550a0Spbrookbsd="no"
945327cf48Sbellardlinux="no"
95c9ec1fe4Sbellardkqemu="no"
9605c2a3e7Sbellardprofiler="no"
975b0753e0Sbellardcocoa="no"
9897ccc689Sbellardcheck_gfx="yes"
991aff381fSbellardcheck_gcc="yes"
1000a8e90f4Spbrooksoftmmu="yes"
101831b7825Sthslinux_user="no"
102831b7825Sthsdarwin_user="no"
103cc8ae6deSpbrookbuild_docs="no"
104c5937220Spbrookuname_release=""
1057d13299dSbellard
1067d13299dSbellard# OS specific
1077d13299dSbellardtargetos=`uname -s`
1087d13299dSbellardcase $targetos in
109c326e0afSbellardCYGWIN*)
110c326e0afSbellardmingw32="yes"
1116f30fa85SthsOS_CFLAGS="-mno-cygwin"
112db8d7dd1SthsVL_OS_LDFLAGS="-mno-cygwin"
113db8d7dd1Sthsif [ "$cpu" = "i386" ] ; then
114db8d7dd1Sths    kqemu="yes"
115db8d7dd1Sthsfi
116c326e0afSbellard;;
11767b915a5SbellardMINGW32*)
11867b915a5Sbellardmingw32="yes"
119db8d7dd1Sthsif [ "$cpu" = "i386" ] ; then
120db8d7dd1Sths    kqemu="yes"
121db8d7dd1Sthsfi
12267b915a5Sbellard;;
1235c40d2bdSthsGNU/kFreeBSD)
1245c40d2bdSthsoss="yes"
1255c40d2bdSthsif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
1265c40d2bdSths    kqemu="yes"
1275c40d2bdSthsfi
1285c40d2bdSths;;
1297d3505c5SbellardFreeBSD)
1307d3505c5Sbellardbsd="yes"
131fb065187Sbellardoss="yes"
132e99f9060Sbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
13307f4ddbfSbellard    kqemu="yes"
13407f4ddbfSbellardfi
1357d3505c5Sbellard;;
1367d3505c5SbellardNetBSD)
1377d3505c5Sbellardbsd="yes"
138fb065187Sbellardoss="yes"
1397d3505c5Sbellard;;
1407d3505c5SbellardOpenBSD)
1417d3505c5Sbellardbsd="yes"
142fb065187Sbellardoss="yes"
1437d3505c5Sbellard;;
14483fb7adfSbellardDarwin)
14583fb7adfSbellardbsd="yes"
14683fb7adfSbellarddarwin="yes"
147831b7825Sthsdarwin_user="yes"
148fd677642Sthscocoa="yes"
149fd677642Sthscoreaudio="yes"
1506f30fa85SthsOS_CFLAGS="-mdynamic-no-pic"
15183fb7adfSbellard;;
152ec530c81SbellardSunOS)
153ec530c81Sbellard    solaris="yes"
154c2b84fabSths    make="gmake"
155c2b84fabSths    install="ginstall"
1560475a5caSths    needs_libsunmath="no"
157c2b84fabSths    solarisrev=`uname -r | cut -f2 -d.`
158c2b84fabSths    if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
1590475a5caSths        if test "$solarisrev" -le 9 ; then
1600475a5caSths            if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
1610475a5caSths                needs_libsunmath="yes"
1620475a5caSths            else
1630475a5caSths                echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
1640475a5caSths                echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
1650475a5caSths                echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
1660475a5caSths                echo "Studio 11 can be downloaded from www.sun.com."
1670475a5caSths                exit 1
1680475a5caSths            fi
1690475a5caSths        fi
1700475a5caSths        if test "$solarisrev" -ge 9 ; then
171c2b84fabSths            kqemu="yes"
172c2b84fabSths        fi
17386b2bd93Sths    fi
1746b4d2ba1Sths    if test -f /usr/include/sys/soundcard.h ; then
1756b4d2ba1Sths        oss=yes
1766b4d2ba1Sths    fi
177ec530c81Sbellard;;
178fb065187Sbellard*)
179fb065187Sbellardoss="yes"
1805327cf48Sbellardlinux="yes"
181831b7825Sthslinux_user="yes"
18207f4ddbfSbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
183c9ec1fe4Sbellard    kqemu="yes"
184c9ec1fe4Sbellardfi
185fb065187Sbellard;;
1867d13299dSbellardesac
1877d13299dSbellard
1887d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
189b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
1907d3505c5Sbellard    make="gmake"
19183fb7adfSbellard  fi
1927d3505c5Sbellardfi
1937d3505c5Sbellard
1947d13299dSbellard# find source path
195ad064840Spbrooksource_path=`dirname "$0"`
196ad064840Spbrookif [ -z "$source_path" ]; then
1977d13299dSbellard    source_path=`pwd`
198ad064840Spbrookelse
199ad064840Spbrook    source_path=`cd "$source_path"; pwd`
200ad064840Spbrookfi
201ad064840Spbrookif test "$source_path" = `pwd` ; then
2027d13299dSbellard    source_path_used="no"
203ad064840Spbrookelse
204ad064840Spbrook    source_path_used="yes"
2057d13299dSbellardfi
2067d13299dSbellard
2077d13299dSbellardfor opt do
208a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
2097d13299dSbellard  case "$opt" in
2102efc3265Sbellard  --help|-h) show_help=yes
2112efc3265Sbellard  ;;
212b1a550a0Spbrook  --prefix=*) prefix="$optarg"
2137d13299dSbellard  ;;
214b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
21532ce6337Sbellard  ;;
216b1a550a0Spbrook  --source-path=*) source_path="$optarg"
217ad064840Spbrook  source_path_used="yes"
2187d13299dSbellard  ;;
219b1a550a0Spbrook  --cross-prefix=*) cross_prefix="$optarg"
2207d13299dSbellard  ;;
221b1a550a0Spbrook  --cc=*) cc="$optarg"
222328a4240Spbrook  gcc3_search="no"
2237d13299dSbellard  ;;
224b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
22583469015Sbellard  ;;
226b1a550a0Spbrook  --make=*) make="$optarg"
2277d13299dSbellard  ;;
2286a882643Spbrook  --install=*) install="$optarg"
2296a882643Spbrook  ;;
230b1a550a0Spbrook  --extra-cflags=*) CFLAGS="$optarg"
2317d13299dSbellard  ;;
232b1a550a0Spbrook  --extra-ldflags=*) LDFLAGS="$optarg"
2337d13299dSbellard  ;;
234b1a550a0Spbrook  --cpu=*) cpu="$optarg"
2357d13299dSbellard  ;;
236b1a550a0Spbrook  --target-list=*) target_list="$optarg"
237de83cd02Sbellard  ;;
2387d13299dSbellard  --enable-gprof) gprof="yes"
2397d13299dSbellard  ;;
24043ce4dfeSbellard  --static) static="yes"
24143ce4dfeSbellard  ;;
24297a847bcSbellard  --disable-sdl) sdl="no"
24397a847bcSbellard  ;;
2441d14ffa9Sbellard  --enable-coreaudio) coreaudio="yes"
2451d14ffa9Sbellard  ;;
2461d14ffa9Sbellard  --enable-alsa) alsa="yes"
2471d14ffa9Sbellard  ;;
2481d14ffa9Sbellard  --enable-dsound) dsound="yes"
2491d14ffa9Sbellard  ;;
250102a52e4Sbellard  --enable-fmod) fmod="yes"
251102a52e4Sbellard  ;;
252b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
253102a52e4Sbellard  ;;
254b1a550a0Spbrook  --fmod-inc=*) fmod_inc="$optarg"
255102a52e4Sbellard  ;;
256*8d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
257*8d5d2d4cSths  ;;
258b93aebecSbellard  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
25967b915a5Sbellard  ;;
260443f1376Sbellard  --disable-slirp) slirp="no"
261c20709aaSbellard  ;;
262fb065187Sbellard  --enable-adlib) adlib="yes"
263fb065187Sbellard  ;;
264c9ec1fe4Sbellard  --disable-kqemu) kqemu="no"
265c9ec1fe4Sbellard  ;;
26605c2a3e7Sbellard  --enable-profiler) profiler="yes"
26705c2a3e7Sbellard  ;;
2681d14ffa9Sbellard  --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
2695b0753e0Sbellard  ;;
27097ccc689Sbellard  --disable-gfx-check) check_gfx="no"
27197ccc689Sbellard  ;;
2721aff381fSbellard  --disable-gcc-check) check_gcc="no"
2731aff381fSbellard  ;;
274cad25d69Spbrook  --disable-system) softmmu="no"
2750a8e90f4Spbrook  ;;
276cad25d69Spbrook  --enable-system) softmmu="yes"
2770a8e90f4Spbrook  ;;
278831b7825Sths  --disable-linux-user) linux_user="no"
2790a8e90f4Spbrook  ;;
280831b7825Sths  --enable-linux-user) linux_user="yes"
281831b7825Sths  ;;
282831b7825Sths  --disable-darwin-user) darwin_user="no"
283831b7825Sths  ;;
284831b7825Sths  --enable-darwin-user) darwin_user="yes"
2850a8e90f4Spbrook  ;;
286c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
287c5937220Spbrook  ;;
2883142255cSblueswir1  --sparc_cpu=*)
2893142255cSblueswir1      sparc_cpu="$optarg"
2903142255cSblueswir1      case $sparc_cpu in
2913142255cSblueswir1        v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
2923142255cSblueswir1                 target_cpu="sparc"; cpu="sparc" ;;
2933142255cSblueswir1        v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
2943142255cSblueswir1                 target_cpu="sparc"; cpu="sparc" ;;
2953142255cSblueswir1        v9)    SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
2963142255cSblueswir1                 target_cpu="sparc64"; cpu="sparc64" ;;
2973142255cSblueswir1        *)     echo "undefined SPARC architecture. Exiting";exit 1;;
2983142255cSblueswir1      esac
2993142255cSblueswir1  ;;
3007d13299dSbellard  esac
3017d13299dSbellarddone
3027d13299dSbellard
303209afb9eSthsif [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
304209afb9eSths    AIOLIBS=
305209afb9eSthselse
306209afb9eSths    AIOLIBS="-lrt"
307209afb9eSthsfi
308209afb9eSths
3096f30fa85Sths# default flags for all hosts
3106f30fa85SthsCFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
3116f30fa85SthsLDFLAGS="$LDFLAGS -g"
3126f30fa85Sths
3133142255cSblueswir1#
3143142255cSblueswir1# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
3153142255cSblueswir1# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
3163142255cSblueswir1#
3173142255cSblueswir1case $cpu in
3183142255cSblueswir1    sparc) if test -z "$sparc_cpu" ; then
3193142255cSblueswir1               ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
3203142255cSblueswir1               ARCH_LDFLAGS="-m32"
3213142255cSblueswir1           else
3223142255cSblueswir1               ARCH_CFLAGS="${SP_CFLAGS}"
3233142255cSblueswir1               ARCH_LDFLAGS="${SP_LDFLAGS}"
3243142255cSblueswir1           fi
3253142255cSblueswir1           ;;
3263142255cSblueswir1    sparc64) if test -z "$sparc_cpu" ; then
3273142255cSblueswir1               ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
3283142255cSblueswir1               ARCH_LDFLAGS="-m64"
3293142255cSblueswir1           else
3303142255cSblueswir1               ARCH_CFLAGS="${SP_CFLAGS}"
3313142255cSblueswir1               ARCH_LDFLAGS="${SP_LDFLAGS}"
3323142255cSblueswir1           fi
3333142255cSblueswir1           ;;
3343142255cSblueswir1esac
3353142255cSblueswir1
336af5db58eSpbrookif test x"$show_help" = x"yes" ; then
337af5db58eSpbrookcat << EOF
338af5db58eSpbrook
339af5db58eSpbrookUsage: configure [options]
340af5db58eSpbrookOptions: [defaults in brackets after descriptions]
341af5db58eSpbrook
342af5db58eSpbrookEOF
343af5db58eSpbrookecho "Standard options:"
344af5db58eSpbrookecho "  --help                   print this message"
345af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
346af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
347af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
348af5db58eSpbrookecho "  --target-list=LIST       set target list [$target_list]"
349af5db58eSpbrookecho ""
350af5db58eSpbrookecho "kqemu kernel acceleration support:"
351af5db58eSpbrookecho "  --disable-kqemu          disable kqemu support"
352af5db58eSpbrookecho ""
353af5db58eSpbrookecho "Advanced options (experts only):"
354af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
355af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
356af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
357af5db58eSpbrookecho "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
358af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
3596a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
360af5db58eSpbrookecho "  --static                 enable static build [$static]"
361af5db58eSpbrookecho "  --enable-cocoa           enable COCOA (Mac OS X only)"
362af5db58eSpbrookecho "  --enable-mingw32         enable Win32 cross compilation with mingw32"
363af5db58eSpbrookecho "  --enable-adlib           enable Adlib emulation"
364af5db58eSpbrookecho "  --enable-coreaudio       enable Coreaudio audio driver"
365af5db58eSpbrookecho "  --enable-alsa            enable ALSA audio driver"
366af5db58eSpbrookecho "  --enable-fmod            enable FMOD audio driver"
367ed5065e1Sthsecho "  --enable-dsound          enable DirectSound audio driver"
368*8d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
369af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
370af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
371831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
372831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
373831b7825Sthsecho "  --enable-darwin-user     enable all darwin usermode emulation targets"
374831b7825Sthsecho "  --disable-darwin-user    disable all darwin usermode emulation targets"
375af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
376af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
377c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
3783142255cSblueswir1echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
379af5db58eSpbrookecho ""
3805bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
381af5db58eSpbrookexit 1
382af5db58eSpbrookfi
383af5db58eSpbrook
3847d13299dSbellardcc="${cross_prefix}${cc}"
3857d13299dSbellardar="${cross_prefix}${ar}"
3867d13299dSbellardstrip="${cross_prefix}${strip}"
3877d13299dSbellard
388064aae13Spbrook# check that the C compiler works.
389064aae13Spbrookcat > $TMPC <<EOF
390064aae13Spbrookint main(void) {}
391064aae13SpbrookEOF
392064aae13Spbrook
393064aae13Spbrookif $cc -c -o $TMPO $TMPC 2> /dev/null ; then
394064aae13Spbrook  : C compiler works ok
395064aae13Spbrookelse
396064aae13Spbrook    echo "ERROR: \"$cc\" either does not exist or does not work"
397064aae13Spbrook    exit 1
398a7350fa1Sbellardfi
399a7350fa1Sbellard
40067b915a5Sbellardif test "$mingw32" = "yes" ; then
4015327cf48Sbellard    linux="no"
40267b915a5Sbellard    EXESUF=".exe"
4039f059ecaSbellard    oss="no"
40467b915a5Sbellardfi
40567b915a5Sbellard
406328a4240Spbrook# Check for gcc4, error if pre-gcc4
407328a4240Spbrookif test "$check_gcc" = "yes" ; then
408328a4240Spbrook    cat > $TMPC <<EOF
409328a4240Spbrook#if __GNUC__ < 4
410328a4240Spbrook#error gcc3
411328a4240Spbrook#endif
412328a4240Spbrookint main(){return 0;}
413328a4240SpbrookEOF
414328a4240Spbrook    if "$cc" -o $TMPE $TMPC 2> /dev/null ; then
415328a4240Spbrook	echo "WARNING: \"$cc\" looks like gcc 4.x"
416328a4240Spbrook	found_compat_cc="no"
417328a4240Spbrook	if test "$gcc3_search" = "yes" ; then
418328a4240Spbrook	    echo "Looking for gcc 3.x"
419328a4240Spbrook	    for compat_cc in $gcc3_list ; do
420d4af3de2Sbalrog		if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
421328a4240Spbrook		    echo "Found \"$compat_cc\""
4221124426aSpbrook		    cc="$cross_prefix$compat_cc"
423328a4240Spbrook		    found_compat_cc="yes"
424328a4240Spbrook		    break
425328a4240Spbrook		fi
426328a4240Spbrook	    done
427328a4240Spbrook	    if test "$found_compat_cc" = "no" ; then
428328a4240Spbrook		echo "gcc 3.x not found!"
429328a4240Spbrook	    fi
430328a4240Spbrook	fi
431328a4240Spbrook	if test "$found_compat_cc" = "no" ; then
432328a4240Spbrook	    echo "QEMU is known to have problems when compiled with gcc 4.x"
433328a4240Spbrook	    echo "It is recommended that you use gcc 3.x to build QEMU"
434328a4240Spbrook	    echo "To use this compiler anyway, configure with --disable-gcc-check"
435328a4240Spbrook	    exit 1;
436328a4240Spbrook	fi
437328a4240Spbrook    fi
438328a4240Spbrookfi
439328a4240Spbrook
440ec530c81Sbellard#
441ec530c81Sbellard# Solaris specific configure tool chain decisions
442ec530c81Sbellard#
443ec530c81Sbellardif test "$solaris" = "yes" ; then
444ec530c81Sbellard  #
445ec530c81Sbellard  # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
446ec530c81Sbellard  # override the check with --disable-gcc-check
447ec530c81Sbellard  #
448ec530c81Sbellard  if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
449ec530c81Sbellard    solgcc=`which $cc`
450ec530c81Sbellard    if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
451ec530c81Sbellard      echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
452ec530c81Sbellard      echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
453ec530c81Sbellard      echo "or get the latest patch from SunSolve for gcc"
454ec530c81Sbellard      exit 1
455ec530c81Sbellard    fi
456ec530c81Sbellard  fi
457ec530c81Sbellard  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
458ec530c81Sbellard  if test -z "$solinst" ; then
459ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
460ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
461ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
462ec530c81Sbellard    exit 1
463ec530c81Sbellard  fi
464ec530c81Sbellard  if test "$solinst" = "/usr/sbin/install" ; then
465ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
466ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
467ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
468ec530c81Sbellard    exit 1
469ec530c81Sbellard  fi
470ec530c81Sbellard  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
471ec530c81Sbellard  if test -z "$sol_ar" ; then
472ec530c81Sbellard    echo "Error: No path includes ar"
473ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
474ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
475ec530c81Sbellard    fi
476ec530c81Sbellard    exit 1
477ec530c81Sbellard  fi
478ec530c81Sbellardfi
479ec530c81Sbellard
480ec530c81Sbellard
4815327cf48Sbellardif test -z "$target_list" ; then
4825327cf48Sbellard# these targets are portable
4830a8e90f4Spbrook    if [ "$softmmu" = "yes" ] ; then
4840633879fSpbrook        target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc64-softmmu ppcemb-softmmu m68k-softmmu"
4850a8e90f4Spbrook    fi
4865327cf48Sbellard# the following are Linux specific
487831b7825Sths    if [ "$linux_user" = "yes" ] ; then
488cf6c1b16Sj_mayer        target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user ppc-linux-user mips-linux-user mipsel-linux-user m68k-linux-user alpha-linux-user $target_list"
489831b7825Sths    fi
490831b7825Sths# the following are Darwin specific
491831b7825Sths    if [ "$darwin_user" = "yes" ] ; then
492831b7825Sths        target_list="i386-darwin-user ppc-darwin-user $target_list"
4935327cf48Sbellard    fi
4946e20a45fSbellardelse
495b1a550a0Spbrook    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
4965327cf48Sbellardfi
4970a8e90f4Spbrookif test -z "$target_list" ; then
4980a8e90f4Spbrook    echo "No targets enabled"
4990a8e90f4Spbrook    exit 1
5000a8e90f4Spbrookfi
5015327cf48Sbellard
5027d13299dSbellardif test -z "$cross_prefix" ; then
5037d13299dSbellard
5047d13299dSbellard# ---
5057d13299dSbellard# big/little endian test
5067d13299dSbellardcat > $TMPC << EOF
5077d13299dSbellard#include <inttypes.h>
5087d13299dSbellardint main(int argc, char ** argv){
5097d13299dSbellard        volatile uint32_t i=0x01234567;
5107d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
5117d13299dSbellard}
5127d13299dSbellardEOF
5137d13299dSbellard
5147d13299dSbellardif $cc -o $TMPE $TMPC 2> /dev/null ; then
5157d13299dSbellard$TMPE && bigendian="yes"
5167d13299dSbellardelse
5177d13299dSbellardecho big/little test failed
5187d13299dSbellardfi
5197d13299dSbellard
5207d13299dSbellardelse
5217d13299dSbellard
5227d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
523fbe4f65bSthsif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "mips64" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
5247d13299dSbellard    bigendian="yes"
5257d13299dSbellardfi
5267d13299dSbellard
5277d13299dSbellardfi
5287d13299dSbellard
529b6853697Sbellard# host long bits test
530b6853697Sbellardhostlongbits="32"
531b6853697Sbellardif test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
532b6853697Sbellard    hostlongbits="64"
533b6853697Sbellardfi
534b6853697Sbellard
535e8cd23deSbellard# check gcc options support
53604369ff2Sbellardcat > $TMPC <<EOF
53704369ff2Sbellardint main(void) {
53804369ff2Sbellard}
53904369ff2SbellardEOF
54004369ff2Sbellard
54111d9f695Sbellard##########################################
54211d9f695Sbellard# SDL probe
54311d9f695Sbellard
54411d9f695Sbellardsdl_too_old=no
54511d9f695Sbellard
54611d9f695Sbellardif test -z "$sdl" ; then
547a6e022adSbellard    sdl_config="sdl-config"
548a6e022adSbellard    sdl=no
5497c1f25b4Sbellard    sdl_static=no
550a6e022adSbellard
551a6e022adSbellard    if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
552a6e022adSbellard    # win32 cross compilation case
553a6e022adSbellard        sdl_config="i386-mingw32msvc-sdl-config"
554a6e022adSbellard        sdl=yes
555a6e022adSbellard    else
556a6e022adSbellard        # normal SDL probe
55711d9f695Sbellardcat > $TMPC << EOF
55811d9f695Sbellard#include <SDL.h>
55911d9f695Sbellard#undef main /* We don't want SDL to override our main() */
56011d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
56111d9f695SbellardEOF
56220b40c6aSths        if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
563a6e022adSbellard            _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
56411d9f695Sbellard            if test "$_sdlversion" -lt 121 ; then
56511d9f695Sbellard                sdl_too_old=yes
56611d9f695Sbellard            else
567fd677642Sths                if test "$cocoa" = "no" ; then
56811d9f695Sbellard                    sdl=yes
56911d9f695Sbellard                fi
570fd677642Sths            fi
5717c1f25b4Sbellard
5727c1f25b4Sbellard            # static link with sdl ?
5737c1f25b4Sbellard            if test "$sdl" = "yes" ; then
5747c1f25b4Sbellard                aa="no"
575e14a693dSths                `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
576e14a693dSths                sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
5777c1f25b4Sbellard                if [ "$aa" = "yes" ] ; then
578d8d8aa4eSbellard                    sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
57911d9f695Sbellard                fi
58011d9f695Sbellard
5817c1f25b4Sbellard                if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
5827c1f25b4Sbellard                    sdl_static=yes
5837c1f25b4Sbellard                fi
5847c1f25b4Sbellard            fi # static link
5857c1f25b4Sbellard        fi # sdl compile test
586a6e022adSbellard    fi # cross compilation
587fd677642Sthselse
588fd677642Sths    # Make sure to disable cocoa if sdl was set
589fd677642Sths    if test "$sdl" = "yes" ; then
590fd677642Sths       cocoa="no"
591fd677642Sths       coreaudio="no"
592fd677642Sths    fi
593a6e022adSbellardfi # -z $sdl
59411d9f695Sbellard
5958f28f3fbSths##########################################
596*8d5d2d4cSths# VNC TLS detection
597*8d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
598*8d5d2d4cSths  `pkg-config gnutls` || vnc_tls="no"
599*8d5d2d4cSthsfi
600*8d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
601*8d5d2d4cSths  vnc_tls_cflags=`pkg-config --cflags gnutls`
602*8d5d2d4cSths  vnc_tls_libs=`pkg-config --libs gnutls`
603*8d5d2d4cSthsfi
604*8d5d2d4cSths
605*8d5d2d4cSths##########################################
6068f28f3fbSths# alsa sound support libraries
6078f28f3fbSths
6088f28f3fbSthsif test "$alsa" = "yes" ; then
6098f28f3fbSths  cat > $TMPC << EOF
6108f28f3fbSths#include <alsa/asoundlib.h>
6118f28f3fbSthsint main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
6128f28f3fbSthsEOF
6138f28f3fbSths  if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
6148f28f3fbSths    :
6158f28f3fbSths  else
6168f28f3fbSths    echo
6178f28f3fbSths    echo "Error: Could not find alsa"
6188f28f3fbSths    echo "Make sure to have the alsa libs and headers installed."
6198f28f3fbSths    echo
6208f28f3fbSths    exit 1
6218f28f3fbSths  fi
6228f28f3fbSthsfi
6238f28f3fbSths
624cc8ae6deSpbrook# Check if tools are available to build documentation.
6256c591867Sthsif [ -x "`which texi2html 2>/dev/null`" ] && \
6266c591867Sths   [ -x "`which pod2man 2>/dev/null`" ]; then
627cc8ae6deSpbrook  build_docs="yes"
628cc8ae6deSpbrookfi
629cc8ae6deSpbrook
63011d9f695Sbellardif test "$mingw32" = "yes" ; then
63111d9f695Sbellard  if test -z "$prefix" ; then
63211d9f695Sbellard      prefix="/c/Program Files/Qemu"
63311d9f695Sbellard  fi
634308c3593Spbrook  mansuffix=""
635308c3593Spbrook  datasuffix=""
636308c3593Spbrook  docsuffix=""
637308c3593Spbrook  binsuffix=""
63811d9f695Sbellardelse
63911d9f695Sbellard  if test -z "$prefix" ; then
64011d9f695Sbellard      prefix="/usr/local"
64111d9f695Sbellard  fi
642308c3593Spbrook  mansuffix="/share/man"
643308c3593Spbrook  datasuffix="/share/qemu"
644308c3593Spbrook  docsuffix="/share/doc/qemu"
645308c3593Spbrook  binsuffix="/bin"
64611d9f695Sbellardfi
6475a67135aSbellard
6487d13299dSbellardecho "Install prefix    $prefix"
649308c3593Spbrookecho "BIOS directory    $prefix$datasuffix"
650308c3593Spbrookecho "binary directory  $prefix$binsuffix"
65111d9f695Sbellardif test "$mingw32" = "no" ; then
652308c3593Spbrookecho "Manual directory  $prefix$mansuffix"
65343ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
65411d9f695Sbellardfi
6555a67135aSbellardecho "Source path       $source_path"
6567d13299dSbellardecho "C compiler        $cc"
65783469015Sbellardecho "Host C compiler   $host_cc"
6587d13299dSbellardecho "make              $make"
6596a882643Spbrookecho "install           $install"
660a98fd896Sbellardecho "host CPU          $cpu"
661de83cd02Sbellardecho "host big endian   $bigendian"
66297a847bcSbellardecho "target list       $target_list"
6637d13299dSbellardecho "gprof enabled     $gprof"
66405c2a3e7Sbellardecho "profiler          $profiler"
66543ce4dfeSbellardecho "static build      $static"
6665b0753e0Sbellardif test "$darwin" = "yes" ; then
6675b0753e0Sbellard    echo "Cocoa support     $cocoa"
6685b0753e0Sbellardfi
66997a847bcSbellardecho "SDL support       $sdl"
670e4afee97Sbellardif test "$sdl" != "no" ; then
6717c1f25b4Sbellard    echo "SDL static link   $sdl_static"
672e4afee97Sbellardfi
67367b915a5Sbellardecho "mingw32 support   $mingw32"
674fb065187Sbellardecho "Adlib support     $adlib"
6751d14ffa9Sbellardecho "CoreAudio support $coreaudio"
6761d14ffa9Sbellardecho "ALSA support      $alsa"
6771d14ffa9Sbellardecho "DSound support    $dsound"
6781d14ffa9Sbellardif test "$fmod" = "yes"; then
6791d14ffa9Sbellard    if test -z $fmod_lib || test -z $fmod_inc; then
6801d14ffa9Sbellard        echo
6811d14ffa9Sbellard        echo "Error: You must specify path to FMOD library and headers"
6821d14ffa9Sbellard        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
6831d14ffa9Sbellard        echo
6841d14ffa9Sbellard        exit 1
6851d14ffa9Sbellard    fi
686b1a550a0Spbrook    fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
687b1a550a0Spbrookelse
688b1a550a0Spbrook    fmod_support=""
689102a52e4Sbellardfi
690b1a550a0Spbrookecho "FMOD support      $fmod $fmod_support"
6916b4d2ba1Sthsecho "OSS support       $oss"
692*8d5d2d4cSthsecho "VNC TLS support   $vnc_tls"
693*8d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
694*8d5d2d4cSths    echo "    TLS CFLAGS    $vnc_tls_cflags"
695*8d5d2d4cSths    echo "    TLS LIBS      $vnc_tls_libs"
696*8d5d2d4cSthsfi
6973142255cSblueswir1if test -n "$sparc_cpu"; then
6983142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
6993142255cSblueswir1fi
70007f4ddbfSbellardecho "kqemu support     $kqemu"
701cc8ae6deSpbrookecho "Documentation     $build_docs"
702c5937220Spbrook[ ! -z "$uname_release" ] && \
703c5937220Spbrookecho "uname -r          $uname_release"
70467b915a5Sbellard
70597a847bcSbellardif test $sdl_too_old = "yes"; then
70624b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
707e8cd23deSbellardfi
70820b40c6aSthsif [ -s /tmp/qemu-$$-sdl-config.log ]; then
70920b40c6aSths  echo "The error log from compiling the libSDL test is: "
71020b40c6aSths  cat /tmp/qemu-$$-sdl-config.log
71120b40c6aSthsfi
71220b40c6aSthsrm -f /tmp/qemu-$$-sdl-config.log
71324b55b96Sbellard#if test "$sdl_static" = "no"; then
71424b55b96Sbellard#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
71524b55b96Sbellard#fi
71697a847bcSbellardconfig_mak="config-host.mak"
71797a847bcSbellardconfig_h="config-host.h"
71897a847bcSbellard
7197c1f25b4Sbellard#echo "Creating $config_mak and $config_h"
72097a847bcSbellard
72115d9ca0fSthstest -f $config_h && mv $config_h ${config_h}~
72215d9ca0fSths
72397a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
72429517134Spbrookecho "# Configured with: $0 $@" >> $config_mak
72597a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
72697a847bcSbellard
72797a847bcSbellardecho "prefix=$prefix" >> $config_mak
728308c3593Spbrookecho "bindir=\${prefix}$binsuffix" >> $config_mak
729308c3593Spbrookecho "mandir=\${prefix}$mansuffix" >> $config_mak
730308c3593Spbrookecho "datadir=\${prefix}$datasuffix" >> $config_mak
7314ad5b06dSthsecho "docdir=\${prefix}$docsuffix" >> $config_mak
732308c3593Spbrookecho "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
73397a847bcSbellardecho "MAKE=$make" >> $config_mak
7346a882643Spbrookecho "INSTALL=$install" >> $config_mak
73597a847bcSbellardecho "CC=$cc" >> $config_mak
73697a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak
73797a847bcSbellardecho "AR=$ar" >> $config_mak
73897a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak
7396f30fa85Sthsecho "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
7403142255cSblueswir1echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
741db8d7dd1Sthsecho "VL_OS_LDFLAGS=$VL_OS_LDFLAGS" >> $config_mak
7423142255cSblueswir1echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
7433142255cSblueswir1echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
74497a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak
74597a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak
74667b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak
74770956b77Sthsecho "AIOLIBS=$AIOLIBS" >> $config_mak
74897a847bcSbellardif test "$cpu" = "i386" ; then
74997a847bcSbellard  echo "ARCH=i386" >> $config_mak
75097a847bcSbellard  echo "#define HOST_I386 1" >> $config_h
7510b0babc6Sbellardelif test "$cpu" = "x86_64" ; then
7520b0babc6Sbellard  echo "ARCH=x86_64" >> $config_mak
7530b0babc6Sbellard  echo "#define HOST_X86_64 1" >> $config_h
754808c4954Sbellardelif test "$cpu" = "armv4b" ; then
755808c4954Sbellard  echo "ARCH=arm" >> $config_mak
756808c4954Sbellard  echo "#define HOST_ARM 1" >> $config_h
7577d13299dSbellardelif test "$cpu" = "armv4l" ; then
75897a847bcSbellard  echo "ARCH=arm" >> $config_mak
75997a847bcSbellard  echo "#define HOST_ARM 1" >> $config_h
7607d13299dSbellardelif test "$cpu" = "powerpc" ; then
76197a847bcSbellard  echo "ARCH=ppc" >> $config_mak
76297a847bcSbellard  echo "#define HOST_PPC 1" >> $config_h
7637d13299dSbellardelif test "$cpu" = "mips" ; then
76497a847bcSbellard  echo "ARCH=mips" >> $config_mak
76597a847bcSbellard  echo "#define HOST_MIPS 1" >> $config_h
766fbe4f65bSthselif test "$cpu" = "mips64" ; then
767fbe4f65bSths  echo "ARCH=mips64" >> $config_mak
768fbe4f65bSths  echo "#define HOST_MIPS64 1" >> $config_h
769fb3e5849Sbellardelif test "$cpu" = "s390" ; then
77097a847bcSbellard  echo "ARCH=s390" >> $config_mak
77197a847bcSbellard  echo "#define HOST_S390 1" >> $config_h
772295defa5Sbellardelif test "$cpu" = "alpha" ; then
77397a847bcSbellard  echo "ARCH=alpha" >> $config_mak
77497a847bcSbellard  echo "#define HOST_ALPHA 1" >> $config_h
775ae228531Sbellardelif test "$cpu" = "sparc" ; then
77697a847bcSbellard  echo "ARCH=sparc" >> $config_mak
77797a847bcSbellard  echo "#define HOST_SPARC 1" >> $config_h
778ae228531Sbellardelif test "$cpu" = "sparc64" ; then
77997a847bcSbellard  echo "ARCH=sparc64" >> $config_mak
78097a847bcSbellard  echo "#define HOST_SPARC64 1" >> $config_h
781a8baa8c5Sbellardelif test "$cpu" = "ia64" ; then
78297a847bcSbellard  echo "ARCH=ia64" >> $config_mak
78397a847bcSbellard  echo "#define HOST_IA64 1" >> $config_h
78438e584a0Sbellardelif test "$cpu" = "m68k" ; then
78538ca2abcSbellard  echo "ARCH=m68k" >> $config_mak
78638ca2abcSbellard  echo "#define HOST_M68K 1" >> $config_h
7877d13299dSbellardelse
7883142255cSblueswir1  echo "Unsupported CPU = $cpu"
7897d13299dSbellard  exit 1
7907d13299dSbellardfi
7917d13299dSbellardif test "$bigendian" = "yes" ; then
79297a847bcSbellard  echo "WORDS_BIGENDIAN=yes" >> $config_mak
79397a847bcSbellard  echo "#define WORDS_BIGENDIAN 1" >> $config_h
79497a847bcSbellardfi
795b6853697Sbellardecho "#define HOST_LONG_BITS $hostlongbits" >> $config_h
79667b915a5Sbellardif test "$mingw32" = "yes" ; then
79767b915a5Sbellard  echo "CONFIG_WIN32=yes" >> $config_mak
79811d9f695Sbellard  echo "#define CONFIG_WIN32 1" >> $config_h
799210fa556Spbrookelse
800210fa556Spbrook  cat > $TMPC << EOF
801210fa556Spbrook#include <byteswap.h>
802210fa556Spbrookint main(void) { return bswap_32(0); }
803210fa556SpbrookEOF
804210fa556Spbrook  if $cc -o $TMPE $TMPC 2> /dev/null ; then
80597a847bcSbellard    echo "#define HAVE_BYTESWAP_H 1" >> $config_h
80667b915a5Sbellard  fi
807210fa556Spbrookfi
80883fb7adfSbellardif test "$darwin" = "yes" ; then
80983fb7adfSbellard  echo "CONFIG_DARWIN=yes" >> $config_mak
81083fb7adfSbellard  echo "#define CONFIG_DARWIN 1" >> $config_h
81183fb7adfSbellardfi
812ec530c81Sbellardif test "$solaris" = "yes" ; then
813ec530c81Sbellard  echo "CONFIG_SOLARIS=yes" >> $config_mak
81438cfa06cSbellard  echo "#define HOST_SOLARIS $solarisrev" >> $config_h
8150475a5caSths  if test "$needs_libsunmath" = "yes" ; then
8160475a5caSths    echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
8170475a5caSths    echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
8180475a5caSths  fi
819ec530c81Sbellardfi
8203142255cSblueswir1if test -n "$sparc_cpu"; then
8213142255cSblueswir1  echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
8223142255cSblueswir1  echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
8233142255cSblueswir1fi
82467b915a5Sbellardif test "$gdbstub" = "yes" ; then
82567b915a5Sbellard  echo "CONFIG_GDBSTUB=yes" >> $config_mak
82667b915a5Sbellard  echo "#define CONFIG_GDBSTUB 1" >> $config_h
82767b915a5Sbellardfi
82897a847bcSbellardif test "$gprof" = "yes" ; then
82997a847bcSbellard  echo "TARGET_GPROF=yes" >> $config_mak
83097a847bcSbellard  echo "#define HAVE_GPROF 1" >> $config_h
83197a847bcSbellardfi
83297a847bcSbellardif test "$static" = "yes" ; then
83397a847bcSbellard  echo "CONFIG_STATIC=yes" >> $config_mak
83450863472Sbellard  echo "#define CONFIG_STATIC 1" >> $config_h
83597a847bcSbellardfi
83605c2a3e7Sbellardif test $profiler = "yes" ; then
83705c2a3e7Sbellard  echo "#define CONFIG_PROFILER 1" >> $config_h
83805c2a3e7Sbellardfi
839c20709aaSbellardif test "$slirp" = "yes" ; then
840c20709aaSbellard  echo "CONFIG_SLIRP=yes" >> $config_mak
841c20709aaSbellard  echo "#define CONFIG_SLIRP 1" >> $config_h
842c20709aaSbellardfi
843fb065187Sbellardif test "$adlib" = "yes" ; then
844fb065187Sbellard  echo "CONFIG_ADLIB=yes" >> $config_mak
845fb065187Sbellard  echo "#define CONFIG_ADLIB 1" >> $config_h
846fb065187Sbellardfi
847fb065187Sbellardif test "$oss" = "yes" ; then
848fb065187Sbellard  echo "CONFIG_OSS=yes" >> $config_mak
849fb065187Sbellard  echo "#define CONFIG_OSS 1" >> $config_h
850fb065187Sbellardfi
8511d14ffa9Sbellardif test "$coreaudio" = "yes" ; then
8521d14ffa9Sbellard  echo "CONFIG_COREAUDIO=yes" >> $config_mak
8531d14ffa9Sbellard  echo "#define CONFIG_COREAUDIO 1" >> $config_h
8541d14ffa9Sbellardfi
8551d14ffa9Sbellardif test "$alsa" = "yes" ; then
8561d14ffa9Sbellard  echo "CONFIG_ALSA=yes" >> $config_mak
8571d14ffa9Sbellard  echo "#define CONFIG_ALSA 1" >> $config_h
8581d14ffa9Sbellardfi
8591d14ffa9Sbellardif test "$dsound" = "yes" ; then
8601d14ffa9Sbellard  echo "CONFIG_DSOUND=yes" >> $config_mak
8611d14ffa9Sbellard  echo "#define CONFIG_DSOUND 1" >> $config_h
8621d14ffa9Sbellardfi
863102a52e4Sbellardif test "$fmod" = "yes" ; then
864102a52e4Sbellard  echo "CONFIG_FMOD=yes" >> $config_mak
865102a52e4Sbellard  echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
866102a52e4Sbellard  echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
867102a52e4Sbellard  echo "#define CONFIG_FMOD 1" >> $config_h
868102a52e4Sbellardfi
869*8d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
870*8d5d2d4cSths  echo "CONFIG_VNC_TLS=yes" >> $config_mak
871*8d5d2d4cSths  echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
872*8d5d2d4cSths  echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
873*8d5d2d4cSths  echo "#define CONFIG_VNC_TLS 1" >> $config_h
874*8d5d2d4cSthsfi
875b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
876b1a550a0Spbrookecho "VERSION=$qemu_version" >>$config_mak
877d4b8f039Spbrookecho "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
87897a847bcSbellard
87997a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak
880ad064840Spbrookif [ "$source_path_used" = "yes" ]; then
881ad064840Spbrook  echo "VPATH=$source_path" >> $config_mak
882ad064840Spbrookfi
88397a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak
884cc8ae6deSpbrookif [ "$build_docs" = "yes" ] ; then
885cc8ae6deSpbrook  echo "BUILD_DOCS=yes" >> $config_mak
886cc8ae6deSpbrookfi
88797a847bcSbellard
88883fb7adfSbellard# XXX: suppress that
8897d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
89043003046Sbellard  echo "#define O_LARGEFILE 0" >> $config_h
89143003046Sbellard  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
8927d3505c5Sbellard  echo "#define _BSD 1" >> $config_h
8937d3505c5Sbellardfi
8947d3505c5Sbellard
895c5937220Spbrookecho "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
896c5937220Spbrook
89715d9ca0fSthstest -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
89815d9ca0fSths
89997a847bcSbellardfor target in $target_list; do
90097a847bcSbellardtarget_dir="$target"
90197a847bcSbellardconfig_mak=$target_dir/config.mak
90297a847bcSbellardconfig_h=$target_dir/config.h
90397a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1`
90497a847bcSbellardtarget_bigendian="no"
905808c4954Sbellard[ "$target_cpu" = "armeb" ] && target_bigendian=yes
9061e43adfcSbellard[ "$target_cpu" = "sparc" ] && target_bigendian=yes
90764b3ab24Sbellard[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
90867867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes
909a2458627Sbellard[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
910d4082e95Sj_mayer[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
911d3258560Sbellard[ "$target_cpu" = "mips" ] && target_bigendian=yes
912fbe4f65bSths[ "$target_cpu" = "mips64" ] && target_bigendian=yes
913908f52b0Spbrook[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
914e6e5906bSpbrook[ "$target_cpu" = "m68k" ] && target_bigendian=yes
91597a847bcSbellardtarget_softmmu="no"
916997344f3Sbellardtarget_user_only="no"
917831b7825Sthstarget_linux_user="no"
918831b7825Sthstarget_darwin_user="no"
9199e407a85Spbrookcase "$target" in
9209e407a85Spbrook  ${target_cpu}-softmmu)
9219e407a85Spbrook    target_softmmu="yes"
9229e407a85Spbrook    ;;
9239e407a85Spbrook  ${target_cpu}-linux-user)
9249e407a85Spbrook    target_user_only="yes"
9259e407a85Spbrook    target_linux_user="yes"
9269e407a85Spbrook    ;;
9279e407a85Spbrook  ${target_cpu}-darwin-user)
9289e407a85Spbrook    target_user_only="yes"
929831b7825Sths    target_darwin_user="yes"
9309e407a85Spbrook    ;;
9319e407a85Spbrook  *)
9329e407a85Spbrook    echo "ERROR: Target '$target' not recognised"
9339e407a85Spbrook    exit 1
9349e407a85Spbrook    ;;
9359e407a85Spbrookesac
936831b7825Sths
93797ccc689Sbellardif test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
93897ccc689Sbellard        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
93997ccc689Sbellard    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
9409c038506Spbrook    echo "To build QEMU without graphical output configure with --disable-gfx-check"
94197ccc689Sbellard    echo "Note that this will disable all output from the virtual graphics card."
94297ccc689Sbellard    exit 1;
94397ccc689Sbellardfi
94497ccc689Sbellard
9457c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
94697a847bcSbellard
94715d9ca0fSthstest -f $config_h && mv $config_h ${config_h}~
94815d9ca0fSths
94997a847bcSbellardmkdir -p $target_dir
950158142c2Sbellardmkdir -p $target_dir/fpu
951831b7825Sthsif test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
95269de927cSbellard  mkdir -p $target_dir/nwfpe
95369de927cSbellardfi
954a7e61ed4Sbellardif test "$target_user_only" = "no" ; then
955a7e61ed4Sbellard  mkdir -p $target_dir/slirp
956a7e61ed4Sbellardfi
95769de927cSbellard
958ec530c81Sbellard#
959ec530c81Sbellard# don't use ln -sf as not all "ln -sf" over write the file/link
960ec530c81Sbellard#
961ec530c81Sbellardrm -f $target_dir/Makefile
962ec530c81Sbellardln -s $source_path/Makefile.target $target_dir/Makefile
963ec530c81Sbellard
96497a847bcSbellard
96597a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
96697a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
96797a847bcSbellard
96897a847bcSbellard
96997a847bcSbellardecho "include ../config-host.mak" >> $config_mak
97097a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h
9711e43adfcSbellard
972e5fe0c52Spbrookbflt="no"
9731e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
9741e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
97597a847bcSbellard
97697a847bcSbellardif test "$target_cpu" = "i386" ; then
97797a847bcSbellard  echo "TARGET_ARCH=i386" >> $config_mak
97897a847bcSbellard  echo "#define TARGET_ARCH \"i386\"" >> $config_h
97997a847bcSbellard  echo "#define TARGET_I386 1" >> $config_h
98007f4ddbfSbellard  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
981824d560fSbellard    echo "#define USE_KQEMU 1" >> $config_h
982824d560fSbellard  fi
983808c4954Sbellardelif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
98497a847bcSbellard  echo "TARGET_ARCH=arm" >> $config_mak
98597a847bcSbellard  echo "#define TARGET_ARCH \"arm\"" >> $config_h
98697a847bcSbellard  echo "#define TARGET_ARM 1" >> $config_h
987e5fe0c52Spbrook  bflt="yes"
9881e43adfcSbellardelif test "$target_cpu" = "sparc" ; then
9891e43adfcSbellard  echo "TARGET_ARCH=sparc" >> $config_mak
9901e43adfcSbellard  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
9911e43adfcSbellard  echo "#define TARGET_SPARC 1" >> $config_h
99264b3ab24Sbellardelif test "$target_cpu" = "sparc64" ; then
99364b3ab24Sbellard  echo "TARGET_ARCH=sparc64" >> $config_mak
99464b3ab24Sbellard  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
99564b3ab24Sbellard  echo "#define TARGET_SPARC 1" >> $config_h
99664b3ab24Sbellard  echo "#define TARGET_SPARC64 1" >> $config_h
99767867308Sbellardelif test "$target_cpu" = "ppc" ; then
99867867308Sbellard  echo "TARGET_ARCH=ppc" >> $config_mak
99967867308Sbellard  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
100067867308Sbellard  echo "#define TARGET_PPC 1" >> $config_h
1001a2458627Sbellardelif test "$target_cpu" = "ppc64" ; then
1002a2458627Sbellard  echo "TARGET_ARCH=ppc64" >> $config_mak
1003a2458627Sbellard  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1004a2458627Sbellard  echo "#define TARGET_PPC 1" >> $config_h
1005a2458627Sbellard  echo "#define TARGET_PPC64 1" >> $config_h
1006d4082e95Sj_mayerelif test "$target_cpu" = "ppcemb" ; then
1007d4082e95Sj_mayer  echo "TARGET_ARCH=ppcemb" >> $config_mak
1008d4082e95Sj_mayer  echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1009d4082e95Sj_mayer  echo "#define TARGET_PPC 1" >> $config_h
1010d4082e95Sj_mayer  echo "#define TARGET_PPCEMB 1" >> $config_h
10110b0babc6Sbellardelif test "$target_cpu" = "x86_64" ; then
10120b0babc6Sbellard  echo "TARGET_ARCH=x86_64" >> $config_mak
10130b0babc6Sbellard  echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
10140b0babc6Sbellard  echo "#define TARGET_I386 1" >> $config_h
10150b0babc6Sbellard  echo "#define TARGET_X86_64 1" >> $config_h
101607f4ddbfSbellard  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
101707f4ddbfSbellard    echo "#define USE_KQEMU 1" >> $config_h
101807f4ddbfSbellard  fi
1019c20eb473Sbellardelif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
1020d3258560Sbellard  echo "TARGET_ARCH=mips" >> $config_mak
1021d3258560Sbellard  echo "#define TARGET_ARCH \"mips\"" >> $config_h
1022d3258560Sbellard  echo "#define TARGET_MIPS 1" >> $config_h
10236ea83fedSbellard  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
10246ea83fedSbellard  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1025fbe4f65bSthselif test "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el" ; then
1026fbe4f65bSths  echo "TARGET_ARCH=mips64" >> $config_mak
1027fbe4f65bSths  echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1028fbe4f65bSths  echo "#define TARGET_MIPS 1" >> $config_h
1029fbe4f65bSths  echo "#define TARGET_MIPS64 1" >> $config_h
1030fbe4f65bSths  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1031fbe4f65bSths  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1032908f52b0Spbrookelif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
1033fdf9b3e8Sbellard  echo "TARGET_ARCH=sh4" >> $config_mak
1034fdf9b3e8Sbellard  echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1035fdf9b3e8Sbellard  echo "#define TARGET_SH4 1" >> $config_h
10364dbed897Spbrook  bflt="yes"
1037e6e5906bSpbrookelif test "$target_cpu" = "m68k" ; then
1038e6e5906bSpbrook  echo "TARGET_ARCH=m68k" >> $config_mak
1039e6e5906bSpbrook  echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1040e6e5906bSpbrook  echo "#define TARGET_M68K 1" >> $config_h
1041e6e5906bSpbrook  bflt="yes"
1042cf6c1b16Sj_mayerelif test "$target_cpu" = "alpha" ; then
1043cf6c1b16Sj_mayer  echo "TARGET_ARCH=alpha" >> $config_mak
1044cf6c1b16Sj_mayer  echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1045cf6c1b16Sj_mayer  echo "#define TARGET_ALPHA 1" >> $config_h
1046de83cd02Sbellardelse
1047de83cd02Sbellard  echo "Unsupported target CPU"
1048de83cd02Sbellard  exit 1
1049de83cd02Sbellardfi
1050de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
105197a847bcSbellard  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
105297a847bcSbellard  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
105397a847bcSbellardfi
105497a847bcSbellardif test "$target_softmmu" = "yes" ; then
105597a847bcSbellard  echo "CONFIG_SOFTMMU=yes" >> $config_mak
105697a847bcSbellard  echo "#define CONFIG_SOFTMMU 1" >> $config_h
1057de83cd02Sbellardfi
1058997344f3Sbellardif test "$target_user_only" = "yes" ; then
1059997344f3Sbellard  echo "CONFIG_USER_ONLY=yes" >> $config_mak
1060997344f3Sbellard  echo "#define CONFIG_USER_ONLY 1" >> $config_h
1061997344f3Sbellardfi
1062831b7825Sthsif test "$target_linux_user" = "yes" ; then
1063831b7825Sths  echo "CONFIG_LINUX_USER=yes" >> $config_mak
1064831b7825Sths  echo "#define CONFIG_LINUX_USER 1" >> $config_h
1065831b7825Sthsfi
1066831b7825Sthsif test "$target_darwin_user" = "yes" ; then
1067831b7825Sths  echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1068831b7825Sths  echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1069831b7825Sthsfi
1070de83cd02Sbellard
1071e6e5906bSpbrookif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
1072158142c2Sbellard  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1073158142c2Sbellard  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1074158142c2Sbellardfi
1075e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1076e5fe0c52Spbrook  echo "TARGET_HAS_BFLT=yes" >> $config_mak
1077e5fe0c52Spbrook  echo "#define TARGET_HAS_BFLT 1" >> $config_h
1078e5fe0c52Spbrookfi
10797c1f25b4Sbellard# sdl defines
10807c1f25b4Sbellard
10817c1f25b4Sbellardif test "$target_user_only" = "no"; then
10827c1f25b4Sbellard    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1083dbb2c921Sbellard        sdl1=$sdl_static
10847c1f25b4Sbellard    else
1085dbb2c921Sbellard        sdl1=$sdl
1086dbb2c921Sbellard    fi
1087dbb2c921Sbellard    if test "$sdl1" = "yes" ; then
10887c1f25b4Sbellard        echo "#define CONFIG_SDL 1" >> $config_h
10897c1f25b4Sbellard        echo "CONFIG_SDL=yes" >> $config_mak
1090dbb2c921Sbellard        if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1091dbb2c921Sbellard            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1092dbb2c921Sbellard        else
10937c1f25b4Sbellard            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
10947c1f25b4Sbellard        fi
10957c1f25b4Sbellard        if [ "${aa}" = "yes" ] ; then
1096b1a550a0Spbrook            echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1097b1a550a0Spbrook        else
1098b1a550a0Spbrook            echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
10997c1f25b4Sbellard        fi
11007c1f25b4Sbellard    fi
1101dbb2c921Sbellardfi
11027c1f25b4Sbellard
11035b0753e0Sbellardif test "$cocoa" = "yes" ; then
11045b0753e0Sbellard    echo "#define CONFIG_COCOA 1" >> $config_h
11055b0753e0Sbellard    echo "CONFIG_COCOA=yes" >> $config_mak
11065b0753e0Sbellardfi
11075b0753e0Sbellard
110815d9ca0fSthstest -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
110915d9ca0fSths
111097a847bcSbellarddone # for target in $targets
11117d13299dSbellard
11127d13299dSbellard# build tree in object directory if source path is different from current one
11137d13299dSbellardif test "$source_path_used" = "yes" ; then
11147d13299dSbellard    DIRS="tests"
11157d13299dSbellard    FILES="Makefile tests/Makefile"
11167d13299dSbellard    for dir in $DIRS ; do
11177d13299dSbellard            mkdir -p $dir
11187d13299dSbellard    done
1119ec530c81Sbellard    # remove the link and recreate it, as not all "ln -sf" overwrite the link
11207d13299dSbellard    for f in $FILES ; do
1121ec530c81Sbellard        rm -f $f
1122ec530c81Sbellard        ln -s $source_path/$f $f
11237d13299dSbellard    done
11247d13299dSbellardfi
11257d13299dSbellard
112697a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS
1127