blob: fa779379f3dba603e93f592900ff0ebf4b600198 [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
blueswir1762e8232009-04-04 09:21:28 +0000501 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
502 if test "$solaris" = "no" ; then
503 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
504 fi
blueswir131422552007-04-16 18:27:06 +0000505 ;;
506 sparc64) if test -z "$sparc_cpu" ; then
507 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
508 ARCH_LDFLAGS="-m64"
509 else
510 ARCH_CFLAGS="${SP_CFLAGS}"
511 ARCH_LDFLAGS="${SP_LDFLAGS}"
512 fi
blueswir1762e8232009-04-04 09:21:28 +0000513 if test "$solaris" = "no" ; then
514 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
515 else
516 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
517 fi
blueswir131422552007-04-16 18:27:06 +0000518 ;;
ths76d83bd2007-11-18 21:22:10 +0000519 s390)
520 ARCH_CFLAGS="-march=z900"
521 ;;
bellard40293e52008-01-31 11:32:10 +0000522 i386)
523 ARCH_CFLAGS="-m32"
524 ARCH_LDFLAGS="-m32"
525 ;;
526 x86_64)
527 ARCH_CFLAGS="-m64"
528 ARCH_LDFLAGS="-m64"
529 ;;
blueswir131422552007-04-16 18:27:06 +0000530esac
531
pbrookaf5db582006-04-08 14:26:41 +0000532if test x"$show_help" = x"yes" ; then
533cat << EOF
534
535Usage: configure [options]
536Options: [defaults in brackets after descriptions]
537
538EOF
539echo "Standard options:"
540echo " --help print this message"
541echo " --prefix=PREFIX install in PREFIX [$prefix]"
542echo " --interp-prefix=PREFIX where to find shared libraries, etc."
543echo " use %M for cpu name [$interp_prefix]"
544echo " --target-list=LIST set target list [$target_list]"
545echo ""
546echo "kqemu kernel acceleration support:"
547echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000548echo ""
549echo "Advanced options (experts only):"
550echo " --source-path=PATH path of source code [$source_path]"
551echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
552echo " --cc=CC use C compiler CC [$cc]"
553echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
554echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000555echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000556echo " --static enable static build [$static]"
aliguori890b1652008-10-07 21:22:41 +0000557echo " --enable-sparse enable sparse checker"
558echo " --disable-sparse disable sparse checker (default)"
bellard85aa5182007-11-11 20:17:03 +0000559echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000560echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000561echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000562echo " --audio-drv-list=LIST set audio drivers list:"
563echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000564echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
565echo " Available cards: $audio_possible_cards"
malc8ff9cbf2008-06-23 18:33:30 +0000566echo " --enable-mixemu enable mixer emulation"
aurel322e4d9fb2008-04-08 06:01:02 +0000567echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000568echo " --disable-vnc-tls disable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000569echo " --disable-vnc-sasl disable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000570echo " --disable-curses disable curses output"
balrogfb599c92008-09-28 23:49:55 +0000571echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000572echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000573echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000574echo " --enable-system enable all system emulation targets"
575echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000576echo " --enable-linux-user enable all linux usermode emulation targets"
577echo " --disable-linux-user disable all linux usermode emulation targets"
578echo " --enable-darwin-user enable all darwin usermode emulation targets"
579echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000580echo " --enable-bsd-user enable all BSD usermode emulation targets"
581echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000582echo " --fmod-lib path to FMOD library"
583echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000584echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000585echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000586echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000587echo " --disable-vde disable support for vde network"
blueswir1414f0da2008-08-15 18:20:52 +0000588echo " --disable-aio disable AIO support"
ths77755342008-11-27 15:45:16 +0000589echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000590echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000591echo ""
ths5bf08932006-12-23 00:33:26 +0000592echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000593exit 1
594fi
595
bellard67b915a2004-03-31 23:37:16 +0000596if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000597 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000598 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000599 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000600 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000601 bsd_user="no"
aliguori49dc7682009-03-08 16:26:59 +0000602 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
aliguoricd01b4a2008-08-21 19:25:45 +0000603fi
604
aliguori03b4fe72008-10-07 19:16:17 +0000605if test ! -x "$(which cgcc 2>/dev/null)"; then
606 sparse="no"
607fi
608
bellardec530c82006-04-25 22:36:06 +0000609#
610# Solaris specific configure tool chain decisions
611#
612if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000613 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
614 if test -z "$solinst" ; then
615 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
616 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
617 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
618 exit 1
619 fi
620 if test "$solinst" = "/usr/sbin/install" ; then
621 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
622 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
623 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
624 exit 1
625 fi
bellardec530c82006-04-25 22:36:06 +0000626 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
627 if test -z "$sol_ar" ; then
628 echo "Error: No path includes ar"
629 if test -f /usr/ccs/bin/ar ; then
630 echo "Add /usr/ccs/bin to your path and rerun configure"
631 fi
632 exit 1
633 fi
ths5fafdf22007-09-16 21:08:06 +0000634fi
bellardec530c82006-04-25 22:36:06 +0000635
636
bellard5327cf42005-01-10 23:18:50 +0000637if test -z "$target_list" ; then
638# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000639 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000640 target_list="\
641i386-softmmu \
642x86_64-softmmu \
643arm-softmmu \
644cris-softmmu \
645m68k-softmmu \
646mips-softmmu \
647mipsel-softmmu \
648mips64-softmmu \
649mips64el-softmmu \
650ppc-softmmu \
651ppcemb-softmmu \
652ppc64-softmmu \
653sh4-softmmu \
654sh4eb-softmmu \
655sparc-softmmu \
656"
pbrook0a8e90f2006-03-19 14:54:16 +0000657 fi
bellard5327cf42005-01-10 23:18:50 +0000658# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000659 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000660 target_list="${target_list}\
661i386-linux-user \
662x86_64-linux-user \
663alpha-linux-user \
664arm-linux-user \
665armeb-linux-user \
666cris-linux-user \
667m68k-linux-user \
668mips-linux-user \
669mipsel-linux-user \
670ppc-linux-user \
671ppc64-linux-user \
672ppc64abi32-linux-user \
673sh4-linux-user \
674sh4eb-linux-user \
675sparc-linux-user \
676sparc64-linux-user \
677sparc32plus-linux-user \
678"
ths831b7822007-01-18 20:06:33 +0000679 fi
680# the following are Darwin specific
681 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000682 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000683 fi
blueswir184778502008-10-26 20:33:16 +0000684# the following are BSD specific
685 if [ "$bsd_user" = "yes" ] ; then
686 target_list="${target_list}\
687sparc64-bsd-user \
688"
689 fi
bellard6e20a452005-06-05 15:56:02 +0000690else
pbrookb1a550a2006-04-16 13:28:56 +0000691 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000692fi
pbrook0a8e90f2006-03-19 14:54:16 +0000693if test -z "$target_list" ; then
694 echo "No targets enabled"
695 exit 1
696fi
bellard5327cf42005-01-10 23:18:50 +0000697
bellard7d132992003-03-06 23:23:54 +0000698if test -z "$cross_prefix" ; then
699
700# ---
701# big/little endian test
702cat > $TMPC << EOF
703#include <inttypes.h>
704int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000705 volatile uint32_t i=0x01234567;
706 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000707}
708EOF
709
aurel32178baee2008-12-08 18:11:57 +0000710if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000711$TMPE && bigendian="yes"
712else
713echo big/little test failed
714fi
715
716else
717
718# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000719if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000720 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000721 -o "$cpu" = "m68k" \
722 -o "$cpu" = "mips" \
723 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000724 -o "$cpu" = "ppc" \
725 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000726 -o "$cpu" = "s390" \
727 -o "$cpu" = "sparc" \
728 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000729 bigendian="yes"
730fi
731
732fi
733
bellardb6853692005-06-05 17:10:39 +0000734# host long bits test
735hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000736if test "$cpu" = "x86_64" \
737 -o "$cpu" = "alpha" \
738 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000739 -o "$cpu" = "sparc64" \
740 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000741 hostlongbits="64"
742fi
743
pbrookbd0c5662008-05-29 14:34:11 +0000744# Check host NPTL support
745cat > $TMPC <<EOF
746#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000747#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000748void foo()
749{
750#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
751#error bork
752#endif
753}
754EOF
755
balrog8c7f7572008-12-15 03:15:36 +0000756if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000757 :
758else
759 nptl="no"
760fi
761
bellard11d9f692004-04-02 20:55:59 +0000762##########################################
balrogac629222008-10-11 09:56:04 +0000763# zlib check
764
765cat > $TMPC << EOF
766#include <zlib.h>
767int main(void) { zlibVersion(); return 0; }
768EOF
balrog8c7f7572008-12-15 03:15:36 +0000769if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000770 :
771else
772 echo
773 echo "Error: zlib check failed"
774 echo "Make sure to have the zlib libs and headers installed."
775 echo
776 exit 1
777fi
778
779##########################################
bellard11d9f692004-04-02 20:55:59 +0000780# SDL probe
781
782sdl_too_old=no
783
784if test -z "$sdl" ; then
ths069b0bd2007-07-12 00:27:15 +0000785 sdl_config="sdl-config"
786 sdl=no
787 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000788
789cat > $TMPC << EOF
790#include <SDL.h>
791#undef main /* We don't want SDL to override our main() */
792int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
793EOF
balrog8c7f7572008-12-15 03:15:36 +0000794 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 +0000795 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
796 if test "$_sdlversion" -lt 121 ; then
797 sdl_too_old=yes
798 else
799 if test "$cocoa" = "no" ; then
800 sdl=yes
801 fi
802 fi
803
804 # static link with sdl ?
805 if test "$sdl" = "yes" ; then
806 aa="no"
807 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
808 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
809 if [ "$aa" = "yes" ] ; then
810 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000811 fi
bellard11d9f692004-04-02 20:55:59 +0000812
balrog8c7f7572008-12-15 03:15:36 +0000813 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 +0000814 sdl_static=yes
815 fi
816 fi # static link
817 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000818else
ths069b0bd2007-07-12 00:27:15 +0000819 # Make sure to disable cocoa if sdl was set
820 if test "$sdl" = "yes" ; then
821 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000822 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000823 fi
bellarda6e022a2004-04-02 21:55:47 +0000824fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000825
aliguori5368a422009-03-03 17:37:21 +0000826if test "$sdl" = "yes" ; then
827cat > $TMPC <<EOF
828#include <SDL.h>
829#if defined(SDL_VIDEO_DRIVER_X11)
830#include <X11/XKBlib.h>
831#else
832#error No x11 support
833#endif
834int main(void) { return 0; }
835EOF
836 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
837 sdl_x11="yes"
838 fi
839fi
840
ths8f28f3f2007-01-05 21:25:54 +0000841##########################################
ths8d5d2d42007-08-25 01:37:51 +0000842# VNC TLS detection
843if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000844cat > $TMPC <<EOF
845#include <gnutls/gnutls.h>
846int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
847EOF
848 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
849 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
850 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000851 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000852 :
853 else
854 vnc_tls="no"
855 fi
ths8d5d2d42007-08-25 01:37:51 +0000856fi
857
858##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000859# VNC SASL detection
860if test "$vnc_sasl" = "yes" ; then
861cat > $TMPC <<EOF
862#include <sasl/sasl.h>
863#include <stdio.h>
864int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
865EOF
866 # Assuming Cyrus-SASL installed in /usr prefix
867 vnc_sasl_cflags=""
868 vnc_sasl_libs="-lsasl2"
869 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
870 $vnc_sasl_libs 2> /dev/null ; then
871 :
872 else
873 vnc_sasl="no"
874 fi
875fi
876
877##########################################
aliguori76655d62009-03-06 20:27:37 +0000878# fnmatch() probe, used for ACL routines
879fnmatch="no"
880cat > $TMPC << EOF
881#include <fnmatch.h>
882int main(void)
883{
884 fnmatch("foo", "foo", 0);
885 return 0;
886}
887EOF
888if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
889 fnmatch="yes"
890fi
891
892##########################################
ths8a16d272008-07-19 09:56:24 +0000893# vde libraries probe
894if test "$vde" = "yes" ; then
895 cat > $TMPC << EOF
896#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000897int main(void)
898{
899 struct vde_open_args a = {0, 0, 0};
900 vde_open("", "", &a);
901 return 0;
902}
ths8a16d272008-07-19 09:56:24 +0000903EOF
balrog8c7f7572008-12-15 03:15:36 +0000904 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000905 :
906 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000907 vde="no"
ths8a16d272008-07-19 09:56:24 +0000908 fi
909fi
910
911##########################################
malcc2de5c92008-06-28 19:13:06 +0000912# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000913
malcc2de5c92008-06-28 19:13:06 +0000914audio_drv_probe()
915{
916 drv=$1
917 hdr=$2
918 lib=$3
919 exp=$4
920 cfl=$5
921 cat > $TMPC << EOF
922#include <$hdr>
923int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000924EOF
balrog8c7f7572008-12-15 03:15:36 +0000925 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +0000926 :
927 else
928 echo
929 echo "Error: $drv check failed"
930 echo "Make sure to have the $drv libs and headers installed."
931 echo
932 exit 1
933 fi
934}
935
malc2fa7d3b2008-07-29 12:58:44 +0000936audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000937for drv in $audio_drv_list; do
938 case $drv in
939 alsa)
940 audio_drv_probe $drv alsa/asoundlib.h -lasound \
941 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
942 ;;
943
944 fmod)
945 if test -z $fmod_lib || test -z $fmod_inc; then
946 echo
947 echo "Error: You must specify path to FMOD library and headers"
948 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
949 echo
950 exit 1
951 fi
952 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
953 ;;
954
955 esd)
956 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
957 ;;
malcb8e59f12008-07-02 21:03:08 +0000958
959 pa)
960 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
961 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
962 ;;
963
blueswir12f6a1ab2008-08-21 18:00:53 +0000964 oss|sdl|core|wav|dsound)
965 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
966 ;;
967
malce4c63a62008-07-19 16:15:16 +0000968 *)
malc1c9b2a52008-07-19 16:57:30 +0000969 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +0000970 echo
971 echo "Error: Unknown driver '$drv' selected"
972 echo "Possible drivers are: $audio_possible_drivers"
973 echo
974 exit 1
975 }
976 ;;
malcc2de5c92008-06-28 19:13:06 +0000977 esac
978done
ths8f28f3f2007-01-05 21:25:54 +0000979
balrog4d3b6f62008-02-10 16:33:14 +0000980##########################################
aurel322e4d9fb2008-04-08 06:01:02 +0000981# BrlAPI probe
982
983if test -z "$brlapi" ; then
984 brlapi=no
985cat > $TMPC << EOF
986#include <brlapi.h>
987int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
988EOF
aurel32178baee2008-12-08 18:11:57 +0000989 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +0000990 brlapi=yes
991 fi # brlapi compile test
992fi # -z $brlapi
993
994##########################################
balrog4d3b6f62008-02-10 16:33:14 +0000995# curses probe
996
997if test "$curses" = "yes" ; then
998 curses=no
999 cat > $TMPC << EOF
1000#include <curses.h>
1001int main(void) { return curses_version(); }
1002EOF
aurel32178baee2008-12-08 18:11:57 +00001003 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +00001004 curses=yes
1005 fi
1006fi # test "$curses"
1007
blueswir1414f0da2008-08-15 18:20:52 +00001008##########################################
balrogfb599c92008-09-28 23:49:55 +00001009# bluez support probe
1010if test "$bluez" = "yes" ; then
1011 `pkg-config bluez` || bluez="no"
1012fi
1013if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001014 cat > $TMPC << EOF
1015#include <bluetooth/bluetooth.h>
1016int main(void) { return bt_error(0); }
1017EOF
balrogfb599c92008-09-28 23:49:55 +00001018 bluez_cflags=`pkg-config --cflags bluez`
1019 bluez_libs=`pkg-config --libs bluez`
balrog17e15922008-10-11 12:00:42 +00001020 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001021 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001022 :
1023 else
1024 bluez="no"
1025 fi
balrogfb599c92008-09-28 23:49:55 +00001026fi
1027
1028##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001029# kvm probe
1030if test "$kvm" = "yes" ; then
1031 cat > $TMPC <<EOF
1032#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001033#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001034#error Invalid KVM version
1035#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001036#if !defined(KVM_CAP_USER_MEMORY)
1037#error Missing KVM capability KVM_CAP_USER_MEMORY
1038#endif
1039#if !defined(KVM_CAP_SET_TSS_ADDR)
1040#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1041#endif
1042#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1043#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1044#endif
aliguori7ba1e612008-11-05 16:04:33 +00001045int main(void) { return 0; }
1046EOF
aliguorieac30262008-11-05 16:28:56 +00001047 if test "$kerneldir" != "" ; then
1048 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001049 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1050 -a -d "$kerneldir/arch/x86/include" ; then
1051 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001052 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1053 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001054 elif test -d "$kerneldir/arch/$cpu/include" ; then
1055 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1056 fi
aliguorieac30262008-11-05 16:28:56 +00001057 else
1058 kvm_cflags=""
1059 fi
aliguori7ba1e612008-11-05 16:04:33 +00001060 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001061 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001062 :
1063 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001064 kvm="no";
1065 if [ -x "`which awk 2>/dev/null`" ] && \
1066 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001067 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001068 | grep "error: " \
1069 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1070 if test "$kvmerr" != "" ; then
1071 kvm="no - (${kvmerr})"
1072 fi
1073 fi
aliguori7ba1e612008-11-05 16:04:33 +00001074 fi
1075fi
1076
1077##########################################
blueswir1414f0da2008-08-15 18:20:52 +00001078# AIO probe
aliguori3c529d92008-12-12 16:41:40 +00001079AIOLIBS=""
1080
blueswir1414f0da2008-08-15 18:20:52 +00001081if test "$aio" = "yes" ; then
1082 aio=no
1083 cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001084#include <pthread.h>
blueswir1c9db92f2009-01-17 06:49:15 +00001085int main(void) { pthread_mutex_t lock; return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001086EOF
1087 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1088 aio=yes
aliguori3c529d92008-12-12 16:41:40 +00001089 AIOLIBS="-lpthread"
blueswir1414f0da2008-08-15 18:20:52 +00001090 fi
1091fi
1092
aliguoribf9298b2008-12-05 20:05:26 +00001093##########################################
1094# iovec probe
1095cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001096#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001097#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001098#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001099int main(void) { struct iovec iov; return 0; }
1100EOF
1101iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001102if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001103 iovec=yes
1104fi
1105
aurel32f652e6a2008-12-16 10:43:48 +00001106##########################################
1107# fdt probe
1108if test "$fdt" = "yes" ; then
1109 fdt=no
1110 cat > $TMPC << EOF
1111int main(void) { return 0; }
1112EOF
1113 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1114 fdt=yes
1115 fi
1116fi
1117
pbrookcc8ae6d2006-04-23 17:57:59 +00001118# Check if tools are available to build documentation.
ths6c591862007-05-09 13:55:03 +00001119if [ -x "`which texi2html 2>/dev/null`" ] && \
1120 [ -x "`which pod2man 2>/dev/null`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +00001121 build_docs="yes"
1122fi
1123
aliguorida93a1f2008-12-12 20:02:52 +00001124##########################################
1125# Do we need librt
1126cat > $TMPC <<EOF
1127#include <signal.h>
1128#include <time.h>
1129int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1130EOF
1131
1132rt=no
balrog8c7f7572008-12-15 03:15:36 +00001133if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001134 :
balrog8c7f7572008-12-15 03:15:36 +00001135elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001136 rt=yes
1137fi
1138
1139if test "$rt" = "yes" ; then
1140 # Hack, we should have a general purpose LIBS for this sort of thing
1141 AIOLIBS="$AIOLIBS -lrt"
1142fi
1143
bellard11d9f692004-04-02 20:55:59 +00001144if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001145 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001146 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001147 fi
1148 mansuffix=""
1149 datasuffix=""
1150 docsuffix=""
1151 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001152else
pbrook308c3592007-02-27 00:52:01 +00001153 if test -z "$prefix" ; then
1154 prefix="/usr/local"
1155 fi
1156 mansuffix="/share/man"
1157 datasuffix="/share/qemu"
1158 docsuffix="/share/doc/qemu"
1159 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001160fi
bellard5a671352003-10-01 00:13:48 +00001161
bellard43ce4df2003-06-09 19:53:12 +00001162echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001163echo "BIOS directory $prefix$datasuffix"
1164echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001165if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001166echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001167echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001168fi
bellard5a671352003-10-01 00:13:48 +00001169echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001170echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001171echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001172echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001173echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001174echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001175echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001176echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001177echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +00001178echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001179echo "sparse enabled $sparse"
bellard05c2a3e2006-02-08 22:39:17 +00001180echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001181echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001182echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001183if test "$darwin" = "yes" ; then
1184 echo "Cocoa support $cocoa"
1185fi
bellard97a847b2003-08-10 21:36:04 +00001186echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001187if test "$sdl" != "no" ; then
1188 echo "SDL static link $sdl_static"
1189fi
balrog4d3b6f62008-02-10 16:33:14 +00001190echo "curses support $curses"
bellard67b915a2004-03-31 23:37:16 +00001191echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001192echo "Audio drivers $audio_drv_list"
1193echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001194echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001195echo "VNC TLS support $vnc_tls"
1196if test "$vnc_tls" = "yes" ; then
1197 echo " TLS CFLAGS $vnc_tls_cflags"
1198 echo " TLS LIBS $vnc_tls_libs"
1199fi
aliguori2f9606b2009-03-06 20:27:28 +00001200echo "VNC SASL support $vnc_sasl"
1201if test "$vnc_sasl" = "yes" ; then
1202 echo " SASL CFLAGS $vnc_sasl_cflags"
1203 echo " SASL LIBS $vnc_sasl_libs"
1204fi
blueswir131422552007-04-16 18:27:06 +00001205if test -n "$sparc_cpu"; then
1206 echo "Target Sparc Arch $sparc_cpu"
1207fi
bellard07f4ddb2005-04-23 17:44:28 +00001208echo "kqemu support $kqemu"
aurel322e4d9fb2008-04-08 06:01:02 +00001209echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001210echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001211[ ! -z "$uname_release" ] && \
1212echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001213echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001214echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001215echo "AIO support $aio"
ths77755342008-11-27 15:45:16 +00001216echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001217echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001218echo "fdt support $fdt"
bellard67b915a2004-03-31 23:37:16 +00001219
bellard97a847b2003-08-10 21:36:04 +00001220if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001221echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001222fi
malcd4742de2008-11-29 22:04:31 +00001223if [ -s $TMPSDLLOG ]; then
ths20b40c62007-07-11 23:39:45 +00001224 echo "The error log from compiling the libSDL test is: "
malcd4742de2008-11-29 22:04:31 +00001225 cat $TMPSDLLOG
ths20b40c62007-07-11 23:39:45 +00001226fi
bellard24b55b92005-03-01 22:30:41 +00001227#if test "$sdl_static" = "no"; then
1228# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1229#fi
bellard97a847b2003-08-10 21:36:04 +00001230config_mak="config-host.mak"
1231config_h="config-host.h"
1232
bellard7c1f25b2004-04-22 00:02:08 +00001233#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001234
ths15d9ca02007-07-31 23:07:32 +00001235test -f $config_h && mv $config_h ${config_h}~
1236
bellard97a847b2003-08-10 21:36:04 +00001237echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001238printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001239printf " '%s'" "$0" "$@" >> $config_mak
1240echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001241echo "/* Automatically generated by configure - do not modify */" > $config_h
1242
1243echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001244echo "bindir=\${prefix}$binsuffix" >> $config_mak
1245echo "mandir=\${prefix}$mansuffix" >> $config_mak
1246echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001247echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001248echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001249echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001250echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001251echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001252echo "HOST_CC=$host_cc" >> $config_mak
1253echo "AR=$ar" >> $config_mak
1254echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001255# XXX: only use CFLAGS and LDFLAGS ?
1256# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1257# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001258echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001259echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1260echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1261echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001262echo "CFLAGS=$CFLAGS" >> $config_mak
1263echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001264echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +00001265echo "AIOLIBS=$AIOLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001266case "$cpu" in
1267 i386)
1268 echo "ARCH=i386" >> $config_mak
1269 echo "#define HOST_I386 1" >> $config_h
1270 ;;
1271 x86_64)
1272 echo "ARCH=x86_64" >> $config_mak
1273 echo "#define HOST_X86_64 1" >> $config_h
1274 ;;
1275 alpha)
1276 echo "ARCH=alpha" >> $config_mak
1277 echo "#define HOST_ALPHA 1" >> $config_h
1278 ;;
1279 armv4b)
1280 echo "ARCH=arm" >> $config_mak
1281 echo "#define HOST_ARM 1" >> $config_h
1282 ;;
1283 armv4l)
1284 echo "ARCH=arm" >> $config_mak
1285 echo "#define HOST_ARM 1" >> $config_h
1286 ;;
1287 cris)
1288 echo "ARCH=cris" >> $config_mak
1289 echo "#define HOST_CRIS 1" >> $config_h
1290 ;;
1291 hppa)
1292 echo "ARCH=hppa" >> $config_mak
1293 echo "#define HOST_HPPA 1" >> $config_h
1294 ;;
1295 ia64)
1296 echo "ARCH=ia64" >> $config_mak
1297 echo "#define HOST_IA64 1" >> $config_h
1298 ;;
1299 m68k)
1300 echo "ARCH=m68k" >> $config_mak
1301 echo "#define HOST_M68K 1" >> $config_h
1302 ;;
1303 mips)
1304 echo "ARCH=mips" >> $config_mak
1305 echo "#define HOST_MIPS 1" >> $config_h
1306 ;;
1307 mips64)
1308 echo "ARCH=mips64" >> $config_mak
1309 echo "#define HOST_MIPS64 1" >> $config_h
1310 ;;
malcfdf7ed92009-01-14 18:39:52 +00001311 ppc)
1312 echo "ARCH=ppc" >> $config_mak
1313 echo "#define HOST_PPC 1" >> $config_h
1314 ;;
1315 ppc64)
1316 echo "ARCH=ppc64" >> $config_mak
1317 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001318 ;;
1319 s390)
1320 echo "ARCH=s390" >> $config_mak
1321 echo "#define HOST_S390 1" >> $config_h
1322 ;;
1323 sparc)
1324 echo "ARCH=sparc" >> $config_mak
1325 echo "#define HOST_SPARC 1" >> $config_h
1326 ;;
1327 sparc64)
1328 echo "ARCH=sparc64" >> $config_mak
1329 echo "#define HOST_SPARC64 1" >> $config_h
1330 ;;
1331 *)
1332 echo "Unsupported CPU = $cpu"
1333 exit 1
1334 ;;
1335esac
aliguori03b4fe72008-10-07 19:16:17 +00001336if test "$sparse" = "yes" ; then
1337 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1338 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1339 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1340fi
bellard7d132992003-03-06 23:23:54 +00001341if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001342 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1343 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1344fi
bellardb6853692005-06-05 17:10:39 +00001345echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001346if test "$mingw32" = "yes" ; then
1347 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001348 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001349else
1350 cat > $TMPC << EOF
1351#include <byteswap.h>
1352int main(void) { return bswap_32(0); }
1353EOF
aurel32178baee2008-12-08 18:11:57 +00001354 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001355 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1356 fi
blueswir113606772008-12-05 17:54:09 +00001357 cat > $TMPC << EOF
1358#include <sys/endian.h>
1359#include <sys/types.h>
1360#include <machine/bswap.h>
1361int main(void) { return bswap32(0); }
1362EOF
aurel32178baee2008-12-08 18:11:57 +00001363 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001364 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1365 fi
bellard67b915a2004-03-31 23:37:16 +00001366fi
blueswir1128ab2f2008-08-15 18:33:42 +00001367
1368if [ "$openbsd" = "yes" ] ; then
1369 echo "#define ENOTSUP 4096" >> $config_h
1370fi
1371
bellard83fb7ad2004-07-05 21:25:26 +00001372if test "$darwin" = "yes" ; then
1373 echo "CONFIG_DARWIN=yes" >> $config_mak
1374 echo "#define CONFIG_DARWIN 1" >> $config_h
1375fi
malcb29fe3e2008-11-18 01:42:22 +00001376
1377if test "$aix" = "yes" ; then
1378 echo "CONFIG_AIX=yes" >> $config_mak
1379 echo "#define CONFIG_AIX 1" >> $config_h
1380fi
1381
bellardec530c82006-04-25 22:36:06 +00001382if test "$solaris" = "yes" ; then
1383 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001384 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001385 if test "$needs_libsunmath" = "yes" ; then
1386 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1387 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1388 fi
bellardec530c82006-04-25 22:36:06 +00001389fi
blueswir131422552007-04-16 18:27:06 +00001390if test -n "$sparc_cpu"; then
1391 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1392 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1393fi
bellard67b915a2004-03-31 23:37:16 +00001394if test "$gdbstub" = "yes" ; then
1395 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1396 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1397fi
bellard97a847b2003-08-10 21:36:04 +00001398if test "$gprof" = "yes" ; then
1399 echo "TARGET_GPROF=yes" >> $config_mak
1400 echo "#define HAVE_GPROF 1" >> $config_h
1401fi
1402if test "$static" = "yes" ; then
1403 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001404 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001405fi
bellard05c2a3e2006-02-08 22:39:17 +00001406if test $profiler = "yes" ; then
1407 echo "#define CONFIG_PROFILER 1" >> $config_h
1408fi
bellardc20709a2004-04-21 23:27:19 +00001409if test "$slirp" = "yes" ; then
1410 echo "CONFIG_SLIRP=yes" >> $config_mak
1411 echo "#define CONFIG_SLIRP 1" >> $config_h
1412fi
ths8a16d272008-07-19 09:56:24 +00001413if test "$vde" = "yes" ; then
1414 echo "CONFIG_VDE=yes" >> $config_mak
1415 echo "#define CONFIG_VDE 1" >> $config_h
1416 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1417fi
malc0c58ac12008-06-25 21:04:05 +00001418for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001419 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001420 echo "$def=yes" >> $config_mak
1421 echo "#define $def 1" >> $config_h
1422done
1423echo "#define AUDIO_DRIVERS \\" >> $config_h
1424for drv in $audio_drv_list; do
1425 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001426 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001427 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001428 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001429 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1430 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001431 elif test "$drv" = "oss"; then
1432 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001433 fi
1434done
1435echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001436if test "$mixemu" = "yes" ; then
1437 echo "CONFIG_MIXEMU=yes" >> $config_mak
1438 echo "#define CONFIG_MIXEMU 1" >> $config_h
1439fi
ths8d5d2d42007-08-25 01:37:51 +00001440if test "$vnc_tls" = "yes" ; then
1441 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1442 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1443 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1444 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1445fi
aliguori2f9606b2009-03-06 20:27:28 +00001446if test "$vnc_sasl" = "yes" ; then
1447 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1448 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1449 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1450 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1451fi
aliguori76655d62009-03-06 20:27:37 +00001452if test "$fnmatch" = "yes" ; then
1453 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1454fi
pbrookb1a550a2006-04-16 13:28:56 +00001455qemu_version=`head $source_path/VERSION`
1456echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001457echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001458
1459echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001460if [ "$source_path_used" = "yes" ]; then
1461 echo "VPATH=$source_path" >> $config_mak
1462fi
bellard97a847b2003-08-10 21:36:04 +00001463echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001464if [ "$build_docs" = "yes" ] ; then
1465 echo "BUILD_DOCS=yes" >> $config_mak
1466fi
bellard49ecc3f2007-11-07 19:25:15 +00001467if test "$static" = "yes"; then
1468 sdl1=$sdl_static
1469else
1470 sdl1=$sdl
1471fi
1472if test "$sdl1" = "yes" ; then
1473 echo "#define CONFIG_SDL 1" >> $config_h
1474 echo "CONFIG_SDL=yes" >> $config_mak
1475 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1476 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001477 elif test "$sdl_x11" = "yes" ; then
1478 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001479 else
1480 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1481 fi
1482 if [ "${aa}" = "yes" ] ; then
1483 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1484 else
1485 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1486 fi
1487fi
1488if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001489 echo "#define CONFIG_COCOA 1" >> $config_h
1490 echo "CONFIG_COCOA=yes" >> $config_mak
1491fi
1492if test "$curses" = "yes" ; then
1493 echo "#define CONFIG_CURSES 1" >> $config_h
1494 echo "CONFIG_CURSES=yes" >> $config_mak
1495 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001496fi
aurel322e4d9fb2008-04-08 06:01:02 +00001497if test "$brlapi" = "yes" ; then
1498 echo "CONFIG_BRLAPI=yes" >> $config_mak
1499 echo "#define CONFIG_BRLAPI 1" >> $config_h
1500 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1501fi
balrogfb599c92008-09-28 23:49:55 +00001502if test "$bluez" = "yes" ; then
1503 echo "CONFIG_BLUEZ=yes" >> $config_mak
1504 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1505 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1506 echo "#define CONFIG_BLUEZ 1" >> $config_h
1507fi
blueswir1414f0da2008-08-15 18:20:52 +00001508if test "$aio" = "yes" ; then
1509 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001510 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001511fi
ths77755342008-11-27 15:45:16 +00001512if test "$blobs" = "yes" ; then
1513 echo "INSTALL_BLOBS=yes" >> $config_mak
1514fi
aliguoribf9298b2008-12-05 20:05:26 +00001515if test "$iovec" = "yes" ; then
1516 echo "#define HAVE_IOVEC 1" >> $config_h
1517fi
aurel32f652e6a2008-12-16 10:43:48 +00001518if test "$fdt" = "yes" ; then
1519 echo "#define HAVE_FDT 1" >> $config_h
1520 echo "FDT_LIBS=-lfdt" >> $config_mak
1521fi
bellard97a847b2003-08-10 21:36:04 +00001522
bellard83fb7ad2004-07-05 21:25:26 +00001523# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001524if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001525 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001526 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
blueswir1179a2c12009-03-08 08:23:32 +00001527 echo "#define HOST_BSD 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001528fi
1529
pbrookc5937222006-05-14 11:30:38 +00001530echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1531
blueswir168063642008-11-22 21:03:55 +00001532# USB host support
1533case "$usb" in
1534linux)
1535 echo "HOST_USB=linux" >> $config_mak
1536;;
1537bsd)
1538 echo "HOST_USB=bsd" >> $config_mak
1539;;
1540*)
1541 echo "HOST_USB=stub" >> $config_mak
1542;;
1543esac
1544
pbrookc39e3332007-09-22 16:49:14 +00001545tools=
1546if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1547 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001548 if [ "$linux" = "yes" ] ; then
1549 tools="qemu-nbd\$(EXESUF) $tools"
1550 fi
pbrookc39e3332007-09-22 16:49:14 +00001551fi
1552echo "TOOLS=$tools" >> $config_mak
1553
ths15d9ca02007-07-31 23:07:32 +00001554test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1555
bellard1d14ffa2005-10-30 18:58:22 +00001556for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001557target_dir="$target"
1558config_mak=$target_dir/config.mak
1559config_h=$target_dir/config.h
1560target_cpu=`echo $target | cut -d '-' -f 1`
1561target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001562[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001563[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1564[ "$target_cpu" = "mips" ] && target_bigendian=yes
1565[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1566[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001567[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001568[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001569[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001570[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001571[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001572[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1573[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1574[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001575target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001576target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001577target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001578target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001579target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001580case "$target" in
1581 ${target_cpu}-softmmu)
1582 target_softmmu="yes"
1583 ;;
1584 ${target_cpu}-linux-user)
1585 target_user_only="yes"
1586 target_linux_user="yes"
1587 ;;
1588 ${target_cpu}-darwin-user)
1589 target_user_only="yes"
1590 target_darwin_user="yes"
1591 ;;
blueswir184778502008-10-26 20:33:16 +00001592 ${target_cpu}-bsd-user)
1593 target_user_only="yes"
1594 target_bsd_user="yes"
1595 ;;
pbrook9e407a82007-05-26 16:38:53 +00001596 *)
1597 echo "ERROR: Target '$target' not recognised"
1598 exit 1
1599 ;;
1600esac
ths831b7822007-01-18 20:06:33 +00001601
bellard97ccc682005-07-02 13:32:17 +00001602if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +00001603 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +00001604 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +00001605 echo "To build QEMU without graphical output configure with --disable-gfx-check"
balrog4d3b6f62008-02-10 16:33:14 +00001606 echo "Note that this will disable all output from the virtual graphics card"
1607 echo "except through VNC or curses."
bellard97ccc682005-07-02 13:32:17 +00001608 exit 1;
1609fi
1610
bellard7c1f25b2004-04-22 00:02:08 +00001611#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001612
ths15d9ca02007-07-31 23:07:32 +00001613test -f $config_h && mv $config_h ${config_h}~
1614
bellard97a847b2003-08-10 21:36:04 +00001615mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001616mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001617mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001618if 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 +00001619 mkdir -p $target_dir/nwfpe
1620fi
1621
bellardec530c82006-04-25 22:36:06 +00001622#
1623# don't use ln -sf as not all "ln -sf" over write the file/link
1624#
1625rm -f $target_dir/Makefile
1626ln -s $source_path/Makefile.target $target_dir/Makefile
1627
bellard97a847b2003-08-10 21:36:04 +00001628
1629echo "# Automatically generated by configure - do not modify" > $config_mak
1630echo "/* Automatically generated by configure - do not modify */" > $config_h
1631
1632
1633echo "include ../config-host.mak" >> $config_mak
1634echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001635
pbrooke5fe0c52006-06-11 13:32:59 +00001636bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001637elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001638target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001639interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1640echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001641gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001642
aliguori5985ece2008-11-05 19:59:25 +00001643# Make sure the target and host cpus are compatible
1644if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
malcfdf7ed92009-01-14 18:39:52 +00001645 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001646 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1647 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001648 kvm="no"
1649fi
1650# Disable KVM for linux-user
1651if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1652 kvm="no"
1653fi
1654
aurel322408a522008-04-20 20:19:44 +00001655case "$target_cpu" in
1656 i386)
1657 echo "TARGET_ARCH=i386" >> $config_mak
1658 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1659 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001660 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001661 then
1662 echo "#define USE_KQEMU 1" >> $config_h
1663 fi
aliguori7ba1e612008-11-05 16:04:33 +00001664 if test "$kvm" = "yes" ; then
1665 echo "CONFIG_KVM=yes" >> $config_mak
1666 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001667 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001668 fi
aurel322408a522008-04-20 20:19:44 +00001669 ;;
1670 x86_64)
1671 echo "TARGET_ARCH=x86_64" >> $config_mak
1672 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1673 echo "#define TARGET_I386 1" >> $config_h
1674 echo "#define TARGET_X86_64 1" >> $config_h
1675 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1676 then
1677 echo "#define USE_KQEMU 1" >> $config_h
1678 fi
aliguori7ba1e612008-11-05 16:04:33 +00001679 if test "$kvm" = "yes" ; then
1680 echo "CONFIG_KVM=yes" >> $config_mak
1681 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1682 echo "#define CONFIG_KVM 1" >> $config_h
1683 fi
aurel322408a522008-04-20 20:19:44 +00001684 ;;
1685 alpha)
1686 echo "TARGET_ARCH=alpha" >> $config_mak
1687 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1688 echo "#define TARGET_ALPHA 1" >> $config_h
1689 ;;
1690 arm|armeb)
1691 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001692 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1693 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001694 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001695 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001696 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00001697 ;;
1698 cris)
1699 echo "TARGET_ARCH=cris" >> $config_mak
1700 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1701 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00001702 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001703 ;;
1704 m68k)
1705 echo "TARGET_ARCH=m68k" >> $config_mak
1706 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1707 echo "#define TARGET_M68K 1" >> $config_h
1708 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001709 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00001710 ;;
1711 mips|mipsel)
1712 echo "TARGET_ARCH=mips" >> $config_mak
1713 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1714 echo "#define TARGET_MIPS 1" >> $config_h
1715 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1716 ;;
1717 mipsn32|mipsn32el)
1718 echo "TARGET_ARCH=mipsn32" >> $config_mak
1719 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1720 echo "#define TARGET_MIPS 1" >> $config_h
1721 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1722 ;;
1723 mips64|mips64el)
1724 echo "TARGET_ARCH=mips64" >> $config_mak
1725 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1726 echo "#define TARGET_MIPS 1" >> $config_h
1727 echo "#define TARGET_MIPS64 1" >> $config_h
1728 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1729 ;;
1730 ppc)
1731 echo "TARGET_ARCH=ppc" >> $config_mak
1732 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1733 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001734 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001735 ;;
1736 ppcemb)
1737 echo "TARGET_ARCH=ppcemb" >> $config_mak
1738 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1739 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1740 echo "#define TARGET_PPC 1" >> $config_h
1741 echo "#define TARGET_PPCEMB 1" >> $config_h
aurel32d76d1652008-12-16 10:43:58 +00001742 if test "$kvm" = "yes" ; then
1743 echo "CONFIG_KVM=yes" >> $config_mak
1744 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1745 echo "#define CONFIG_KVM 1" >> $config_h
1746 fi
aurel32c8b35322009-01-24 15:07:34 +00001747 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001748 ;;
1749 ppc64)
1750 echo "TARGET_ARCH=ppc64" >> $config_mak
1751 echo "TARGET_ABI_DIR=ppc" >> $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
aurel32c8b35322009-01-24 15:07:34 +00001755 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001756 ;;
1757 ppc64abi32)
1758 echo "TARGET_ARCH=ppc64" >> $config_mak
1759 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1760 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1761 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1762 echo "#define TARGET_PPC 1" >> $config_h
1763 echo "#define TARGET_PPC64 1" >> $config_h
1764 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001765 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001766 ;;
1767 sh4|sh4eb)
1768 echo "TARGET_ARCH=sh4" >> $config_mak
1769 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1770 echo "#define TARGET_SH4 1" >> $config_h
1771 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001772 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001773 ;;
1774 sparc)
1775 echo "TARGET_ARCH=sparc" >> $config_mak
1776 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1777 echo "#define TARGET_SPARC 1" >> $config_h
1778 ;;
1779 sparc64)
1780 echo "TARGET_ARCH=sparc64" >> $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 elfload32="yes"
1785 ;;
1786 sparc32plus)
1787 echo "TARGET_ARCH=sparc64" >> $config_mak
1788 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1789 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1790 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1791 echo "#define TARGET_SPARC 1" >> $config_h
1792 echo "#define TARGET_SPARC64 1" >> $config_h
1793 echo "#define TARGET_ABI32 1" >> $config_h
1794 ;;
1795 *)
1796 echo "Unsupported target CPU"
1797 exit 1
1798 ;;
1799esac
bellardde83cd02003-06-15 20:25:43 +00001800if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001801 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1802 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1803fi
1804if test "$target_softmmu" = "yes" ; then
1805 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1806 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00001807fi
bellard997344f2003-10-27 21:10:39 +00001808if test "$target_user_only" = "yes" ; then
1809 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1810 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1811fi
ths831b7822007-01-18 20:06:33 +00001812if test "$target_linux_user" = "yes" ; then
1813 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1814 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1815fi
1816if test "$target_darwin_user" = "yes" ; then
1817 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1818 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1819fi
pbrook56aebc82008-10-11 17:55:29 +00001820list=""
1821if test ! -z "$gdb_xml_files" ; then
1822 for x in $gdb_xml_files; do
1823 list="$list $source_path/gdb-xml/$x"
1824 done
1825fi
1826echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00001827
aurel320938cda2008-04-11 21:36:06 +00001828if test "$target_cpu" = "arm" \
1829 -o "$target_cpu" = "armeb" \
1830 -o "$target_cpu" = "m68k" \
1831 -o "$target_cpu" = "mips" \
1832 -o "$target_cpu" = "mipsel" \
1833 -o "$target_cpu" = "mipsn32" \
1834 -o "$target_cpu" = "mipsn32el" \
1835 -o "$target_cpu" = "mips64" \
1836 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00001837 -o "$target_cpu" = "ppc" \
1838 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00001839 -o "$target_cpu" = "ppc64abi32" \
1840 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00001841 -o "$target_cpu" = "sparc" \
1842 -o "$target_cpu" = "sparc64" \
1843 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00001844 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1845 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1846fi
pbrooke5fe0c52006-06-11 13:32:59 +00001847if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1848 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1849 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1850fi
pbrookbd0c5662008-05-29 14:34:11 +00001851if test "$target_user_only" = "yes" \
1852 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1853 echo "#define USE_NPTL 1" >> $config_h
1854fi
blueswir1cb33da52007-10-09 16:34:29 +00001855# 32 bit ELF loader in addition to native 64 bit loader?
1856if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1857 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1858 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1859fi
blueswir184778502008-10-26 20:33:16 +00001860if test "$target_bsd_user" = "yes" ; then
1861 echo "CONFIG_BSD_USER=yes" >> $config_mak
1862 echo "#define CONFIG_BSD_USER 1" >> $config_h
1863fi
bellard5b0753e2005-03-01 21:37:28 +00001864
ths15d9ca02007-07-31 23:07:32 +00001865test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1866
bellard97a847b2003-08-10 21:36:04 +00001867done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00001868
1869# build tree in object directory if source path is different from current one
1870if test "$source_path_used" = "yes" ; then
bellard49ecc3f2007-11-07 19:25:15 +00001871 DIRS="tests tests/cris slirp audio"
bellard7d132992003-03-06 23:23:54 +00001872 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00001873 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00001874 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00001875 for dir in $DIRS ; do
1876 mkdir -p $dir
1877 done
bellardec530c82006-04-25 22:36:06 +00001878 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00001879 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00001880 rm -f $f
1881 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00001882 done
1883fi