blob: 6e5073b6f94d60cb860354875aece6ce9b1224be [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"
pbrook6a882642006-04-17 13:57:12 +000028install="install"
bellard7d132992003-03-06 23:23:54 +000029strip="strip"
30cpu=`uname -m`
bellard5327cf42005-01-10 23:18:50 +000031target_list=""
bellard7d132992003-03-06 23:23:54 +000032case "$cpu" in
33 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +000034 cpu="i386"
bellard7d132992003-03-06 23:23:54 +000035 ;;
bellardba680552005-03-13 09:49:52 +000036 armv*b)
bellard808c4952004-12-19 23:33:47 +000037 cpu="armv4b"
38 ;;
bellardba680552005-03-13 09:49:52 +000039 armv*l)
bellard7d132992003-03-06 23:23:54 +000040 cpu="armv4l"
41 ;;
42 alpha)
43 cpu="alpha"
44 ;;
bellard295defa2003-04-07 21:31:29 +000045 "Power Macintosh"|ppc|ppc64)
bellard7d132992003-03-06 23:23:54 +000046 cpu="powerpc"
47 ;;
48 mips)
49 cpu="mips"
50 ;;
bellardfb3e5842003-03-29 17:32:36 +000051 s390)
52 cpu="s390"
53 ;;
bellardae228532003-05-13 18:59:59 +000054 sparc)
55 cpu="sparc"
56 ;;
57 sparc64)
58 cpu="sparc64"
59 ;;
bellarda8baa8c2003-04-29 20:53:31 +000060 ia64)
61 cpu="ia64"
62 ;;
bellard38e584a2003-08-10 22:14:22 +000063 m68k)
64 cpu="m68k"
65 ;;
bellardbc51c5c2004-03-17 23:46:04 +000066 x86_64|amd64)
bellard0b0babc2005-01-03 23:38:40 +000067 cpu="x86_64"
bellardbc51c5c2004-03-17 23:46:04 +000068 ;;
bellard7d132992003-03-06 23:23:54 +000069 *)
70 cpu="unknown"
71 ;;
72esac
73gprof="no"
74bigendian="no"
bellard67b915a2004-03-31 23:37:16 +000075mingw32="no"
76EXESUF=""
77gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +000078slirp="yes"
bellardfb065182004-11-09 23:09:44 +000079adlib="no"
80oss="no"
bellard1d14ffa2005-10-30 18:58:22 +000081dsound="no"
82coreaudio="no"
83alsa="no"
bellard102a52e2004-11-14 19:57:29 +000084fmod="no"
85fmod_lib=""
86fmod_inc=""
pbrookb1a550a2006-04-16 13:28:56 +000087bsd="no"
bellard5327cf42005-01-10 23:18:50 +000088linux="no"
bellardc9ec1fe2005-02-10 21:55:30 +000089kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +000090profiler="no"
bellardc9ec1fe2005-02-10 21:55:30 +000091kernel_path=""
bellard5b0753e2005-03-01 21:37:28 +000092cocoa="no"
bellard97ccc682005-07-02 13:32:17 +000093check_gfx="yes"
bellard1aff3812005-11-02 22:30:45 +000094check_gcc="yes"
pbrook0a8e90f2006-03-19 14:54:16 +000095softmmu="yes"
96user="no"
bellard7d132992003-03-06 23:23:54 +000097
98# OS specific
99targetos=`uname -s`
100case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000101CYGWIN*)
102mingw32="yes"
103CFLAGS="-O2 -mno-cygwin"
104;;
bellard67b915a2004-03-31 23:37:16 +0000105MINGW32*)
106mingw32="yes"
107;;
bellard7d3505c2004-05-12 19:32:15 +0000108FreeBSD)
109bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000110oss="yes"
bellarde99f9062005-07-28 21:45:38 +0000111if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000112 kqemu="yes"
113fi
bellard7d3505c2004-05-12 19:32:15 +0000114;;
115NetBSD)
116bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000117oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000118;;
119OpenBSD)
120bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000121oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000122;;
bellard83fb7ad2004-07-05 21:25:26 +0000123Darwin)
124bsd="yes"
125darwin="yes"
126;;
bellard1d14ffa2005-10-30 18:58:22 +0000127*)
bellardfb065182004-11-09 23:09:44 +0000128oss="yes"
bellard5327cf42005-01-10 23:18:50 +0000129linux="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000130user="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000131if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000132 kqemu="yes"
133fi
bellardfb065182004-11-09 23:09:44 +0000134;;
bellard7d132992003-03-06 23:23:54 +0000135esac
136
bellard7d3505c2004-05-12 19:32:15 +0000137if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000138 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000139 make="gmake"
140 fi
bellard7d3505c2004-05-12 19:32:15 +0000141fi
142
bellard7d132992003-03-06 23:23:54 +0000143# find source path
pbrookad064842006-04-16 12:41:07 +0000144source_path=`dirname "$0"`
145if [ -z "$source_path" ]; then
bellard7d132992003-03-06 23:23:54 +0000146 source_path=`pwd`
pbrookad064842006-04-16 12:41:07 +0000147else
148 source_path=`cd "$source_path"; pwd`
149fi
150if test "$source_path" = `pwd` ; then
bellard7d132992003-03-06 23:23:54 +0000151 source_path_used="no"
pbrookad064842006-04-16 12:41:07 +0000152else
153 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000154fi
155
156for opt do
pbrookb1a550a2006-04-16 13:28:56 +0000157 optarg=`expr "$opt" : '[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000158 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000159 --help|-h) show_help=yes
160 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000161 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000162 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000163 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000164 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000165 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000166 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000167 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000168 --cross-prefix=*) cross_prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000169 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000170 --cc=*) cc="$optarg"
bellard7d132992003-03-06 23:23:54 +0000171 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000172 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000173 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000174 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000175 ;;
pbrook6a882642006-04-17 13:57:12 +0000176 --install=*) install="$optarg"
177 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000178 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000179 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000180 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000181 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000182 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000183 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000184 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000185 ;;
bellard7d132992003-03-06 23:23:54 +0000186 --enable-gprof) gprof="yes"
187 ;;
bellard43ce4df2003-06-09 19:53:12 +0000188 --static) static="yes"
189 ;;
bellard97a847b2003-08-10 21:36:04 +0000190 --disable-sdl) sdl="no"
191 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000192 --enable-coreaudio) coreaudio="yes"
193 ;;
194 --enable-alsa) alsa="yes"
195 ;;
196 --enable-dsound) dsound="yes"
197 ;;
bellard102a52e2004-11-14 19:57:29 +0000198 --enable-fmod) fmod="yes"
199 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000200 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000201 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000202 --fmod-inc=*) fmod_inc="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000203 ;;
bellard67b915a2004-03-31 23:37:16 +0000204 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
bellard1d14ffa2005-10-30 18:58:22 +0000205 ;;
bellard443f1372004-06-04 11:13:20 +0000206 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000207 ;;
bellardfb065182004-11-09 23:09:44 +0000208 --enable-adlib) adlib="yes"
bellard1d14ffa2005-10-30 18:58:22 +0000209 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000210 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000211 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000212 --enable-profiler) profiler="yes"
213 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000214 --kernel-path=*) kernel_path="$optarg"
bellard1d14ffa2005-10-30 18:58:22 +0000215 ;;
216 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
217 ;;
bellard97ccc682005-07-02 13:32:17 +0000218 --disable-gfx-check) check_gfx="no"
219 ;;
bellard1aff3812005-11-02 22:30:45 +0000220 --disable-gcc-check) check_gcc="no"
221 ;;
pbrookcad25d62006-03-19 16:31:11 +0000222 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000223 ;;
pbrookcad25d62006-03-19 16:31:11 +0000224 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000225 ;;
226 --disable-user) user="no"
227 ;;
228 --enable-user) user="yes"
229 ;;
bellard7d132992003-03-06 23:23:54 +0000230 esac
231done
232
233# Checking for CFLAGS
234if test -z "$CFLAGS"; then
235 CFLAGS="-O2"
236fi
237
pbrookaf5db582006-04-08 14:26:41 +0000238if test x"$show_help" = x"yes" ; then
239cat << EOF
240
241Usage: configure [options]
242Options: [defaults in brackets after descriptions]
243
244EOF
245echo "Standard options:"
246echo " --help print this message"
247echo " --prefix=PREFIX install in PREFIX [$prefix]"
248echo " --interp-prefix=PREFIX where to find shared libraries, etc."
249echo " use %M for cpu name [$interp_prefix]"
250echo " --target-list=LIST set target list [$target_list]"
251echo ""
252echo "kqemu kernel acceleration support:"
253echo " --disable-kqemu disable kqemu support"
254echo " --kernel-path=PATH set the kernel path (configure probes it)"
255echo ""
256echo "Advanced options (experts only):"
257echo " --source-path=PATH path of source code [$source_path]"
258echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
259echo " --cc=CC use C compiler CC [$cc]"
260echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
261echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000262echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000263echo " --static enable static build [$static]"
264echo " --enable-cocoa enable COCOA (Mac OS X only)"
265echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
266echo " --enable-adlib enable Adlib emulation"
267echo " --enable-coreaudio enable Coreaudio audio driver"
268echo " --enable-alsa enable ALSA audio driver"
269echo " --enable-fmod enable FMOD audio driver"
270echo " --enabled-dsound enable DirectSound audio driver"
271echo " --enable-system enable all system emulation targets"
272echo " --disable-system disable all system emulation targets"
273echo " --enable-user enable all linux usermode emulation targets"
274echo " --disable-user disable all linux usermode emulation targets"
275echo " --fmod-lib path to FMOD library"
276echo " --fmod-inc path to FMOD includes"
277echo ""
278echo "NOTE: The object files are build at the place where configure is launched"
279exit 1
280fi
281
bellard7d132992003-03-06 23:23:54 +0000282cc="${cross_prefix}${cc}"
283ar="${cross_prefix}${ar}"
284strip="${cross_prefix}${strip}"
285
bellard67b915a2004-03-31 23:37:16 +0000286if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000287 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000288 EXESUF=".exe"
289 gdbstub="no"
bellard9f059ec2004-11-14 18:59:52 +0000290 oss="no"
bellard07f4ddb2005-04-23 17:44:28 +0000291 if [ "$cpu" = "i386" ] ; then
292 kqemu="yes"
293 fi
bellard67b915a2004-03-31 23:37:16 +0000294fi
295
bellard5327cf42005-01-10 23:18:50 +0000296if test -z "$target_list" ; then
297# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000298 if [ "$softmmu" = "yes" ] ; then
299 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
300 fi
bellard5327cf42005-01-10 23:18:50 +0000301# the following are Linux specific
pbrook0a8e90f2006-03-19 14:54:16 +0000302 if [ "$user" = "yes" ] ; then
bellardc20eb472005-12-06 21:42:55 +0000303 target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list"
bellard5327cf42005-01-10 23:18:50 +0000304 fi
bellard6e20a452005-06-05 15:56:02 +0000305else
pbrookb1a550a2006-04-16 13:28:56 +0000306 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000307fi
pbrook0a8e90f2006-03-19 14:54:16 +0000308if test -z "$target_list" ; then
309 echo "No targets enabled"
310 exit 1
311fi
bellard5327cf42005-01-10 23:18:50 +0000312
bellard7d132992003-03-06 23:23:54 +0000313if test -z "$cross_prefix" ; then
314
315# ---
316# big/little endian test
317cat > $TMPC << EOF
318#include <inttypes.h>
319int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000320 volatile uint32_t i=0x01234567;
321 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000322}
323EOF
324
325if $cc -o $TMPE $TMPC 2>/dev/null ; then
326$TMPE && bigendian="yes"
327else
328echo big/little test failed
329fi
330
331else
332
333# if cross compiling, cannot launch a program, so make a static guess
bellard808c4952004-12-19 23:33:47 +0000334if 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 +0000335 bigendian="yes"
336fi
337
338fi
339
bellardb6853692005-06-05 17:10:39 +0000340# host long bits test
341hostlongbits="32"
342if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
343 hostlongbits="64"
344fi
345
bellarde8cd23d2003-06-25 16:08:13 +0000346# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000347cat > $TMPC <<EOF
348int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000349}
350EOF
351
bellarde8cd23d2003-06-25 16:08:13 +0000352have_gcc3_options="no"
353if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
354 have_gcc3_options="yes"
bellard04369ff2003-03-20 22:33:23 +0000355fi
bellardca735202003-03-18 20:41:34 +0000356
pbrookb1a550a2006-04-16 13:28:56 +0000357# Check for gcc4, error if pre-gcc4
bellard1aff3812005-11-02 22:30:45 +0000358if test "$check_gcc" = "yes" ; then
359 cat > $TMPC <<EOF
pbrookb1a550a2006-04-16 13:28:56 +0000360#if __GNUC__ < 4
361#error gcc3
bellard1aff3812005-11-02 22:30:45 +0000362#endif
363int main(){return 0;}
364EOF
pbrookb1a550a2006-04-16 13:28:56 +0000365 if $cc -o $TMPO $TMPC 2>/dev/null ; then
bellard1aff3812005-11-02 22:30:45 +0000366 echo "ERROR: \"$cc\" looks like gcc 4.x"
367 echo "QEMU is known to have problems when compiled with gcc 4.x"
368 echo "It is recommended that you use gcc 3.x to build QEMU"
369 echo "To use this compiler anyway, configure with --disable-gcc-check"
370 exit 1;
371 fi
372fi
373
bellard11d9f692004-04-02 20:55:59 +0000374##########################################
375# SDL probe
376
377sdl_too_old=no
378
379if test -z "$sdl" ; then
380
bellarda6e022a2004-04-02 21:55:47 +0000381sdl_config="sdl-config"
382sdl=no
bellard7c1f25b2004-04-22 00:02:08 +0000383sdl_static=no
bellarda6e022a2004-04-02 21:55:47 +0000384
385if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
386# win32 cross compilation case
387 sdl_config="i386-mingw32msvc-sdl-config"
388 sdl=yes
389else
390# normal SDL probe
bellard11d9f692004-04-02 20:55:59 +0000391cat > $TMPC << EOF
392#include <SDL.h>
393#undef main /* We don't want SDL to override our main() */
394int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
395EOF
396
bellarda6e022a2004-04-02 21:55:47 +0000397if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
398_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
bellard11d9f692004-04-02 20:55:59 +0000399if test "$_sdlversion" -lt 121 ; then
400sdl_too_old=yes
401else
402sdl=yes
403fi
bellard7c1f25b2004-04-22 00:02:08 +0000404
405# static link with sdl ?
406if test "$sdl" = "yes" ; then
407aa="no"
408`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
409sdl_static_libs=`$sdl_config --static-libs`
410if [ "$aa" = "yes" ] ; then
bellardd8d8aa42004-04-29 20:14:07 +0000411 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
bellard11d9f692004-04-02 20:55:59 +0000412fi
413
bellard7c1f25b2004-04-22 00:02:08 +0000414if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
415 sdl_static=yes
416fi
417
418fi # static link
419
420fi # sdl compile test
421
bellarda6e022a2004-04-02 21:55:47 +0000422fi # cross compilation
423fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000424
bellard11d9f692004-04-02 20:55:59 +0000425if test "$mingw32" = "yes" ; then
426if test -z "$prefix" ; then
427 prefix="/c/Program Files/Qemu"
428fi
429mandir="$prefix"
bellard7efa4382004-05-12 18:54:06 +0000430datadir="$prefix"
bellard1f50f8d2004-05-08 14:44:43 +0000431docdir="$prefix"
bellard11d9f692004-04-02 20:55:59 +0000432bindir="$prefix"
433else
434if test -z "$prefix" ; then
435 prefix="/usr/local"
436fi
bellard5a671352003-10-01 00:13:48 +0000437mandir="$prefix/share/man"
bellard7efa4382004-05-12 18:54:06 +0000438datadir="$prefix/share/qemu"
bellard1f50f8d2004-05-08 14:44:43 +0000439docdir="$prefix/share/doc/qemu"
bellard11d9f692004-04-02 20:55:59 +0000440bindir="$prefix/bin"
441fi
bellard5a671352003-10-01 00:13:48 +0000442
bellard43ce4df2003-06-09 19:53:12 +0000443echo "Install prefix $prefix"
bellard7efa4382004-05-12 18:54:06 +0000444echo "BIOS directory $datadir"
bellard11d9f692004-04-02 20:55:59 +0000445echo "binary directory $bindir"
446if test "$mingw32" = "no" ; then
447echo "Manual directory $mandir"
bellard43ce4df2003-06-09 19:53:12 +0000448echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000449fi
bellard5a671352003-10-01 00:13:48 +0000450echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000451echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +0000452echo "Host C compiler $host_cc"
bellard43ce4df2003-06-09 19:53:12 +0000453echo "make $make"
pbrook6a882642006-04-17 13:57:12 +0000454echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +0000455echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000456echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000457echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000458echo "gprof enabled $gprof"
bellard05c2a3e2006-02-08 22:39:17 +0000459echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +0000460echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000461if test "$darwin" = "yes" ; then
462 echo "Cocoa support $cocoa"
463fi
bellard97a847b2003-08-10 21:36:04 +0000464echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000465if test "$sdl" != "no" ; then
466 echo "SDL static link $sdl_static"
467fi
bellard67b915a2004-03-31 23:37:16 +0000468echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000469echo "Adlib support $adlib"
bellard1d14ffa2005-10-30 18:58:22 +0000470echo "CoreAudio support $coreaudio"
471echo "ALSA support $alsa"
472echo "DSound support $dsound"
bellard1d14ffa2005-10-30 18:58:22 +0000473if test "$fmod" = "yes"; then
474 if test -z $fmod_lib || test -z $fmod_inc; then
475 echo
476 echo "Error: You must specify path to FMOD library and headers"
477 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
478 echo
479 exit 1
480 fi
pbrookb1a550a2006-04-16 13:28:56 +0000481 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
482else
483 fmod_support=""
bellard102a52e2004-11-14 19:57:29 +0000484fi
pbrookb1a550a2006-04-16 13:28:56 +0000485echo "FMOD support $fmod $fmod_support"
bellard07f4ddb2005-04-23 17:44:28 +0000486echo "kqemu support $kqemu"
bellard67b915a2004-03-31 23:37:16 +0000487
bellard97a847b2003-08-10 21:36:04 +0000488if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000489echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000490fi
bellard24b55b92005-03-01 22:30:41 +0000491#if test "$sdl_static" = "no"; then
492# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
493#fi
bellard97a847b2003-08-10 21:36:04 +0000494config_mak="config-host.mak"
495config_h="config-host.h"
496
bellard7c1f25b2004-04-22 00:02:08 +0000497#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000498
499echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +0000500echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000501echo "/* Automatically generated by configure - do not modify */" > $config_h
502
503echo "prefix=$prefix" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000504echo "bindir=$bindir" >> $config_mak
bellard5a671352003-10-01 00:13:48 +0000505echo "mandir=$mandir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000506echo "datadir=$datadir" >> $config_mak
bellard1f50f8d2004-05-08 14:44:43 +0000507echo "docdir=$docdir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000508echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000509echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +0000510echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000511echo "CC=$cc" >> $config_mak
512if test "$have_gcc3_options" = "yes" ; then
513 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
514fi
515echo "HOST_CC=$host_cc" >> $config_mak
516echo "AR=$ar" >> $config_mak
517echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
518echo "CFLAGS=$CFLAGS" >> $config_mak
519echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +0000520echo "EXESUF=$EXESUF" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000521if test "$cpu" = "i386" ; then
522 echo "ARCH=i386" >> $config_mak
523 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000524elif test "$cpu" = "x86_64" ; then
525 echo "ARCH=x86_64" >> $config_mak
526 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000527elif test "$cpu" = "armv4b" ; then
528 echo "ARCH=arm" >> $config_mak
529 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000530elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000531 echo "ARCH=arm" >> $config_mak
532 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000533elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000534 echo "ARCH=ppc" >> $config_mak
535 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000536elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000537 echo "ARCH=mips" >> $config_mak
538 echo "#define HOST_MIPS 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000539elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000540 echo "ARCH=s390" >> $config_mak
541 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000542elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000543 echo "ARCH=alpha" >> $config_mak
544 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000545elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000546 echo "ARCH=sparc" >> $config_mak
547 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000548elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000549 echo "ARCH=sparc64" >> $config_mak
550 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000551elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000552 echo "ARCH=ia64" >> $config_mak
553 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000554elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000555 echo "ARCH=m68k" >> $config_mak
556 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000557else
558 echo "Unsupported CPU"
559 exit 1
560fi
561if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000562 echo "WORDS_BIGENDIAN=yes" >> $config_mak
563 echo "#define WORDS_BIGENDIAN 1" >> $config_h
564fi
bellardb6853692005-06-05 17:10:39 +0000565echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +0000566if test "$mingw32" = "yes" ; then
567 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000568 echo "#define CONFIG_WIN32 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000569elif test -f "/usr/include/byteswap.h" ; then
bellard67b915a2004-03-31 23:37:16 +0000570 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
571fi
bellard83fb7ad2004-07-05 21:25:26 +0000572if test "$darwin" = "yes" ; then
573 echo "CONFIG_DARWIN=yes" >> $config_mak
574 echo "#define CONFIG_DARWIN 1" >> $config_h
575fi
bellard67b915a2004-03-31 23:37:16 +0000576if test "$gdbstub" = "yes" ; then
577 echo "CONFIG_GDBSTUB=yes" >> $config_mak
578 echo "#define CONFIG_GDBSTUB 1" >> $config_h
579fi
bellard97a847b2003-08-10 21:36:04 +0000580if test "$gprof" = "yes" ; then
581 echo "TARGET_GPROF=yes" >> $config_mak
582 echo "#define HAVE_GPROF 1" >> $config_h
583fi
584if test "$static" = "yes" ; then
585 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +0000586 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000587fi
bellard05c2a3e2006-02-08 22:39:17 +0000588if test $profiler = "yes" ; then
589 echo "#define CONFIG_PROFILER 1" >> $config_h
590fi
bellardc20709a2004-04-21 23:27:19 +0000591if test "$slirp" = "yes" ; then
592 echo "CONFIG_SLIRP=yes" >> $config_mak
593 echo "#define CONFIG_SLIRP 1" >> $config_h
594fi
bellardfb065182004-11-09 23:09:44 +0000595if test "$adlib" = "yes" ; then
596 echo "CONFIG_ADLIB=yes" >> $config_mak
597 echo "#define CONFIG_ADLIB 1" >> $config_h
598fi
599if test "$oss" = "yes" ; then
600 echo "CONFIG_OSS=yes" >> $config_mak
601 echo "#define CONFIG_OSS 1" >> $config_h
602fi
bellard1d14ffa2005-10-30 18:58:22 +0000603if test "$coreaudio" = "yes" ; then
604 echo "CONFIG_COREAUDIO=yes" >> $config_mak
605 echo "#define CONFIG_COREAUDIO 1" >> $config_h
606fi
607if test "$alsa" = "yes" ; then
608 echo "CONFIG_ALSA=yes" >> $config_mak
609 echo "#define CONFIG_ALSA 1" >> $config_h
610fi
611if test "$dsound" = "yes" ; then
612 echo "CONFIG_DSOUND=yes" >> $config_mak
613 echo "#define CONFIG_DSOUND 1" >> $config_h
614fi
bellard102a52e2004-11-14 19:57:29 +0000615if test "$fmod" = "yes" ; then
616 echo "CONFIG_FMOD=yes" >> $config_mak
617 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
618 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
619 echo "#define CONFIG_FMOD 1" >> $config_h
620fi
pbrookb1a550a2006-04-16 13:28:56 +0000621qemu_version=`head $source_path/VERSION`
622echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +0000623echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000624
625echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +0000626if [ "$source_path_used" = "yes" ]; then
627 echo "VPATH=$source_path" >> $config_mak
628fi
bellard97a847b2003-08-10 21:36:04 +0000629echo "TARGET_DIRS=$target_list" >> $config_mak
630
bellard83fb7ad2004-07-05 21:25:26 +0000631# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000632if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000633 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000634 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000635 echo "#define _BSD 1" >> $config_h
636fi
637
bellard1d14ffa2005-10-30 18:58:22 +0000638for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +0000639target_dir="$target"
640config_mak=$target_dir/config.mak
641config_h=$target_dir/config.h
642target_cpu=`echo $target | cut -d '-' -f 1`
643target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +0000644[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000645[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000646[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000647[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellarda2458622005-07-23 22:39:53 +0000648[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
bellardd3258562005-07-02 15:37:12 +0000649[ "$target_cpu" = "mips" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000650target_softmmu="no"
651if expr $target : '.*-softmmu' > /dev/null ; then
652 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000653fi
bellard997344f2003-10-27 21:10:39 +0000654target_user_only="no"
655if expr $target : '.*-user' > /dev/null ; then
656 target_user_only="yes"
657fi
bellardde83cd02003-06-15 20:25:43 +0000658
bellard97ccc682005-07-02 13:32:17 +0000659if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +0000660 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +0000661 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +0000662 echo "To build QEMU without graphical output configure with --disable-gfx-check"
bellard97ccc682005-07-02 13:32:17 +0000663 echo "Note that this will disable all output from the virtual graphics card."
664 exit 1;
665fi
666
bellard7c1f25b2004-04-22 00:02:08 +0000667#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000668
669mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +0000670mkdir -p $target_dir/fpu
bellard808c4952004-12-19 23:33:47 +0000671if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
bellard69de9272004-02-16 21:40:43 +0000672 mkdir -p $target_dir/nwfpe
673fi
bellarda7e61ed2004-04-22 21:46:47 +0000674if test "$target_user_only" = "no" ; then
675 mkdir -p $target_dir/slirp
676fi
bellard69de9272004-02-16 21:40:43 +0000677
bellard97a847b2003-08-10 21:36:04 +0000678ln -sf $source_path/Makefile.target $target_dir/Makefile
679
680echo "# Automatically generated by configure - do not modify" > $config_mak
681echo "/* Automatically generated by configure - do not modify */" > $config_h
682
683
684echo "include ../config-host.mak" >> $config_mak
685echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000686
687interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
688echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000689
690if test "$target_cpu" = "i386" ; then
691 echo "TARGET_ARCH=i386" >> $config_mak
692 echo "#define TARGET_ARCH \"i386\"" >> $config_h
693 echo "#define TARGET_I386 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000694 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
bellard824d5602005-02-12 18:58:00 +0000695 echo "#define USE_KQEMU 1" >> $config_h
696 fi
bellard808c4952004-12-19 23:33:47 +0000697elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000698 echo "TARGET_ARCH=arm" >> $config_mak
699 echo "#define TARGET_ARCH \"arm\"" >> $config_h
700 echo "#define TARGET_ARM 1" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000701elif test "$target_cpu" = "sparc" ; then
702 echo "TARGET_ARCH=sparc" >> $config_mak
703 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
704 echo "#define TARGET_SPARC 1" >> $config_h
bellard64b3ab22005-01-30 22:43:42 +0000705elif test "$target_cpu" = "sparc64" ; then
706 echo "TARGET_ARCH=sparc64" >> $config_mak
707 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
708 echo "#define TARGET_SPARC 1" >> $config_h
709 echo "#define TARGET_SPARC64 1" >> $config_h
bellard67867302003-11-23 17:05:30 +0000710elif test "$target_cpu" = "ppc" ; then
711 echo "TARGET_ARCH=ppc" >> $config_mak
712 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
713 echo "#define TARGET_PPC 1" >> $config_h
bellarda2458622005-07-23 22:39:53 +0000714elif test "$target_cpu" = "ppc64" ; then
715 echo "TARGET_ARCH=ppc64" >> $config_mak
716 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
717 echo "#define TARGET_PPC 1" >> $config_h
718 echo "#define TARGET_PPC64 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000719elif test "$target_cpu" = "x86_64" ; then
720 echo "TARGET_ARCH=x86_64" >> $config_mak
721 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
722 echo "#define TARGET_I386 1" >> $config_h
723 echo "#define TARGET_X86_64 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000724 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
725 echo "#define USE_KQEMU 1" >> $config_h
726 fi
bellardc20eb472005-12-06 21:42:55 +0000727elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
bellardd3258562005-07-02 15:37:12 +0000728 echo "TARGET_ARCH=mips" >> $config_mak
729 echo "#define TARGET_ARCH \"mips\"" >> $config_h
730 echo "#define TARGET_MIPS 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000731else
732 echo "Unsupported target CPU"
733 exit 1
734fi
735if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000736 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
737 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
738fi
739if test "$target_softmmu" = "yes" ; then
740 echo "CONFIG_SOFTMMU=yes" >> $config_mak
741 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000742fi
bellard997344f2003-10-27 21:10:39 +0000743if test "$target_user_only" = "yes" ; then
744 echo "CONFIG_USER_ONLY=yes" >> $config_mak
745 echo "#define CONFIG_USER_ONLY 1" >> $config_h
746fi
bellardde83cd02003-06-15 20:25:43 +0000747
bellard158142c2005-03-13 16:54:06 +0000748if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
749 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
750 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
751fi
bellard7c1f25b2004-04-22 00:02:08 +0000752# sdl defines
753
754if test "$target_user_only" = "no"; then
755 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000756 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000757 else
bellarddbb2c922004-10-24 22:17:47 +0000758 sdl1=$sdl
759 fi
760 if test "$sdl1" = "yes" ; then
761 echo "#define CONFIG_SDL 1" >> $config_h
762 echo "CONFIG_SDL=yes" >> $config_mak
763 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
764 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
765 else
bellard7c1f25b2004-04-22 00:02:08 +0000766 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
767 fi
bellarddbb2c922004-10-24 22:17:47 +0000768 if [ "${aa}" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000769 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
770 else
771 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
bellarddbb2c922004-10-24 22:17:47 +0000772 fi
bellard7c1f25b2004-04-22 00:02:08 +0000773 fi
bellard7c1f25b2004-04-22 00:02:08 +0000774fi
775
bellard5b0753e2005-03-01 21:37:28 +0000776if test "$cocoa" = "yes" ; then
777 echo "#define CONFIG_COCOA 1" >> $config_h
778 echo "CONFIG_COCOA=yes" >> $config_mak
779fi
780
bellard97a847b2003-08-10 21:36:04 +0000781done # for target in $targets
bellard7d132992003-03-06 23:23:54 +0000782
783# build tree in object directory if source path is different from current one
784if test "$source_path_used" = "yes" ; then
785 DIRS="tests"
786 FILES="Makefile tests/Makefile"
787 for dir in $DIRS ; do
788 mkdir -p $dir
789 done
790 for f in $FILES ; do
791 ln -sf $source_path/$f $f
792 done
793fi
bellard7d132992003-03-06 23:23:54 +0000794
bellard97a847b2003-08-10 21:36:04 +0000795rm -f $TMPO $TMPC $TMPE $TMPS