blob: 5c62c594ec75273aa5d14c457e0c538cbbd82bd3 [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"
malc9d56d2d2008-09-30 19:44:32 +000018TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
malcd4742de2008-11-29 22:04:31 +000019TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
bellard7d132992003-03-06 23:23:54 +000020
malcd4742de2008-11-29 22:04:31 +000021trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
malc9ac81bb2008-11-29 20:09:56 +000022
bellard7d132992003-03-06 23:23:54 +000023# default parameters
bellard11d9f692004-04-02 20:55:59 +000024prefix=""
bellard1e43adf2003-09-30 20:54:24 +000025interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000026static="no"
bellard7d132992003-03-06 23:23:54 +000027cross_prefix=""
28cc="gcc"
malc0c58ac12008-06-25 21:04:05 +000029audio_drv_list=""
malc4c9b53e2009-01-09 10:46:34 +000030audio_card_list="ac97 es1370 sb16"
31audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
bellard7d132992003-03-06 23:23:54 +000032host_cc="gcc"
33ar="ar"
34make="make"
pbrook6a882642006-04-17 13:57:12 +000035install="install"
bellard7d132992003-03-06 23:23:54 +000036strip="strip"
aliguoriac0df512008-12-29 17:14:15 +000037
38# parse CC options first
39for opt do
40 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
41 case "$opt" in
42 --cross-prefix=*) cross_prefix="$optarg"
43 ;;
44 --cc=*) cc="$optarg"
45 ;;
46 esac
47done
48
49# OS specific
50# Using uname is really, really broken. Once we have the right set of checks
51# we can eliminate it's usage altogether
52
53cc="${cross_prefix}${cc}"
54ar="${cross_prefix}${ar}"
55strip="${cross_prefix}${strip}"
56
57# check that the C compiler works.
58cat > $TMPC <<EOF
59int main(void) {}
60EOF
61
62if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
63 : C compiler works ok
64else
65 echo "ERROR: \"$cc\" either does not exist or does not work"
66 exit 1
67fi
68
69check_define() {
70cat > $TMPC <<EOF
71#if !defined($1)
72#error Not defined
73#endif
74int main(void) { return 0; }
75EOF
76 $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
77}
78
79if check_define __i386__ ; then
80 cpu="i386"
81elif check_define __x86_64__ ; then
82 cpu="x86_64"
blueswir13aa9bd62008-12-31 16:55:26 +000083elif check_define __sparc__ ; then
84 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
85 # They must be specified using --sparc_cpu
86 if check_define __arch64__ ; then
87 cpu="sparc64"
88 else
89 cpu="sparc"
90 fi
malcfdf7ed92009-01-14 18:39:52 +000091elif check_define _ARCH_PPC ; then
92 if check_define _ARCH_PPC64 ; then
93 cpu="ppc64"
94 else
95 cpu="ppc"
96 fi
aliguoriac0df512008-12-29 17:14:15 +000097else
malcfdf7ed92009-01-14 18:39:52 +000098 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +000099fi
100
bellard5327cf42005-01-10 23:18:50 +0000101target_list=""
bellard7d132992003-03-06 23:23:54 +0000102case "$cpu" in
103 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000104 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000105 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000106 x86_64|amd64)
107 cpu="x86_64"
108 ;;
109 alpha)
110 cpu="alpha"
111 ;;
bellardba680552005-03-13 09:49:52 +0000112 armv*b)
bellard808c4952004-12-19 23:33:47 +0000113 cpu="armv4b"
114 ;;
bellardba680552005-03-13 09:49:52 +0000115 armv*l)
bellard7d132992003-03-06 23:23:54 +0000116 cpu="armv4l"
117 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000118 cris)
119 cpu="cris"
bellard7d132992003-03-06 23:23:54 +0000120 ;;
aurel32f54b3f92008-04-12 20:14:54 +0000121 parisc|parisc64)
122 cpu="hppa"
123 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000124 ia64)
125 cpu="ia64"
126 ;;
127 m68k)
128 cpu="m68k"
bellard7d132992003-03-06 23:23:54 +0000129 ;;
130 mips)
131 cpu="mips"
132 ;;
thsfbe4f652007-04-01 11:16:48 +0000133 mips64)
134 cpu="mips64"
135 ;;
malcfdf7ed92009-01-14 18:39:52 +0000136 ppc)
137 cpu="ppc"
138 ;;
139 ppc64)
140 cpu="ppc64"
thse7daa602007-10-08 13:38:27 +0000141 ;;
ths0e7b8a92007-08-01 00:09:31 +0000142 s390*)
bellardfb3e5842003-03-29 17:32:36 +0000143 cpu="s390"
144 ;;
blueswir131422552007-04-16 18:27:06 +0000145 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000146 cpu="sparc"
147 ;;
148 sparc64)
149 cpu="sparc64"
150 ;;
bellard7d132992003-03-06 23:23:54 +0000151 *)
152 cpu="unknown"
153 ;;
154esac
155gprof="no"
aliguori03b4fe72008-10-07 19:16:17 +0000156sparse="no"
bellard7d132992003-03-06 23:23:54 +0000157bigendian="no"
bellard67b915a2004-03-31 23:37:16 +0000158mingw32="no"
159EXESUF=""
160gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +0000161slirp="yes"
aliguorie0e6c8c02008-07-23 18:14:33 +0000162vde="yes"
bellard102a52e2004-11-14 19:57:29 +0000163fmod_lib=""
164fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +0000165oss_lib=""
ths8d5d2d42007-08-25 01:37:51 +0000166vnc_tls="yes"
aliguori2f9606b2009-03-06 20:27:28 +0000167vnc_sasl="yes"
pbrookb1a550a2006-04-16 13:28:56 +0000168bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000169linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000170solaris="no"
bellardc9ec1fe2005-02-10 21:55:30 +0000171kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +0000172profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000173cocoa="no"
bellard97ccc682005-07-02 13:32:17 +0000174check_gfx="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000175softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000176linux_user="no"
177darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000178bsd_user="no"
pbrookcc8ae6d2006-04-23 17:57:59 +0000179build_docs="no"
pbrookc5937222006-05-14 11:30:38 +0000180uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000181curses="yes"
blueswir1414f0da2008-08-15 18:20:52 +0000182aio="yes"
pbrookbd0c5662008-05-29 14:34:11 +0000183nptl="yes"
malc8ff9cbf2008-06-23 18:33:30 +0000184mixemu="no"
balrogfb599c92008-09-28 23:49:55 +0000185bluez="yes"
aliguori7ba1e612008-11-05 16:04:33 +0000186kvm="yes"
aliguorieac30262008-11-05 16:28:56 +0000187kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000188aix="no"
ths77755342008-11-27 15:45:16 +0000189blobs="yes"
aurel32f652e6a2008-12-16 10:43:48 +0000190fdt="yes"
aliguori5368a422009-03-03 17:37:21 +0000191sdl_x11="no"
bellard7d132992003-03-06 23:23:54 +0000192
193# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000194if check_define __linux__ ; then
195 targetos="Linux"
196elif check_define _WIN32 ; then
197 targetos='MINGW32'
198else
199 targetos=`uname -s`
200fi
bellard7d132992003-03-06 23:23:54 +0000201case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000202CYGWIN*)
203mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000204OS_CFLAGS="-mno-cygwin"
thsdb8d7dd2007-07-12 09:29:18 +0000205if [ "$cpu" = "i386" ] ; then
206 kqemu="yes"
207fi
malcc2de5c92008-06-28 19:13:06 +0000208audio_possible_drivers="sdl"
bellardc326e0a2005-04-23 18:30:28 +0000209;;
bellard67b915a2004-03-31 23:37:16 +0000210MINGW32*)
211mingw32="yes"
thsdb8d7dd2007-07-12 09:29:18 +0000212if [ "$cpu" = "i386" ] ; then
213 kqemu="yes"
214fi
malcc2de5c92008-06-28 19:13:06 +0000215audio_possible_drivers="dsound sdl fmod"
bellard67b915a2004-03-31 23:37:16 +0000216;;
ths5c40d2b2007-06-23 16:03:36 +0000217GNU/kFreeBSD)
malc0c58ac12008-06-25 21:04:05 +0000218audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000219audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000220if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
221 kqemu="yes"
222fi
223;;
bellard7d3505c2004-05-12 19:32:15 +0000224FreeBSD)
225bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000226audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000227audio_possible_drivers="oss sdl esd pa"
bellarde99f9062005-07-28 21:45:38 +0000228if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000229 kqemu="yes"
230fi
bellard7d3505c2004-05-12 19:32:15 +0000231;;
blueswir1c5e97232009-03-07 20:06:23 +0000232DragonFly)
233bsd="yes"
234audio_drv_list="oss"
235audio_possible_drivers="oss sdl esd pa"
236if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
237 kqemu="yes"
238fi
239aio="no"
240;;
bellard7d3505c2004-05-12 19:32:15 +0000241NetBSD)
242bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000243audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000244audio_possible_drivers="oss sdl esd"
blueswir18ef92a82008-11-22 20:24:29 +0000245oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000246;;
247OpenBSD)
248bsd="yes"
blueswir1128ab2f2008-08-15 18:33:42 +0000249openbsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000250audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000251audio_possible_drivers="oss sdl esd"
blueswir12f6a1ab2008-08-21 18:00:53 +0000252oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000253;;
bellard83fb7ad2004-07-05 21:25:26 +0000254Darwin)
255bsd="yes"
256darwin="yes"
aliguori1b0f9cc2009-01-26 15:37:40 +0000257# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code
malcaab85882009-02-23 14:11:10 +0000258if [ "$cpu" = "i386" ] ; then
259 is_x86_64=`sysctl -n hw.optional.x86_64`
260 [ "$is_x86_64" = "1" ] && cpu=x86_64
aliguori1b0f9cc2009-01-26 15:37:40 +0000261fi
262if [ "$cpu" = "x86_64" ] ; then
263 OS_CFLAGS="-arch x86_64"
264 LDFLAGS="-arch x86_64"
265else
266 OS_CFLAGS="-mdynamic-no-pic"
267fi
ths831b7822007-01-18 20:06:33 +0000268darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000269cocoa="yes"
malc0c58ac12008-06-25 21:04:05 +0000270audio_drv_list="coreaudio"
malcc2de5c92008-06-28 19:13:06 +0000271audio_possible_drivers="coreaudio sdl fmod"
thsc2c59c32008-01-08 00:00:20 +0000272OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
bellard83fb7ad2004-07-05 21:25:26 +0000273;;
bellardec530c82006-04-25 22:36:06 +0000274SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000275 solaris="yes"
276 make="gmake"
277 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000278 needs_libsunmath="no"
thsc2b84fa2007-02-10 23:21:21 +0000279 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000280 # have to select again, because `uname -m` returns i86pc
281 # even on an x86_64 box.
282 solariscpu=`isainfo -k`
283 if test "${solariscpu}" = "amd64" ; then
284 cpu="x86_64"
285 fi
thsc2b84fa2007-02-10 23:21:21 +0000286 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000287 if test "$solarisrev" -le 9 ; then
288 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
289 needs_libsunmath="yes"
290 else
291 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
292 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
293 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
294 echo "Studio 11 can be downloaded from www.sun.com."
295 exit 1
296 fi
297 fi
298 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000299 kqemu="yes"
300 fi
ths86b2bd92007-02-11 00:31:33 +0000301 fi
ths6b4d2ba2007-05-13 18:02:43 +0000302 if test -f /usr/include/sys/soundcard.h ; then
malc0c58ac12008-06-25 21:04:05 +0000303 audio_drv_list="oss"
ths6b4d2ba2007-05-13 18:02:43 +0000304 fi
malcc2de5c92008-06-28 19:13:06 +0000305 audio_possible_drivers="oss sdl"
ths86b2bd92007-02-11 00:31:33 +0000306;;
malcb29fe3e2008-11-18 01:42:22 +0000307AIX)
308aix="yes"
309make="gmake"
310;;
bellard1d14ffa2005-10-30 18:58:22 +0000311*)
malc0c58ac12008-06-25 21:04:05 +0000312audio_drv_list="oss"
malcb8e59f12008-07-02 21:03:08 +0000313audio_possible_drivers="oss alsa sdl esd pa"
bellard5327cf42005-01-10 23:18:50 +0000314linux="yes"
ths831b7822007-01-18 20:06:33 +0000315linux_user="yes"
blueswir168063642008-11-22 21:03:55 +0000316usb="linux"
bellard07f4ddb2005-04-23 17:44:28 +0000317if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000318 kqemu="yes"
malcc2de5c92008-06-28 19:13:06 +0000319 audio_possible_drivers="$audio_possible_drivers fmod"
bellardc9ec1fe2005-02-10 21:55:30 +0000320fi
bellardfb065182004-11-09 23:09:44 +0000321;;
bellard7d132992003-03-06 23:23:54 +0000322esac
323
bellard7d3505c2004-05-12 19:32:15 +0000324if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000325 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000326 make="gmake"
blueswir168063642008-11-22 21:03:55 +0000327 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000328 fi
blueswir184778502008-10-26 20:33:16 +0000329 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000330fi
331
bellard7d132992003-03-06 23:23:54 +0000332# find source path
pbrookad064842006-04-16 12:41:07 +0000333source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000334source_path_used="no"
335workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000336if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000337 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000338else
339 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000340fi
pbrook724db112008-02-03 19:20:13 +0000341[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000342
bellard85aa5182007-11-11 20:17:03 +0000343werror="no"
bellard0d1e2392007-11-11 20:24:30 +0000344# generate compile errors on warnings for development builds
345#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
346#werror="yes";
347#fi
bellard85aa5182007-11-11 20:17:03 +0000348
bellard7d132992003-03-06 23:23:54 +0000349for opt do
pbrooka46e4032006-04-29 23:05:22 +0000350 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000351 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000352 --help|-h) show_help=yes
353 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000354 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000355 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000356 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000357 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000358 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000359 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000360 ;;
aliguoriac0df512008-12-29 17:14:15 +0000361 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000362 ;;
aliguoriac0df512008-12-29 17:14:15 +0000363 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000364 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000365 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000366 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000367 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000368 ;;
pbrook6a882642006-04-17 13:57:12 +0000369 --install=*) install="$optarg"
370 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000371 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000372 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000373 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000374 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000375 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000376 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000377 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000378 ;;
bellard7d132992003-03-06 23:23:54 +0000379 --enable-gprof) gprof="yes"
380 ;;
bellard43ce4df2003-06-09 19:53:12 +0000381 --static) static="yes"
382 ;;
bellard97a847b2003-08-10 21:36:04 +0000383 --disable-sdl) sdl="no"
384 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000385 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000386 ;;
malcc2de5c92008-06-28 19:13:06 +0000387 --fmod-inc=*) fmod_inc="$optarg"
388 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000389 --oss-lib=*) oss_lib="$optarg"
390 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000391 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000392 ;;
393 --audio-drv-list=*) audio_drv_list="$optarg"
394 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000395 --enable-sparse) sparse="yes"
396 ;;
397 --disable-sparse) sparse="no"
398 ;;
ths8d5d2d42007-08-25 01:37:51 +0000399 --disable-vnc-tls) vnc_tls="no"
400 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000401 --disable-vnc-sasl) vnc_sasl="no"
402 ;;
bellard443f1372004-06-04 11:13:20 +0000403 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000404 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000405 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000406 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000407 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000408 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000409 --disable-brlapi) brlapi="no"
410 ;;
balrogfb599c92008-09-28 23:49:55 +0000411 --disable-bluez) bluez="no"
412 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000413 --disable-kvm) kvm="no"
414 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000415 --enable-profiler) profiler="yes"
416 ;;
malcc2de5c92008-06-28 19:13:06 +0000417 --enable-cocoa)
418 cocoa="yes" ;
419 sdl="no" ;
420 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000421 ;;
bellard97ccc682005-07-02 13:32:17 +0000422 --disable-gfx-check) check_gfx="no"
423 ;;
pbrookcad25d62006-03-19 16:31:11 +0000424 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000425 ;;
pbrookcad25d62006-03-19 16:31:11 +0000426 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000427 ;;
ths831b7822007-01-18 20:06:33 +0000428 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000429 ;;
ths831b7822007-01-18 20:06:33 +0000430 --enable-linux-user) linux_user="yes"
431 ;;
432 --disable-darwin-user) darwin_user="no"
433 ;;
434 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000435 ;;
blueswir184778502008-10-26 20:33:16 +0000436 --disable-bsd-user) bsd_user="no"
437 ;;
438 --enable-bsd-user) bsd_user="yes"
439 ;;
pbrookc5937222006-05-14 11:30:38 +0000440 --enable-uname-release=*) uname_release="$optarg"
441 ;;
blueswir131422552007-04-16 18:27:06 +0000442 --sparc_cpu=*)
443 sparc_cpu="$optarg"
444 case $sparc_cpu in
445 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
446 target_cpu="sparc"; cpu="sparc" ;;
447 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
448 target_cpu="sparc"; cpu="sparc" ;;
449 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
450 target_cpu="sparc64"; cpu="sparc64" ;;
451 *) echo "undefined SPARC architecture. Exiting";exit 1;;
452 esac
453 ;;
bellard85aa5182007-11-11 20:17:03 +0000454 --enable-werror) werror="yes"
455 ;;
456 --disable-werror) werror="no"
457 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000458 --disable-curses) curses="no"
459 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000460 --disable-nptl) nptl="no"
461 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000462 --enable-mixemu) mixemu="yes"
463 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000464 --disable-aio) aio="no"
465 ;;
ths77755342008-11-27 15:45:16 +0000466 --disable-blobs) blobs="no"
467 ;;
aliguorieac30262008-11-05 16:28:56 +0000468 --kerneldir=*) kerneldir="$optarg"
469 ;;
balrog7f1559c2007-11-17 10:24:32 +0000470 *) echo "ERROR: unknown option $opt"; show_help="yes"
471 ;;
bellard7d132992003-03-06 23:23:54 +0000472 esac
473done
474
ths6f30fa82007-01-05 01:00:47 +0000475# default flags for all hosts
blueswir1ac41a622008-09-14 06:46:31 +0000476CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
blueswir1e0e36fe2008-12-07 19:16:27 +0000477CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
ths6f30fa82007-01-05 01:00:47 +0000478LDFLAGS="$LDFLAGS -g"
bellard85aa5182007-11-11 20:17:03 +0000479if test "$werror" = "yes" ; then
480CFLAGS="$CFLAGS -Werror"
481fi
ths6f30fa82007-01-05 01:00:47 +0000482
blueswir1d2c7c9b2008-11-01 14:50:20 +0000483if test "$solaris" = "no" ; then
484 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
485 LDFLAGS="$LDFLAGS -Wl,--warn-common"
486 fi
blueswir149237ac2008-09-17 19:05:19 +0000487fi
488
blueswir131422552007-04-16 18:27:06 +0000489#
490# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
491# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
492#
bellard40293e52008-01-31 11:32:10 +0000493case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000494 sparc) if test -z "$sparc_cpu" ; then
495 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
496 ARCH_LDFLAGS="-m32"
497 else
498 ARCH_CFLAGS="${SP_CFLAGS}"
499 ARCH_LDFLAGS="${SP_LDFLAGS}"
500 fi
501 ;;
502 sparc64) if test -z "$sparc_cpu" ; then
503 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
504 ARCH_LDFLAGS="-m64"
505 else
506 ARCH_CFLAGS="${SP_CFLAGS}"
507 ARCH_LDFLAGS="${SP_LDFLAGS}"
508 fi
509 ;;
ths76d83bd2007-11-18 21:22:10 +0000510 s390)
511 ARCH_CFLAGS="-march=z900"
512 ;;
bellard40293e52008-01-31 11:32:10 +0000513 i386)
514 ARCH_CFLAGS="-m32"
515 ARCH_LDFLAGS="-m32"
516 ;;
517 x86_64)
518 ARCH_CFLAGS="-m64"
519 ARCH_LDFLAGS="-m64"
520 ;;
blueswir131422552007-04-16 18:27:06 +0000521esac
522
pbrookaf5db582006-04-08 14:26:41 +0000523if test x"$show_help" = x"yes" ; then
524cat << EOF
525
526Usage: configure [options]
527Options: [defaults in brackets after descriptions]
528
529EOF
530echo "Standard options:"
531echo " --help print this message"
532echo " --prefix=PREFIX install in PREFIX [$prefix]"
533echo " --interp-prefix=PREFIX where to find shared libraries, etc."
534echo " use %M for cpu name [$interp_prefix]"
535echo " --target-list=LIST set target list [$target_list]"
536echo ""
537echo "kqemu kernel acceleration support:"
538echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000539echo ""
540echo "Advanced options (experts only):"
541echo " --source-path=PATH path of source code [$source_path]"
542echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
543echo " --cc=CC use C compiler CC [$cc]"
544echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
545echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000546echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000547echo " --static enable static build [$static]"
aliguori890b1652008-10-07 21:22:41 +0000548echo " --enable-sparse enable sparse checker"
549echo " --disable-sparse disable sparse checker (default)"
bellard85aa5182007-11-11 20:17:03 +0000550echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000551echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000552echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000553echo " --audio-drv-list=LIST set audio drivers list:"
554echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000555echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
556echo " Available cards: $audio_possible_cards"
malc8ff9cbf2008-06-23 18:33:30 +0000557echo " --enable-mixemu enable mixer emulation"
aurel322e4d9fb2008-04-08 06:01:02 +0000558echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000559echo " --disable-vnc-tls disable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000560echo " --disable-vnc-sasl disable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000561echo " --disable-curses disable curses output"
balrogfb599c92008-09-28 23:49:55 +0000562echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000563echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000564echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000565echo " --enable-system enable all system emulation targets"
566echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000567echo " --enable-linux-user enable all linux usermode emulation targets"
568echo " --disable-linux-user disable all linux usermode emulation targets"
569echo " --enable-darwin-user enable all darwin usermode emulation targets"
570echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000571echo " --enable-bsd-user enable all BSD usermode emulation targets"
572echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000573echo " --fmod-lib path to FMOD library"
574echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000575echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000576echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000577echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000578echo " --disable-vde disable support for vde network"
blueswir1414f0da2008-08-15 18:20:52 +0000579echo " --disable-aio disable AIO support"
ths77755342008-11-27 15:45:16 +0000580echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000581echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000582echo ""
ths5bf08932006-12-23 00:33:26 +0000583echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000584exit 1
585fi
586
bellard67b915a2004-03-31 23:37:16 +0000587if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000588 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000589 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000590 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000591 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000592 bsd_user="no"
aliguori49dc7682009-03-08 16:26:59 +0000593 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
aliguoricd01b4a2008-08-21 19:25:45 +0000594fi
595
aliguori03b4fe72008-10-07 19:16:17 +0000596if test ! -x "$(which cgcc 2>/dev/null)"; then
597 sparse="no"
598fi
599
bellardec530c82006-04-25 22:36:06 +0000600#
601# Solaris specific configure tool chain decisions
602#
603if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000604 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
605 if test -z "$solinst" ; then
606 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
607 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
608 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
609 exit 1
610 fi
611 if test "$solinst" = "/usr/sbin/install" ; then
612 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
613 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
614 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
615 exit 1
616 fi
bellardec530c82006-04-25 22:36:06 +0000617 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
618 if test -z "$sol_ar" ; then
619 echo "Error: No path includes ar"
620 if test -f /usr/ccs/bin/ar ; then
621 echo "Add /usr/ccs/bin to your path and rerun configure"
622 fi
623 exit 1
624 fi
ths5fafdf22007-09-16 21:08:06 +0000625fi
bellardec530c82006-04-25 22:36:06 +0000626
627
bellard5327cf42005-01-10 23:18:50 +0000628if test -z "$target_list" ; then
629# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000630 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000631 target_list="\
632i386-softmmu \
633x86_64-softmmu \
634arm-softmmu \
635cris-softmmu \
636m68k-softmmu \
637mips-softmmu \
638mipsel-softmmu \
639mips64-softmmu \
640mips64el-softmmu \
641ppc-softmmu \
642ppcemb-softmmu \
643ppc64-softmmu \
644sh4-softmmu \
645sh4eb-softmmu \
646sparc-softmmu \
647"
pbrook0a8e90f2006-03-19 14:54:16 +0000648 fi
bellard5327cf42005-01-10 23:18:50 +0000649# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000650 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000651 target_list="${target_list}\
652i386-linux-user \
653x86_64-linux-user \
654alpha-linux-user \
655arm-linux-user \
656armeb-linux-user \
657cris-linux-user \
658m68k-linux-user \
659mips-linux-user \
660mipsel-linux-user \
661ppc-linux-user \
662ppc64-linux-user \
663ppc64abi32-linux-user \
664sh4-linux-user \
665sh4eb-linux-user \
666sparc-linux-user \
667sparc64-linux-user \
668sparc32plus-linux-user \
669"
ths831b7822007-01-18 20:06:33 +0000670 fi
671# the following are Darwin specific
672 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000673 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000674 fi
blueswir184778502008-10-26 20:33:16 +0000675# the following are BSD specific
676 if [ "$bsd_user" = "yes" ] ; then
677 target_list="${target_list}\
678sparc64-bsd-user \
679"
680 fi
bellard6e20a452005-06-05 15:56:02 +0000681else
pbrookb1a550a2006-04-16 13:28:56 +0000682 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000683fi
pbrook0a8e90f2006-03-19 14:54:16 +0000684if test -z "$target_list" ; then
685 echo "No targets enabled"
686 exit 1
687fi
bellard5327cf42005-01-10 23:18:50 +0000688
bellard7d132992003-03-06 23:23:54 +0000689if test -z "$cross_prefix" ; then
690
691# ---
692# big/little endian test
693cat > $TMPC << EOF
694#include <inttypes.h>
695int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000696 volatile uint32_t i=0x01234567;
697 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000698}
699EOF
700
aurel32178baee2008-12-08 18:11:57 +0000701if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000702$TMPE && bigendian="yes"
703else
704echo big/little test failed
705fi
706
707else
708
709# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000710if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000711 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000712 -o "$cpu" = "m68k" \
713 -o "$cpu" = "mips" \
714 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000715 -o "$cpu" = "ppc" \
716 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000717 -o "$cpu" = "s390" \
718 -o "$cpu" = "sparc" \
719 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000720 bigendian="yes"
721fi
722
723fi
724
bellardb6853692005-06-05 17:10:39 +0000725# host long bits test
726hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000727if test "$cpu" = "x86_64" \
728 -o "$cpu" = "alpha" \
729 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000730 -o "$cpu" = "sparc64" \
731 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000732 hostlongbits="64"
733fi
734
pbrookbd0c5662008-05-29 14:34:11 +0000735# Check host NPTL support
736cat > $TMPC <<EOF
737#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000738#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000739void foo()
740{
741#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
742#error bork
743#endif
744}
745EOF
746
balrog8c7f7572008-12-15 03:15:36 +0000747if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000748 :
749else
750 nptl="no"
751fi
752
bellard11d9f692004-04-02 20:55:59 +0000753##########################################
balrogac629222008-10-11 09:56:04 +0000754# zlib check
755
756cat > $TMPC << EOF
757#include <zlib.h>
758int main(void) { zlibVersion(); return 0; }
759EOF
balrog8c7f7572008-12-15 03:15:36 +0000760if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000761 :
762else
763 echo
764 echo "Error: zlib check failed"
765 echo "Make sure to have the zlib libs and headers installed."
766 echo
767 exit 1
768fi
769
770##########################################
bellard11d9f692004-04-02 20:55:59 +0000771# SDL probe
772
773sdl_too_old=no
774
775if test -z "$sdl" ; then
ths069b0bd2007-07-12 00:27:15 +0000776 sdl_config="sdl-config"
777 sdl=no
778 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000779
780cat > $TMPC << EOF
781#include <SDL.h>
782#undef main /* We don't want SDL to override our main() */
783int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
784EOF
balrog8c7f7572008-12-15 03:15:36 +0000785 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
aliguoricd01b4a2008-08-21 19:25:45 +0000786 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
787 if test "$_sdlversion" -lt 121 ; then
788 sdl_too_old=yes
789 else
790 if test "$cocoa" = "no" ; then
791 sdl=yes
792 fi
793 fi
794
795 # static link with sdl ?
796 if test "$sdl" = "yes" ; then
797 aa="no"
798 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
799 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
800 if [ "$aa" = "yes" ] ; then
801 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000802 fi
bellard11d9f692004-04-02 20:55:59 +0000803
balrog8c7f7572008-12-15 03:15:36 +0000804 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
aliguoricd01b4a2008-08-21 19:25:45 +0000805 sdl_static=yes
806 fi
807 fi # static link
808 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000809else
ths069b0bd2007-07-12 00:27:15 +0000810 # Make sure to disable cocoa if sdl was set
811 if test "$sdl" = "yes" ; then
812 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000813 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000814 fi
bellarda6e022a2004-04-02 21:55:47 +0000815fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000816
aliguori5368a422009-03-03 17:37:21 +0000817if test "$sdl" = "yes" ; then
818cat > $TMPC <<EOF
819#include <SDL.h>
820#if defined(SDL_VIDEO_DRIVER_X11)
821#include <X11/XKBlib.h>
822#else
823#error No x11 support
824#endif
825int main(void) { return 0; }
826EOF
827 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > /dev/null 2>&1 ; then
828 sdl_x11="yes"
829 fi
830fi
831
ths8f28f3f2007-01-05 21:25:54 +0000832##########################################
ths8d5d2d42007-08-25 01:37:51 +0000833# VNC TLS detection
834if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000835cat > $TMPC <<EOF
836#include <gnutls/gnutls.h>
837int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
838EOF
839 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
840 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
841 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000842 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000843 :
844 else
845 vnc_tls="no"
846 fi
ths8d5d2d42007-08-25 01:37:51 +0000847fi
848
849##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000850# VNC SASL detection
851if test "$vnc_sasl" = "yes" ; then
852cat > $TMPC <<EOF
853#include <sasl/sasl.h>
854#include <stdio.h>
855int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
856EOF
857 # Assuming Cyrus-SASL installed in /usr prefix
858 vnc_sasl_cflags=""
859 vnc_sasl_libs="-lsasl2"
860 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
861 $vnc_sasl_libs 2> /dev/null ; then
862 :
863 else
864 vnc_sasl="no"
865 fi
866fi
867
868##########################################
aliguori76655d62009-03-06 20:27:37 +0000869# fnmatch() probe, used for ACL routines
870fnmatch="no"
871cat > $TMPC << EOF
872#include <fnmatch.h>
873int main(void)
874{
875 fnmatch("foo", "foo", 0);
876 return 0;
877}
878EOF
879if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
880 fnmatch="yes"
881fi
882
883##########################################
ths8a16d272008-07-19 09:56:24 +0000884# vde libraries probe
885if test "$vde" = "yes" ; then
886 cat > $TMPC << EOF
887#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000888int main(void)
889{
890 struct vde_open_args a = {0, 0, 0};
891 vde_open("", "", &a);
892 return 0;
893}
ths8a16d272008-07-19 09:56:24 +0000894EOF
balrog8c7f7572008-12-15 03:15:36 +0000895 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000896 :
897 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000898 vde="no"
ths8a16d272008-07-19 09:56:24 +0000899 fi
900fi
901
902##########################################
malcc2de5c92008-06-28 19:13:06 +0000903# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000904
malcc2de5c92008-06-28 19:13:06 +0000905audio_drv_probe()
906{
907 drv=$1
908 hdr=$2
909 lib=$3
910 exp=$4
911 cfl=$5
912 cat > $TMPC << EOF
913#include <$hdr>
914int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000915EOF
balrog8c7f7572008-12-15 03:15:36 +0000916 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +0000917 :
918 else
919 echo
920 echo "Error: $drv check failed"
921 echo "Make sure to have the $drv libs and headers installed."
922 echo
923 exit 1
924 fi
925}
926
malc2fa7d3b2008-07-29 12:58:44 +0000927audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000928for drv in $audio_drv_list; do
929 case $drv in
930 alsa)
931 audio_drv_probe $drv alsa/asoundlib.h -lasound \
932 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
933 ;;
934
935 fmod)
936 if test -z $fmod_lib || test -z $fmod_inc; then
937 echo
938 echo "Error: You must specify path to FMOD library and headers"
939 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
940 echo
941 exit 1
942 fi
943 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
944 ;;
945
946 esd)
947 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
948 ;;
malcb8e59f12008-07-02 21:03:08 +0000949
950 pa)
951 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
952 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
953 ;;
954
blueswir12f6a1ab2008-08-21 18:00:53 +0000955 oss|sdl|core|wav|dsound)
956 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
957 ;;
958
malce4c63a62008-07-19 16:15:16 +0000959 *)
malc1c9b2a52008-07-19 16:57:30 +0000960 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +0000961 echo
962 echo "Error: Unknown driver '$drv' selected"
963 echo "Possible drivers are: $audio_possible_drivers"
964 echo
965 exit 1
966 }
967 ;;
malcc2de5c92008-06-28 19:13:06 +0000968 esac
969done
ths8f28f3f2007-01-05 21:25:54 +0000970
balrog4d3b6f62008-02-10 16:33:14 +0000971##########################################
aurel322e4d9fb2008-04-08 06:01:02 +0000972# BrlAPI probe
973
974if test -z "$brlapi" ; then
975 brlapi=no
976cat > $TMPC << EOF
977#include <brlapi.h>
978int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
979EOF
aurel32178baee2008-12-08 18:11:57 +0000980 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +0000981 brlapi=yes
982 fi # brlapi compile test
983fi # -z $brlapi
984
985##########################################
balrog4d3b6f62008-02-10 16:33:14 +0000986# curses probe
987
988if test "$curses" = "yes" ; then
989 curses=no
990 cat > $TMPC << EOF
991#include <curses.h>
992int main(void) { return curses_version(); }
993EOF
aurel32178baee2008-12-08 18:11:57 +0000994 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +0000995 curses=yes
996 fi
997fi # test "$curses"
998
blueswir1414f0da2008-08-15 18:20:52 +0000999##########################################
balrogfb599c92008-09-28 23:49:55 +00001000# bluez support probe
1001if test "$bluez" = "yes" ; then
1002 `pkg-config bluez` || bluez="no"
1003fi
1004if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001005 cat > $TMPC << EOF
1006#include <bluetooth/bluetooth.h>
1007int main(void) { return bt_error(0); }
1008EOF
balrogfb599c92008-09-28 23:49:55 +00001009 bluez_cflags=`pkg-config --cflags bluez`
1010 bluez_libs=`pkg-config --libs bluez`
balrog17e15922008-10-11 12:00:42 +00001011 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001012 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001013 :
1014 else
1015 bluez="no"
1016 fi
balrogfb599c92008-09-28 23:49:55 +00001017fi
1018
1019##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001020# kvm probe
1021if test "$kvm" = "yes" ; then
1022 cat > $TMPC <<EOF
1023#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001024#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001025#error Invalid KVM version
1026#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001027#if !defined(KVM_CAP_USER_MEMORY)
1028#error Missing KVM capability KVM_CAP_USER_MEMORY
1029#endif
1030#if !defined(KVM_CAP_SET_TSS_ADDR)
1031#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1032#endif
1033#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1034#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1035#endif
aliguori7ba1e612008-11-05 16:04:33 +00001036int main(void) { return 0; }
1037EOF
aliguorieac30262008-11-05 16:28:56 +00001038 if test "$kerneldir" != "" ; then
1039 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001040 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1041 -a -d "$kerneldir/arch/x86/include" ; then
1042 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001043 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1044 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001045 elif test -d "$kerneldir/arch/$cpu/include" ; then
1046 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1047 fi
aliguorieac30262008-11-05 16:28:56 +00001048 else
1049 kvm_cflags=""
1050 fi
aliguori7ba1e612008-11-05 16:04:33 +00001051 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001052 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001053 :
1054 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001055 kvm="no";
1056 if [ -x "`which awk 2>/dev/null`" ] && \
1057 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001058 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001059 | grep "error: " \
1060 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1061 if test "$kvmerr" != "" ; then
1062 kvm="no - (${kvmerr})"
1063 fi
1064 fi
aliguori7ba1e612008-11-05 16:04:33 +00001065 fi
1066fi
1067
1068##########################################
blueswir1414f0da2008-08-15 18:20:52 +00001069# AIO probe
aliguori3c529d92008-12-12 16:41:40 +00001070AIOLIBS=""
1071
blueswir1414f0da2008-08-15 18:20:52 +00001072if test "$aio" = "yes" ; then
1073 aio=no
1074 cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001075#include <pthread.h>
blueswir1c9db92f2009-01-17 06:49:15 +00001076int main(void) { pthread_mutex_t lock; return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001077EOF
1078 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1079 aio=yes
aliguori3c529d92008-12-12 16:41:40 +00001080 AIOLIBS="-lpthread"
blueswir1414f0da2008-08-15 18:20:52 +00001081 fi
1082fi
1083
aliguoribf9298b2008-12-05 20:05:26 +00001084##########################################
1085# iovec probe
1086cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001087#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001088#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001089#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001090int main(void) { struct iovec iov; return 0; }
1091EOF
1092iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001093if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001094 iovec=yes
1095fi
1096
aurel32f652e6a2008-12-16 10:43:48 +00001097##########################################
1098# fdt probe
1099if test "$fdt" = "yes" ; then
1100 fdt=no
1101 cat > $TMPC << EOF
1102int main(void) { return 0; }
1103EOF
1104 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1105 fdt=yes
1106 fi
1107fi
1108
pbrookcc8ae6d2006-04-23 17:57:59 +00001109# Check if tools are available to build documentation.
ths6c591862007-05-09 13:55:03 +00001110if [ -x "`which texi2html 2>/dev/null`" ] && \
1111 [ -x "`which pod2man 2>/dev/null`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +00001112 build_docs="yes"
1113fi
1114
aliguorida93a1f2008-12-12 20:02:52 +00001115##########################################
1116# Do we need librt
1117cat > $TMPC <<EOF
1118#include <signal.h>
1119#include <time.h>
1120int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1121EOF
1122
1123rt=no
balrog8c7f7572008-12-15 03:15:36 +00001124if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001125 :
balrog8c7f7572008-12-15 03:15:36 +00001126elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001127 rt=yes
1128fi
1129
1130if test "$rt" = "yes" ; then
1131 # Hack, we should have a general purpose LIBS for this sort of thing
1132 AIOLIBS="$AIOLIBS -lrt"
1133fi
1134
bellard11d9f692004-04-02 20:55:59 +00001135if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001136 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001137 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001138 fi
1139 mansuffix=""
1140 datasuffix=""
1141 docsuffix=""
1142 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001143else
pbrook308c3592007-02-27 00:52:01 +00001144 if test -z "$prefix" ; then
1145 prefix="/usr/local"
1146 fi
1147 mansuffix="/share/man"
1148 datasuffix="/share/qemu"
1149 docsuffix="/share/doc/qemu"
1150 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001151fi
bellard5a671352003-10-01 00:13:48 +00001152
bellard43ce4df2003-06-09 19:53:12 +00001153echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001154echo "BIOS directory $prefix$datasuffix"
1155echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001156if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001157echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001158echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001159fi
bellard5a671352003-10-01 00:13:48 +00001160echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001161echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001162echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001163echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001164echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001165echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001166echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001167echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001168echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +00001169echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001170echo "sparse enabled $sparse"
bellard05c2a3e2006-02-08 22:39:17 +00001171echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001172echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001173echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001174if test "$darwin" = "yes" ; then
1175 echo "Cocoa support $cocoa"
1176fi
bellard97a847b2003-08-10 21:36:04 +00001177echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001178if test "$sdl" != "no" ; then
1179 echo "SDL static link $sdl_static"
1180fi
balrog4d3b6f62008-02-10 16:33:14 +00001181echo "curses support $curses"
bellard67b915a2004-03-31 23:37:16 +00001182echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001183echo "Audio drivers $audio_drv_list"
1184echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001185echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001186echo "VNC TLS support $vnc_tls"
1187if test "$vnc_tls" = "yes" ; then
1188 echo " TLS CFLAGS $vnc_tls_cflags"
1189 echo " TLS LIBS $vnc_tls_libs"
1190fi
aliguori2f9606b2009-03-06 20:27:28 +00001191echo "VNC SASL support $vnc_sasl"
1192if test "$vnc_sasl" = "yes" ; then
1193 echo " SASL CFLAGS $vnc_sasl_cflags"
1194 echo " SASL LIBS $vnc_sasl_libs"
1195fi
blueswir131422552007-04-16 18:27:06 +00001196if test -n "$sparc_cpu"; then
1197 echo "Target Sparc Arch $sparc_cpu"
1198fi
bellard07f4ddb2005-04-23 17:44:28 +00001199echo "kqemu support $kqemu"
aurel322e4d9fb2008-04-08 06:01:02 +00001200echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001201echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001202[ ! -z "$uname_release" ] && \
1203echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001204echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001205echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001206echo "AIO support $aio"
ths77755342008-11-27 15:45:16 +00001207echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001208echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001209echo "fdt support $fdt"
bellard67b915a2004-03-31 23:37:16 +00001210
bellard97a847b2003-08-10 21:36:04 +00001211if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001212echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001213fi
malcd4742de2008-11-29 22:04:31 +00001214if [ -s $TMPSDLLOG ]; then
ths20b40c62007-07-11 23:39:45 +00001215 echo "The error log from compiling the libSDL test is: "
malcd4742de2008-11-29 22:04:31 +00001216 cat $TMPSDLLOG
ths20b40c62007-07-11 23:39:45 +00001217fi
bellard24b55b92005-03-01 22:30:41 +00001218#if test "$sdl_static" = "no"; then
1219# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1220#fi
bellard97a847b2003-08-10 21:36:04 +00001221config_mak="config-host.mak"
1222config_h="config-host.h"
1223
bellard7c1f25b2004-04-22 00:02:08 +00001224#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001225
ths15d9ca02007-07-31 23:07:32 +00001226test -f $config_h && mv $config_h ${config_h}~
1227
bellard97a847b2003-08-10 21:36:04 +00001228echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001229printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001230printf " '%s'" "$0" "$@" >> $config_mak
1231echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001232echo "/* Automatically generated by configure - do not modify */" > $config_h
1233
1234echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001235echo "bindir=\${prefix}$binsuffix" >> $config_mak
1236echo "mandir=\${prefix}$mansuffix" >> $config_mak
1237echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001238echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001239echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001240echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001241echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001242echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001243echo "HOST_CC=$host_cc" >> $config_mak
1244echo "AR=$ar" >> $config_mak
1245echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001246# XXX: only use CFLAGS and LDFLAGS ?
1247# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1248# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001249echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001250echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1251echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1252echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001253echo "CFLAGS=$CFLAGS" >> $config_mak
1254echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001255echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +00001256echo "AIOLIBS=$AIOLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001257case "$cpu" in
1258 i386)
1259 echo "ARCH=i386" >> $config_mak
1260 echo "#define HOST_I386 1" >> $config_h
1261 ;;
1262 x86_64)
1263 echo "ARCH=x86_64" >> $config_mak
1264 echo "#define HOST_X86_64 1" >> $config_h
1265 ;;
1266 alpha)
1267 echo "ARCH=alpha" >> $config_mak
1268 echo "#define HOST_ALPHA 1" >> $config_h
1269 ;;
1270 armv4b)
1271 echo "ARCH=arm" >> $config_mak
1272 echo "#define HOST_ARM 1" >> $config_h
1273 ;;
1274 armv4l)
1275 echo "ARCH=arm" >> $config_mak
1276 echo "#define HOST_ARM 1" >> $config_h
1277 ;;
1278 cris)
1279 echo "ARCH=cris" >> $config_mak
1280 echo "#define HOST_CRIS 1" >> $config_h
1281 ;;
1282 hppa)
1283 echo "ARCH=hppa" >> $config_mak
1284 echo "#define HOST_HPPA 1" >> $config_h
1285 ;;
1286 ia64)
1287 echo "ARCH=ia64" >> $config_mak
1288 echo "#define HOST_IA64 1" >> $config_h
1289 ;;
1290 m68k)
1291 echo "ARCH=m68k" >> $config_mak
1292 echo "#define HOST_M68K 1" >> $config_h
1293 ;;
1294 mips)
1295 echo "ARCH=mips" >> $config_mak
1296 echo "#define HOST_MIPS 1" >> $config_h
1297 ;;
1298 mips64)
1299 echo "ARCH=mips64" >> $config_mak
1300 echo "#define HOST_MIPS64 1" >> $config_h
1301 ;;
malcfdf7ed92009-01-14 18:39:52 +00001302 ppc)
1303 echo "ARCH=ppc" >> $config_mak
1304 echo "#define HOST_PPC 1" >> $config_h
1305 ;;
1306 ppc64)
1307 echo "ARCH=ppc64" >> $config_mak
1308 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001309 ;;
1310 s390)
1311 echo "ARCH=s390" >> $config_mak
1312 echo "#define HOST_S390 1" >> $config_h
1313 ;;
1314 sparc)
1315 echo "ARCH=sparc" >> $config_mak
1316 echo "#define HOST_SPARC 1" >> $config_h
1317 ;;
1318 sparc64)
1319 echo "ARCH=sparc64" >> $config_mak
1320 echo "#define HOST_SPARC64 1" >> $config_h
1321 ;;
1322 *)
1323 echo "Unsupported CPU = $cpu"
1324 exit 1
1325 ;;
1326esac
aliguori03b4fe72008-10-07 19:16:17 +00001327if test "$sparse" = "yes" ; then
1328 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1329 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1330 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1331fi
bellard7d132992003-03-06 23:23:54 +00001332if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001333 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1334 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1335fi
bellardb6853692005-06-05 17:10:39 +00001336echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001337if test "$mingw32" = "yes" ; then
1338 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001339 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001340else
1341 cat > $TMPC << EOF
1342#include <byteswap.h>
1343int main(void) { return bswap_32(0); }
1344EOF
aurel32178baee2008-12-08 18:11:57 +00001345 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001346 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1347 fi
blueswir113606772008-12-05 17:54:09 +00001348 cat > $TMPC << EOF
1349#include <sys/endian.h>
1350#include <sys/types.h>
1351#include <machine/bswap.h>
1352int main(void) { return bswap32(0); }
1353EOF
aurel32178baee2008-12-08 18:11:57 +00001354 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001355 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1356 fi
bellard67b915a2004-03-31 23:37:16 +00001357fi
blueswir1128ab2f2008-08-15 18:33:42 +00001358
1359if [ "$openbsd" = "yes" ] ; then
1360 echo "#define ENOTSUP 4096" >> $config_h
1361fi
1362
bellard83fb7ad2004-07-05 21:25:26 +00001363if test "$darwin" = "yes" ; then
1364 echo "CONFIG_DARWIN=yes" >> $config_mak
1365 echo "#define CONFIG_DARWIN 1" >> $config_h
1366fi
malcb29fe3e2008-11-18 01:42:22 +00001367
1368if test "$aix" = "yes" ; then
1369 echo "CONFIG_AIX=yes" >> $config_mak
1370 echo "#define CONFIG_AIX 1" >> $config_h
1371fi
1372
bellardec530c82006-04-25 22:36:06 +00001373if test "$solaris" = "yes" ; then
1374 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001375 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001376 if test "$needs_libsunmath" = "yes" ; then
1377 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1378 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1379 fi
bellardec530c82006-04-25 22:36:06 +00001380fi
blueswir131422552007-04-16 18:27:06 +00001381if test -n "$sparc_cpu"; then
1382 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1383 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1384fi
bellard67b915a2004-03-31 23:37:16 +00001385if test "$gdbstub" = "yes" ; then
1386 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1387 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1388fi
bellard97a847b2003-08-10 21:36:04 +00001389if test "$gprof" = "yes" ; then
1390 echo "TARGET_GPROF=yes" >> $config_mak
1391 echo "#define HAVE_GPROF 1" >> $config_h
1392fi
1393if test "$static" = "yes" ; then
1394 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001395 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001396fi
bellard05c2a3e2006-02-08 22:39:17 +00001397if test $profiler = "yes" ; then
1398 echo "#define CONFIG_PROFILER 1" >> $config_h
1399fi
bellardc20709a2004-04-21 23:27:19 +00001400if test "$slirp" = "yes" ; then
1401 echo "CONFIG_SLIRP=yes" >> $config_mak
1402 echo "#define CONFIG_SLIRP 1" >> $config_h
1403fi
ths8a16d272008-07-19 09:56:24 +00001404if test "$vde" = "yes" ; then
1405 echo "CONFIG_VDE=yes" >> $config_mak
1406 echo "#define CONFIG_VDE 1" >> $config_h
1407 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1408fi
malc0c58ac12008-06-25 21:04:05 +00001409for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001410 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001411 echo "$def=yes" >> $config_mak
1412 echo "#define $def 1" >> $config_h
1413done
1414echo "#define AUDIO_DRIVERS \\" >> $config_h
1415for drv in $audio_drv_list; do
1416 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001417 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001418 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001419 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001420 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1421 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001422 elif test "$drv" = "oss"; then
1423 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001424 fi
1425done
1426echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001427if test "$mixemu" = "yes" ; then
1428 echo "CONFIG_MIXEMU=yes" >> $config_mak
1429 echo "#define CONFIG_MIXEMU 1" >> $config_h
1430fi
ths8d5d2d42007-08-25 01:37:51 +00001431if test "$vnc_tls" = "yes" ; then
1432 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1433 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1434 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1435 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1436fi
aliguori2f9606b2009-03-06 20:27:28 +00001437if test "$vnc_sasl" = "yes" ; then
1438 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1439 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1440 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1441 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1442fi
aliguori76655d62009-03-06 20:27:37 +00001443if test "$fnmatch" = "yes" ; then
1444 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1445fi
pbrookb1a550a2006-04-16 13:28:56 +00001446qemu_version=`head $source_path/VERSION`
1447echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001448echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001449
1450echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001451if [ "$source_path_used" = "yes" ]; then
1452 echo "VPATH=$source_path" >> $config_mak
1453fi
bellard97a847b2003-08-10 21:36:04 +00001454echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001455if [ "$build_docs" = "yes" ] ; then
1456 echo "BUILD_DOCS=yes" >> $config_mak
1457fi
bellard49ecc3f2007-11-07 19:25:15 +00001458if test "$static" = "yes"; then
1459 sdl1=$sdl_static
1460else
1461 sdl1=$sdl
1462fi
1463if test "$sdl1" = "yes" ; then
1464 echo "#define CONFIG_SDL 1" >> $config_h
1465 echo "CONFIG_SDL=yes" >> $config_mak
1466 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1467 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001468 elif test "$sdl_x11" = "yes" ; then
1469 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001470 else
1471 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1472 fi
1473 if [ "${aa}" = "yes" ] ; then
1474 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1475 else
1476 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1477 fi
1478fi
1479if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001480 echo "#define CONFIG_COCOA 1" >> $config_h
1481 echo "CONFIG_COCOA=yes" >> $config_mak
1482fi
1483if test "$curses" = "yes" ; then
1484 echo "#define CONFIG_CURSES 1" >> $config_h
1485 echo "CONFIG_CURSES=yes" >> $config_mak
1486 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001487fi
aurel322e4d9fb2008-04-08 06:01:02 +00001488if test "$brlapi" = "yes" ; then
1489 echo "CONFIG_BRLAPI=yes" >> $config_mak
1490 echo "#define CONFIG_BRLAPI 1" >> $config_h
1491 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1492fi
balrogfb599c92008-09-28 23:49:55 +00001493if test "$bluez" = "yes" ; then
1494 echo "CONFIG_BLUEZ=yes" >> $config_mak
1495 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1496 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1497 echo "#define CONFIG_BLUEZ 1" >> $config_h
1498fi
blueswir1414f0da2008-08-15 18:20:52 +00001499if test "$aio" = "yes" ; then
1500 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001501 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001502fi
ths77755342008-11-27 15:45:16 +00001503if test "$blobs" = "yes" ; then
1504 echo "INSTALL_BLOBS=yes" >> $config_mak
1505fi
aliguoribf9298b2008-12-05 20:05:26 +00001506if test "$iovec" = "yes" ; then
1507 echo "#define HAVE_IOVEC 1" >> $config_h
1508fi
aurel32f652e6a2008-12-16 10:43:48 +00001509if test "$fdt" = "yes" ; then
1510 echo "#define HAVE_FDT 1" >> $config_h
1511 echo "FDT_LIBS=-lfdt" >> $config_mak
1512fi
bellard97a847b2003-08-10 21:36:04 +00001513
bellard83fb7ad2004-07-05 21:25:26 +00001514# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001515if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001516 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001517 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
blueswir1179a2c12009-03-08 08:23:32 +00001518 echo "#define HOST_BSD 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001519fi
1520
pbrookc5937222006-05-14 11:30:38 +00001521echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1522
blueswir168063642008-11-22 21:03:55 +00001523# USB host support
1524case "$usb" in
1525linux)
1526 echo "HOST_USB=linux" >> $config_mak
1527;;
1528bsd)
1529 echo "HOST_USB=bsd" >> $config_mak
1530;;
1531*)
1532 echo "HOST_USB=stub" >> $config_mak
1533;;
1534esac
1535
pbrookc39e3332007-09-22 16:49:14 +00001536tools=
1537if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1538 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001539 if [ "$linux" = "yes" ] ; then
1540 tools="qemu-nbd\$(EXESUF) $tools"
1541 fi
pbrookc39e3332007-09-22 16:49:14 +00001542fi
1543echo "TOOLS=$tools" >> $config_mak
1544
ths15d9ca02007-07-31 23:07:32 +00001545test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1546
bellard1d14ffa2005-10-30 18:58:22 +00001547for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001548target_dir="$target"
1549config_mak=$target_dir/config.mak
1550config_h=$target_dir/config.h
1551target_cpu=`echo $target | cut -d '-' -f 1`
1552target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001553[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001554[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1555[ "$target_cpu" = "mips" ] && target_bigendian=yes
1556[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1557[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001558[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001559[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001560[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001561[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001562[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001563[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1564[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1565[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001566target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001567target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001568target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001569target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001570target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001571case "$target" in
1572 ${target_cpu}-softmmu)
1573 target_softmmu="yes"
1574 ;;
1575 ${target_cpu}-linux-user)
1576 target_user_only="yes"
1577 target_linux_user="yes"
1578 ;;
1579 ${target_cpu}-darwin-user)
1580 target_user_only="yes"
1581 target_darwin_user="yes"
1582 ;;
blueswir184778502008-10-26 20:33:16 +00001583 ${target_cpu}-bsd-user)
1584 target_user_only="yes"
1585 target_bsd_user="yes"
1586 ;;
pbrook9e407a82007-05-26 16:38:53 +00001587 *)
1588 echo "ERROR: Target '$target' not recognised"
1589 exit 1
1590 ;;
1591esac
ths831b7822007-01-18 20:06:33 +00001592
bellard97ccc682005-07-02 13:32:17 +00001593if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +00001594 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +00001595 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +00001596 echo "To build QEMU without graphical output configure with --disable-gfx-check"
balrog4d3b6f62008-02-10 16:33:14 +00001597 echo "Note that this will disable all output from the virtual graphics card"
1598 echo "except through VNC or curses."
bellard97ccc682005-07-02 13:32:17 +00001599 exit 1;
1600fi
1601
bellard7c1f25b2004-04-22 00:02:08 +00001602#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001603
ths15d9ca02007-07-31 23:07:32 +00001604test -f $config_h && mv $config_h ${config_h}~
1605
bellard97a847b2003-08-10 21:36:04 +00001606mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001607mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001608mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001609if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
bellard69de9272004-02-16 21:40:43 +00001610 mkdir -p $target_dir/nwfpe
1611fi
1612
bellardec530c82006-04-25 22:36:06 +00001613#
1614# don't use ln -sf as not all "ln -sf" over write the file/link
1615#
1616rm -f $target_dir/Makefile
1617ln -s $source_path/Makefile.target $target_dir/Makefile
1618
bellard97a847b2003-08-10 21:36:04 +00001619
1620echo "# Automatically generated by configure - do not modify" > $config_mak
1621echo "/* Automatically generated by configure - do not modify */" > $config_h
1622
1623
1624echo "include ../config-host.mak" >> $config_mak
1625echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001626
pbrooke5fe0c52006-06-11 13:32:59 +00001627bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001628elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001629target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001630interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1631echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001632gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001633
aliguori5985ece2008-11-05 19:59:25 +00001634# Make sure the target and host cpus are compatible
1635if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
malcfdf7ed92009-01-14 18:39:52 +00001636 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001637 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1638 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001639 kvm="no"
1640fi
1641# Disable KVM for linux-user
1642if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1643 kvm="no"
1644fi
1645
aurel322408a522008-04-20 20:19:44 +00001646case "$target_cpu" in
1647 i386)
1648 echo "TARGET_ARCH=i386" >> $config_mak
1649 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1650 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001651 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001652 then
1653 echo "#define USE_KQEMU 1" >> $config_h
1654 fi
aliguori7ba1e612008-11-05 16:04:33 +00001655 if test "$kvm" = "yes" ; then
1656 echo "CONFIG_KVM=yes" >> $config_mak
1657 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001658 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001659 fi
aurel322408a522008-04-20 20:19:44 +00001660 ;;
1661 x86_64)
1662 echo "TARGET_ARCH=x86_64" >> $config_mak
1663 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1664 echo "#define TARGET_I386 1" >> $config_h
1665 echo "#define TARGET_X86_64 1" >> $config_h
1666 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1667 then
1668 echo "#define USE_KQEMU 1" >> $config_h
1669 fi
aliguori7ba1e612008-11-05 16:04:33 +00001670 if test "$kvm" = "yes" ; then
1671 echo "CONFIG_KVM=yes" >> $config_mak
1672 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1673 echo "#define CONFIG_KVM 1" >> $config_h
1674 fi
aurel322408a522008-04-20 20:19:44 +00001675 ;;
1676 alpha)
1677 echo "TARGET_ARCH=alpha" >> $config_mak
1678 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1679 echo "#define TARGET_ALPHA 1" >> $config_h
1680 ;;
1681 arm|armeb)
1682 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001683 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1684 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001685 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001686 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001687 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00001688 ;;
1689 cris)
1690 echo "TARGET_ARCH=cris" >> $config_mak
1691 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1692 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00001693 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001694 ;;
1695 m68k)
1696 echo "TARGET_ARCH=m68k" >> $config_mak
1697 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1698 echo "#define TARGET_M68K 1" >> $config_h
1699 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001700 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00001701 ;;
1702 mips|mipsel)
1703 echo "TARGET_ARCH=mips" >> $config_mak
1704 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1705 echo "#define TARGET_MIPS 1" >> $config_h
1706 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1707 ;;
1708 mipsn32|mipsn32el)
1709 echo "TARGET_ARCH=mipsn32" >> $config_mak
1710 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1711 echo "#define TARGET_MIPS 1" >> $config_h
1712 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1713 ;;
1714 mips64|mips64el)
1715 echo "TARGET_ARCH=mips64" >> $config_mak
1716 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1717 echo "#define TARGET_MIPS 1" >> $config_h
1718 echo "#define TARGET_MIPS64 1" >> $config_h
1719 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1720 ;;
1721 ppc)
1722 echo "TARGET_ARCH=ppc" >> $config_mak
1723 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1724 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001725 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001726 ;;
1727 ppcemb)
1728 echo "TARGET_ARCH=ppcemb" >> $config_mak
1729 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1730 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1731 echo "#define TARGET_PPC 1" >> $config_h
1732 echo "#define TARGET_PPCEMB 1" >> $config_h
aurel32d76d1652008-12-16 10:43:58 +00001733 if test "$kvm" = "yes" ; then
1734 echo "CONFIG_KVM=yes" >> $config_mak
1735 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1736 echo "#define CONFIG_KVM 1" >> $config_h
1737 fi
aurel32c8b35322009-01-24 15:07:34 +00001738 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001739 ;;
1740 ppc64)
1741 echo "TARGET_ARCH=ppc64" >> $config_mak
1742 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1743 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1744 echo "#define TARGET_PPC 1" >> $config_h
1745 echo "#define TARGET_PPC64 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001746 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001747 ;;
1748 ppc64abi32)
1749 echo "TARGET_ARCH=ppc64" >> $config_mak
1750 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1751 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1752 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1753 echo "#define TARGET_PPC 1" >> $config_h
1754 echo "#define TARGET_PPC64 1" >> $config_h
1755 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001756 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001757 ;;
1758 sh4|sh4eb)
1759 echo "TARGET_ARCH=sh4" >> $config_mak
1760 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1761 echo "#define TARGET_SH4 1" >> $config_h
1762 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001763 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001764 ;;
1765 sparc)
1766 echo "TARGET_ARCH=sparc" >> $config_mak
1767 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1768 echo "#define TARGET_SPARC 1" >> $config_h
1769 ;;
1770 sparc64)
1771 echo "TARGET_ARCH=sparc64" >> $config_mak
1772 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1773 echo "#define TARGET_SPARC 1" >> $config_h
1774 echo "#define TARGET_SPARC64 1" >> $config_h
1775 elfload32="yes"
1776 ;;
1777 sparc32plus)
1778 echo "TARGET_ARCH=sparc64" >> $config_mak
1779 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1780 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1781 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1782 echo "#define TARGET_SPARC 1" >> $config_h
1783 echo "#define TARGET_SPARC64 1" >> $config_h
1784 echo "#define TARGET_ABI32 1" >> $config_h
1785 ;;
1786 *)
1787 echo "Unsupported target CPU"
1788 exit 1
1789 ;;
1790esac
bellardde83cd02003-06-15 20:25:43 +00001791if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001792 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1793 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1794fi
1795if test "$target_softmmu" = "yes" ; then
1796 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1797 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00001798fi
bellard997344f2003-10-27 21:10:39 +00001799if test "$target_user_only" = "yes" ; then
1800 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1801 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1802fi
ths831b7822007-01-18 20:06:33 +00001803if test "$target_linux_user" = "yes" ; then
1804 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1805 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1806fi
1807if test "$target_darwin_user" = "yes" ; then
1808 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1809 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1810fi
pbrook56aebc82008-10-11 17:55:29 +00001811list=""
1812if test ! -z "$gdb_xml_files" ; then
1813 for x in $gdb_xml_files; do
1814 list="$list $source_path/gdb-xml/$x"
1815 done
1816fi
1817echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00001818
aurel320938cda2008-04-11 21:36:06 +00001819if test "$target_cpu" = "arm" \
1820 -o "$target_cpu" = "armeb" \
1821 -o "$target_cpu" = "m68k" \
1822 -o "$target_cpu" = "mips" \
1823 -o "$target_cpu" = "mipsel" \
1824 -o "$target_cpu" = "mipsn32" \
1825 -o "$target_cpu" = "mipsn32el" \
1826 -o "$target_cpu" = "mips64" \
1827 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00001828 -o "$target_cpu" = "ppc" \
1829 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00001830 -o "$target_cpu" = "ppc64abi32" \
1831 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00001832 -o "$target_cpu" = "sparc" \
1833 -o "$target_cpu" = "sparc64" \
1834 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00001835 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1836 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1837fi
pbrooke5fe0c52006-06-11 13:32:59 +00001838if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1839 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1840 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1841fi
pbrookbd0c5662008-05-29 14:34:11 +00001842if test "$target_user_only" = "yes" \
1843 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1844 echo "#define USE_NPTL 1" >> $config_h
1845fi
blueswir1cb33da52007-10-09 16:34:29 +00001846# 32 bit ELF loader in addition to native 64 bit loader?
1847if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1848 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1849 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1850fi
blueswir184778502008-10-26 20:33:16 +00001851if test "$target_bsd_user" = "yes" ; then
1852 echo "CONFIG_BSD_USER=yes" >> $config_mak
1853 echo "#define CONFIG_BSD_USER 1" >> $config_h
1854fi
bellard5b0753e2005-03-01 21:37:28 +00001855
ths15d9ca02007-07-31 23:07:32 +00001856test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1857
bellard97a847b2003-08-10 21:36:04 +00001858done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00001859
1860# build tree in object directory if source path is different from current one
1861if test "$source_path_used" = "yes" ; then
bellard49ecc3f2007-11-07 19:25:15 +00001862 DIRS="tests tests/cris slirp audio"
bellard7d132992003-03-06 23:23:54 +00001863 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00001864 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00001865 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00001866 for dir in $DIRS ; do
1867 mkdir -p $dir
1868 done
bellardec530c82006-04-25 22:36:06 +00001869 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00001870 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00001871 rm -f $f
1872 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00001873 done
1874fi