blob: 7754774d617cc122db7a7fd65cdff4eb5f82177f [file] [log] [blame]
bellard7d132992003-03-06 23:23:54 +00001#!/bin/sh
2#
bellard3ef693a2003-03-23 20:17:16 +00003# qemu configure script (c) 2003 Fabrice Bellard
bellard7d132992003-03-06 23:23:54 +00004#
5# set temporary file name
6if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10else
11 TMPDIR1="/tmp"
12fi
13
bellard3ef693a2003-03-23 20:17:16 +000014TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
bellard7d132992003-03-06 23:23:54 +000018
19# default parameters
bellard11d9f692004-04-02 20:55:59 +000020prefix=""
bellard1e43adf2003-09-30 20:54:24 +000021interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000022static="no"
bellard7d132992003-03-06 23:23:54 +000023cross_prefix=""
24cc="gcc"
pbrook328a4242006-12-19 03:31:34 +000025gcc3_search="yes"
26gcc3_list="gcc-3.4 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"
bellard7d132992003-03-06 23:23:54 +000027host_cc="gcc"
28ar="ar"
29make="make"
pbrook6a882642006-04-17 13:57:12 +000030install="install"
bellard7d132992003-03-06 23:23:54 +000031strip="strip"
32cpu=`uname -m`
bellard5327cf42005-01-10 23:18:50 +000033target_list=""
bellard7d132992003-03-06 23:23:54 +000034case "$cpu" in
35 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +000036 cpu="i386"
bellard7d132992003-03-06 23:23:54 +000037 ;;
bellardba680552005-03-13 09:49:52 +000038 armv*b)
bellard808c4952004-12-19 23:33:47 +000039 cpu="armv4b"
40 ;;
bellardba680552005-03-13 09:49:52 +000041 armv*l)
bellard7d132992003-03-06 23:23:54 +000042 cpu="armv4l"
43 ;;
44 alpha)
45 cpu="alpha"
46 ;;
bellard295defa2003-04-07 21:31:29 +000047 "Power Macintosh"|ppc|ppc64)
bellard7d132992003-03-06 23:23:54 +000048 cpu="powerpc"
49 ;;
50 mips)
51 cpu="mips"
52 ;;
thsfbe4f652007-04-01 11:16:48 +000053 mips64)
54 cpu="mips64"
55 ;;
bellardfb3e5842003-03-29 17:32:36 +000056 s390)
57 cpu="s390"
58 ;;
pbrook94ac5152006-04-26 16:07:35 +000059 sparc|sun4[muv])
bellardae228532003-05-13 18:59:59 +000060 cpu="sparc"
61 ;;
62 sparc64)
63 cpu="sparc64"
64 ;;
bellarda8baa8c2003-04-29 20:53:31 +000065 ia64)
66 cpu="ia64"
67 ;;
bellard38e584a2003-08-10 22:14:22 +000068 m68k)
69 cpu="m68k"
70 ;;
bellardbc51c5c2004-03-17 23:46:04 +000071 x86_64|amd64)
bellard0b0babc2005-01-03 23:38:40 +000072 cpu="x86_64"
bellardbc51c5c2004-03-17 23:46:04 +000073 ;;
bellard7d132992003-03-06 23:23:54 +000074 *)
75 cpu="unknown"
76 ;;
77esac
78gprof="no"
79bigendian="no"
bellard67b915a2004-03-31 23:37:16 +000080mingw32="no"
81EXESUF=""
82gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +000083slirp="yes"
bellardfb065182004-11-09 23:09:44 +000084adlib="no"
85oss="no"
bellard1d14ffa2005-10-30 18:58:22 +000086dsound="no"
87coreaudio="no"
88alsa="no"
bellard102a52e2004-11-14 19:57:29 +000089fmod="no"
90fmod_lib=""
91fmod_inc=""
pbrookb1a550a2006-04-16 13:28:56 +000092bsd="no"
bellard5327cf42005-01-10 23:18:50 +000093linux="no"
bellardc9ec1fe2005-02-10 21:55:30 +000094kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +000095profiler="no"
bellard5b0753e2005-03-01 21:37:28 +000096cocoa="no"
bellard97ccc682005-07-02 13:32:17 +000097check_gfx="yes"
bellard1aff3812005-11-02 22:30:45 +000098check_gcc="yes"
pbrook0a8e90f2006-03-19 14:54:16 +000099softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000100linux_user="no"
101darwin_user="no"
pbrookcc8ae6d2006-04-23 17:57:59 +0000102build_docs="no"
pbrookc5937222006-05-14 11:30:38 +0000103uname_release=""
bellard7d132992003-03-06 23:23:54 +0000104
105# OS specific
106targetos=`uname -s`
107case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000108CYGWIN*)
109mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000110OS_CFLAGS="-mno-cygwin"
bellardc326e0a2005-04-23 18:30:28 +0000111;;
bellard67b915a2004-03-31 23:37:16 +0000112MINGW32*)
113mingw32="yes"
114;;
bellard7d3505c2004-05-12 19:32:15 +0000115FreeBSD)
116bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000117oss="yes"
bellarde99f9062005-07-28 21:45:38 +0000118if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000119 kqemu="yes"
120fi
bellard7d3505c2004-05-12 19:32:15 +0000121;;
122NetBSD)
123bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000124oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000125;;
126OpenBSD)
127bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000128oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000129;;
bellard83fb7ad2004-07-05 21:25:26 +0000130Darwin)
131bsd="yes"
132darwin="yes"
ths831b7822007-01-18 20:06:33 +0000133darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000134cocoa="yes"
135coreaudio="yes"
ths6f30fa82007-01-05 01:00:47 +0000136OS_CFLAGS="-mdynamic-no-pic"
bellard83fb7ad2004-07-05 21:25:26 +0000137;;
bellardec530c82006-04-25 22:36:06 +0000138SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000139 solaris="yes"
140 make="gmake"
141 install="ginstall"
142 solarisrev=`uname -r | cut -f2 -d.`
143 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
144 if test "$solarisrev" -ge 10 ; then
145 kqemu="yes"
146 fi
ths86b2bd92007-02-11 00:31:33 +0000147 fi
148;;
bellard1d14ffa2005-10-30 18:58:22 +0000149*)
bellardfb065182004-11-09 23:09:44 +0000150oss="yes"
bellard5327cf42005-01-10 23:18:50 +0000151linux="yes"
ths831b7822007-01-18 20:06:33 +0000152linux_user="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000153if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000154 kqemu="yes"
155fi
bellardfb065182004-11-09 23:09:44 +0000156;;
bellard7d132992003-03-06 23:23:54 +0000157esac
158
bellard7d3505c2004-05-12 19:32:15 +0000159if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000160 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000161 make="gmake"
162 fi
bellard7d3505c2004-05-12 19:32:15 +0000163fi
164
bellard7d132992003-03-06 23:23:54 +0000165# find source path
pbrookad064842006-04-16 12:41:07 +0000166source_path=`dirname "$0"`
167if [ -z "$source_path" ]; then
bellard7d132992003-03-06 23:23:54 +0000168 source_path=`pwd`
pbrookad064842006-04-16 12:41:07 +0000169else
170 source_path=`cd "$source_path"; pwd`
171fi
172if test "$source_path" = `pwd` ; then
bellard7d132992003-03-06 23:23:54 +0000173 source_path_used="no"
pbrookad064842006-04-16 12:41:07 +0000174else
175 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000176fi
177
178for opt do
pbrooka46e4032006-04-29 23:05:22 +0000179 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000180 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000181 --help|-h) show_help=yes
182 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000183 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000184 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000185 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000186 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000187 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000188 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000189 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000190 --cross-prefix=*) cross_prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000191 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000192 --cc=*) cc="$optarg"
pbrook328a4242006-12-19 03:31:34 +0000193 gcc3_search="no"
bellard7d132992003-03-06 23:23:54 +0000194 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000195 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000196 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000197 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000198 ;;
pbrook6a882642006-04-17 13:57:12 +0000199 --install=*) install="$optarg"
200 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000201 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000202 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000203 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000204 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000205 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000206 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000207 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000208 ;;
bellard7d132992003-03-06 23:23:54 +0000209 --enable-gprof) gprof="yes"
210 ;;
bellard43ce4df2003-06-09 19:53:12 +0000211 --static) static="yes"
212 ;;
bellard97a847b2003-08-10 21:36:04 +0000213 --disable-sdl) sdl="no"
214 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000215 --enable-coreaudio) coreaudio="yes"
216 ;;
217 --enable-alsa) alsa="yes"
218 ;;
219 --enable-dsound) dsound="yes"
220 ;;
bellard102a52e2004-11-14 19:57:29 +0000221 --enable-fmod) fmod="yes"
222 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000223 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000224 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000225 --fmod-inc=*) fmod_inc="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000226 ;;
bellardb93aebe2007-02-15 22:58:18 +0000227 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
bellard1d14ffa2005-10-30 18:58:22 +0000228 ;;
bellard443f1372004-06-04 11:13:20 +0000229 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000230 ;;
bellardfb065182004-11-09 23:09:44 +0000231 --enable-adlib) adlib="yes"
bellard1d14ffa2005-10-30 18:58:22 +0000232 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000233 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000234 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000235 --enable-profiler) profiler="yes"
236 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000237 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
238 ;;
bellard97ccc682005-07-02 13:32:17 +0000239 --disable-gfx-check) check_gfx="no"
240 ;;
bellard1aff3812005-11-02 22:30:45 +0000241 --disable-gcc-check) check_gcc="no"
242 ;;
pbrookcad25d62006-03-19 16:31:11 +0000243 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000244 ;;
pbrookcad25d62006-03-19 16:31:11 +0000245 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000246 ;;
ths831b7822007-01-18 20:06:33 +0000247 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000248 ;;
ths831b7822007-01-18 20:06:33 +0000249 --enable-linux-user) linux_user="yes"
250 ;;
251 --disable-darwin-user) darwin_user="no"
252 ;;
253 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000254 ;;
pbrookc5937222006-05-14 11:30:38 +0000255 --enable-uname-release=*) uname_release="$optarg"
256 ;;
bellard7d132992003-03-06 23:23:54 +0000257 esac
258done
259
ths209afb92007-03-25 20:55:00 +0000260if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
261 AIOLIBS=
262else
263 AIOLIBS="-lrt"
264fi
265
ths6f30fa82007-01-05 01:00:47 +0000266# default flags for all hosts
267CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
268LDFLAGS="$LDFLAGS -g"
269
pbrookaf5db582006-04-08 14:26:41 +0000270if test x"$show_help" = x"yes" ; then
271cat << EOF
272
273Usage: configure [options]
274Options: [defaults in brackets after descriptions]
275
276EOF
277echo "Standard options:"
278echo " --help print this message"
279echo " --prefix=PREFIX install in PREFIX [$prefix]"
280echo " --interp-prefix=PREFIX where to find shared libraries, etc."
281echo " use %M for cpu name [$interp_prefix]"
282echo " --target-list=LIST set target list [$target_list]"
283echo ""
284echo "kqemu kernel acceleration support:"
285echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000286echo ""
287echo "Advanced options (experts only):"
288echo " --source-path=PATH path of source code [$source_path]"
289echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
290echo " --cc=CC use C compiler CC [$cc]"
291echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
292echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000293echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000294echo " --static enable static build [$static]"
295echo " --enable-cocoa enable COCOA (Mac OS X only)"
296echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
297echo " --enable-adlib enable Adlib emulation"
298echo " --enable-coreaudio enable Coreaudio audio driver"
299echo " --enable-alsa enable ALSA audio driver"
300echo " --enable-fmod enable FMOD audio driver"
thsed5065e2007-03-25 16:15:21 +0000301echo " --enable-dsound enable DirectSound audio driver"
pbrookaf5db582006-04-08 14:26:41 +0000302echo " --enable-system enable all system emulation targets"
303echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000304echo " --enable-linux-user enable all linux usermode emulation targets"
305echo " --disable-linux-user disable all linux usermode emulation targets"
306echo " --enable-darwin-user enable all darwin usermode emulation targets"
307echo " --disable-darwin-user disable all darwin usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000308echo " --fmod-lib path to FMOD library"
309echo " --fmod-inc path to FMOD includes"
pbrookc5937222006-05-14 11:30:38 +0000310echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
pbrookaf5db582006-04-08 14:26:41 +0000311echo ""
ths5bf08932006-12-23 00:33:26 +0000312echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000313exit 1
314fi
315
bellard7d132992003-03-06 23:23:54 +0000316cc="${cross_prefix}${cc}"
317ar="${cross_prefix}${ar}"
318strip="${cross_prefix}${strip}"
319
pbrook064aae12006-05-08 00:51:44 +0000320# check that the C compiler works.
321cat > $TMPC <<EOF
322int main(void) {}
323EOF
324
thscf257232007-02-11 15:02:17 +0000325if $cc -c -o $TMPO $TMPC 2> /dev/null ; then
pbrook064aae12006-05-08 00:51:44 +0000326 : C compiler works ok
327else
328 echo "ERROR: \"$cc\" either does not exist or does not work"
329 exit 1
bellarda7350fa2006-04-23 14:35:23 +0000330fi
331
bellard67b915a2004-03-31 23:37:16 +0000332if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000333 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000334 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000335 oss="no"
bellard07f4ddb2005-04-23 17:44:28 +0000336 if [ "$cpu" = "i386" ] ; then
337 kqemu="yes"
338 fi
bellard67b915a2004-03-31 23:37:16 +0000339fi
340
pbrook328a4242006-12-19 03:31:34 +0000341# Check for gcc4, error if pre-gcc4
342if test "$check_gcc" = "yes" ; then
343 cat > $TMPC <<EOF
344#if __GNUC__ < 4
345#error gcc3
346#endif
347int main(){return 0;}
348EOF
349 check_cc() {
thscf257232007-02-11 15:02:17 +0000350 which "$1" 2> /dev/null
pbrook328a4242006-12-19 03:31:34 +0000351 return $?
352 }
353
thscf257232007-02-11 15:02:17 +0000354 if "$cc" -o $TMPE $TMPC 2> /dev/null ; then
pbrook328a4242006-12-19 03:31:34 +0000355 echo "WARNING: \"$cc\" looks like gcc 4.x"
356 found_compat_cc="no"
357 if test "$gcc3_search" = "yes" ; then
358 echo "Looking for gcc 3.x"
359 for compat_cc in $gcc3_list ; do
pbrook11244262007-02-27 01:03:41 +0000360 if check_cc "$cross_prefix$compat_cc" ; then
pbrook328a4242006-12-19 03:31:34 +0000361 echo "Found \"$compat_cc\""
pbrook11244262007-02-27 01:03:41 +0000362 cc="$cross_prefix$compat_cc"
pbrook328a4242006-12-19 03:31:34 +0000363 found_compat_cc="yes"
364 break
365 fi
366 done
367 if test "$found_compat_cc" = "no" ; then
368 echo "gcc 3.x not found!"
369 fi
370 fi
371 if test "$found_compat_cc" = "no" ; then
372 echo "QEMU is known to have problems when compiled with gcc 4.x"
373 echo "It is recommended that you use gcc 3.x to build QEMU"
374 echo "To use this compiler anyway, configure with --disable-gcc-check"
375 exit 1;
376 fi
377 fi
378fi
379
bellardec530c82006-04-25 22:36:06 +0000380#
381# Solaris specific configure tool chain decisions
382#
383if test "$solaris" = "yes" ; then
384 #
385 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
386 # override the check with --disable-gcc-check
387 #
388 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
389 solgcc=`which $cc`
390 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
391 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
392 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
393 echo "or get the latest patch from SunSolve for gcc"
394 exit 1
395 fi
396 fi
397 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
398 if test -z "$solinst" ; then
399 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
400 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
401 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
402 exit 1
403 fi
404 if test "$solinst" = "/usr/sbin/install" ; then
405 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
406 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
407 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
408 exit 1
409 fi
bellardec530c82006-04-25 22:36:06 +0000410 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
411 if test -z "$sol_ar" ; then
412 echo "Error: No path includes ar"
413 if test -f /usr/ccs/bin/ar ; then
414 echo "Add /usr/ccs/bin to your path and rerun configure"
415 fi
416 exit 1
417 fi
418fi
419
420
bellard5327cf42005-01-10 23:18:50 +0000421if test -z "$target_list" ; then
422# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000423 if [ "$softmmu" = "yes" ] ; then
thsfbe4f652007-04-01 11:16:48 +0000424 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc64-softmmu"
pbrook0a8e90f2006-03-19 14:54:16 +0000425 fi
bellard5327cf42005-01-10 23:18:50 +0000426# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000427 if [ "$linux_user" = "yes" ] ; then
428 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 $target_list"
429 fi
430# the following are Darwin specific
431 if [ "$darwin_user" = "yes" ] ; then
432 target_list="i386-darwin-user ppc-darwin-user $target_list"
bellard5327cf42005-01-10 23:18:50 +0000433 fi
bellard6e20a452005-06-05 15:56:02 +0000434else
pbrookb1a550a2006-04-16 13:28:56 +0000435 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000436fi
pbrook0a8e90f2006-03-19 14:54:16 +0000437if test -z "$target_list" ; then
438 echo "No targets enabled"
439 exit 1
440fi
bellard5327cf42005-01-10 23:18:50 +0000441
bellard7d132992003-03-06 23:23:54 +0000442if test -z "$cross_prefix" ; then
443
444# ---
445# big/little endian test
446cat > $TMPC << EOF
447#include <inttypes.h>
448int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000449 volatile uint32_t i=0x01234567;
450 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000451}
452EOF
453
thscf257232007-02-11 15:02:17 +0000454if $cc -o $TMPE $TMPC 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000455$TMPE && bigendian="yes"
456else
457echo big/little test failed
458fi
459
460else
461
462# if cross compiling, cannot launch a program, so make a static guess
thsfbe4f652007-04-01 11:16:48 +0000463if 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
bellard7d132992003-03-06 23:23:54 +0000464 bigendian="yes"
465fi
466
467fi
468
bellardb6853692005-06-05 17:10:39 +0000469# host long bits test
470hostlongbits="32"
471if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
472 hostlongbits="64"
473fi
474
bellarde8cd23d2003-06-25 16:08:13 +0000475# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000476cat > $TMPC <<EOF
477int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000478}
479EOF
480
bellard11d9f692004-04-02 20:55:59 +0000481##########################################
482# SDL probe
483
484sdl_too_old=no
485
486if test -z "$sdl" ; then
487
bellarda6e022a2004-04-02 21:55:47 +0000488sdl_config="sdl-config"
489sdl=no
bellard7c1f25b2004-04-22 00:02:08 +0000490sdl_static=no
bellarda6e022a2004-04-02 21:55:47 +0000491
492if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
493# win32 cross compilation case
494 sdl_config="i386-mingw32msvc-sdl-config"
495 sdl=yes
496else
497# normal SDL probe
bellard11d9f692004-04-02 20:55:59 +0000498cat > $TMPC << EOF
499#include <SDL.h>
500#undef main /* We don't want SDL to override our main() */
501int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
502EOF
503
bellarda6e022a2004-04-02 21:55:47 +0000504if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
505_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
bellard11d9f692004-04-02 20:55:59 +0000506if test "$_sdlversion" -lt 121 ; then
507sdl_too_old=yes
508else
thsfd677642007-01-31 12:10:07 +0000509 if test "$cocoa" = "no" ; then
510 sdl=yes
511 fi
bellard11d9f692004-04-02 20:55:59 +0000512fi
bellard7c1f25b2004-04-22 00:02:08 +0000513
514# static link with sdl ?
515if test "$sdl" = "yes" ; then
516aa="no"
517`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
518sdl_static_libs=`$sdl_config --static-libs`
519if [ "$aa" = "yes" ] ; then
bellardd8d8aa42004-04-29 20:14:07 +0000520 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
bellard11d9f692004-04-02 20:55:59 +0000521fi
522
bellard7c1f25b2004-04-22 00:02:08 +0000523if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
524 sdl_static=yes
525fi
526
527fi # static link
528
529fi # sdl compile test
530
bellarda6e022a2004-04-02 21:55:47 +0000531fi # cross compilation
thsfd677642007-01-31 12:10:07 +0000532
533else
534 # Make sure to disable cocoa if sdl was set
535 if test "$sdl" = "yes" ; then
536 cocoa="no"
537 coreaudio="no"
538 fi
bellarda6e022a2004-04-02 21:55:47 +0000539fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000540
ths8f28f3f2007-01-05 21:25:54 +0000541##########################################
542# alsa sound support libraries
543
544if test "$alsa" = "yes" ; then
545 cat > $TMPC << EOF
546#include <alsa/asoundlib.h>
547int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
548EOF
549 if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
550 :
551 else
552 echo
553 echo "Error: Could not find alsa"
554 echo "Make sure to have the alsa libs and headers installed."
555 echo
556 exit 1
557 fi
558fi
559
pbrookcc8ae6d2006-04-23 17:57:59 +0000560# Check if tools are available to build documentation.
pbrook94ac5152006-04-26 16:07:35 +0000561if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +0000562 build_docs="yes"
563fi
564
bellard11d9f692004-04-02 20:55:59 +0000565if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +0000566 if test -z "$prefix" ; then
567 prefix="/c/Program Files/Qemu"
568 fi
569 mansuffix=""
570 datasuffix=""
571 docsuffix=""
572 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +0000573else
pbrook308c3592007-02-27 00:52:01 +0000574 if test -z "$prefix" ; then
575 prefix="/usr/local"
576 fi
577 mansuffix="/share/man"
578 datasuffix="/share/qemu"
579 docsuffix="/share/doc/qemu"
580 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +0000581fi
bellard5a671352003-10-01 00:13:48 +0000582
bellard43ce4df2003-06-09 19:53:12 +0000583echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +0000584echo "BIOS directory $prefix$datasuffix"
585echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +0000586if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +0000587echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +0000588echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000589fi
bellard5a671352003-10-01 00:13:48 +0000590echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000591echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +0000592echo "Host C compiler $host_cc"
bellard43ce4df2003-06-09 19:53:12 +0000593echo "make $make"
pbrook6a882642006-04-17 13:57:12 +0000594echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +0000595echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000596echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000597echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000598echo "gprof enabled $gprof"
bellard05c2a3e2006-02-08 22:39:17 +0000599echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +0000600echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000601if test "$darwin" = "yes" ; then
602 echo "Cocoa support $cocoa"
603fi
bellard97a847b2003-08-10 21:36:04 +0000604echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000605if test "$sdl" != "no" ; then
606 echo "SDL static link $sdl_static"
607fi
bellard67b915a2004-03-31 23:37:16 +0000608echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000609echo "Adlib support $adlib"
bellard1d14ffa2005-10-30 18:58:22 +0000610echo "CoreAudio support $coreaudio"
611echo "ALSA support $alsa"
612echo "DSound support $dsound"
bellard1d14ffa2005-10-30 18:58:22 +0000613if test "$fmod" = "yes"; then
614 if test -z $fmod_lib || test -z $fmod_inc; then
615 echo
616 echo "Error: You must specify path to FMOD library and headers"
617 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
618 echo
619 exit 1
620 fi
pbrookb1a550a2006-04-16 13:28:56 +0000621 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
622else
623 fmod_support=""
bellard102a52e2004-11-14 19:57:29 +0000624fi
pbrookb1a550a2006-04-16 13:28:56 +0000625echo "FMOD support $fmod $fmod_support"
bellard07f4ddb2005-04-23 17:44:28 +0000626echo "kqemu support $kqemu"
pbrookcc8ae6d2006-04-23 17:57:59 +0000627echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +0000628[ ! -z "$uname_release" ] && \
629echo "uname -r $uname_release"
bellard67b915a2004-03-31 23:37:16 +0000630
bellard97a847b2003-08-10 21:36:04 +0000631if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000632echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000633fi
bellard24b55b92005-03-01 22:30:41 +0000634#if test "$sdl_static" = "no"; then
635# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
636#fi
bellard97a847b2003-08-10 21:36:04 +0000637config_mak="config-host.mak"
638config_h="config-host.h"
639
bellard7c1f25b2004-04-22 00:02:08 +0000640#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000641
642echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +0000643echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000644echo "/* Automatically generated by configure - do not modify */" > $config_h
645
646echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +0000647echo "bindir=\${prefix}$binsuffix" >> $config_mak
648echo "mandir=\${prefix}$mansuffix" >> $config_mak
649echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +0000650echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +0000651echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000652echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +0000653echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000654echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000655echo "HOST_CC=$host_cc" >> $config_mak
656echo "AR=$ar" >> $config_mak
657echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
ths6f30fa82007-01-05 01:00:47 +0000658echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000659echo "CFLAGS=$CFLAGS" >> $config_mak
660echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +0000661echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +0000662echo "AIOLIBS=$AIOLIBS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000663if test "$cpu" = "i386" ; then
664 echo "ARCH=i386" >> $config_mak
665 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000666elif test "$cpu" = "x86_64" ; then
667 echo "ARCH=x86_64" >> $config_mak
668 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000669elif test "$cpu" = "armv4b" ; then
670 echo "ARCH=arm" >> $config_mak
671 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000672elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000673 echo "ARCH=arm" >> $config_mak
674 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000675elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000676 echo "ARCH=ppc" >> $config_mak
677 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000678elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000679 echo "ARCH=mips" >> $config_mak
680 echo "#define HOST_MIPS 1" >> $config_h
thsfbe4f652007-04-01 11:16:48 +0000681elif test "$cpu" = "mips64" ; then
682 echo "ARCH=mips64" >> $config_mak
683 echo "#define HOST_MIPS64 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000684elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000685 echo "ARCH=s390" >> $config_mak
686 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000687elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000688 echo "ARCH=alpha" >> $config_mak
689 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000690elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000691 echo "ARCH=sparc" >> $config_mak
692 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000693elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000694 echo "ARCH=sparc64" >> $config_mak
695 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000696elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000697 echo "ARCH=ia64" >> $config_mak
698 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000699elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000700 echo "ARCH=m68k" >> $config_mak
701 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000702else
703 echo "Unsupported CPU"
704 exit 1
705fi
706if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000707 echo "WORDS_BIGENDIAN=yes" >> $config_mak
708 echo "#define WORDS_BIGENDIAN 1" >> $config_h
709fi
bellardb6853692005-06-05 17:10:39 +0000710echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +0000711if test "$mingw32" = "yes" ; then
712 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000713 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +0000714else
715 cat > $TMPC << EOF
716#include <byteswap.h>
717int main(void) { return bswap_32(0); }
718EOF
719 if $cc -o $TMPE $TMPC 2> /dev/null ; then
720 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
721 fi
bellard67b915a2004-03-31 23:37:16 +0000722fi
bellard83fb7ad2004-07-05 21:25:26 +0000723if test "$darwin" = "yes" ; then
724 echo "CONFIG_DARWIN=yes" >> $config_mak
725 echo "#define CONFIG_DARWIN 1" >> $config_h
726fi
bellardec530c82006-04-25 22:36:06 +0000727if test "$solaris" = "yes" ; then
728 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +0000729 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
bellardec530c82006-04-25 22:36:06 +0000730fi
bellard67b915a2004-03-31 23:37:16 +0000731if test "$gdbstub" = "yes" ; then
732 echo "CONFIG_GDBSTUB=yes" >> $config_mak
733 echo "#define CONFIG_GDBSTUB 1" >> $config_h
734fi
bellard97a847b2003-08-10 21:36:04 +0000735if test "$gprof" = "yes" ; then
736 echo "TARGET_GPROF=yes" >> $config_mak
737 echo "#define HAVE_GPROF 1" >> $config_h
738fi
739if test "$static" = "yes" ; then
740 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +0000741 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000742fi
bellard05c2a3e2006-02-08 22:39:17 +0000743if test $profiler = "yes" ; then
744 echo "#define CONFIG_PROFILER 1" >> $config_h
745fi
bellardc20709a2004-04-21 23:27:19 +0000746if test "$slirp" = "yes" ; then
747 echo "CONFIG_SLIRP=yes" >> $config_mak
748 echo "#define CONFIG_SLIRP 1" >> $config_h
749fi
bellardfb065182004-11-09 23:09:44 +0000750if test "$adlib" = "yes" ; then
751 echo "CONFIG_ADLIB=yes" >> $config_mak
752 echo "#define CONFIG_ADLIB 1" >> $config_h
753fi
754if test "$oss" = "yes" ; then
755 echo "CONFIG_OSS=yes" >> $config_mak
756 echo "#define CONFIG_OSS 1" >> $config_h
757fi
bellard1d14ffa2005-10-30 18:58:22 +0000758if test "$coreaudio" = "yes" ; then
759 echo "CONFIG_COREAUDIO=yes" >> $config_mak
760 echo "#define CONFIG_COREAUDIO 1" >> $config_h
761fi
762if test "$alsa" = "yes" ; then
763 echo "CONFIG_ALSA=yes" >> $config_mak
764 echo "#define CONFIG_ALSA 1" >> $config_h
765fi
766if test "$dsound" = "yes" ; then
767 echo "CONFIG_DSOUND=yes" >> $config_mak
768 echo "#define CONFIG_DSOUND 1" >> $config_h
769fi
bellard102a52e2004-11-14 19:57:29 +0000770if test "$fmod" = "yes" ; then
771 echo "CONFIG_FMOD=yes" >> $config_mak
772 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
773 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
774 echo "#define CONFIG_FMOD 1" >> $config_h
775fi
pbrookb1a550a2006-04-16 13:28:56 +0000776qemu_version=`head $source_path/VERSION`
777echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +0000778echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000779
780echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +0000781if [ "$source_path_used" = "yes" ]; then
782 echo "VPATH=$source_path" >> $config_mak
783fi
bellard97a847b2003-08-10 21:36:04 +0000784echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +0000785if [ "$build_docs" = "yes" ] ; then
786 echo "BUILD_DOCS=yes" >> $config_mak
787fi
bellard97a847b2003-08-10 21:36:04 +0000788
bellard83fb7ad2004-07-05 21:25:26 +0000789# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000790if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000791 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000792 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000793 echo "#define _BSD 1" >> $config_h
794fi
795
pbrookc5937222006-05-14 11:30:38 +0000796echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
797
bellard1d14ffa2005-10-30 18:58:22 +0000798for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +0000799target_dir="$target"
800config_mak=$target_dir/config.mak
801config_h=$target_dir/config.h
802target_cpu=`echo $target | cut -d '-' -f 1`
803target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +0000804[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000805[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000806[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000807[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellarda2458622005-07-23 22:39:53 +0000808[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
bellardd3258562005-07-02 15:37:12 +0000809[ "$target_cpu" = "mips" ] && target_bigendian=yes
thsfbe4f652007-04-01 11:16:48 +0000810[ "$target_cpu" = "mips64" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +0000811[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
pbrooke6e59062006-10-22 00:18:54 +0000812[ "$target_cpu" = "m68k" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000813target_softmmu="no"
814if expr $target : '.*-softmmu' > /dev/null ; then
815 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000816fi
bellard997344f2003-10-27 21:10:39 +0000817target_user_only="no"
818if expr $target : '.*-user' > /dev/null ; then
819 target_user_only="yes"
820fi
bellardde83cd02003-06-15 20:25:43 +0000821
ths831b7822007-01-18 20:06:33 +0000822target_linux_user="no"
823if expr $target : '.*-linux-user' > /dev/null ; then
824 target_linux_user="yes"
825fi
826
827target_darwin_user="no"
828if expr $target : '.*-darwin-user' > /dev/null ; then
829 target_darwin_user="yes"
830fi
831
bellard97ccc682005-07-02 13:32:17 +0000832if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +0000833 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +0000834 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +0000835 echo "To build QEMU without graphical output configure with --disable-gfx-check"
bellard97ccc682005-07-02 13:32:17 +0000836 echo "Note that this will disable all output from the virtual graphics card."
837 exit 1;
838fi
839
bellard7c1f25b2004-04-22 00:02:08 +0000840#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000841
842mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +0000843mkdir -p $target_dir/fpu
ths831b7822007-01-18 20:06:33 +0000844if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
bellard69de9272004-02-16 21:40:43 +0000845 mkdir -p $target_dir/nwfpe
846fi
bellarda7e61ed2004-04-22 21:46:47 +0000847if test "$target_user_only" = "no" ; then
848 mkdir -p $target_dir/slirp
849fi
bellard69de9272004-02-16 21:40:43 +0000850
bellardec530c82006-04-25 22:36:06 +0000851#
852# don't use ln -sf as not all "ln -sf" over write the file/link
853#
854rm -f $target_dir/Makefile
855ln -s $source_path/Makefile.target $target_dir/Makefile
856
bellard97a847b2003-08-10 21:36:04 +0000857
858echo "# Automatically generated by configure - do not modify" > $config_mak
859echo "/* Automatically generated by configure - do not modify */" > $config_h
860
861
862echo "include ../config-host.mak" >> $config_mak
863echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000864
pbrooke5fe0c52006-06-11 13:32:59 +0000865bflt="no"
bellard1e43adf2003-09-30 20:54:24 +0000866interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
867echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000868
869if test "$target_cpu" = "i386" ; then
870 echo "TARGET_ARCH=i386" >> $config_mak
871 echo "#define TARGET_ARCH \"i386\"" >> $config_h
872 echo "#define TARGET_I386 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000873 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
bellard824d5602005-02-12 18:58:00 +0000874 echo "#define USE_KQEMU 1" >> $config_h
875 fi
bellard808c4952004-12-19 23:33:47 +0000876elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000877 echo "TARGET_ARCH=arm" >> $config_mak
878 echo "#define TARGET_ARCH \"arm\"" >> $config_h
879 echo "#define TARGET_ARM 1" >> $config_h
pbrooke5fe0c52006-06-11 13:32:59 +0000880 bflt="yes"
bellard1e43adf2003-09-30 20:54:24 +0000881elif test "$target_cpu" = "sparc" ; then
882 echo "TARGET_ARCH=sparc" >> $config_mak
883 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
884 echo "#define TARGET_SPARC 1" >> $config_h
bellard64b3ab22005-01-30 22:43:42 +0000885elif test "$target_cpu" = "sparc64" ; then
886 echo "TARGET_ARCH=sparc64" >> $config_mak
887 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
888 echo "#define TARGET_SPARC 1" >> $config_h
889 echo "#define TARGET_SPARC64 1" >> $config_h
bellard67867302003-11-23 17:05:30 +0000890elif test "$target_cpu" = "ppc" ; then
891 echo "TARGET_ARCH=ppc" >> $config_mak
892 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
893 echo "#define TARGET_PPC 1" >> $config_h
bellarda2458622005-07-23 22:39:53 +0000894elif test "$target_cpu" = "ppc64" ; then
895 echo "TARGET_ARCH=ppc64" >> $config_mak
896 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
897 echo "#define TARGET_PPC 1" >> $config_h
898 echo "#define TARGET_PPC64 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000899elif test "$target_cpu" = "x86_64" ; then
900 echo "TARGET_ARCH=x86_64" >> $config_mak
901 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
902 echo "#define TARGET_I386 1" >> $config_h
903 echo "#define TARGET_X86_64 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000904 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
905 echo "#define USE_KQEMU 1" >> $config_h
906 fi
bellardc20eb472005-12-06 21:42:55 +0000907elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
bellardd3258562005-07-02 15:37:12 +0000908 echo "TARGET_ARCH=mips" >> $config_mak
909 echo "#define TARGET_ARCH \"mips\"" >> $config_h
910 echo "#define TARGET_MIPS 1" >> $config_h
bellard6ea83fe2006-06-14 12:56:19 +0000911 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
912 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
thsfbe4f652007-04-01 11:16:48 +0000913elif test "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el" ; then
914 echo "TARGET_ARCH=mips64" >> $config_mak
915 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
916 echo "#define TARGET_MIPS 1" >> $config_h
917 echo "#define TARGET_MIPS64 1" >> $config_h
918 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
919 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
pbrook908f52b2006-06-18 19:16:53 +0000920elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
bellardfdf9b3e2006-04-27 21:07:38 +0000921 echo "TARGET_ARCH=sh4" >> $config_mak
922 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
923 echo "#define TARGET_SH4 1" >> $config_h
pbrook4dbed892006-06-17 20:01:14 +0000924 bflt="yes"
pbrooke6e59062006-10-22 00:18:54 +0000925elif test "$target_cpu" = "m68k" ; then
926 echo "TARGET_ARCH=m68k" >> $config_mak
927 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
928 echo "#define TARGET_M68K 1" >> $config_h
929 bflt="yes"
bellardde83cd02003-06-15 20:25:43 +0000930else
931 echo "Unsupported target CPU"
932 exit 1
933fi
934if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000935 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
936 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
937fi
938if test "$target_softmmu" = "yes" ; then
939 echo "CONFIG_SOFTMMU=yes" >> $config_mak
940 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000941fi
bellard997344f2003-10-27 21:10:39 +0000942if test "$target_user_only" = "yes" ; then
943 echo "CONFIG_USER_ONLY=yes" >> $config_mak
944 echo "#define CONFIG_USER_ONLY 1" >> $config_h
945fi
ths831b7822007-01-18 20:06:33 +0000946if test "$target_linux_user" = "yes" ; then
947 echo "CONFIG_LINUX_USER=yes" >> $config_mak
948 echo "#define CONFIG_LINUX_USER 1" >> $config_h
949fi
950if test "$target_darwin_user" = "yes" ; then
951 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
952 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
953fi
bellardde83cd02003-06-15 20:25:43 +0000954
pbrooke6e59062006-10-22 00:18:54 +0000955if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
bellard158142c2005-03-13 16:54:06 +0000956 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
957 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
958fi
pbrooke5fe0c52006-06-11 13:32:59 +0000959if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
960 echo "TARGET_HAS_BFLT=yes" >> $config_mak
961 echo "#define TARGET_HAS_BFLT 1" >> $config_h
962fi
bellard7c1f25b2004-04-22 00:02:08 +0000963# sdl defines
964
965if test "$target_user_only" = "no"; then
966 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000967 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000968 else
bellarddbb2c922004-10-24 22:17:47 +0000969 sdl1=$sdl
970 fi
971 if test "$sdl1" = "yes" ; then
972 echo "#define CONFIG_SDL 1" >> $config_h
973 echo "CONFIG_SDL=yes" >> $config_mak
974 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
975 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
976 else
bellard7c1f25b2004-04-22 00:02:08 +0000977 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
978 fi
bellarddbb2c922004-10-24 22:17:47 +0000979 if [ "${aa}" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000980 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
981 else
982 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
bellarddbb2c922004-10-24 22:17:47 +0000983 fi
bellard7c1f25b2004-04-22 00:02:08 +0000984 fi
bellard7c1f25b2004-04-22 00:02:08 +0000985fi
986
bellard5b0753e2005-03-01 21:37:28 +0000987if test "$cocoa" = "yes" ; then
988 echo "#define CONFIG_COCOA 1" >> $config_h
989 echo "CONFIG_COCOA=yes" >> $config_mak
990fi
991
bellard97a847b2003-08-10 21:36:04 +0000992done # for target in $targets
bellard7d132992003-03-06 23:23:54 +0000993
994# build tree in object directory if source path is different from current one
995if test "$source_path_used" = "yes" ; then
996 DIRS="tests"
997 FILES="Makefile tests/Makefile"
998 for dir in $DIRS ; do
999 mkdir -p $dir
1000 done
bellardec530c82006-04-25 22:36:06 +00001001 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00001002 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00001003 rm -f $f
1004 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00001005 done
1006fi
bellard7d132992003-03-06 23:23:54 +00001007
bellard97a847b2003-08-10 21:36:04 +00001008rm -f $TMPO $TMPC $TMPE $TMPS