blob: eda1437fe8acf68a7484dbcf1dc1ab8826db15a0 [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"
ths6f30fa82007-01-05 01:00:47 +0000131OS_CFLAGS="-mdynamic-no-pic"
bellard83fb7ad2004-07-05 21:25:26 +0000132;;
bellardec530c82006-04-25 22:36:06 +0000133SunOS)
134solaris="yes"
135;;
bellard1d14ffa2005-10-30 18:58:22 +0000136*)
bellardfb065182004-11-09 23:09:44 +0000137oss="yes"
bellard5327cf42005-01-10 23:18:50 +0000138linux="yes"
ths831b7822007-01-18 20:06:33 +0000139linux_user="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000140if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000141 kqemu="yes"
142fi
bellardfb065182004-11-09 23:09:44 +0000143;;
bellard7d132992003-03-06 23:23:54 +0000144esac
145
bellard7d3505c2004-05-12 19:32:15 +0000146if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000147 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000148 make="gmake"
149 fi
bellard7d3505c2004-05-12 19:32:15 +0000150fi
151
bellardec530c82006-04-25 22:36:06 +0000152if [ "$solaris" = "yes" ] ; then
153 make="gmake"
154 install="ginstall"
155 solarisrev=`uname -r | cut -f2 -d.`
ths605686c2007-01-17 23:31:19 +0000156 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
157 if test "$solarisrev" -gt 10 ; then
158 kqemu="yes"
159 fi
160 fi
bellardec530c82006-04-25 22:36:06 +0000161fi
162
bellard7d132992003-03-06 23:23:54 +0000163# find source path
pbrookad064842006-04-16 12:41:07 +0000164source_path=`dirname "$0"`
165if [ -z "$source_path" ]; then
bellard7d132992003-03-06 23:23:54 +0000166 source_path=`pwd`
pbrookad064842006-04-16 12:41:07 +0000167else
168 source_path=`cd "$source_path"; pwd`
169fi
170if test "$source_path" = `pwd` ; then
bellard7d132992003-03-06 23:23:54 +0000171 source_path_used="no"
pbrookad064842006-04-16 12:41:07 +0000172else
173 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000174fi
175
176for opt do
pbrooka46e4032006-04-29 23:05:22 +0000177 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000178 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000179 --help|-h) show_help=yes
180 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000181 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000182 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000183 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000184 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000185 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000186 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000187 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000188 --cross-prefix=*) cross_prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000189 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000190 --cc=*) cc="$optarg"
pbrook328a4242006-12-19 03:31:34 +0000191 gcc3_search="no"
bellard7d132992003-03-06 23:23:54 +0000192 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000193 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000194 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000195 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000196 ;;
pbrook6a882642006-04-17 13:57:12 +0000197 --install=*) install="$optarg"
198 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000199 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000200 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000201 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000202 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000203 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000204 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000205 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000206 ;;
bellard7d132992003-03-06 23:23:54 +0000207 --enable-gprof) gprof="yes"
208 ;;
bellard43ce4df2003-06-09 19:53:12 +0000209 --static) static="yes"
210 ;;
bellard97a847b2003-08-10 21:36:04 +0000211 --disable-sdl) sdl="no"
212 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000213 --enable-coreaudio) coreaudio="yes"
214 ;;
215 --enable-alsa) alsa="yes"
216 ;;
217 --enable-dsound) dsound="yes"
218 ;;
bellard102a52e2004-11-14 19:57:29 +0000219 --enable-fmod) fmod="yes"
220 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000221 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000222 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000223 --fmod-inc=*) fmod_inc="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000224 ;;
bellard87ac5422006-06-25 17:35:56 +0000225 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no"
bellard1d14ffa2005-10-30 18:58:22 +0000226 ;;
bellard443f1372004-06-04 11:13:20 +0000227 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000228 ;;
bellardfb065182004-11-09 23:09:44 +0000229 --enable-adlib) adlib="yes"
bellard1d14ffa2005-10-30 18:58:22 +0000230 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000231 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000232 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000233 --enable-profiler) profiler="yes"
234 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000235 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
236 ;;
bellard97ccc682005-07-02 13:32:17 +0000237 --disable-gfx-check) check_gfx="no"
238 ;;
bellard1aff3812005-11-02 22:30:45 +0000239 --disable-gcc-check) check_gcc="no"
240 ;;
pbrookcad25d62006-03-19 16:31:11 +0000241 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000242 ;;
pbrookcad25d62006-03-19 16:31:11 +0000243 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000244 ;;
ths831b7822007-01-18 20:06:33 +0000245 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000246 ;;
ths831b7822007-01-18 20:06:33 +0000247 --enable-linux-user) linux_user="yes"
248 ;;
249 --disable-darwin-user) darwin_user="no"
250 ;;
251 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000252 ;;
pbrookc5937222006-05-14 11:30:38 +0000253 --enable-uname-release=*) uname_release="$optarg"
254 ;;
bellard7d132992003-03-06 23:23:54 +0000255 esac
256done
257
ths6f30fa82007-01-05 01:00:47 +0000258# default flags for all hosts
259CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
260LDFLAGS="$LDFLAGS -g"
261
pbrookaf5db582006-04-08 14:26:41 +0000262if test x"$show_help" = x"yes" ; then
263cat << EOF
264
265Usage: configure [options]
266Options: [defaults in brackets after descriptions]
267
268EOF
269echo "Standard options:"
270echo " --help print this message"
271echo " --prefix=PREFIX install in PREFIX [$prefix]"
272echo " --interp-prefix=PREFIX where to find shared libraries, etc."
273echo " use %M for cpu name [$interp_prefix]"
274echo " --target-list=LIST set target list [$target_list]"
275echo ""
276echo "kqemu kernel acceleration support:"
277echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000278echo ""
279echo "Advanced options (experts only):"
280echo " --source-path=PATH path of source code [$source_path]"
281echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
282echo " --cc=CC use C compiler CC [$cc]"
283echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
284echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000285echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000286echo " --static enable static build [$static]"
287echo " --enable-cocoa enable COCOA (Mac OS X only)"
288echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
289echo " --enable-adlib enable Adlib emulation"
290echo " --enable-coreaudio enable Coreaudio audio driver"
291echo " --enable-alsa enable ALSA audio driver"
292echo " --enable-fmod enable FMOD audio driver"
293echo " --enabled-dsound enable DirectSound audio driver"
294echo " --enable-system enable all system emulation targets"
295echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000296echo " --enable-linux-user enable all linux usermode emulation targets"
297echo " --disable-linux-user disable all linux usermode emulation targets"
298echo " --enable-darwin-user enable all darwin usermode emulation targets"
299echo " --disable-darwin-user disable all darwin usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000300echo " --fmod-lib path to FMOD library"
301echo " --fmod-inc path to FMOD includes"
pbrookc5937222006-05-14 11:30:38 +0000302echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
pbrookaf5db582006-04-08 14:26:41 +0000303echo ""
ths5bf08932006-12-23 00:33:26 +0000304echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000305exit 1
306fi
307
bellard7d132992003-03-06 23:23:54 +0000308cc="${cross_prefix}${cc}"
309ar="${cross_prefix}${ar}"
310strip="${cross_prefix}${strip}"
311
pbrook064aae12006-05-08 00:51:44 +0000312# check that the C compiler works.
313cat > $TMPC <<EOF
314int main(void) {}
315EOF
316
317if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
318 : C compiler works ok
319else
320 echo "ERROR: \"$cc\" either does not exist or does not work"
321 exit 1
bellarda7350fa2006-04-23 14:35:23 +0000322fi
323
bellard67b915a2004-03-31 23:37:16 +0000324if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000325 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000326 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000327 oss="no"
bellard07f4ddb2005-04-23 17:44:28 +0000328 if [ "$cpu" = "i386" ] ; then
329 kqemu="yes"
330 fi
bellard67b915a2004-03-31 23:37:16 +0000331fi
332
pbrook328a4242006-12-19 03:31:34 +0000333# Check for gcc4, error if pre-gcc4
334if test "$check_gcc" = "yes" ; then
335 cat > $TMPC <<EOF
336#if __GNUC__ < 4
337#error gcc3
338#endif
339int main(){return 0;}
340EOF
341 check_cc() {
342 which "$1" >&/dev/null
343 return $?
344 }
345
346 if "$cc" -o $TMPE $TMPC 2>/dev/null ; then
347 echo "WARNING: \"$cc\" looks like gcc 4.x"
348 found_compat_cc="no"
349 if test "$gcc3_search" = "yes" ; then
350 echo "Looking for gcc 3.x"
351 for compat_cc in $gcc3_list ; do
352 if check_cc "$compat_cc" ; then
353 echo "Found \"$compat_cc\""
354 cc="$compat_cc"
355 found_compat_cc="yes"
356 break
357 fi
358 done
359 if test "$found_compat_cc" = "no" ; then
360 echo "gcc 3.x not found!"
361 fi
362 fi
363 if test "$found_compat_cc" = "no" ; then
364 echo "QEMU is known to have problems when compiled with gcc 4.x"
365 echo "It is recommended that you use gcc 3.x to build QEMU"
366 echo "To use this compiler anyway, configure with --disable-gcc-check"
367 exit 1;
368 fi
369 fi
370fi
371
bellardec530c82006-04-25 22:36:06 +0000372#
373# Solaris specific configure tool chain decisions
374#
375if test "$solaris" = "yes" ; then
376 #
377 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
378 # override the check with --disable-gcc-check
379 #
380 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
381 solgcc=`which $cc`
382 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
383 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
384 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
385 echo "or get the latest patch from SunSolve for gcc"
386 exit 1
387 fi
388 fi
389 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
390 if test -z "$solinst" ; then
391 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
392 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
393 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
394 exit 1
395 fi
396 if test "$solinst" = "/usr/sbin/install" ; then
397 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
398 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
399 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
400 exit 1
401 fi
bellardec530c82006-04-25 22:36:06 +0000402 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
403 if test -z "$sol_ar" ; then
404 echo "Error: No path includes ar"
405 if test -f /usr/ccs/bin/ar ; then
406 echo "Add /usr/ccs/bin to your path and rerun configure"
407 fi
408 exit 1
409 fi
410fi
411
412
bellard5327cf42005-01-10 23:18:50 +0000413if test -z "$target_list" ; then
414# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000415 if [ "$softmmu" = "yes" ] ; then
416 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
417 fi
bellard5327cf42005-01-10 23:18:50 +0000418# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000419 if [ "$linux_user" = "yes" ] ; then
420 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"
421 fi
422# the following are Darwin specific
423 if [ "$darwin_user" = "yes" ] ; then
424 target_list="i386-darwin-user ppc-darwin-user $target_list"
bellard5327cf42005-01-10 23:18:50 +0000425 fi
bellard6e20a452005-06-05 15:56:02 +0000426else
pbrookb1a550a2006-04-16 13:28:56 +0000427 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000428fi
pbrook0a8e90f2006-03-19 14:54:16 +0000429if test -z "$target_list" ; then
430 echo "No targets enabled"
431 exit 1
432fi
bellard5327cf42005-01-10 23:18:50 +0000433
bellard7d132992003-03-06 23:23:54 +0000434if test -z "$cross_prefix" ; then
435
436# ---
437# big/little endian test
438cat > $TMPC << EOF
439#include <inttypes.h>
440int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000441 volatile uint32_t i=0x01234567;
442 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000443}
444EOF
445
446if $cc -o $TMPE $TMPC 2>/dev/null ; then
447$TMPE && bigendian="yes"
448else
449echo big/little test failed
450fi
451
452else
453
454# if cross compiling, cannot launch a program, so make a static guess
bellard808c4952004-12-19 23:33:47 +0000455if 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 +0000456 bigendian="yes"
457fi
458
459fi
460
bellardb6853692005-06-05 17:10:39 +0000461# host long bits test
462hostlongbits="32"
463if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
464 hostlongbits="64"
465fi
466
bellarde8cd23d2003-06-25 16:08:13 +0000467# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000468cat > $TMPC <<EOF
469int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000470}
471EOF
472
bellarde8cd23d2003-06-25 16:08:13 +0000473have_gcc3_options="no"
474if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
475 have_gcc3_options="yes"
bellard04369ff2003-03-20 22:33:23 +0000476fi
bellardca735202003-03-18 20:41:34 +0000477
bellard11d9f692004-04-02 20:55:59 +0000478##########################################
479# SDL probe
480
481sdl_too_old=no
482
483if test -z "$sdl" ; then
484
bellarda6e022a2004-04-02 21:55:47 +0000485sdl_config="sdl-config"
486sdl=no
bellard7c1f25b2004-04-22 00:02:08 +0000487sdl_static=no
bellarda6e022a2004-04-02 21:55:47 +0000488
489if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
490# win32 cross compilation case
491 sdl_config="i386-mingw32msvc-sdl-config"
492 sdl=yes
493else
494# normal SDL probe
bellard11d9f692004-04-02 20:55:59 +0000495cat > $TMPC << EOF
496#include <SDL.h>
497#undef main /* We don't want SDL to override our main() */
498int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
499EOF
500
bellarda6e022a2004-04-02 21:55:47 +0000501if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
502_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
bellard11d9f692004-04-02 20:55:59 +0000503if test "$_sdlversion" -lt 121 ; then
504sdl_too_old=yes
505else
506sdl=yes
507fi
bellard7c1f25b2004-04-22 00:02:08 +0000508
509# static link with sdl ?
510if test "$sdl" = "yes" ; then
511aa="no"
512`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
513sdl_static_libs=`$sdl_config --static-libs`
514if [ "$aa" = "yes" ] ; then
bellardd8d8aa42004-04-29 20:14:07 +0000515 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
bellard11d9f692004-04-02 20:55:59 +0000516fi
517
bellard7c1f25b2004-04-22 00:02:08 +0000518if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
519 sdl_static=yes
520fi
521
522fi # static link
523
524fi # sdl compile test
525
bellarda6e022a2004-04-02 21:55:47 +0000526fi # cross compilation
527fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000528
ths8f28f3f2007-01-05 21:25:54 +0000529##########################################
530# alsa sound support libraries
531
532if test "$alsa" = "yes" ; then
533 cat > $TMPC << EOF
534#include <alsa/asoundlib.h>
535int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
536EOF
537 if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
538 :
539 else
540 echo
541 echo "Error: Could not find alsa"
542 echo "Make sure to have the alsa libs and headers installed."
543 echo
544 exit 1
545 fi
546fi
547
pbrookcc8ae6d2006-04-23 17:57:59 +0000548# Check if tools are available to build documentation.
pbrook94ac5152006-04-26 16:07:35 +0000549if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +0000550 build_docs="yes"
551fi
552
bellard11d9f692004-04-02 20:55:59 +0000553if test "$mingw32" = "yes" ; then
554if test -z "$prefix" ; then
555 prefix="/c/Program Files/Qemu"
556fi
557mandir="$prefix"
bellard7efa4382004-05-12 18:54:06 +0000558datadir="$prefix"
bellard1f50f8d2004-05-08 14:44:43 +0000559docdir="$prefix"
bellard11d9f692004-04-02 20:55:59 +0000560bindir="$prefix"
561else
562if test -z "$prefix" ; then
563 prefix="/usr/local"
564fi
bellard5a671352003-10-01 00:13:48 +0000565mandir="$prefix/share/man"
bellard7efa4382004-05-12 18:54:06 +0000566datadir="$prefix/share/qemu"
bellard1f50f8d2004-05-08 14:44:43 +0000567docdir="$prefix/share/doc/qemu"
bellard11d9f692004-04-02 20:55:59 +0000568bindir="$prefix/bin"
569fi
bellard5a671352003-10-01 00:13:48 +0000570
bellard43ce4df2003-06-09 19:53:12 +0000571echo "Install prefix $prefix"
bellard7efa4382004-05-12 18:54:06 +0000572echo "BIOS directory $datadir"
bellard11d9f692004-04-02 20:55:59 +0000573echo "binary directory $bindir"
574if test "$mingw32" = "no" ; then
575echo "Manual directory $mandir"
bellard43ce4df2003-06-09 19:53:12 +0000576echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000577fi
bellard5a671352003-10-01 00:13:48 +0000578echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000579echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +0000580echo "Host C compiler $host_cc"
bellard43ce4df2003-06-09 19:53:12 +0000581echo "make $make"
pbrook6a882642006-04-17 13:57:12 +0000582echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +0000583echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000584echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000585echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000586echo "gprof enabled $gprof"
bellard05c2a3e2006-02-08 22:39:17 +0000587echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +0000588echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000589if test "$darwin" = "yes" ; then
590 echo "Cocoa support $cocoa"
591fi
bellard97a847b2003-08-10 21:36:04 +0000592echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000593if test "$sdl" != "no" ; then
594 echo "SDL static link $sdl_static"
595fi
bellard67b915a2004-03-31 23:37:16 +0000596echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000597echo "Adlib support $adlib"
bellard1d14ffa2005-10-30 18:58:22 +0000598echo "CoreAudio support $coreaudio"
599echo "ALSA support $alsa"
600echo "DSound support $dsound"
bellard1d14ffa2005-10-30 18:58:22 +0000601if test "$fmod" = "yes"; then
602 if test -z $fmod_lib || test -z $fmod_inc; then
603 echo
604 echo "Error: You must specify path to FMOD library and headers"
605 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
606 echo
607 exit 1
608 fi
pbrookb1a550a2006-04-16 13:28:56 +0000609 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
610else
611 fmod_support=""
bellard102a52e2004-11-14 19:57:29 +0000612fi
pbrookb1a550a2006-04-16 13:28:56 +0000613echo "FMOD support $fmod $fmod_support"
bellard07f4ddb2005-04-23 17:44:28 +0000614echo "kqemu support $kqemu"
pbrookcc8ae6d2006-04-23 17:57:59 +0000615echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +0000616[ ! -z "$uname_release" ] && \
617echo "uname -r $uname_release"
bellard67b915a2004-03-31 23:37:16 +0000618
bellard97a847b2003-08-10 21:36:04 +0000619if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000620echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000621fi
bellard24b55b92005-03-01 22:30:41 +0000622#if test "$sdl_static" = "no"; then
623# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
624#fi
bellard97a847b2003-08-10 21:36:04 +0000625config_mak="config-host.mak"
626config_h="config-host.h"
627
bellard7c1f25b2004-04-22 00:02:08 +0000628#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000629
630echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +0000631echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000632echo "/* Automatically generated by configure - do not modify */" > $config_h
633
634echo "prefix=$prefix" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000635echo "bindir=$bindir" >> $config_mak
bellard5a671352003-10-01 00:13:48 +0000636echo "mandir=$mandir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000637echo "datadir=$datadir" >> $config_mak
bellard1f50f8d2004-05-08 14:44:43 +0000638echo "docdir=$docdir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000639echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000640echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +0000641echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000642echo "CC=$cc" >> $config_mak
643if test "$have_gcc3_options" = "yes" ; then
644 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
645fi
646echo "HOST_CC=$host_cc" >> $config_mak
647echo "AR=$ar" >> $config_mak
648echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
ths6f30fa82007-01-05 01:00:47 +0000649echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000650echo "CFLAGS=$CFLAGS" >> $config_mak
651echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +0000652echo "EXESUF=$EXESUF" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000653if test "$cpu" = "i386" ; then
654 echo "ARCH=i386" >> $config_mak
655 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000656elif test "$cpu" = "x86_64" ; then
657 echo "ARCH=x86_64" >> $config_mak
658 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000659elif test "$cpu" = "armv4b" ; then
660 echo "ARCH=arm" >> $config_mak
661 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000662elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000663 echo "ARCH=arm" >> $config_mak
664 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000665elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000666 echo "ARCH=ppc" >> $config_mak
667 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000668elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000669 echo "ARCH=mips" >> $config_mak
670 echo "#define HOST_MIPS 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000671elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000672 echo "ARCH=s390" >> $config_mak
673 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000674elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000675 echo "ARCH=alpha" >> $config_mak
676 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000677elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000678 echo "ARCH=sparc" >> $config_mak
679 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000680elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000681 echo "ARCH=sparc64" >> $config_mak
682 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000683elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000684 echo "ARCH=ia64" >> $config_mak
685 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000686elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000687 echo "ARCH=m68k" >> $config_mak
688 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000689else
690 echo "Unsupported CPU"
691 exit 1
692fi
693if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000694 echo "WORDS_BIGENDIAN=yes" >> $config_mak
695 echo "#define WORDS_BIGENDIAN 1" >> $config_h
696fi
bellardb6853692005-06-05 17:10:39 +0000697echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +0000698if test "$mingw32" = "yes" ; then
699 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000700 echo "#define CONFIG_WIN32 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000701elif test -f "/usr/include/byteswap.h" ; then
bellard67b915a2004-03-31 23:37:16 +0000702 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
703fi
bellard83fb7ad2004-07-05 21:25:26 +0000704if test "$darwin" = "yes" ; then
705 echo "CONFIG_DARWIN=yes" >> $config_mak
706 echo "#define CONFIG_DARWIN 1" >> $config_h
707fi
bellardec530c82006-04-25 22:36:06 +0000708if test "$solaris" = "yes" ; then
709 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +0000710 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
bellardec530c82006-04-25 22:36:06 +0000711fi
bellard67b915a2004-03-31 23:37:16 +0000712if test "$gdbstub" = "yes" ; then
713 echo "CONFIG_GDBSTUB=yes" >> $config_mak
714 echo "#define CONFIG_GDBSTUB 1" >> $config_h
715fi
bellard97a847b2003-08-10 21:36:04 +0000716if test "$gprof" = "yes" ; then
717 echo "TARGET_GPROF=yes" >> $config_mak
718 echo "#define HAVE_GPROF 1" >> $config_h
719fi
720if test "$static" = "yes" ; then
721 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +0000722 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000723fi
bellard05c2a3e2006-02-08 22:39:17 +0000724if test $profiler = "yes" ; then
725 echo "#define CONFIG_PROFILER 1" >> $config_h
726fi
bellardc20709a2004-04-21 23:27:19 +0000727if test "$slirp" = "yes" ; then
728 echo "CONFIG_SLIRP=yes" >> $config_mak
729 echo "#define CONFIG_SLIRP 1" >> $config_h
730fi
bellardfb065182004-11-09 23:09:44 +0000731if test "$adlib" = "yes" ; then
732 echo "CONFIG_ADLIB=yes" >> $config_mak
733 echo "#define CONFIG_ADLIB 1" >> $config_h
734fi
735if test "$oss" = "yes" ; then
736 echo "CONFIG_OSS=yes" >> $config_mak
737 echo "#define CONFIG_OSS 1" >> $config_h
738fi
bellard1d14ffa2005-10-30 18:58:22 +0000739if test "$coreaudio" = "yes" ; then
740 echo "CONFIG_COREAUDIO=yes" >> $config_mak
741 echo "#define CONFIG_COREAUDIO 1" >> $config_h
742fi
743if test "$alsa" = "yes" ; then
744 echo "CONFIG_ALSA=yes" >> $config_mak
745 echo "#define CONFIG_ALSA 1" >> $config_h
746fi
747if test "$dsound" = "yes" ; then
748 echo "CONFIG_DSOUND=yes" >> $config_mak
749 echo "#define CONFIG_DSOUND 1" >> $config_h
750fi
bellard102a52e2004-11-14 19:57:29 +0000751if test "$fmod" = "yes" ; then
752 echo "CONFIG_FMOD=yes" >> $config_mak
753 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
754 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
755 echo "#define CONFIG_FMOD 1" >> $config_h
756fi
pbrookb1a550a2006-04-16 13:28:56 +0000757qemu_version=`head $source_path/VERSION`
758echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +0000759echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000760
761echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +0000762if [ "$source_path_used" = "yes" ]; then
763 echo "VPATH=$source_path" >> $config_mak
764fi
bellard97a847b2003-08-10 21:36:04 +0000765echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +0000766if [ "$build_docs" = "yes" ] ; then
767 echo "BUILD_DOCS=yes" >> $config_mak
768fi
bellard97a847b2003-08-10 21:36:04 +0000769
bellard83fb7ad2004-07-05 21:25:26 +0000770# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000771if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000772 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000773 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000774 echo "#define _BSD 1" >> $config_h
775fi
776
pbrookc5937222006-05-14 11:30:38 +0000777echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
778
bellard1d14ffa2005-10-30 18:58:22 +0000779for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +0000780target_dir="$target"
781config_mak=$target_dir/config.mak
782config_h=$target_dir/config.h
783target_cpu=`echo $target | cut -d '-' -f 1`
784target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +0000785[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000786[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000787[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000788[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellarda2458622005-07-23 22:39:53 +0000789[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
bellardd3258562005-07-02 15:37:12 +0000790[ "$target_cpu" = "mips" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +0000791[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
pbrooke6e59062006-10-22 00:18:54 +0000792[ "$target_cpu" = "m68k" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000793target_softmmu="no"
794if expr $target : '.*-softmmu' > /dev/null ; then
795 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000796fi
bellard997344f2003-10-27 21:10:39 +0000797target_user_only="no"
798if expr $target : '.*-user' > /dev/null ; then
799 target_user_only="yes"
800fi
bellardde83cd02003-06-15 20:25:43 +0000801
ths831b7822007-01-18 20:06:33 +0000802target_linux_user="no"
803if expr $target : '.*-linux-user' > /dev/null ; then
804 target_linux_user="yes"
805fi
806
807target_darwin_user="no"
808if expr $target : '.*-darwin-user' > /dev/null ; then
809 target_darwin_user="yes"
810fi
811
bellard97ccc682005-07-02 13:32:17 +0000812if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +0000813 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +0000814 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +0000815 echo "To build QEMU without graphical output configure with --disable-gfx-check"
bellard97ccc682005-07-02 13:32:17 +0000816 echo "Note that this will disable all output from the virtual graphics card."
817 exit 1;
818fi
819
bellard7c1f25b2004-04-22 00:02:08 +0000820#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000821
822mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +0000823mkdir -p $target_dir/fpu
ths831b7822007-01-18 20:06:33 +0000824if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
bellard69de9272004-02-16 21:40:43 +0000825 mkdir -p $target_dir/nwfpe
826fi
bellarda7e61ed2004-04-22 21:46:47 +0000827if test "$target_user_only" = "no" ; then
828 mkdir -p $target_dir/slirp
829fi
bellard69de9272004-02-16 21:40:43 +0000830
bellardec530c82006-04-25 22:36:06 +0000831#
832# don't use ln -sf as not all "ln -sf" over write the file/link
833#
834rm -f $target_dir/Makefile
835ln -s $source_path/Makefile.target $target_dir/Makefile
836
bellard97a847b2003-08-10 21:36:04 +0000837
838echo "# Automatically generated by configure - do not modify" > $config_mak
839echo "/* Automatically generated by configure - do not modify */" > $config_h
840
841
842echo "include ../config-host.mak" >> $config_mak
843echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000844
pbrooke5fe0c52006-06-11 13:32:59 +0000845bflt="no"
bellard1e43adf2003-09-30 20:54:24 +0000846interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
847echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000848
849if test "$target_cpu" = "i386" ; then
850 echo "TARGET_ARCH=i386" >> $config_mak
851 echo "#define TARGET_ARCH \"i386\"" >> $config_h
852 echo "#define TARGET_I386 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000853 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
bellard824d5602005-02-12 18:58:00 +0000854 echo "#define USE_KQEMU 1" >> $config_h
855 fi
bellard808c4952004-12-19 23:33:47 +0000856elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000857 echo "TARGET_ARCH=arm" >> $config_mak
858 echo "#define TARGET_ARCH \"arm\"" >> $config_h
859 echo "#define TARGET_ARM 1" >> $config_h
pbrooke5fe0c52006-06-11 13:32:59 +0000860 bflt="yes"
bellard1e43adf2003-09-30 20:54:24 +0000861elif test "$target_cpu" = "sparc" ; then
862 echo "TARGET_ARCH=sparc" >> $config_mak
863 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
864 echo "#define TARGET_SPARC 1" >> $config_h
bellard64b3ab22005-01-30 22:43:42 +0000865elif test "$target_cpu" = "sparc64" ; then
866 echo "TARGET_ARCH=sparc64" >> $config_mak
867 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
868 echo "#define TARGET_SPARC 1" >> $config_h
869 echo "#define TARGET_SPARC64 1" >> $config_h
bellard67867302003-11-23 17:05:30 +0000870elif test "$target_cpu" = "ppc" ; then
871 echo "TARGET_ARCH=ppc" >> $config_mak
872 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
873 echo "#define TARGET_PPC 1" >> $config_h
bellarda2458622005-07-23 22:39:53 +0000874elif test "$target_cpu" = "ppc64" ; then
875 echo "TARGET_ARCH=ppc64" >> $config_mak
876 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
877 echo "#define TARGET_PPC 1" >> $config_h
878 echo "#define TARGET_PPC64 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000879elif test "$target_cpu" = "x86_64" ; then
880 echo "TARGET_ARCH=x86_64" >> $config_mak
881 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
882 echo "#define TARGET_I386 1" >> $config_h
883 echo "#define TARGET_X86_64 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000884 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
885 echo "#define USE_KQEMU 1" >> $config_h
886 fi
bellardc20eb472005-12-06 21:42:55 +0000887elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
bellardd3258562005-07-02 15:37:12 +0000888 echo "TARGET_ARCH=mips" >> $config_mak
889 echo "#define TARGET_ARCH \"mips\"" >> $config_h
890 echo "#define TARGET_MIPS 1" >> $config_h
bellard6ea83fe2006-06-14 12:56:19 +0000891 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
892 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
pbrook908f52b2006-06-18 19:16:53 +0000893elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
bellardfdf9b3e2006-04-27 21:07:38 +0000894 echo "TARGET_ARCH=sh4" >> $config_mak
895 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
896 echo "#define TARGET_SH4 1" >> $config_h
pbrook4dbed892006-06-17 20:01:14 +0000897 bflt="yes"
pbrooke6e59062006-10-22 00:18:54 +0000898elif test "$target_cpu" = "m68k" ; then
899 echo "TARGET_ARCH=m68k" >> $config_mak
900 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
901 echo "#define TARGET_M68K 1" >> $config_h
902 bflt="yes"
bellardde83cd02003-06-15 20:25:43 +0000903else
904 echo "Unsupported target CPU"
905 exit 1
906fi
907if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000908 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
909 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
910fi
911if test "$target_softmmu" = "yes" ; then
912 echo "CONFIG_SOFTMMU=yes" >> $config_mak
913 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000914fi
bellard997344f2003-10-27 21:10:39 +0000915if test "$target_user_only" = "yes" ; then
916 echo "CONFIG_USER_ONLY=yes" >> $config_mak
917 echo "#define CONFIG_USER_ONLY 1" >> $config_h
918fi
ths831b7822007-01-18 20:06:33 +0000919if test "$target_linux_user" = "yes" ; then
920 echo "CONFIG_LINUX_USER=yes" >> $config_mak
921 echo "#define CONFIG_LINUX_USER 1" >> $config_h
922fi
923if test "$target_darwin_user" = "yes" ; then
924 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
925 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
926fi
bellardde83cd02003-06-15 20:25:43 +0000927
pbrooke6e59062006-10-22 00:18:54 +0000928if 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 +0000929 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
930 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
931fi
pbrooke5fe0c52006-06-11 13:32:59 +0000932if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
933 echo "TARGET_HAS_BFLT=yes" >> $config_mak
934 echo "#define TARGET_HAS_BFLT 1" >> $config_h
935fi
bellard7c1f25b2004-04-22 00:02:08 +0000936# sdl defines
937
938if test "$target_user_only" = "no"; then
939 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000940 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000941 else
bellarddbb2c922004-10-24 22:17:47 +0000942 sdl1=$sdl
943 fi
944 if test "$sdl1" = "yes" ; then
945 echo "#define CONFIG_SDL 1" >> $config_h
946 echo "CONFIG_SDL=yes" >> $config_mak
947 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
948 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
949 else
bellard7c1f25b2004-04-22 00:02:08 +0000950 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
951 fi
bellarddbb2c922004-10-24 22:17:47 +0000952 if [ "${aa}" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000953 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
954 else
955 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
bellarddbb2c922004-10-24 22:17:47 +0000956 fi
bellard7c1f25b2004-04-22 00:02:08 +0000957 fi
bellard7c1f25b2004-04-22 00:02:08 +0000958fi
959
bellard5b0753e2005-03-01 21:37:28 +0000960if test "$cocoa" = "yes" ; then
961 echo "#define CONFIG_COCOA 1" >> $config_h
962 echo "CONFIG_COCOA=yes" >> $config_mak
963fi
964
bellard97a847b2003-08-10 21:36:04 +0000965done # for target in $targets
bellard7d132992003-03-06 23:23:54 +0000966
967# build tree in object directory if source path is different from current one
968if test "$source_path_used" = "yes" ; then
969 DIRS="tests"
970 FILES="Makefile tests/Makefile"
971 for dir in $DIRS ; do
972 mkdir -p $dir
973 done
bellardec530c82006-04-25 22:36:06 +0000974 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +0000975 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +0000976 rm -f $f
977 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +0000978 done
979fi
bellard7d132992003-03-06 23:23:54 +0000980
bellard97a847b2003-08-10 21:36:04 +0000981rm -f $TMPO $TMPC $TMPE $TMPS