blob: 963111934b16599eb2ef25da36b3c1befb54e447 [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 ;;
bellardfb3e5842003-03-29 17:32:36 +000053 s390)
54 cpu="s390"
55 ;;
pbrook94ac5152006-04-26 16:07:35 +000056 sparc|sun4[muv])
bellardae228532003-05-13 18:59:59 +000057 cpu="sparc"
58 ;;
59 sparc64)
60 cpu="sparc64"
61 ;;
bellarda8baa8c2003-04-29 20:53:31 +000062 ia64)
63 cpu="ia64"
64 ;;
bellard38e584a2003-08-10 22:14:22 +000065 m68k)
66 cpu="m68k"
67 ;;
bellardbc51c5c2004-03-17 23:46:04 +000068 x86_64|amd64)
bellard0b0babc2005-01-03 23:38:40 +000069 cpu="x86_64"
bellardbc51c5c2004-03-17 23:46:04 +000070 ;;
bellard7d132992003-03-06 23:23:54 +000071 *)
72 cpu="unknown"
73 ;;
74esac
75gprof="no"
76bigendian="no"
bellard67b915a2004-03-31 23:37:16 +000077mingw32="no"
78EXESUF=""
79gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +000080slirp="yes"
bellardfb065182004-11-09 23:09:44 +000081adlib="no"
82oss="no"
bellard1d14ffa2005-10-30 18:58:22 +000083dsound="no"
84coreaudio="no"
85alsa="no"
bellard102a52e2004-11-14 19:57:29 +000086fmod="no"
87fmod_lib=""
88fmod_inc=""
pbrookb1a550a2006-04-16 13:28:56 +000089bsd="no"
bellard5327cf42005-01-10 23:18:50 +000090linux="no"
bellardc9ec1fe2005-02-10 21:55:30 +000091kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +000092profiler="no"
bellard5b0753e2005-03-01 21:37:28 +000093cocoa="no"
bellard97ccc682005-07-02 13:32:17 +000094check_gfx="yes"
bellard1aff3812005-11-02 22:30:45 +000095check_gcc="yes"
pbrook0a8e90f2006-03-19 14:54:16 +000096softmmu="yes"
ths831b7822007-01-18 20:06:33 +000097linux_user="no"
98darwin_user="no"
pbrookcc8ae6d2006-04-23 17:57:59 +000099build_docs="no"
pbrookc5937222006-05-14 11:30:38 +0000100uname_release=""
bellard7d132992003-03-06 23:23:54 +0000101
102# OS specific
103targetos=`uname -s`
104case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000105CYGWIN*)
106mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000107OS_CFLAGS="-mno-cygwin"
bellardc326e0a2005-04-23 18:30:28 +0000108;;
bellard67b915a2004-03-31 23:37:16 +0000109MINGW32*)
110mingw32="yes"
111;;
bellard7d3505c2004-05-12 19:32:15 +0000112FreeBSD)
113bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000114oss="yes"
bellarde99f9062005-07-28 21:45:38 +0000115if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000116 kqemu="yes"
117fi
bellard7d3505c2004-05-12 19:32:15 +0000118;;
119NetBSD)
120bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000121oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000122;;
123OpenBSD)
124bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000125oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000126;;
bellard83fb7ad2004-07-05 21:25:26 +0000127Darwin)
128bsd="yes"
129darwin="yes"
ths831b7822007-01-18 20:06:33 +0000130darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000131cocoa="yes"
132coreaudio="yes"
ths6f30fa82007-01-05 01:00:47 +0000133OS_CFLAGS="-mdynamic-no-pic"
bellard83fb7ad2004-07-05 21:25:26 +0000134;;
bellardec530c82006-04-25 22:36:06 +0000135SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000136 solaris="yes"
137 make="gmake"
138 install="ginstall"
139 solarisrev=`uname -r | cut -f2 -d.`
140 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
141 if test "$solarisrev" -ge 10 ; then
142 kqemu="yes"
143 fi
ths86b2bd92007-02-11 00:31:33 +0000144 fi
145;;
bellard1d14ffa2005-10-30 18:58:22 +0000146*)
bellardfb065182004-11-09 23:09:44 +0000147oss="yes"
bellard5327cf42005-01-10 23:18:50 +0000148linux="yes"
ths831b7822007-01-18 20:06:33 +0000149linux_user="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000150if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000151 kqemu="yes"
152fi
bellardfb065182004-11-09 23:09:44 +0000153;;
bellard7d132992003-03-06 23:23:54 +0000154esac
155
bellard7d3505c2004-05-12 19:32:15 +0000156if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000157 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000158 make="gmake"
159 fi
bellard7d3505c2004-05-12 19:32:15 +0000160fi
161
bellard7d132992003-03-06 23:23:54 +0000162# find source path
pbrookad064842006-04-16 12:41:07 +0000163source_path=`dirname "$0"`
164if [ -z "$source_path" ]; then
bellard7d132992003-03-06 23:23:54 +0000165 source_path=`pwd`
pbrookad064842006-04-16 12:41:07 +0000166else
167 source_path=`cd "$source_path"; pwd`
168fi
169if test "$source_path" = `pwd` ; then
bellard7d132992003-03-06 23:23:54 +0000170 source_path_used="no"
pbrookad064842006-04-16 12:41:07 +0000171else
172 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000173fi
174
175for opt do
pbrooka46e4032006-04-29 23:05:22 +0000176 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000177 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000178 --help|-h) show_help=yes
179 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000180 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000181 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000182 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000183 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000184 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000185 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000186 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000187 --cross-prefix=*) cross_prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000188 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000189 --cc=*) cc="$optarg"
pbrook328a4242006-12-19 03:31:34 +0000190 gcc3_search="no"
bellard7d132992003-03-06 23:23:54 +0000191 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000192 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000193 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000194 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000195 ;;
pbrook6a882642006-04-17 13:57:12 +0000196 --install=*) install="$optarg"
197 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000198 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000199 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000200 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000201 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000202 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000203 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000204 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000205 ;;
bellard7d132992003-03-06 23:23:54 +0000206 --enable-gprof) gprof="yes"
207 ;;
bellard43ce4df2003-06-09 19:53:12 +0000208 --static) static="yes"
209 ;;
bellard97a847b2003-08-10 21:36:04 +0000210 --disable-sdl) sdl="no"
211 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000212 --enable-coreaudio) coreaudio="yes"
213 ;;
214 --enable-alsa) alsa="yes"
215 ;;
216 --enable-dsound) dsound="yes"
217 ;;
bellard102a52e2004-11-14 19:57:29 +0000218 --enable-fmod) fmod="yes"
219 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000220 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000221 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000222 --fmod-inc=*) fmod_inc="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000223 ;;
bellardb93aebe2007-02-15 22:58:18 +0000224 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
bellard1d14ffa2005-10-30 18:58:22 +0000225 ;;
bellard443f1372004-06-04 11:13:20 +0000226 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000227 ;;
bellardfb065182004-11-09 23:09:44 +0000228 --enable-adlib) adlib="yes"
bellard1d14ffa2005-10-30 18:58:22 +0000229 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000230 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000231 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000232 --enable-profiler) profiler="yes"
233 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000234 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
235 ;;
bellard97ccc682005-07-02 13:32:17 +0000236 --disable-gfx-check) check_gfx="no"
237 ;;
bellard1aff3812005-11-02 22:30:45 +0000238 --disable-gcc-check) check_gcc="no"
239 ;;
pbrookcad25d62006-03-19 16:31:11 +0000240 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000241 ;;
pbrookcad25d62006-03-19 16:31:11 +0000242 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000243 ;;
ths831b7822007-01-18 20:06:33 +0000244 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000245 ;;
ths831b7822007-01-18 20:06:33 +0000246 --enable-linux-user) linux_user="yes"
247 ;;
248 --disable-darwin-user) darwin_user="no"
249 ;;
250 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000251 ;;
pbrookc5937222006-05-14 11:30:38 +0000252 --enable-uname-release=*) uname_release="$optarg"
253 ;;
bellard7d132992003-03-06 23:23:54 +0000254 esac
255done
256
ths6f30fa82007-01-05 01:00:47 +0000257# default flags for all hosts
258CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
259LDFLAGS="$LDFLAGS -g"
260
pbrookaf5db582006-04-08 14:26:41 +0000261if test x"$show_help" = x"yes" ; then
262cat << EOF
263
264Usage: configure [options]
265Options: [defaults in brackets after descriptions]
266
267EOF
268echo "Standard options:"
269echo " --help print this message"
270echo " --prefix=PREFIX install in PREFIX [$prefix]"
271echo " --interp-prefix=PREFIX where to find shared libraries, etc."
272echo " use %M for cpu name [$interp_prefix]"
273echo " --target-list=LIST set target list [$target_list]"
274echo ""
275echo "kqemu kernel acceleration support:"
276echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000277echo ""
278echo "Advanced options (experts only):"
279echo " --source-path=PATH path of source code [$source_path]"
280echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
281echo " --cc=CC use C compiler CC [$cc]"
282echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
283echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000284echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000285echo " --static enable static build [$static]"
286echo " --enable-cocoa enable COCOA (Mac OS X only)"
287echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
288echo " --enable-adlib enable Adlib emulation"
289echo " --enable-coreaudio enable Coreaudio audio driver"
290echo " --enable-alsa enable ALSA audio driver"
291echo " --enable-fmod enable FMOD audio driver"
292echo " --enabled-dsound enable DirectSound audio driver"
293echo " --enable-system enable all system emulation targets"
294echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000295echo " --enable-linux-user enable all linux usermode emulation targets"
296echo " --disable-linux-user disable all linux usermode emulation targets"
297echo " --enable-darwin-user enable all darwin usermode emulation targets"
298echo " --disable-darwin-user disable all darwin usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000299echo " --fmod-lib path to FMOD library"
300echo " --fmod-inc path to FMOD includes"
pbrookc5937222006-05-14 11:30:38 +0000301echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
pbrookaf5db582006-04-08 14:26:41 +0000302echo ""
ths5bf08932006-12-23 00:33:26 +0000303echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000304exit 1
305fi
306
bellard7d132992003-03-06 23:23:54 +0000307cc="${cross_prefix}${cc}"
308ar="${cross_prefix}${ar}"
309strip="${cross_prefix}${strip}"
310
pbrook064aae12006-05-08 00:51:44 +0000311# check that the C compiler works.
312cat > $TMPC <<EOF
313int main(void) {}
314EOF
315
thscf257232007-02-11 15:02:17 +0000316if $cc -c -o $TMPO $TMPC 2> /dev/null ; then
pbrook064aae12006-05-08 00:51:44 +0000317 : C compiler works ok
318else
319 echo "ERROR: \"$cc\" either does not exist or does not work"
320 exit 1
bellarda7350fa2006-04-23 14:35:23 +0000321fi
322
bellard67b915a2004-03-31 23:37:16 +0000323if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000324 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000325 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000326 oss="no"
bellard07f4ddb2005-04-23 17:44:28 +0000327 if [ "$cpu" = "i386" ] ; then
328 kqemu="yes"
329 fi
bellard67b915a2004-03-31 23:37:16 +0000330fi
331
pbrook328a4242006-12-19 03:31:34 +0000332# Check for gcc4, error if pre-gcc4
333if test "$check_gcc" = "yes" ; then
334 cat > $TMPC <<EOF
335#if __GNUC__ < 4
336#error gcc3
337#endif
338int main(){return 0;}
339EOF
340 check_cc() {
thscf257232007-02-11 15:02:17 +0000341 which "$1" 2> /dev/null
pbrook328a4242006-12-19 03:31:34 +0000342 return $?
343 }
344
thscf257232007-02-11 15:02:17 +0000345 if "$cc" -o $TMPE $TMPC 2> /dev/null ; then
pbrook328a4242006-12-19 03:31:34 +0000346 echo "WARNING: \"$cc\" looks like gcc 4.x"
347 found_compat_cc="no"
348 if test "$gcc3_search" = "yes" ; then
349 echo "Looking for gcc 3.x"
350 for compat_cc in $gcc3_list ; do
351 if check_cc "$compat_cc" ; then
352 echo "Found \"$compat_cc\""
353 cc="$compat_cc"
354 found_compat_cc="yes"
355 break
356 fi
357 done
358 if test "$found_compat_cc" = "no" ; then
359 echo "gcc 3.x not found!"
360 fi
361 fi
362 if test "$found_compat_cc" = "no" ; then
363 echo "QEMU is known to have problems when compiled with gcc 4.x"
364 echo "It is recommended that you use gcc 3.x to build QEMU"
365 echo "To use this compiler anyway, configure with --disable-gcc-check"
366 exit 1;
367 fi
368 fi
369fi
370
bellardec530c82006-04-25 22:36:06 +0000371#
372# Solaris specific configure tool chain decisions
373#
374if test "$solaris" = "yes" ; then
375 #
376 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
377 # override the check with --disable-gcc-check
378 #
379 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
380 solgcc=`which $cc`
381 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
382 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
383 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
384 echo "or get the latest patch from SunSolve for gcc"
385 exit 1
386 fi
387 fi
388 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
389 if test -z "$solinst" ; then
390 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
391 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
392 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
393 exit 1
394 fi
395 if test "$solinst" = "/usr/sbin/install" ; then
396 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
397 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
398 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
399 exit 1
400 fi
bellardec530c82006-04-25 22:36:06 +0000401 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
402 if test -z "$sol_ar" ; then
403 echo "Error: No path includes ar"
404 if test -f /usr/ccs/bin/ar ; then
405 echo "Add /usr/ccs/bin to your path and rerun configure"
406 fi
407 exit 1
408 fi
409fi
410
411
bellard5327cf42005-01-10 23:18:50 +0000412if test -z "$target_list" ; then
413# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000414 if [ "$softmmu" = "yes" ] ; then
415 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
416 fi
bellard5327cf42005-01-10 23:18:50 +0000417# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000418 if [ "$linux_user" = "yes" ] ; then
419 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"
420 fi
421# the following are Darwin specific
422 if [ "$darwin_user" = "yes" ] ; then
423 target_list="i386-darwin-user ppc-darwin-user $target_list"
bellard5327cf42005-01-10 23:18:50 +0000424 fi
bellard6e20a452005-06-05 15:56:02 +0000425else
pbrookb1a550a2006-04-16 13:28:56 +0000426 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000427fi
pbrook0a8e90f2006-03-19 14:54:16 +0000428if test -z "$target_list" ; then
429 echo "No targets enabled"
430 exit 1
431fi
bellard5327cf42005-01-10 23:18:50 +0000432
bellard7d132992003-03-06 23:23:54 +0000433if test -z "$cross_prefix" ; then
434
435# ---
436# big/little endian test
437cat > $TMPC << EOF
438#include <inttypes.h>
439int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000440 volatile uint32_t i=0x01234567;
441 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000442}
443EOF
444
thscf257232007-02-11 15:02:17 +0000445if $cc -o $TMPE $TMPC 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000446$TMPE && bigendian="yes"
447else
448echo big/little test failed
449fi
450
451else
452
453# if cross compiling, cannot launch a program, so make a static guess
bellard808c4952004-12-19 23:33:47 +0000454if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
bellard7d132992003-03-06 23:23:54 +0000455 bigendian="yes"
456fi
457
458fi
459
bellardb6853692005-06-05 17:10:39 +0000460# host long bits test
461hostlongbits="32"
462if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
463 hostlongbits="64"
464fi
465
bellarde8cd23d2003-06-25 16:08:13 +0000466# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000467cat > $TMPC <<EOF
468int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000469}
470EOF
471
bellarde8cd23d2003-06-25 16:08:13 +0000472have_gcc3_options="no"
473if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
474 have_gcc3_options="yes"
bellard04369ff2003-03-20 22:33:23 +0000475fi
bellardca735202003-03-18 20:41:34 +0000476
bellard11d9f692004-04-02 20:55:59 +0000477##########################################
478# SDL probe
479
480sdl_too_old=no
481
482if test -z "$sdl" ; then
483
bellarda6e022a2004-04-02 21:55:47 +0000484sdl_config="sdl-config"
485sdl=no
bellard7c1f25b2004-04-22 00:02:08 +0000486sdl_static=no
bellarda6e022a2004-04-02 21:55:47 +0000487
488if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
489# win32 cross compilation case
490 sdl_config="i386-mingw32msvc-sdl-config"
491 sdl=yes
492else
493# normal SDL probe
bellard11d9f692004-04-02 20:55:59 +0000494cat > $TMPC << EOF
495#include <SDL.h>
496#undef main /* We don't want SDL to override our main() */
497int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
498EOF
499
bellarda6e022a2004-04-02 21:55:47 +0000500if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
501_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
bellard11d9f692004-04-02 20:55:59 +0000502if test "$_sdlversion" -lt 121 ; then
503sdl_too_old=yes
504else
thsfd677642007-01-31 12:10:07 +0000505 if test "$cocoa" = "no" ; then
506 sdl=yes
507 fi
bellard11d9f692004-04-02 20:55:59 +0000508fi
bellard7c1f25b2004-04-22 00:02:08 +0000509
510# static link with sdl ?
511if test "$sdl" = "yes" ; then
512aa="no"
513`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
514sdl_static_libs=`$sdl_config --static-libs`
515if [ "$aa" = "yes" ] ; then
bellardd8d8aa42004-04-29 20:14:07 +0000516 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
bellard11d9f692004-04-02 20:55:59 +0000517fi
518
bellard7c1f25b2004-04-22 00:02:08 +0000519if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
520 sdl_static=yes
521fi
522
523fi # static link
524
525fi # sdl compile test
526
bellarda6e022a2004-04-02 21:55:47 +0000527fi # cross compilation
thsfd677642007-01-31 12:10:07 +0000528
529else
530 # Make sure to disable cocoa if sdl was set
531 if test "$sdl" = "yes" ; then
532 cocoa="no"
533 coreaudio="no"
534 fi
bellarda6e022a2004-04-02 21:55:47 +0000535fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000536
ths8f28f3f2007-01-05 21:25:54 +0000537##########################################
538# alsa sound support libraries
539
540if test "$alsa" = "yes" ; then
541 cat > $TMPC << EOF
542#include <alsa/asoundlib.h>
543int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
544EOF
545 if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
546 :
547 else
548 echo
549 echo "Error: Could not find alsa"
550 echo "Make sure to have the alsa libs and headers installed."
551 echo
552 exit 1
553 fi
554fi
555
pbrookcc8ae6d2006-04-23 17:57:59 +0000556# Check if tools are available to build documentation.
pbrook94ac5152006-04-26 16:07:35 +0000557if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +0000558 build_docs="yes"
559fi
560
bellard11d9f692004-04-02 20:55:59 +0000561if test "$mingw32" = "yes" ; then
562if test -z "$prefix" ; then
563 prefix="/c/Program Files/Qemu"
564fi
565mandir="$prefix"
bellard7efa4382004-05-12 18:54:06 +0000566datadir="$prefix"
bellard1f50f8d2004-05-08 14:44:43 +0000567docdir="$prefix"
bellard11d9f692004-04-02 20:55:59 +0000568bindir="$prefix"
569else
570if test -z "$prefix" ; then
571 prefix="/usr/local"
572fi
bellard5a671352003-10-01 00:13:48 +0000573mandir="$prefix/share/man"
bellard7efa4382004-05-12 18:54:06 +0000574datadir="$prefix/share/qemu"
bellard1f50f8d2004-05-08 14:44:43 +0000575docdir="$prefix/share/doc/qemu"
bellard11d9f692004-04-02 20:55:59 +0000576bindir="$prefix/bin"
577fi
bellard5a671352003-10-01 00:13:48 +0000578
bellard43ce4df2003-06-09 19:53:12 +0000579echo "Install prefix $prefix"
bellard7efa4382004-05-12 18:54:06 +0000580echo "BIOS directory $datadir"
bellard11d9f692004-04-02 20:55:59 +0000581echo "binary directory $bindir"
582if test "$mingw32" = "no" ; then
583echo "Manual directory $mandir"
bellard43ce4df2003-06-09 19:53:12 +0000584echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000585fi
bellard5a671352003-10-01 00:13:48 +0000586echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000587echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +0000588echo "Host C compiler $host_cc"
bellard43ce4df2003-06-09 19:53:12 +0000589echo "make $make"
pbrook6a882642006-04-17 13:57:12 +0000590echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +0000591echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000592echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000593echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000594echo "gprof enabled $gprof"
bellard05c2a3e2006-02-08 22:39:17 +0000595echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +0000596echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000597if test "$darwin" = "yes" ; then
598 echo "Cocoa support $cocoa"
599fi
bellard97a847b2003-08-10 21:36:04 +0000600echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000601if test "$sdl" != "no" ; then
602 echo "SDL static link $sdl_static"
603fi
bellard67b915a2004-03-31 23:37:16 +0000604echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000605echo "Adlib support $adlib"
bellard1d14ffa2005-10-30 18:58:22 +0000606echo "CoreAudio support $coreaudio"
607echo "ALSA support $alsa"
608echo "DSound support $dsound"
bellard1d14ffa2005-10-30 18:58:22 +0000609if test "$fmod" = "yes"; then
610 if test -z $fmod_lib || test -z $fmod_inc; then
611 echo
612 echo "Error: You must specify path to FMOD library and headers"
613 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
614 echo
615 exit 1
616 fi
pbrookb1a550a2006-04-16 13:28:56 +0000617 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
618else
619 fmod_support=""
bellard102a52e2004-11-14 19:57:29 +0000620fi
pbrookb1a550a2006-04-16 13:28:56 +0000621echo "FMOD support $fmod $fmod_support"
bellard07f4ddb2005-04-23 17:44:28 +0000622echo "kqemu support $kqemu"
pbrookcc8ae6d2006-04-23 17:57:59 +0000623echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +0000624[ ! -z "$uname_release" ] && \
625echo "uname -r $uname_release"
bellard67b915a2004-03-31 23:37:16 +0000626
bellard97a847b2003-08-10 21:36:04 +0000627if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000628echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000629fi
bellard24b55b92005-03-01 22:30:41 +0000630#if test "$sdl_static" = "no"; then
631# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
632#fi
bellard97a847b2003-08-10 21:36:04 +0000633config_mak="config-host.mak"
634config_h="config-host.h"
635
bellard7c1f25b2004-04-22 00:02:08 +0000636#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000637
638echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +0000639echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000640echo "/* Automatically generated by configure - do not modify */" > $config_h
641
642echo "prefix=$prefix" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000643echo "bindir=$bindir" >> $config_mak
bellard5a671352003-10-01 00:13:48 +0000644echo "mandir=$mandir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000645echo "datadir=$datadir" >> $config_mak
bellard1f50f8d2004-05-08 14:44:43 +0000646echo "docdir=$docdir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000647echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000648echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +0000649echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000650echo "CC=$cc" >> $config_mak
651if test "$have_gcc3_options" = "yes" ; then
652 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
653fi
654echo "HOST_CC=$host_cc" >> $config_mak
655echo "AR=$ar" >> $config_mak
656echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
ths6f30fa82007-01-05 01:00:47 +0000657echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000658echo "CFLAGS=$CFLAGS" >> $config_mak
659echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +0000660echo "EXESUF=$EXESUF" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000661if test "$cpu" = "i386" ; then
662 echo "ARCH=i386" >> $config_mak
663 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000664elif test "$cpu" = "x86_64" ; then
665 echo "ARCH=x86_64" >> $config_mak
666 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000667elif test "$cpu" = "armv4b" ; then
668 echo "ARCH=arm" >> $config_mak
669 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000670elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000671 echo "ARCH=arm" >> $config_mak
672 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000673elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000674 echo "ARCH=ppc" >> $config_mak
675 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000676elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000677 echo "ARCH=mips" >> $config_mak
678 echo "#define HOST_MIPS 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000679elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000680 echo "ARCH=s390" >> $config_mak
681 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000682elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000683 echo "ARCH=alpha" >> $config_mak
684 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000685elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000686 echo "ARCH=sparc" >> $config_mak
687 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000688elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000689 echo "ARCH=sparc64" >> $config_mak
690 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000691elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000692 echo "ARCH=ia64" >> $config_mak
693 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000694elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000695 echo "ARCH=m68k" >> $config_mak
696 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000697else
698 echo "Unsupported CPU"
699 exit 1
700fi
701if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000702 echo "WORDS_BIGENDIAN=yes" >> $config_mak
703 echo "#define WORDS_BIGENDIAN 1" >> $config_h
704fi
bellardb6853692005-06-05 17:10:39 +0000705echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +0000706if test "$mingw32" = "yes" ; then
707 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000708 echo "#define CONFIG_WIN32 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000709elif test -f "/usr/include/byteswap.h" ; then
bellard67b915a2004-03-31 23:37:16 +0000710 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
711fi
bellard83fb7ad2004-07-05 21:25:26 +0000712if test "$darwin" = "yes" ; then
713 echo "CONFIG_DARWIN=yes" >> $config_mak
714 echo "#define CONFIG_DARWIN 1" >> $config_h
715fi
bellardec530c82006-04-25 22:36:06 +0000716if test "$solaris" = "yes" ; then
717 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +0000718 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
bellardec530c82006-04-25 22:36:06 +0000719fi
bellard67b915a2004-03-31 23:37:16 +0000720if test "$gdbstub" = "yes" ; then
721 echo "CONFIG_GDBSTUB=yes" >> $config_mak
722 echo "#define CONFIG_GDBSTUB 1" >> $config_h
723fi
bellard97a847b2003-08-10 21:36:04 +0000724if test "$gprof" = "yes" ; then
725 echo "TARGET_GPROF=yes" >> $config_mak
726 echo "#define HAVE_GPROF 1" >> $config_h
727fi
728if test "$static" = "yes" ; then
729 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +0000730 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000731fi
bellard05c2a3e2006-02-08 22:39:17 +0000732if test $profiler = "yes" ; then
733 echo "#define CONFIG_PROFILER 1" >> $config_h
734fi
bellardc20709a2004-04-21 23:27:19 +0000735if test "$slirp" = "yes" ; then
736 echo "CONFIG_SLIRP=yes" >> $config_mak
737 echo "#define CONFIG_SLIRP 1" >> $config_h
738fi
bellardfb065182004-11-09 23:09:44 +0000739if test "$adlib" = "yes" ; then
740 echo "CONFIG_ADLIB=yes" >> $config_mak
741 echo "#define CONFIG_ADLIB 1" >> $config_h
742fi
743if test "$oss" = "yes" ; then
744 echo "CONFIG_OSS=yes" >> $config_mak
745 echo "#define CONFIG_OSS 1" >> $config_h
746fi
bellard1d14ffa2005-10-30 18:58:22 +0000747if test "$coreaudio" = "yes" ; then
748 echo "CONFIG_COREAUDIO=yes" >> $config_mak
749 echo "#define CONFIG_COREAUDIO 1" >> $config_h
750fi
751if test "$alsa" = "yes" ; then
752 echo "CONFIG_ALSA=yes" >> $config_mak
753 echo "#define CONFIG_ALSA 1" >> $config_h
754fi
755if test "$dsound" = "yes" ; then
756 echo "CONFIG_DSOUND=yes" >> $config_mak
757 echo "#define CONFIG_DSOUND 1" >> $config_h
758fi
bellard102a52e2004-11-14 19:57:29 +0000759if test "$fmod" = "yes" ; then
760 echo "CONFIG_FMOD=yes" >> $config_mak
761 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
762 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
763 echo "#define CONFIG_FMOD 1" >> $config_h
764fi
pbrookb1a550a2006-04-16 13:28:56 +0000765qemu_version=`head $source_path/VERSION`
766echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +0000767echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000768
769echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +0000770if [ "$source_path_used" = "yes" ]; then
771 echo "VPATH=$source_path" >> $config_mak
772fi
bellard97a847b2003-08-10 21:36:04 +0000773echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +0000774if [ "$build_docs" = "yes" ] ; then
775 echo "BUILD_DOCS=yes" >> $config_mak
776fi
bellard97a847b2003-08-10 21:36:04 +0000777
bellard83fb7ad2004-07-05 21:25:26 +0000778# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000779if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000780 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000781 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000782 echo "#define _BSD 1" >> $config_h
783fi
784
pbrookc5937222006-05-14 11:30:38 +0000785echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
786
bellard1d14ffa2005-10-30 18:58:22 +0000787for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +0000788target_dir="$target"
789config_mak=$target_dir/config.mak
790config_h=$target_dir/config.h
791target_cpu=`echo $target | cut -d '-' -f 1`
792target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +0000793[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000794[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000795[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000796[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellarda2458622005-07-23 22:39:53 +0000797[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
bellardd3258562005-07-02 15:37:12 +0000798[ "$target_cpu" = "mips" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +0000799[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
pbrooke6e59062006-10-22 00:18:54 +0000800[ "$target_cpu" = "m68k" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000801target_softmmu="no"
802if expr $target : '.*-softmmu' > /dev/null ; then
803 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000804fi
bellard997344f2003-10-27 21:10:39 +0000805target_user_only="no"
806if expr $target : '.*-user' > /dev/null ; then
807 target_user_only="yes"
808fi
bellardde83cd02003-06-15 20:25:43 +0000809
ths831b7822007-01-18 20:06:33 +0000810target_linux_user="no"
811if expr $target : '.*-linux-user' > /dev/null ; then
812 target_linux_user="yes"
813fi
814
815target_darwin_user="no"
816if expr $target : '.*-darwin-user' > /dev/null ; then
817 target_darwin_user="yes"
818fi
819
bellard97ccc682005-07-02 13:32:17 +0000820if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +0000821 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +0000822 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +0000823 echo "To build QEMU without graphical output configure with --disable-gfx-check"
bellard97ccc682005-07-02 13:32:17 +0000824 echo "Note that this will disable all output from the virtual graphics card."
825 exit 1;
826fi
827
bellard7c1f25b2004-04-22 00:02:08 +0000828#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000829
830mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +0000831mkdir -p $target_dir/fpu
ths831b7822007-01-18 20:06:33 +0000832if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
bellard69de9272004-02-16 21:40:43 +0000833 mkdir -p $target_dir/nwfpe
834fi
bellarda7e61ed2004-04-22 21:46:47 +0000835if test "$target_user_only" = "no" ; then
836 mkdir -p $target_dir/slirp
837fi
bellard69de9272004-02-16 21:40:43 +0000838
bellardec530c82006-04-25 22:36:06 +0000839#
840# don't use ln -sf as not all "ln -sf" over write the file/link
841#
842rm -f $target_dir/Makefile
843ln -s $source_path/Makefile.target $target_dir/Makefile
844
bellard97a847b2003-08-10 21:36:04 +0000845
846echo "# Automatically generated by configure - do not modify" > $config_mak
847echo "/* Automatically generated by configure - do not modify */" > $config_h
848
849
850echo "include ../config-host.mak" >> $config_mak
851echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000852
pbrooke5fe0c52006-06-11 13:32:59 +0000853bflt="no"
bellard1e43adf2003-09-30 20:54:24 +0000854interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
855echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000856
857if test "$target_cpu" = "i386" ; then
858 echo "TARGET_ARCH=i386" >> $config_mak
859 echo "#define TARGET_ARCH \"i386\"" >> $config_h
860 echo "#define TARGET_I386 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000861 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
bellard824d5602005-02-12 18:58:00 +0000862 echo "#define USE_KQEMU 1" >> $config_h
863 fi
bellard808c4952004-12-19 23:33:47 +0000864elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000865 echo "TARGET_ARCH=arm" >> $config_mak
866 echo "#define TARGET_ARCH \"arm\"" >> $config_h
867 echo "#define TARGET_ARM 1" >> $config_h
pbrooke5fe0c52006-06-11 13:32:59 +0000868 bflt="yes"
bellard1e43adf2003-09-30 20:54:24 +0000869elif test "$target_cpu" = "sparc" ; then
870 echo "TARGET_ARCH=sparc" >> $config_mak
871 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
872 echo "#define TARGET_SPARC 1" >> $config_h
bellard64b3ab22005-01-30 22:43:42 +0000873elif test "$target_cpu" = "sparc64" ; then
874 echo "TARGET_ARCH=sparc64" >> $config_mak
875 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
876 echo "#define TARGET_SPARC 1" >> $config_h
877 echo "#define TARGET_SPARC64 1" >> $config_h
bellard67867302003-11-23 17:05:30 +0000878elif test "$target_cpu" = "ppc" ; then
879 echo "TARGET_ARCH=ppc" >> $config_mak
880 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
881 echo "#define TARGET_PPC 1" >> $config_h
bellarda2458622005-07-23 22:39:53 +0000882elif test "$target_cpu" = "ppc64" ; then
883 echo "TARGET_ARCH=ppc64" >> $config_mak
884 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
885 echo "#define TARGET_PPC 1" >> $config_h
886 echo "#define TARGET_PPC64 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000887elif test "$target_cpu" = "x86_64" ; then
888 echo "TARGET_ARCH=x86_64" >> $config_mak
889 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
890 echo "#define TARGET_I386 1" >> $config_h
891 echo "#define TARGET_X86_64 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000892 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
893 echo "#define USE_KQEMU 1" >> $config_h
894 fi
bellardc20eb472005-12-06 21:42:55 +0000895elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
bellardd3258562005-07-02 15:37:12 +0000896 echo "TARGET_ARCH=mips" >> $config_mak
897 echo "#define TARGET_ARCH \"mips\"" >> $config_h
898 echo "#define TARGET_MIPS 1" >> $config_h
bellard6ea83fe2006-06-14 12:56:19 +0000899 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
900 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
pbrook908f52b2006-06-18 19:16:53 +0000901elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
bellardfdf9b3e2006-04-27 21:07:38 +0000902 echo "TARGET_ARCH=sh4" >> $config_mak
903 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
904 echo "#define TARGET_SH4 1" >> $config_h
pbrook4dbed892006-06-17 20:01:14 +0000905 bflt="yes"
pbrooke6e59062006-10-22 00:18:54 +0000906elif test "$target_cpu" = "m68k" ; then
907 echo "TARGET_ARCH=m68k" >> $config_mak
908 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
909 echo "#define TARGET_M68K 1" >> $config_h
910 bflt="yes"
bellardde83cd02003-06-15 20:25:43 +0000911else
912 echo "Unsupported target CPU"
913 exit 1
914fi
915if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000916 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
917 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
918fi
919if test "$target_softmmu" = "yes" ; then
920 echo "CONFIG_SOFTMMU=yes" >> $config_mak
921 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000922fi
bellard997344f2003-10-27 21:10:39 +0000923if test "$target_user_only" = "yes" ; then
924 echo "CONFIG_USER_ONLY=yes" >> $config_mak
925 echo "#define CONFIG_USER_ONLY 1" >> $config_h
926fi
ths831b7822007-01-18 20:06:33 +0000927if test "$target_linux_user" = "yes" ; then
928 echo "CONFIG_LINUX_USER=yes" >> $config_mak
929 echo "#define CONFIG_LINUX_USER 1" >> $config_h
930fi
931if test "$target_darwin_user" = "yes" ; then
932 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
933 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
934fi
bellardde83cd02003-06-15 20:25:43 +0000935
pbrooke6e59062006-10-22 00:18:54 +0000936if 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 +0000937 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
938 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
939fi
pbrooke5fe0c52006-06-11 13:32:59 +0000940if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
941 echo "TARGET_HAS_BFLT=yes" >> $config_mak
942 echo "#define TARGET_HAS_BFLT 1" >> $config_h
943fi
bellard7c1f25b2004-04-22 00:02:08 +0000944# sdl defines
945
946if test "$target_user_only" = "no"; then
947 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000948 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000949 else
bellarddbb2c922004-10-24 22:17:47 +0000950 sdl1=$sdl
951 fi
952 if test "$sdl1" = "yes" ; then
953 echo "#define CONFIG_SDL 1" >> $config_h
954 echo "CONFIG_SDL=yes" >> $config_mak
955 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
956 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
957 else
bellard7c1f25b2004-04-22 00:02:08 +0000958 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
959 fi
bellarddbb2c922004-10-24 22:17:47 +0000960 if [ "${aa}" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000961 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
962 else
963 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
bellarddbb2c922004-10-24 22:17:47 +0000964 fi
bellard7c1f25b2004-04-22 00:02:08 +0000965 fi
bellard7c1f25b2004-04-22 00:02:08 +0000966fi
967
bellard5b0753e2005-03-01 21:37:28 +0000968if test "$cocoa" = "yes" ; then
969 echo "#define CONFIG_COCOA 1" >> $config_h
970 echo "CONFIG_COCOA=yes" >> $config_mak
971fi
972
bellard97a847b2003-08-10 21:36:04 +0000973done # for target in $targets
bellard7d132992003-03-06 23:23:54 +0000974
975# build tree in object directory if source path is different from current one
976if test "$source_path_used" = "yes" ; then
977 DIRS="tests"
978 FILES="Makefile tests/Makefile"
979 for dir in $DIRS ; do
980 mkdir -p $dir
981 done
bellardec530c82006-04-25 22:36:06 +0000982 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +0000983 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +0000984 rm -f $f
985 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +0000986 done
987fi
bellard7d132992003-03-06 23:23:54 +0000988
bellard97a847b2003-08-10 21:36:04 +0000989rm -f $TMPO $TMPC $TMPE $TMPS