blob: f315c1938f9c2292f4a0e01929093bbd511a1c87 [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"
25host_cc="gcc"
26ar="ar"
27make="make"
28strip="strip"
29cpu=`uname -m`
bellard5327cf42005-01-10 23:18:50 +000030target_list=""
bellard7d132992003-03-06 23:23:54 +000031case "$cpu" in
32 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +000033 cpu="i386"
bellard7d132992003-03-06 23:23:54 +000034 ;;
bellardba680552005-03-13 09:49:52 +000035 armv*b)
bellard808c4952004-12-19 23:33:47 +000036 cpu="armv4b"
37 ;;
bellardba680552005-03-13 09:49:52 +000038 armv*l)
bellard7d132992003-03-06 23:23:54 +000039 cpu="armv4l"
40 ;;
41 alpha)
42 cpu="alpha"
43 ;;
bellard295defa2003-04-07 21:31:29 +000044 "Power Macintosh"|ppc|ppc64)
bellard7d132992003-03-06 23:23:54 +000045 cpu="powerpc"
46 ;;
47 mips)
48 cpu="mips"
49 ;;
bellardfb3e5842003-03-29 17:32:36 +000050 s390)
51 cpu="s390"
52 ;;
bellardae228532003-05-13 18:59:59 +000053 sparc)
54 cpu="sparc"
55 ;;
56 sparc64)
57 cpu="sparc64"
58 ;;
bellarda8baa8c2003-04-29 20:53:31 +000059 ia64)
60 cpu="ia64"
61 ;;
bellard38e584a2003-08-10 22:14:22 +000062 m68k)
63 cpu="m68k"
64 ;;
bellardbc51c5c2004-03-17 23:46:04 +000065 x86_64|amd64)
bellard0b0babc2005-01-03 23:38:40 +000066 cpu="x86_64"
bellardbc51c5c2004-03-17 23:46:04 +000067 ;;
bellard7d132992003-03-06 23:23:54 +000068 *)
69 cpu="unknown"
70 ;;
71esac
72gprof="no"
73bigendian="no"
bellard67b915a2004-03-31 23:37:16 +000074mingw32="no"
75EXESUF=""
76gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +000077slirp="yes"
bellardfb065182004-11-09 23:09:44 +000078adlib="no"
79oss="no"
bellard1d14ffa2005-10-30 18:58:22 +000080dsound="no"
81coreaudio="no"
82alsa="no"
bellard102a52e2004-11-14 19:57:29 +000083fmod="no"
84fmod_lib=""
85fmod_inc=""
pbrookb1a550a2006-04-16 13:28:56 +000086bsd="no"
bellard5327cf42005-01-10 23:18:50 +000087linux="no"
bellardc9ec1fe2005-02-10 21:55:30 +000088kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +000089profiler="no"
bellardc9ec1fe2005-02-10 21:55:30 +000090kernel_path=""
bellard5b0753e2005-03-01 21:37:28 +000091cocoa="no"
bellard97ccc682005-07-02 13:32:17 +000092check_gfx="yes"
bellard1aff3812005-11-02 22:30:45 +000093check_gcc="yes"
pbrook0a8e90f2006-03-19 14:54:16 +000094softmmu="yes"
95user="no"
bellard7d132992003-03-06 23:23:54 +000096
97# OS specific
98targetos=`uname -s`
99case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000100CYGWIN*)
101mingw32="yes"
102CFLAGS="-O2 -mno-cygwin"
103;;
bellard67b915a2004-03-31 23:37:16 +0000104MINGW32*)
105mingw32="yes"
106;;
bellard7d3505c2004-05-12 19:32:15 +0000107FreeBSD)
108bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000109oss="yes"
bellarde99f9062005-07-28 21:45:38 +0000110if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000111 kqemu="yes"
112fi
bellard7d3505c2004-05-12 19:32:15 +0000113;;
114NetBSD)
115bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000116oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000117;;
118OpenBSD)
119bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000120oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000121;;
bellard83fb7ad2004-07-05 21:25:26 +0000122Darwin)
123bsd="yes"
124darwin="yes"
125;;
bellard1d14ffa2005-10-30 18:58:22 +0000126*)
bellardfb065182004-11-09 23:09:44 +0000127oss="yes"
bellard5327cf42005-01-10 23:18:50 +0000128linux="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000129user="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000130if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000131 kqemu="yes"
132fi
bellardfb065182004-11-09 23:09:44 +0000133;;
bellard7d132992003-03-06 23:23:54 +0000134esac
135
bellard7d3505c2004-05-12 19:32:15 +0000136if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000137 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000138 make="gmake"
139 fi
bellard7d3505c2004-05-12 19:32:15 +0000140fi
141
bellard7d132992003-03-06 23:23:54 +0000142# find source path
pbrookad064842006-04-16 12:41:07 +0000143source_path=`dirname "$0"`
144if [ -z "$source_path" ]; then
bellard7d132992003-03-06 23:23:54 +0000145 source_path=`pwd`
pbrookad064842006-04-16 12:41:07 +0000146else
147 source_path=`cd "$source_path"; pwd`
148fi
149if test "$source_path" = `pwd` ; then
bellard7d132992003-03-06 23:23:54 +0000150 source_path_used="no"
pbrookad064842006-04-16 12:41:07 +0000151else
152 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000153fi
154
155for opt do
pbrookb1a550a2006-04-16 13:28:56 +0000156 optarg=`expr "$opt" : '[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000157 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000158 --help|-h) show_help=yes
159 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000160 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000161 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000162 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000163 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000164 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000165 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000166 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000167 --cross-prefix=*) cross_prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000168 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000169 --cc=*) cc="$optarg"
bellard7d132992003-03-06 23:23:54 +0000170 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000171 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000172 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000173 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000174 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000175 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000176 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000177 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000178 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000179 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000180 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000181 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000182 ;;
bellard7d132992003-03-06 23:23:54 +0000183 --enable-gprof) gprof="yes"
184 ;;
bellard43ce4df2003-06-09 19:53:12 +0000185 --static) static="yes"
186 ;;
bellard97a847b2003-08-10 21:36:04 +0000187 --disable-sdl) sdl="no"
188 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000189 --enable-coreaudio) coreaudio="yes"
190 ;;
191 --enable-alsa) alsa="yes"
192 ;;
193 --enable-dsound) dsound="yes"
194 ;;
bellard102a52e2004-11-14 19:57:29 +0000195 --enable-fmod) fmod="yes"
196 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000197 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000198 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000199 --fmod-inc=*) fmod_inc="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000200 ;;
bellard67b915a2004-03-31 23:37:16 +0000201 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
bellard1d14ffa2005-10-30 18:58:22 +0000202 ;;
bellard443f1372004-06-04 11:13:20 +0000203 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000204 ;;
bellardfb065182004-11-09 23:09:44 +0000205 --enable-adlib) adlib="yes"
bellard1d14ffa2005-10-30 18:58:22 +0000206 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000207 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000208 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000209 --enable-profiler) profiler="yes"
210 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000211 --kernel-path=*) kernel_path="$optarg"
bellard1d14ffa2005-10-30 18:58:22 +0000212 ;;
213 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
214 ;;
bellard97ccc682005-07-02 13:32:17 +0000215 --disable-gfx-check) check_gfx="no"
216 ;;
bellard1aff3812005-11-02 22:30:45 +0000217 --disable-gcc-check) check_gcc="no"
218 ;;
pbrookcad25d62006-03-19 16:31:11 +0000219 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000220 ;;
pbrookcad25d62006-03-19 16:31:11 +0000221 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000222 ;;
223 --disable-user) user="no"
224 ;;
225 --enable-user) user="yes"
226 ;;
bellard7d132992003-03-06 23:23:54 +0000227 esac
228done
229
230# Checking for CFLAGS
231if test -z "$CFLAGS"; then
232 CFLAGS="-O2"
233fi
234
pbrookaf5db582006-04-08 14:26:41 +0000235if test x"$show_help" = x"yes" ; then
236cat << EOF
237
238Usage: configure [options]
239Options: [defaults in brackets after descriptions]
240
241EOF
242echo "Standard options:"
243echo " --help print this message"
244echo " --prefix=PREFIX install in PREFIX [$prefix]"
245echo " --interp-prefix=PREFIX where to find shared libraries, etc."
246echo " use %M for cpu name [$interp_prefix]"
247echo " --target-list=LIST set target list [$target_list]"
248echo ""
249echo "kqemu kernel acceleration support:"
250echo " --disable-kqemu disable kqemu support"
251echo " --kernel-path=PATH set the kernel path (configure probes it)"
252echo ""
253echo "Advanced options (experts only):"
254echo " --source-path=PATH path of source code [$source_path]"
255echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
256echo " --cc=CC use C compiler CC [$cc]"
257echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
258echo " --make=MAKE use specified make [$make]"
259echo " --static enable static build [$static]"
260echo " --enable-cocoa enable COCOA (Mac OS X only)"
261echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
262echo " --enable-adlib enable Adlib emulation"
263echo " --enable-coreaudio enable Coreaudio audio driver"
264echo " --enable-alsa enable ALSA audio driver"
265echo " --enable-fmod enable FMOD audio driver"
266echo " --enabled-dsound enable DirectSound audio driver"
267echo " --enable-system enable all system emulation targets"
268echo " --disable-system disable all system emulation targets"
269echo " --enable-user enable all linux usermode emulation targets"
270echo " --disable-user disable all linux usermode emulation targets"
271echo " --fmod-lib path to FMOD library"
272echo " --fmod-inc path to FMOD includes"
273echo ""
274echo "NOTE: The object files are build at the place where configure is launched"
275exit 1
276fi
277
bellard7d132992003-03-06 23:23:54 +0000278cc="${cross_prefix}${cc}"
279ar="${cross_prefix}${ar}"
280strip="${cross_prefix}${strip}"
281
bellard67b915a2004-03-31 23:37:16 +0000282if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000283 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000284 EXESUF=".exe"
285 gdbstub="no"
bellard9f059ec2004-11-14 18:59:52 +0000286 oss="no"
bellard07f4ddb2005-04-23 17:44:28 +0000287 if [ "$cpu" = "i386" ] ; then
288 kqemu="yes"
289 fi
bellard67b915a2004-03-31 23:37:16 +0000290fi
291
bellard5327cf42005-01-10 23:18:50 +0000292if test -z "$target_list" ; then
293# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000294 if [ "$softmmu" = "yes" ] ; then
295 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
296 fi
bellard5327cf42005-01-10 23:18:50 +0000297# the following are Linux specific
pbrook0a8e90f2006-03-19 14:54:16 +0000298 if [ "$user" = "yes" ] ; then
bellardc20eb472005-12-06 21:42:55 +0000299 target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list"
bellard5327cf42005-01-10 23:18:50 +0000300 fi
bellard6e20a452005-06-05 15:56:02 +0000301else
pbrookb1a550a2006-04-16 13:28:56 +0000302 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000303fi
pbrook0a8e90f2006-03-19 14:54:16 +0000304if test -z "$target_list" ; then
305 echo "No targets enabled"
306 exit 1
307fi
bellard5327cf42005-01-10 23:18:50 +0000308
bellard7d132992003-03-06 23:23:54 +0000309if test -z "$cross_prefix" ; then
310
311# ---
312# big/little endian test
313cat > $TMPC << EOF
314#include <inttypes.h>
315int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000316 volatile uint32_t i=0x01234567;
317 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000318}
319EOF
320
321if $cc -o $TMPE $TMPC 2>/dev/null ; then
322$TMPE && bigendian="yes"
323else
324echo big/little test failed
325fi
326
327else
328
329# if cross compiling, cannot launch a program, so make a static guess
bellard808c4952004-12-19 23:33:47 +0000330if 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 +0000331 bigendian="yes"
332fi
333
334fi
335
bellardb6853692005-06-05 17:10:39 +0000336# host long bits test
337hostlongbits="32"
338if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
339 hostlongbits="64"
340fi
341
bellarde8cd23d2003-06-25 16:08:13 +0000342# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000343cat > $TMPC <<EOF
344int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000345}
346EOF
347
bellarde8cd23d2003-06-25 16:08:13 +0000348have_gcc3_options="no"
349if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
350 have_gcc3_options="yes"
bellard04369ff2003-03-20 22:33:23 +0000351fi
bellardca735202003-03-18 20:41:34 +0000352
pbrookb1a550a2006-04-16 13:28:56 +0000353# Check for gcc4, error if pre-gcc4
bellard1aff3812005-11-02 22:30:45 +0000354if test "$check_gcc" = "yes" ; then
355 cat > $TMPC <<EOF
pbrookb1a550a2006-04-16 13:28:56 +0000356#if __GNUC__ < 4
357#error gcc3
bellard1aff3812005-11-02 22:30:45 +0000358#endif
359int main(){return 0;}
360EOF
pbrookb1a550a2006-04-16 13:28:56 +0000361 if $cc -o $TMPO $TMPC 2>/dev/null ; then
bellard1aff3812005-11-02 22:30:45 +0000362 echo "ERROR: \"$cc\" looks like gcc 4.x"
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
368fi
369
bellard11d9f692004-04-02 20:55:59 +0000370##########################################
371# SDL probe
372
373sdl_too_old=no
374
375if test -z "$sdl" ; then
376
bellarda6e022a2004-04-02 21:55:47 +0000377sdl_config="sdl-config"
378sdl=no
bellard7c1f25b2004-04-22 00:02:08 +0000379sdl_static=no
bellarda6e022a2004-04-02 21:55:47 +0000380
381if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
382# win32 cross compilation case
383 sdl_config="i386-mingw32msvc-sdl-config"
384 sdl=yes
385else
386# normal SDL probe
bellard11d9f692004-04-02 20:55:59 +0000387cat > $TMPC << EOF
388#include <SDL.h>
389#undef main /* We don't want SDL to override our main() */
390int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
391EOF
392
bellarda6e022a2004-04-02 21:55:47 +0000393if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
394_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
bellard11d9f692004-04-02 20:55:59 +0000395if test "$_sdlversion" -lt 121 ; then
396sdl_too_old=yes
397else
398sdl=yes
399fi
bellard7c1f25b2004-04-22 00:02:08 +0000400
401# static link with sdl ?
402if test "$sdl" = "yes" ; then
403aa="no"
404`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
405sdl_static_libs=`$sdl_config --static-libs`
406if [ "$aa" = "yes" ] ; then
bellardd8d8aa42004-04-29 20:14:07 +0000407 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
bellard11d9f692004-04-02 20:55:59 +0000408fi
409
bellard7c1f25b2004-04-22 00:02:08 +0000410if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
411 sdl_static=yes
412fi
413
414fi # static link
415
416fi # sdl compile test
417
bellarda6e022a2004-04-02 21:55:47 +0000418fi # cross compilation
419fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000420
bellard11d9f692004-04-02 20:55:59 +0000421if test "$mingw32" = "yes" ; then
422if test -z "$prefix" ; then
423 prefix="/c/Program Files/Qemu"
424fi
425mandir="$prefix"
bellard7efa4382004-05-12 18:54:06 +0000426datadir="$prefix"
bellard1f50f8d2004-05-08 14:44:43 +0000427docdir="$prefix"
bellard11d9f692004-04-02 20:55:59 +0000428bindir="$prefix"
429else
430if test -z "$prefix" ; then
431 prefix="/usr/local"
432fi
bellard5a671352003-10-01 00:13:48 +0000433mandir="$prefix/share/man"
bellard7efa4382004-05-12 18:54:06 +0000434datadir="$prefix/share/qemu"
bellard1f50f8d2004-05-08 14:44:43 +0000435docdir="$prefix/share/doc/qemu"
bellard11d9f692004-04-02 20:55:59 +0000436bindir="$prefix/bin"
437fi
bellard5a671352003-10-01 00:13:48 +0000438
bellard43ce4df2003-06-09 19:53:12 +0000439echo "Install prefix $prefix"
bellard7efa4382004-05-12 18:54:06 +0000440echo "BIOS directory $datadir"
bellard11d9f692004-04-02 20:55:59 +0000441echo "binary directory $bindir"
442if test "$mingw32" = "no" ; then
443echo "Manual directory $mandir"
bellard43ce4df2003-06-09 19:53:12 +0000444echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000445fi
bellard5a671352003-10-01 00:13:48 +0000446echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000447echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +0000448echo "Host C compiler $host_cc"
bellard43ce4df2003-06-09 19:53:12 +0000449echo "make $make"
450echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000451echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000452echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000453echo "gprof enabled $gprof"
bellard05c2a3e2006-02-08 22:39:17 +0000454echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +0000455echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000456if test "$darwin" = "yes" ; then
457 echo "Cocoa support $cocoa"
458fi
bellard97a847b2003-08-10 21:36:04 +0000459echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000460if test "$sdl" != "no" ; then
461 echo "SDL static link $sdl_static"
462fi
bellard67b915a2004-03-31 23:37:16 +0000463echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000464echo "Adlib support $adlib"
bellard1d14ffa2005-10-30 18:58:22 +0000465echo "CoreAudio support $coreaudio"
466echo "ALSA support $alsa"
467echo "DSound support $dsound"
bellard1d14ffa2005-10-30 18:58:22 +0000468if test "$fmod" = "yes"; then
469 if test -z $fmod_lib || test -z $fmod_inc; then
470 echo
471 echo "Error: You must specify path to FMOD library and headers"
472 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
473 echo
474 exit 1
475 fi
pbrookb1a550a2006-04-16 13:28:56 +0000476 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
477else
478 fmod_support=""
bellard102a52e2004-11-14 19:57:29 +0000479fi
pbrookb1a550a2006-04-16 13:28:56 +0000480echo "FMOD support $fmod $fmod_support"
bellard07f4ddb2005-04-23 17:44:28 +0000481echo "kqemu support $kqemu"
bellard67b915a2004-03-31 23:37:16 +0000482
bellard97a847b2003-08-10 21:36:04 +0000483if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000484echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000485fi
bellard24b55b92005-03-01 22:30:41 +0000486#if test "$sdl_static" = "no"; then
487# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
488#fi
bellard97a847b2003-08-10 21:36:04 +0000489config_mak="config-host.mak"
490config_h="config-host.h"
491
bellard7c1f25b2004-04-22 00:02:08 +0000492#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000493
494echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +0000495echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000496echo "/* Automatically generated by configure - do not modify */" > $config_h
497
498echo "prefix=$prefix" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000499echo "bindir=$bindir" >> $config_mak
bellard5a671352003-10-01 00:13:48 +0000500echo "mandir=$mandir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000501echo "datadir=$datadir" >> $config_mak
bellard1f50f8d2004-05-08 14:44:43 +0000502echo "docdir=$docdir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000503echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000504echo "MAKE=$make" >> $config_mak
505echo "CC=$cc" >> $config_mak
506if test "$have_gcc3_options" = "yes" ; then
507 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
508fi
509echo "HOST_CC=$host_cc" >> $config_mak
510echo "AR=$ar" >> $config_mak
511echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
512echo "CFLAGS=$CFLAGS" >> $config_mak
513echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +0000514echo "EXESUF=$EXESUF" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000515if test "$cpu" = "i386" ; then
516 echo "ARCH=i386" >> $config_mak
517 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000518elif test "$cpu" = "x86_64" ; then
519 echo "ARCH=x86_64" >> $config_mak
520 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000521elif test "$cpu" = "armv4b" ; then
522 echo "ARCH=arm" >> $config_mak
523 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000524elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000525 echo "ARCH=arm" >> $config_mak
526 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000527elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000528 echo "ARCH=ppc" >> $config_mak
529 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000530elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000531 echo "ARCH=mips" >> $config_mak
532 echo "#define HOST_MIPS 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000533elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000534 echo "ARCH=s390" >> $config_mak
535 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000536elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000537 echo "ARCH=alpha" >> $config_mak
538 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000539elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000540 echo "ARCH=sparc" >> $config_mak
541 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000542elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000543 echo "ARCH=sparc64" >> $config_mak
544 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000545elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000546 echo "ARCH=ia64" >> $config_mak
547 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000548elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000549 echo "ARCH=m68k" >> $config_mak
550 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000551else
552 echo "Unsupported CPU"
553 exit 1
554fi
555if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000556 echo "WORDS_BIGENDIAN=yes" >> $config_mak
557 echo "#define WORDS_BIGENDIAN 1" >> $config_h
558fi
bellardb6853692005-06-05 17:10:39 +0000559echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +0000560if test "$mingw32" = "yes" ; then
561 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000562 echo "#define CONFIG_WIN32 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000563elif test -f "/usr/include/byteswap.h" ; then
bellard67b915a2004-03-31 23:37:16 +0000564 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
565fi
bellard83fb7ad2004-07-05 21:25:26 +0000566if test "$darwin" = "yes" ; then
567 echo "CONFIG_DARWIN=yes" >> $config_mak
568 echo "#define CONFIG_DARWIN 1" >> $config_h
569fi
bellard67b915a2004-03-31 23:37:16 +0000570if test "$gdbstub" = "yes" ; then
571 echo "CONFIG_GDBSTUB=yes" >> $config_mak
572 echo "#define CONFIG_GDBSTUB 1" >> $config_h
573fi
bellard97a847b2003-08-10 21:36:04 +0000574if test "$gprof" = "yes" ; then
575 echo "TARGET_GPROF=yes" >> $config_mak
576 echo "#define HAVE_GPROF 1" >> $config_h
577fi
578if test "$static" = "yes" ; then
579 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +0000580 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000581fi
bellard05c2a3e2006-02-08 22:39:17 +0000582if test $profiler = "yes" ; then
583 echo "#define CONFIG_PROFILER 1" >> $config_h
584fi
bellardc20709a2004-04-21 23:27:19 +0000585if test "$slirp" = "yes" ; then
586 echo "CONFIG_SLIRP=yes" >> $config_mak
587 echo "#define CONFIG_SLIRP 1" >> $config_h
588fi
bellardfb065182004-11-09 23:09:44 +0000589if test "$adlib" = "yes" ; then
590 echo "CONFIG_ADLIB=yes" >> $config_mak
591 echo "#define CONFIG_ADLIB 1" >> $config_h
592fi
593if test "$oss" = "yes" ; then
594 echo "CONFIG_OSS=yes" >> $config_mak
595 echo "#define CONFIG_OSS 1" >> $config_h
596fi
bellard1d14ffa2005-10-30 18:58:22 +0000597if test "$coreaudio" = "yes" ; then
598 echo "CONFIG_COREAUDIO=yes" >> $config_mak
599 echo "#define CONFIG_COREAUDIO 1" >> $config_h
600fi
601if test "$alsa" = "yes" ; then
602 echo "CONFIG_ALSA=yes" >> $config_mak
603 echo "#define CONFIG_ALSA 1" >> $config_h
604fi
605if test "$dsound" = "yes" ; then
606 echo "CONFIG_DSOUND=yes" >> $config_mak
607 echo "#define CONFIG_DSOUND 1" >> $config_h
608fi
bellard102a52e2004-11-14 19:57:29 +0000609if test "$fmod" = "yes" ; then
610 echo "CONFIG_FMOD=yes" >> $config_mak
611 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
612 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
613 echo "#define CONFIG_FMOD 1" >> $config_h
614fi
pbrookb1a550a2006-04-16 13:28:56 +0000615qemu_version=`head $source_path/VERSION`
616echo "VERSION=$qemu_version" >>$config_mak
617echo "#define QEMU_VERSION $qemu_version" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000618
619echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +0000620if [ "$source_path_used" = "yes" ]; then
621 echo "VPATH=$source_path" >> $config_mak
622fi
bellard97a847b2003-08-10 21:36:04 +0000623echo "TARGET_DIRS=$target_list" >> $config_mak
624
bellard83fb7ad2004-07-05 21:25:26 +0000625# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000626if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000627 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000628 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000629 echo "#define _BSD 1" >> $config_h
630fi
631
bellard1d14ffa2005-10-30 18:58:22 +0000632for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +0000633target_dir="$target"
634config_mak=$target_dir/config.mak
635config_h=$target_dir/config.h
636target_cpu=`echo $target | cut -d '-' -f 1`
637target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +0000638[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000639[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000640[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000641[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellarda2458622005-07-23 22:39:53 +0000642[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
bellardd3258562005-07-02 15:37:12 +0000643[ "$target_cpu" = "mips" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000644target_softmmu="no"
645if expr $target : '.*-softmmu' > /dev/null ; then
646 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000647fi
bellard997344f2003-10-27 21:10:39 +0000648target_user_only="no"
649if expr $target : '.*-user' > /dev/null ; then
650 target_user_only="yes"
651fi
bellardde83cd02003-06-15 20:25:43 +0000652
bellard97ccc682005-07-02 13:32:17 +0000653if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +0000654 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +0000655 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
656 echo "To build QEMU with graphical output configure with --disable-gfx-check"
657 echo "Note that this will disable all output from the virtual graphics card."
658 exit 1;
659fi
660
bellard7c1f25b2004-04-22 00:02:08 +0000661#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000662
663mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +0000664mkdir -p $target_dir/fpu
bellard808c4952004-12-19 23:33:47 +0000665if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
bellard69de9272004-02-16 21:40:43 +0000666 mkdir -p $target_dir/nwfpe
667fi
bellarda7e61ed2004-04-22 21:46:47 +0000668if test "$target_user_only" = "no" ; then
669 mkdir -p $target_dir/slirp
670fi
bellard69de9272004-02-16 21:40:43 +0000671
bellard97a847b2003-08-10 21:36:04 +0000672ln -sf $source_path/Makefile.target $target_dir/Makefile
673
674echo "# Automatically generated by configure - do not modify" > $config_mak
675echo "/* Automatically generated by configure - do not modify */" > $config_h
676
677
678echo "include ../config-host.mak" >> $config_mak
679echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000680
681interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
682echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000683
684if test "$target_cpu" = "i386" ; then
685 echo "TARGET_ARCH=i386" >> $config_mak
686 echo "#define TARGET_ARCH \"i386\"" >> $config_h
687 echo "#define TARGET_I386 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000688 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
bellard824d5602005-02-12 18:58:00 +0000689 echo "#define USE_KQEMU 1" >> $config_h
690 fi
bellard808c4952004-12-19 23:33:47 +0000691elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000692 echo "TARGET_ARCH=arm" >> $config_mak
693 echo "#define TARGET_ARCH \"arm\"" >> $config_h
694 echo "#define TARGET_ARM 1" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000695elif test "$target_cpu" = "sparc" ; then
696 echo "TARGET_ARCH=sparc" >> $config_mak
697 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
698 echo "#define TARGET_SPARC 1" >> $config_h
bellard64b3ab22005-01-30 22:43:42 +0000699elif test "$target_cpu" = "sparc64" ; then
700 echo "TARGET_ARCH=sparc64" >> $config_mak
701 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
702 echo "#define TARGET_SPARC 1" >> $config_h
703 echo "#define TARGET_SPARC64 1" >> $config_h
bellard67867302003-11-23 17:05:30 +0000704elif test "$target_cpu" = "ppc" ; then
705 echo "TARGET_ARCH=ppc" >> $config_mak
706 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
707 echo "#define TARGET_PPC 1" >> $config_h
bellarda2458622005-07-23 22:39:53 +0000708elif test "$target_cpu" = "ppc64" ; then
709 echo "TARGET_ARCH=ppc64" >> $config_mak
710 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
711 echo "#define TARGET_PPC 1" >> $config_h
712 echo "#define TARGET_PPC64 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000713elif test "$target_cpu" = "x86_64" ; then
714 echo "TARGET_ARCH=x86_64" >> $config_mak
715 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
716 echo "#define TARGET_I386 1" >> $config_h
717 echo "#define TARGET_X86_64 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000718 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
719 echo "#define USE_KQEMU 1" >> $config_h
720 fi
bellardc20eb472005-12-06 21:42:55 +0000721elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
bellardd3258562005-07-02 15:37:12 +0000722 echo "TARGET_ARCH=mips" >> $config_mak
723 echo "#define TARGET_ARCH \"mips\"" >> $config_h
724 echo "#define TARGET_MIPS 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000725else
726 echo "Unsupported target CPU"
727 exit 1
728fi
729if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000730 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
731 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
732fi
733if test "$target_softmmu" = "yes" ; then
734 echo "CONFIG_SOFTMMU=yes" >> $config_mak
735 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000736fi
bellard997344f2003-10-27 21:10:39 +0000737if test "$target_user_only" = "yes" ; then
738 echo "CONFIG_USER_ONLY=yes" >> $config_mak
739 echo "#define CONFIG_USER_ONLY 1" >> $config_h
740fi
bellardde83cd02003-06-15 20:25:43 +0000741
bellard158142c2005-03-13 16:54:06 +0000742if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
743 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
744 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
745fi
bellard7c1f25b2004-04-22 00:02:08 +0000746# sdl defines
747
748if test "$target_user_only" = "no"; then
749 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000750 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000751 else
bellarddbb2c922004-10-24 22:17:47 +0000752 sdl1=$sdl
753 fi
754 if test "$sdl1" = "yes" ; then
755 echo "#define CONFIG_SDL 1" >> $config_h
756 echo "CONFIG_SDL=yes" >> $config_mak
757 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
758 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
759 else
bellard7c1f25b2004-04-22 00:02:08 +0000760 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
761 fi
bellarddbb2c922004-10-24 22:17:47 +0000762 if [ "${aa}" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000763 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
764 else
765 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
bellarddbb2c922004-10-24 22:17:47 +0000766 fi
bellard7c1f25b2004-04-22 00:02:08 +0000767 fi
bellard7c1f25b2004-04-22 00:02:08 +0000768fi
769
bellard5b0753e2005-03-01 21:37:28 +0000770if test "$cocoa" = "yes" ; then
771 echo "#define CONFIG_COCOA 1" >> $config_h
772 echo "CONFIG_COCOA=yes" >> $config_mak
773fi
774
bellard97a847b2003-08-10 21:36:04 +0000775done # for target in $targets
bellard7d132992003-03-06 23:23:54 +0000776
777# build tree in object directory if source path is different from current one
778if test "$source_path_used" = "yes" ; then
779 DIRS="tests"
780 FILES="Makefile tests/Makefile"
781 for dir in $DIRS ; do
782 mkdir -p $dir
783 done
784 for f in $FILES ; do
785 ln -sf $source_path/$f $f
786 done
787fi
bellard7d132992003-03-06 23:23:54 +0000788
bellard97a847b2003-08-10 21:36:04 +0000789rm -f $TMPO $TMPC $TMPE $TMPS