blob: 515d1f38ec58fff4d77a42b7412350b6f2e76394 [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
ths70956b72007-03-17 15:00:37 +0000162if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
163 AIOLIBS=
164else
165 AIOLIBS="-lrt"
166fi
167
bellard7d132992003-03-06 23:23:54 +0000168# find source path
pbrookad064842006-04-16 12:41:07 +0000169source_path=`dirname "$0"`
170if [ -z "$source_path" ]; then
bellard7d132992003-03-06 23:23:54 +0000171 source_path=`pwd`
pbrookad064842006-04-16 12:41:07 +0000172else
173 source_path=`cd "$source_path"; pwd`
174fi
175if test "$source_path" = `pwd` ; then
bellard7d132992003-03-06 23:23:54 +0000176 source_path_used="no"
pbrookad064842006-04-16 12:41:07 +0000177else
178 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000179fi
180
181for opt do
pbrooka46e4032006-04-29 23:05:22 +0000182 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000183 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000184 --help|-h) show_help=yes
185 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000186 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000187 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000188 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000189 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000190 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000191 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000192 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000193 --cross-prefix=*) cross_prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000194 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000195 --cc=*) cc="$optarg"
pbrook328a4242006-12-19 03:31:34 +0000196 gcc3_search="no"
bellard7d132992003-03-06 23:23:54 +0000197 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000198 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000199 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000200 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000201 ;;
pbrook6a882642006-04-17 13:57:12 +0000202 --install=*) install="$optarg"
203 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000204 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000205 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000206 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000207 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000208 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000209 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000210 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000211 ;;
bellard7d132992003-03-06 23:23:54 +0000212 --enable-gprof) gprof="yes"
213 ;;
bellard43ce4df2003-06-09 19:53:12 +0000214 --static) static="yes"
215 ;;
bellard97a847b2003-08-10 21:36:04 +0000216 --disable-sdl) sdl="no"
217 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000218 --enable-coreaudio) coreaudio="yes"
219 ;;
220 --enable-alsa) alsa="yes"
221 ;;
222 --enable-dsound) dsound="yes"
223 ;;
bellard102a52e2004-11-14 19:57:29 +0000224 --enable-fmod) fmod="yes"
225 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000226 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000227 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000228 --fmod-inc=*) fmod_inc="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000229 ;;
bellardb93aebe2007-02-15 22:58:18 +0000230 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
bellard1d14ffa2005-10-30 18:58:22 +0000231 ;;
bellard443f1372004-06-04 11:13:20 +0000232 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000233 ;;
bellardfb065182004-11-09 23:09:44 +0000234 --enable-adlib) adlib="yes"
bellard1d14ffa2005-10-30 18:58:22 +0000235 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000236 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000237 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000238 --enable-profiler) profiler="yes"
239 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000240 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
241 ;;
bellard97ccc682005-07-02 13:32:17 +0000242 --disable-gfx-check) check_gfx="no"
243 ;;
bellard1aff3812005-11-02 22:30:45 +0000244 --disable-gcc-check) check_gcc="no"
245 ;;
pbrookcad25d62006-03-19 16:31:11 +0000246 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000247 ;;
pbrookcad25d62006-03-19 16:31:11 +0000248 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000249 ;;
ths831b7822007-01-18 20:06:33 +0000250 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000251 ;;
ths831b7822007-01-18 20:06:33 +0000252 --enable-linux-user) linux_user="yes"
253 ;;
254 --disable-darwin-user) darwin_user="no"
255 ;;
256 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000257 ;;
pbrookc5937222006-05-14 11:30:38 +0000258 --enable-uname-release=*) uname_release="$optarg"
259 ;;
bellard7d132992003-03-06 23:23:54 +0000260 esac
261done
262
ths6f30fa82007-01-05 01:00:47 +0000263# default flags for all hosts
264CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
265LDFLAGS="$LDFLAGS -g"
266
pbrookaf5db582006-04-08 14:26:41 +0000267if test x"$show_help" = x"yes" ; then
268cat << EOF
269
270Usage: configure [options]
271Options: [defaults in brackets after descriptions]
272
273EOF
274echo "Standard options:"
275echo " --help print this message"
276echo " --prefix=PREFIX install in PREFIX [$prefix]"
277echo " --interp-prefix=PREFIX where to find shared libraries, etc."
278echo " use %M for cpu name [$interp_prefix]"
279echo " --target-list=LIST set target list [$target_list]"
280echo ""
281echo "kqemu kernel acceleration support:"
282echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000283echo ""
284echo "Advanced options (experts only):"
285echo " --source-path=PATH path of source code [$source_path]"
286echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
287echo " --cc=CC use C compiler CC [$cc]"
288echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
289echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000290echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000291echo " --static enable static build [$static]"
292echo " --enable-cocoa enable COCOA (Mac OS X only)"
293echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
294echo " --enable-adlib enable Adlib emulation"
295echo " --enable-coreaudio enable Coreaudio audio driver"
296echo " --enable-alsa enable ALSA audio driver"
297echo " --enable-fmod enable FMOD audio driver"
298echo " --enabled-dsound enable DirectSound audio driver"
299echo " --enable-system enable all system emulation targets"
300echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000301echo " --enable-linux-user enable all linux usermode emulation targets"
302echo " --disable-linux-user disable all linux usermode emulation targets"
303echo " --enable-darwin-user enable all darwin usermode emulation targets"
304echo " --disable-darwin-user disable all darwin usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000305echo " --fmod-lib path to FMOD library"
306echo " --fmod-inc path to FMOD includes"
pbrookc5937222006-05-14 11:30:38 +0000307echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
pbrookaf5db582006-04-08 14:26:41 +0000308echo ""
ths5bf08932006-12-23 00:33:26 +0000309echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000310exit 1
311fi
312
bellard7d132992003-03-06 23:23:54 +0000313cc="${cross_prefix}${cc}"
314ar="${cross_prefix}${ar}"
315strip="${cross_prefix}${strip}"
316
pbrook064aae12006-05-08 00:51:44 +0000317# check that the C compiler works.
318cat > $TMPC <<EOF
319int main(void) {}
320EOF
321
thscf257232007-02-11 15:02:17 +0000322if $cc -c -o $TMPO $TMPC 2> /dev/null ; then
pbrook064aae12006-05-08 00:51:44 +0000323 : C compiler works ok
324else
325 echo "ERROR: \"$cc\" either does not exist or does not work"
326 exit 1
bellarda7350fa2006-04-23 14:35:23 +0000327fi
328
bellard67b915a2004-03-31 23:37:16 +0000329if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000330 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000331 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000332 oss="no"
bellard07f4ddb2005-04-23 17:44:28 +0000333 if [ "$cpu" = "i386" ] ; then
334 kqemu="yes"
335 fi
bellard67b915a2004-03-31 23:37:16 +0000336fi
337
pbrook328a4242006-12-19 03:31:34 +0000338# Check for gcc4, error if pre-gcc4
339if test "$check_gcc" = "yes" ; then
340 cat > $TMPC <<EOF
341#if __GNUC__ < 4
342#error gcc3
343#endif
344int main(){return 0;}
345EOF
346 check_cc() {
thscf257232007-02-11 15:02:17 +0000347 which "$1" 2> /dev/null
pbrook328a4242006-12-19 03:31:34 +0000348 return $?
349 }
350
thscf257232007-02-11 15:02:17 +0000351 if "$cc" -o $TMPE $TMPC 2> /dev/null ; then
pbrook328a4242006-12-19 03:31:34 +0000352 echo "WARNING: \"$cc\" looks like gcc 4.x"
353 found_compat_cc="no"
354 if test "$gcc3_search" = "yes" ; then
355 echo "Looking for gcc 3.x"
356 for compat_cc in $gcc3_list ; do
pbrook11244262007-02-27 01:03:41 +0000357 if check_cc "$cross_prefix$compat_cc" ; then
pbrook328a4242006-12-19 03:31:34 +0000358 echo "Found \"$compat_cc\""
pbrook11244262007-02-27 01:03:41 +0000359 cc="$cross_prefix$compat_cc"
pbrook328a4242006-12-19 03:31:34 +0000360 found_compat_cc="yes"
361 break
362 fi
363 done
364 if test "$found_compat_cc" = "no" ; then
365 echo "gcc 3.x not found!"
366 fi
367 fi
368 if test "$found_compat_cc" = "no" ; then
369 echo "QEMU is known to have problems when compiled with gcc 4.x"
370 echo "It is recommended that you use gcc 3.x to build QEMU"
371 echo "To use this compiler anyway, configure with --disable-gcc-check"
372 exit 1;
373 fi
374 fi
375fi
376
bellardec530c82006-04-25 22:36:06 +0000377#
378# Solaris specific configure tool chain decisions
379#
380if test "$solaris" = "yes" ; then
381 #
382 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
383 # override the check with --disable-gcc-check
384 #
385 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
386 solgcc=`which $cc`
387 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
388 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
389 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
390 echo "or get the latest patch from SunSolve for gcc"
391 exit 1
392 fi
393 fi
394 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
395 if test -z "$solinst" ; then
396 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
397 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
398 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
399 exit 1
400 fi
401 if test "$solinst" = "/usr/sbin/install" ; then
402 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
403 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
404 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
405 exit 1
406 fi
bellardec530c82006-04-25 22:36:06 +0000407 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
408 if test -z "$sol_ar" ; then
409 echo "Error: No path includes ar"
410 if test -f /usr/ccs/bin/ar ; then
411 echo "Add /usr/ccs/bin to your path and rerun configure"
412 fi
413 exit 1
414 fi
415fi
416
417
bellard5327cf42005-01-10 23:18:50 +0000418if test -z "$target_list" ; then
419# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000420 if [ "$softmmu" = "yes" ] ; then
j_mayer36bc0bc2007-03-17 14:04:57 +0000421 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu ppc64-softmmu"
pbrook0a8e90f2006-03-19 14:54:16 +0000422 fi
bellard5327cf42005-01-10 23:18:50 +0000423# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000424 if [ "$linux_user" = "yes" ] ; then
425 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"
426 fi
427# the following are Darwin specific
428 if [ "$darwin_user" = "yes" ] ; then
429 target_list="i386-darwin-user ppc-darwin-user $target_list"
bellard5327cf42005-01-10 23:18:50 +0000430 fi
bellard6e20a452005-06-05 15:56:02 +0000431else
pbrookb1a550a2006-04-16 13:28:56 +0000432 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000433fi
pbrook0a8e90f2006-03-19 14:54:16 +0000434if test -z "$target_list" ; then
435 echo "No targets enabled"
436 exit 1
437fi
bellard5327cf42005-01-10 23:18:50 +0000438
bellard7d132992003-03-06 23:23:54 +0000439if test -z "$cross_prefix" ; then
440
441# ---
442# big/little endian test
443cat > $TMPC << EOF
444#include <inttypes.h>
445int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000446 volatile uint32_t i=0x01234567;
447 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000448}
449EOF
450
thscf257232007-02-11 15:02:17 +0000451if $cc -o $TMPE $TMPC 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000452$TMPE && bigendian="yes"
453else
454echo big/little test failed
455fi
456
457else
458
459# if cross compiling, cannot launch a program, so make a static guess
bellard808c4952004-12-19 23:33:47 +0000460if 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 +0000461 bigendian="yes"
462fi
463
464fi
465
bellardb6853692005-06-05 17:10:39 +0000466# host long bits test
467hostlongbits="32"
468if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
469 hostlongbits="64"
470fi
471
bellarde8cd23d2003-06-25 16:08:13 +0000472# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000473cat > $TMPC <<EOF
474int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000475}
476EOF
477
bellarde8cd23d2003-06-25 16:08:13 +0000478have_gcc3_options="no"
479if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
480 have_gcc3_options="yes"
bellard04369ff2003-03-20 22:33:23 +0000481fi
bellardca735202003-03-18 20:41:34 +0000482
bellard11d9f692004-04-02 20:55:59 +0000483##########################################
484# SDL probe
485
486sdl_too_old=no
487
488if test -z "$sdl" ; then
489
bellarda6e022a2004-04-02 21:55:47 +0000490sdl_config="sdl-config"
491sdl=no
bellard7c1f25b2004-04-22 00:02:08 +0000492sdl_static=no
bellarda6e022a2004-04-02 21:55:47 +0000493
494if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
495# win32 cross compilation case
496 sdl_config="i386-mingw32msvc-sdl-config"
497 sdl=yes
498else
499# normal SDL probe
bellard11d9f692004-04-02 20:55:59 +0000500cat > $TMPC << EOF
501#include <SDL.h>
502#undef main /* We don't want SDL to override our main() */
503int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
504EOF
505
bellarda6e022a2004-04-02 21:55:47 +0000506if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
507_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
bellard11d9f692004-04-02 20:55:59 +0000508if test "$_sdlversion" -lt 121 ; then
509sdl_too_old=yes
510else
thsfd677642007-01-31 12:10:07 +0000511 if test "$cocoa" = "no" ; then
512 sdl=yes
513 fi
bellard11d9f692004-04-02 20:55:59 +0000514fi
bellard7c1f25b2004-04-22 00:02:08 +0000515
516# static link with sdl ?
517if test "$sdl" = "yes" ; then
518aa="no"
519`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
520sdl_static_libs=`$sdl_config --static-libs`
521if [ "$aa" = "yes" ] ; then
bellardd8d8aa42004-04-29 20:14:07 +0000522 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
bellard11d9f692004-04-02 20:55:59 +0000523fi
524
bellard7c1f25b2004-04-22 00:02:08 +0000525if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
526 sdl_static=yes
527fi
528
529fi # static link
530
531fi # sdl compile test
532
bellarda6e022a2004-04-02 21:55:47 +0000533fi # cross compilation
thsfd677642007-01-31 12:10:07 +0000534
535else
536 # Make sure to disable cocoa if sdl was set
537 if test "$sdl" = "yes" ; then
538 cocoa="no"
539 coreaudio="no"
540 fi
bellarda6e022a2004-04-02 21:55:47 +0000541fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000542
ths8f28f3f2007-01-05 21:25:54 +0000543##########################################
544# alsa sound support libraries
545
546if test "$alsa" = "yes" ; then
547 cat > $TMPC << EOF
548#include <alsa/asoundlib.h>
549int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
550EOF
551 if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
552 :
553 else
554 echo
555 echo "Error: Could not find alsa"
556 echo "Make sure to have the alsa libs and headers installed."
557 echo
558 exit 1
559 fi
560fi
561
pbrookcc8ae6d2006-04-23 17:57:59 +0000562# Check if tools are available to build documentation.
pbrook94ac5152006-04-26 16:07:35 +0000563if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +0000564 build_docs="yes"
565fi
566
bellard11d9f692004-04-02 20:55:59 +0000567if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +0000568 if test -z "$prefix" ; then
569 prefix="/c/Program Files/Qemu"
570 fi
571 mansuffix=""
572 datasuffix=""
573 docsuffix=""
574 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +0000575else
pbrook308c3592007-02-27 00:52:01 +0000576 if test -z "$prefix" ; then
577 prefix="/usr/local"
578 fi
579 mansuffix="/share/man"
580 datasuffix="/share/qemu"
581 docsuffix="/share/doc/qemu"
582 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +0000583fi
bellard5a671352003-10-01 00:13:48 +0000584
bellard43ce4df2003-06-09 19:53:12 +0000585echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +0000586echo "BIOS directory $prefix$datasuffix"
587echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +0000588if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +0000589echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +0000590echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000591fi
bellard5a671352003-10-01 00:13:48 +0000592echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000593echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +0000594echo "Host C compiler $host_cc"
bellard43ce4df2003-06-09 19:53:12 +0000595echo "make $make"
pbrook6a882642006-04-17 13:57:12 +0000596echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +0000597echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000598echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000599echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000600echo "gprof enabled $gprof"
bellard05c2a3e2006-02-08 22:39:17 +0000601echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +0000602echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000603if test "$darwin" = "yes" ; then
604 echo "Cocoa support $cocoa"
605fi
bellard97a847b2003-08-10 21:36:04 +0000606echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000607if test "$sdl" != "no" ; then
608 echo "SDL static link $sdl_static"
609fi
bellard67b915a2004-03-31 23:37:16 +0000610echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000611echo "Adlib support $adlib"
bellard1d14ffa2005-10-30 18:58:22 +0000612echo "CoreAudio support $coreaudio"
613echo "ALSA support $alsa"
614echo "DSound support $dsound"
bellard1d14ffa2005-10-30 18:58:22 +0000615if test "$fmod" = "yes"; then
616 if test -z $fmod_lib || test -z $fmod_inc; then
617 echo
618 echo "Error: You must specify path to FMOD library and headers"
619 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
620 echo
621 exit 1
622 fi
pbrookb1a550a2006-04-16 13:28:56 +0000623 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
624else
625 fmod_support=""
bellard102a52e2004-11-14 19:57:29 +0000626fi
pbrookb1a550a2006-04-16 13:28:56 +0000627echo "FMOD support $fmod $fmod_support"
bellard07f4ddb2005-04-23 17:44:28 +0000628echo "kqemu support $kqemu"
pbrookcc8ae6d2006-04-23 17:57:59 +0000629echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +0000630[ ! -z "$uname_release" ] && \
631echo "uname -r $uname_release"
bellard67b915a2004-03-31 23:37:16 +0000632
bellard97a847b2003-08-10 21:36:04 +0000633if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000634echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000635fi
bellard24b55b92005-03-01 22:30:41 +0000636#if test "$sdl_static" = "no"; then
637# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
638#fi
bellard97a847b2003-08-10 21:36:04 +0000639config_mak="config-host.mak"
640config_h="config-host.h"
641
bellard7c1f25b2004-04-22 00:02:08 +0000642#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000643
644echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +0000645echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000646echo "/* Automatically generated by configure - do not modify */" > $config_h
647
648echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +0000649echo "bindir=\${prefix}$binsuffix" >> $config_mak
650echo "mandir=\${prefix}$mansuffix" >> $config_mak
651echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +0000652echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +0000653echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000654echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +0000655echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000656echo "CC=$cc" >> $config_mak
657if test "$have_gcc3_options" = "yes" ; then
658 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
659fi
660echo "HOST_CC=$host_cc" >> $config_mak
661echo "AR=$ar" >> $config_mak
662echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
ths6f30fa82007-01-05 01:00:47 +0000663echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000664echo "CFLAGS=$CFLAGS" >> $config_mak
665echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +0000666echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +0000667echo "AIOLIBS=$AIOLIBS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000668if test "$cpu" = "i386" ; then
669 echo "ARCH=i386" >> $config_mak
670 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000671elif test "$cpu" = "x86_64" ; then
672 echo "ARCH=x86_64" >> $config_mak
673 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000674elif test "$cpu" = "armv4b" ; then
675 echo "ARCH=arm" >> $config_mak
676 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000677elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000678 echo "ARCH=arm" >> $config_mak
679 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000680elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000681 echo "ARCH=ppc" >> $config_mak
682 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000683elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000684 echo "ARCH=mips" >> $config_mak
685 echo "#define HOST_MIPS 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000686elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000687 echo "ARCH=s390" >> $config_mak
688 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000689elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000690 echo "ARCH=alpha" >> $config_mak
691 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000692elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000693 echo "ARCH=sparc" >> $config_mak
694 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000695elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000696 echo "ARCH=sparc64" >> $config_mak
697 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000698elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000699 echo "ARCH=ia64" >> $config_mak
700 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000701elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000702 echo "ARCH=m68k" >> $config_mak
703 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000704else
705 echo "Unsupported CPU"
706 exit 1
707fi
708if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000709 echo "WORDS_BIGENDIAN=yes" >> $config_mak
710 echo "#define WORDS_BIGENDIAN 1" >> $config_h
711fi
bellardb6853692005-06-05 17:10:39 +0000712echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +0000713if test "$mingw32" = "yes" ; then
714 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000715 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +0000716else
717 cat > $TMPC << EOF
718#include <byteswap.h>
719int main(void) { return bswap_32(0); }
720EOF
721 if $cc -o $TMPE $TMPC 2> /dev/null ; then
722 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
723 fi
bellard67b915a2004-03-31 23:37:16 +0000724fi
bellard83fb7ad2004-07-05 21:25:26 +0000725if test "$darwin" = "yes" ; then
726 echo "CONFIG_DARWIN=yes" >> $config_mak
727 echo "#define CONFIG_DARWIN 1" >> $config_h
728fi
bellardec530c82006-04-25 22:36:06 +0000729if test "$solaris" = "yes" ; then
730 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +0000731 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
bellardec530c82006-04-25 22:36:06 +0000732fi
bellard67b915a2004-03-31 23:37:16 +0000733if test "$gdbstub" = "yes" ; then
734 echo "CONFIG_GDBSTUB=yes" >> $config_mak
735 echo "#define CONFIG_GDBSTUB 1" >> $config_h
736fi
bellard97a847b2003-08-10 21:36:04 +0000737if test "$gprof" = "yes" ; then
738 echo "TARGET_GPROF=yes" >> $config_mak
739 echo "#define HAVE_GPROF 1" >> $config_h
740fi
741if test "$static" = "yes" ; then
742 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +0000743 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000744fi
bellard05c2a3e2006-02-08 22:39:17 +0000745if test $profiler = "yes" ; then
746 echo "#define CONFIG_PROFILER 1" >> $config_h
747fi
bellardc20709a2004-04-21 23:27:19 +0000748if test "$slirp" = "yes" ; then
749 echo "CONFIG_SLIRP=yes" >> $config_mak
750 echo "#define CONFIG_SLIRP 1" >> $config_h
751fi
bellardfb065182004-11-09 23:09:44 +0000752if test "$adlib" = "yes" ; then
753 echo "CONFIG_ADLIB=yes" >> $config_mak
754 echo "#define CONFIG_ADLIB 1" >> $config_h
755fi
756if test "$oss" = "yes" ; then
757 echo "CONFIG_OSS=yes" >> $config_mak
758 echo "#define CONFIG_OSS 1" >> $config_h
759fi
bellard1d14ffa2005-10-30 18:58:22 +0000760if test "$coreaudio" = "yes" ; then
761 echo "CONFIG_COREAUDIO=yes" >> $config_mak
762 echo "#define CONFIG_COREAUDIO 1" >> $config_h
763fi
764if test "$alsa" = "yes" ; then
765 echo "CONFIG_ALSA=yes" >> $config_mak
766 echo "#define CONFIG_ALSA 1" >> $config_h
767fi
768if test "$dsound" = "yes" ; then
769 echo "CONFIG_DSOUND=yes" >> $config_mak
770 echo "#define CONFIG_DSOUND 1" >> $config_h
771fi
bellard102a52e2004-11-14 19:57:29 +0000772if test "$fmod" = "yes" ; then
773 echo "CONFIG_FMOD=yes" >> $config_mak
774 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
775 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
776 echo "#define CONFIG_FMOD 1" >> $config_h
777fi
pbrookb1a550a2006-04-16 13:28:56 +0000778qemu_version=`head $source_path/VERSION`
779echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +0000780echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000781
782echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +0000783if [ "$source_path_used" = "yes" ]; then
784 echo "VPATH=$source_path" >> $config_mak
785fi
bellard97a847b2003-08-10 21:36:04 +0000786echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +0000787if [ "$build_docs" = "yes" ] ; then
788 echo "BUILD_DOCS=yes" >> $config_mak
789fi
bellard97a847b2003-08-10 21:36:04 +0000790
bellard83fb7ad2004-07-05 21:25:26 +0000791# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000792if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000793 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000794 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000795 echo "#define _BSD 1" >> $config_h
796fi
797
pbrookc5937222006-05-14 11:30:38 +0000798echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
799
bellard1d14ffa2005-10-30 18:58:22 +0000800for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +0000801target_dir="$target"
802config_mak=$target_dir/config.mak
803config_h=$target_dir/config.h
804target_cpu=`echo $target | cut -d '-' -f 1`
805target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +0000806[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000807[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000808[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000809[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellarda2458622005-07-23 22:39:53 +0000810[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
bellardd3258562005-07-02 15:37:12 +0000811[ "$target_cpu" = "mips" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +0000812[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
pbrooke6e59062006-10-22 00:18:54 +0000813[ "$target_cpu" = "m68k" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000814target_softmmu="no"
815if expr $target : '.*-softmmu' > /dev/null ; then
816 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000817fi
bellard997344f2003-10-27 21:10:39 +0000818target_user_only="no"
819if expr $target : '.*-user' > /dev/null ; then
820 target_user_only="yes"
821fi
bellardde83cd02003-06-15 20:25:43 +0000822
ths831b7822007-01-18 20:06:33 +0000823target_linux_user="no"
824if expr $target : '.*-linux-user' > /dev/null ; then
825 target_linux_user="yes"
826fi
827
828target_darwin_user="no"
829if expr $target : '.*-darwin-user' > /dev/null ; then
830 target_darwin_user="yes"
831fi
832
bellard97ccc682005-07-02 13:32:17 +0000833if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +0000834 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +0000835 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +0000836 echo "To build QEMU without graphical output configure with --disable-gfx-check"
bellard97ccc682005-07-02 13:32:17 +0000837 echo "Note that this will disable all output from the virtual graphics card."
838 exit 1;
839fi
840
bellard7c1f25b2004-04-22 00:02:08 +0000841#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000842
843mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +0000844mkdir -p $target_dir/fpu
ths831b7822007-01-18 20:06:33 +0000845if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
bellard69de9272004-02-16 21:40:43 +0000846 mkdir -p $target_dir/nwfpe
847fi
bellarda7e61ed2004-04-22 21:46:47 +0000848if test "$target_user_only" = "no" ; then
849 mkdir -p $target_dir/slirp
850fi
bellard69de9272004-02-16 21:40:43 +0000851
bellardec530c82006-04-25 22:36:06 +0000852#
853# don't use ln -sf as not all "ln -sf" over write the file/link
854#
855rm -f $target_dir/Makefile
856ln -s $source_path/Makefile.target $target_dir/Makefile
857
bellard97a847b2003-08-10 21:36:04 +0000858
859echo "# Automatically generated by configure - do not modify" > $config_mak
860echo "/* Automatically generated by configure - do not modify */" > $config_h
861
862
863echo "include ../config-host.mak" >> $config_mak
864echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000865
pbrooke5fe0c52006-06-11 13:32:59 +0000866bflt="no"
bellard1e43adf2003-09-30 20:54:24 +0000867interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
868echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000869
870if test "$target_cpu" = "i386" ; then
871 echo "TARGET_ARCH=i386" >> $config_mak
872 echo "#define TARGET_ARCH \"i386\"" >> $config_h
873 echo "#define TARGET_I386 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000874 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
bellard824d5602005-02-12 18:58:00 +0000875 echo "#define USE_KQEMU 1" >> $config_h
876 fi
bellard808c4952004-12-19 23:33:47 +0000877elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000878 echo "TARGET_ARCH=arm" >> $config_mak
879 echo "#define TARGET_ARCH \"arm\"" >> $config_h
880 echo "#define TARGET_ARM 1" >> $config_h
pbrooke5fe0c52006-06-11 13:32:59 +0000881 bflt="yes"
bellard1e43adf2003-09-30 20:54:24 +0000882elif test "$target_cpu" = "sparc" ; then
883 echo "TARGET_ARCH=sparc" >> $config_mak
884 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
885 echo "#define TARGET_SPARC 1" >> $config_h
bellard64b3ab22005-01-30 22:43:42 +0000886elif test "$target_cpu" = "sparc64" ; then
887 echo "TARGET_ARCH=sparc64" >> $config_mak
888 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
889 echo "#define TARGET_SPARC 1" >> $config_h
890 echo "#define TARGET_SPARC64 1" >> $config_h
bellard67867302003-11-23 17:05:30 +0000891elif test "$target_cpu" = "ppc" ; then
892 echo "TARGET_ARCH=ppc" >> $config_mak
893 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
894 echo "#define TARGET_PPC 1" >> $config_h
bellarda2458622005-07-23 22:39:53 +0000895elif test "$target_cpu" = "ppc64" ; then
896 echo "TARGET_ARCH=ppc64" >> $config_mak
897 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
898 echo "#define TARGET_PPC 1" >> $config_h
899 echo "#define TARGET_PPC64 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000900elif test "$target_cpu" = "x86_64" ; then
901 echo "TARGET_ARCH=x86_64" >> $config_mak
902 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
903 echo "#define TARGET_I386 1" >> $config_h
904 echo "#define TARGET_X86_64 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000905 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
906 echo "#define USE_KQEMU 1" >> $config_h
907 fi
bellardc20eb472005-12-06 21:42:55 +0000908elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
bellardd3258562005-07-02 15:37:12 +0000909 echo "TARGET_ARCH=mips" >> $config_mak
910 echo "#define TARGET_ARCH \"mips\"" >> $config_h
911 echo "#define TARGET_MIPS 1" >> $config_h
bellard6ea83fe2006-06-14 12:56:19 +0000912 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
913 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
pbrook908f52b2006-06-18 19:16:53 +0000914elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
bellardfdf9b3e2006-04-27 21:07:38 +0000915 echo "TARGET_ARCH=sh4" >> $config_mak
916 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
917 echo "#define TARGET_SH4 1" >> $config_h
pbrook4dbed892006-06-17 20:01:14 +0000918 bflt="yes"
pbrooke6e59062006-10-22 00:18:54 +0000919elif test "$target_cpu" = "m68k" ; then
920 echo "TARGET_ARCH=m68k" >> $config_mak
921 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
922 echo "#define TARGET_M68K 1" >> $config_h
923 bflt="yes"
bellardde83cd02003-06-15 20:25:43 +0000924else
925 echo "Unsupported target CPU"
926 exit 1
927fi
928if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000929 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
930 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
931fi
932if test "$target_softmmu" = "yes" ; then
933 echo "CONFIG_SOFTMMU=yes" >> $config_mak
934 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000935fi
bellard997344f2003-10-27 21:10:39 +0000936if test "$target_user_only" = "yes" ; then
937 echo "CONFIG_USER_ONLY=yes" >> $config_mak
938 echo "#define CONFIG_USER_ONLY 1" >> $config_h
939fi
ths831b7822007-01-18 20:06:33 +0000940if test "$target_linux_user" = "yes" ; then
941 echo "CONFIG_LINUX_USER=yes" >> $config_mak
942 echo "#define CONFIG_LINUX_USER 1" >> $config_h
943fi
944if test "$target_darwin_user" = "yes" ; then
945 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
946 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
947fi
bellardde83cd02003-06-15 20:25:43 +0000948
pbrooke6e59062006-10-22 00:18:54 +0000949if 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 +0000950 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
951 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
952fi
pbrooke5fe0c52006-06-11 13:32:59 +0000953if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
954 echo "TARGET_HAS_BFLT=yes" >> $config_mak
955 echo "#define TARGET_HAS_BFLT 1" >> $config_h
956fi
bellard7c1f25b2004-04-22 00:02:08 +0000957# sdl defines
958
959if test "$target_user_only" = "no"; then
960 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000961 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000962 else
bellarddbb2c922004-10-24 22:17:47 +0000963 sdl1=$sdl
964 fi
965 if test "$sdl1" = "yes" ; then
966 echo "#define CONFIG_SDL 1" >> $config_h
967 echo "CONFIG_SDL=yes" >> $config_mak
968 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
969 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
970 else
bellard7c1f25b2004-04-22 00:02:08 +0000971 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
972 fi
bellarddbb2c922004-10-24 22:17:47 +0000973 if [ "${aa}" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000974 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
975 else
976 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
bellarddbb2c922004-10-24 22:17:47 +0000977 fi
bellard7c1f25b2004-04-22 00:02:08 +0000978 fi
bellard7c1f25b2004-04-22 00:02:08 +0000979fi
980
bellard5b0753e2005-03-01 21:37:28 +0000981if test "$cocoa" = "yes" ; then
982 echo "#define CONFIG_COCOA 1" >> $config_h
983 echo "CONFIG_COCOA=yes" >> $config_mak
984fi
985
bellard97a847b2003-08-10 21:36:04 +0000986done # for target in $targets
bellard7d132992003-03-06 23:23:54 +0000987
988# build tree in object directory if source path is different from current one
989if test "$source_path_used" = "yes" ; then
990 DIRS="tests"
991 FILES="Makefile tests/Makefile"
992 for dir in $DIRS ; do
993 mkdir -p $dir
994 done
bellardec530c82006-04-25 22:36:06 +0000995 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +0000996 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +0000997 rm -f $f
998 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +0000999 done
1000fi
bellard7d132992003-03-06 23:23:54 +00001001
bellard97a847b2003-08-10 21:36:04 +00001002rm -f $TMPO $TMPC $TMPE $TMPS