blob: a4e6f8dbfafdda767edce8c11e5079db2053daa4 [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"
aliguoricd01b4a2008-08-21 19:25:45 +0000593fi
594
aliguori03b4fe72008-10-07 19:16:17 +0000595if test ! -x "$(which cgcc 2>/dev/null)"; then
596 sparse="no"
597fi
598
bellardec530c82006-04-25 22:36:06 +0000599#
600# Solaris specific configure tool chain decisions
601#
602if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000603 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
604 if test -z "$solinst" ; then
605 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
606 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
607 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
608 exit 1
609 fi
610 if test "$solinst" = "/usr/sbin/install" ; then
611 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
612 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
613 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
614 exit 1
615 fi
bellardec530c82006-04-25 22:36:06 +0000616 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
617 if test -z "$sol_ar" ; then
618 echo "Error: No path includes ar"
619 if test -f /usr/ccs/bin/ar ; then
620 echo "Add /usr/ccs/bin to your path and rerun configure"
621 fi
622 exit 1
623 fi
ths5fafdf22007-09-16 21:08:06 +0000624fi
bellardec530c82006-04-25 22:36:06 +0000625
626
bellard5327cf42005-01-10 23:18:50 +0000627if test -z "$target_list" ; then
628# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000629 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000630 target_list="\
631i386-softmmu \
632x86_64-softmmu \
633arm-softmmu \
634cris-softmmu \
635m68k-softmmu \
636mips-softmmu \
637mipsel-softmmu \
638mips64-softmmu \
639mips64el-softmmu \
640ppc-softmmu \
641ppcemb-softmmu \
642ppc64-softmmu \
643sh4-softmmu \
644sh4eb-softmmu \
645sparc-softmmu \
646"
pbrook0a8e90f2006-03-19 14:54:16 +0000647 fi
bellard5327cf42005-01-10 23:18:50 +0000648# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000649 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000650 target_list="${target_list}\
651i386-linux-user \
652x86_64-linux-user \
653alpha-linux-user \
654arm-linux-user \
655armeb-linux-user \
656cris-linux-user \
657m68k-linux-user \
658mips-linux-user \
659mipsel-linux-user \
660ppc-linux-user \
661ppc64-linux-user \
662ppc64abi32-linux-user \
663sh4-linux-user \
664sh4eb-linux-user \
665sparc-linux-user \
666sparc64-linux-user \
667sparc32plus-linux-user \
668"
ths831b7822007-01-18 20:06:33 +0000669 fi
670# the following are Darwin specific
671 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000672 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000673 fi
blueswir184778502008-10-26 20:33:16 +0000674# the following are BSD specific
675 if [ "$bsd_user" = "yes" ] ; then
676 target_list="${target_list}\
677sparc64-bsd-user \
678"
679 fi
bellard6e20a452005-06-05 15:56:02 +0000680else
pbrookb1a550a2006-04-16 13:28:56 +0000681 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000682fi
pbrook0a8e90f2006-03-19 14:54:16 +0000683if test -z "$target_list" ; then
684 echo "No targets enabled"
685 exit 1
686fi
bellard5327cf42005-01-10 23:18:50 +0000687
bellard7d132992003-03-06 23:23:54 +0000688if test -z "$cross_prefix" ; then
689
690# ---
691# big/little endian test
692cat > $TMPC << EOF
693#include <inttypes.h>
694int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000695 volatile uint32_t i=0x01234567;
696 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000697}
698EOF
699
aurel32178baee2008-12-08 18:11:57 +0000700if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000701$TMPE && bigendian="yes"
702else
703echo big/little test failed
704fi
705
706else
707
708# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000709if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000710 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000711 -o "$cpu" = "m68k" \
712 -o "$cpu" = "mips" \
713 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000714 -o "$cpu" = "ppc" \
715 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000716 -o "$cpu" = "s390" \
717 -o "$cpu" = "sparc" \
718 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000719 bigendian="yes"
720fi
721
722fi
723
bellardb6853692005-06-05 17:10:39 +0000724# host long bits test
725hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000726if test "$cpu" = "x86_64" \
727 -o "$cpu" = "alpha" \
728 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000729 -o "$cpu" = "sparc64" \
730 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000731 hostlongbits="64"
732fi
733
bellarde8cd23d2003-06-25 16:08:13 +0000734# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000735cat > $TMPC <<EOF
736int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000737}
738EOF
739
pbrookbd0c5662008-05-29 14:34:11 +0000740# Check host NPTL support
741cat > $TMPC <<EOF
742#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000743#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000744void foo()
745{
746#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
747#error bork
748#endif
749}
750EOF
751
balrog8c7f7572008-12-15 03:15:36 +0000752if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000753 :
754else
755 nptl="no"
756fi
757
bellard11d9f692004-04-02 20:55:59 +0000758##########################################
balrogac629222008-10-11 09:56:04 +0000759# zlib check
760
761cat > $TMPC << EOF
762#include <zlib.h>
763int main(void) { zlibVersion(); return 0; }
764EOF
balrog8c7f7572008-12-15 03:15:36 +0000765if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000766 :
767else
768 echo
769 echo "Error: zlib check failed"
770 echo "Make sure to have the zlib libs and headers installed."
771 echo
772 exit 1
773fi
774
775##########################################
bellard11d9f692004-04-02 20:55:59 +0000776# SDL probe
777
778sdl_too_old=no
779
780if test -z "$sdl" ; then
ths069b0bd2007-07-12 00:27:15 +0000781 sdl_config="sdl-config"
782 sdl=no
783 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000784
785cat > $TMPC << EOF
786#include <SDL.h>
787#undef main /* We don't want SDL to override our main() */
788int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
789EOF
balrog8c7f7572008-12-15 03:15:36 +0000790 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 +0000791 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
792 if test "$_sdlversion" -lt 121 ; then
793 sdl_too_old=yes
794 else
795 if test "$cocoa" = "no" ; then
796 sdl=yes
797 fi
798 fi
799
800 # static link with sdl ?
801 if test "$sdl" = "yes" ; then
802 aa="no"
803 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
804 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
805 if [ "$aa" = "yes" ] ; then
806 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000807 fi
bellard11d9f692004-04-02 20:55:59 +0000808
balrog8c7f7572008-12-15 03:15:36 +0000809 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 +0000810 sdl_static=yes
811 fi
812 fi # static link
813 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000814else
ths069b0bd2007-07-12 00:27:15 +0000815 # Make sure to disable cocoa if sdl was set
816 if test "$sdl" = "yes" ; then
817 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000818 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000819 fi
bellarda6e022a2004-04-02 21:55:47 +0000820fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000821
aliguori5368a422009-03-03 17:37:21 +0000822if test "$sdl" = "yes" ; then
823cat > $TMPC <<EOF
824#include <SDL.h>
825#if defined(SDL_VIDEO_DRIVER_X11)
826#include <X11/XKBlib.h>
827#else
828#error No x11 support
829#endif
830int main(void) { return 0; }
831EOF
832 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
833 sdl_x11="yes"
834 fi
835fi
836
ths8f28f3f2007-01-05 21:25:54 +0000837##########################################
ths8d5d2d42007-08-25 01:37:51 +0000838# VNC TLS detection
839if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000840cat > $TMPC <<EOF
841#include <gnutls/gnutls.h>
842int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
843EOF
844 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
845 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
846 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000847 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000848 :
849 else
850 vnc_tls="no"
851 fi
ths8d5d2d42007-08-25 01:37:51 +0000852fi
853
854##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000855# VNC SASL detection
856if test "$vnc_sasl" = "yes" ; then
857cat > $TMPC <<EOF
858#include <sasl/sasl.h>
859#include <stdio.h>
860int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
861EOF
862 # Assuming Cyrus-SASL installed in /usr prefix
863 vnc_sasl_cflags=""
864 vnc_sasl_libs="-lsasl2"
865 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
866 $vnc_sasl_libs 2> /dev/null ; then
867 :
868 else
869 vnc_sasl="no"
870 fi
871fi
872
873##########################################
aliguori76655d62009-03-06 20:27:37 +0000874# fnmatch() probe, used for ACL routines
875fnmatch="no"
876cat > $TMPC << EOF
877#include <fnmatch.h>
878int main(void)
879{
880 fnmatch("foo", "foo", 0);
881 return 0;
882}
883EOF
884if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
885 fnmatch="yes"
886fi
887
888##########################################
ths8a16d272008-07-19 09:56:24 +0000889# vde libraries probe
890if test "$vde" = "yes" ; then
891 cat > $TMPC << EOF
892#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000893int main(void)
894{
895 struct vde_open_args a = {0, 0, 0};
896 vde_open("", "", &a);
897 return 0;
898}
ths8a16d272008-07-19 09:56:24 +0000899EOF
balrog8c7f7572008-12-15 03:15:36 +0000900 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000901 :
902 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000903 vde="no"
ths8a16d272008-07-19 09:56:24 +0000904 fi
905fi
906
907##########################################
malcc2de5c92008-06-28 19:13:06 +0000908# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000909
malcc2de5c92008-06-28 19:13:06 +0000910audio_drv_probe()
911{
912 drv=$1
913 hdr=$2
914 lib=$3
915 exp=$4
916 cfl=$5
917 cat > $TMPC << EOF
918#include <$hdr>
919int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000920EOF
balrog8c7f7572008-12-15 03:15:36 +0000921 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +0000922 :
923 else
924 echo
925 echo "Error: $drv check failed"
926 echo "Make sure to have the $drv libs and headers installed."
927 echo
928 exit 1
929 fi
930}
931
malc2fa7d3b2008-07-29 12:58:44 +0000932audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000933for drv in $audio_drv_list; do
934 case $drv in
935 alsa)
936 audio_drv_probe $drv alsa/asoundlib.h -lasound \
937 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
938 ;;
939
940 fmod)
941 if test -z $fmod_lib || test -z $fmod_inc; then
942 echo
943 echo "Error: You must specify path to FMOD library and headers"
944 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
945 echo
946 exit 1
947 fi
948 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
949 ;;
950
951 esd)
952 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
953 ;;
malcb8e59f12008-07-02 21:03:08 +0000954
955 pa)
956 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
957 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
958 ;;
959
blueswir12f6a1ab2008-08-21 18:00:53 +0000960 oss|sdl|core|wav|dsound)
961 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
962 ;;
963
malce4c63a62008-07-19 16:15:16 +0000964 *)
malc1c9b2a52008-07-19 16:57:30 +0000965 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +0000966 echo
967 echo "Error: Unknown driver '$drv' selected"
968 echo "Possible drivers are: $audio_possible_drivers"
969 echo
970 exit 1
971 }
972 ;;
malcc2de5c92008-06-28 19:13:06 +0000973 esac
974done
ths8f28f3f2007-01-05 21:25:54 +0000975
balrog4d3b6f62008-02-10 16:33:14 +0000976##########################################
aurel322e4d9fb2008-04-08 06:01:02 +0000977# BrlAPI probe
978
979if test -z "$brlapi" ; then
980 brlapi=no
981cat > $TMPC << EOF
982#include <brlapi.h>
983int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
984EOF
aurel32178baee2008-12-08 18:11:57 +0000985 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +0000986 brlapi=yes
987 fi # brlapi compile test
988fi # -z $brlapi
989
990##########################################
balrog4d3b6f62008-02-10 16:33:14 +0000991# curses probe
992
993if test "$curses" = "yes" ; then
994 curses=no
995 cat > $TMPC << EOF
996#include <curses.h>
997int main(void) { return curses_version(); }
998EOF
aurel32178baee2008-12-08 18:11:57 +0000999 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +00001000 curses=yes
1001 fi
1002fi # test "$curses"
1003
blueswir1414f0da2008-08-15 18:20:52 +00001004##########################################
balrogfb599c92008-09-28 23:49:55 +00001005# bluez support probe
1006if test "$bluez" = "yes" ; then
1007 `pkg-config bluez` || bluez="no"
1008fi
1009if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001010 cat > $TMPC << EOF
1011#include <bluetooth/bluetooth.h>
1012int main(void) { return bt_error(0); }
1013EOF
balrogfb599c92008-09-28 23:49:55 +00001014 bluez_cflags=`pkg-config --cflags bluez`
1015 bluez_libs=`pkg-config --libs bluez`
balrog17e15922008-10-11 12:00:42 +00001016 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001017 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001018 :
1019 else
1020 bluez="no"
1021 fi
balrogfb599c92008-09-28 23:49:55 +00001022fi
1023
1024##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001025# kvm probe
1026if test "$kvm" = "yes" ; then
1027 cat > $TMPC <<EOF
1028#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001029#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001030#error Invalid KVM version
1031#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001032#if !defined(KVM_CAP_USER_MEMORY)
1033#error Missing KVM capability KVM_CAP_USER_MEMORY
1034#endif
1035#if !defined(KVM_CAP_SET_TSS_ADDR)
1036#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1037#endif
1038#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1039#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1040#endif
aliguori7ba1e612008-11-05 16:04:33 +00001041int main(void) { return 0; }
1042EOF
aliguorieac30262008-11-05 16:28:56 +00001043 if test "$kerneldir" != "" ; then
1044 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001045 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1046 -a -d "$kerneldir/arch/x86/include" ; then
1047 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001048 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1049 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001050 elif test -d "$kerneldir/arch/$cpu/include" ; then
1051 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1052 fi
aliguorieac30262008-11-05 16:28:56 +00001053 else
1054 kvm_cflags=""
1055 fi
aliguori7ba1e612008-11-05 16:04:33 +00001056 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001057 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001058 :
1059 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001060 kvm="no";
1061 if [ -x "`which awk 2>/dev/null`" ] && \
1062 [ -x "`which grep 2>/dev/null`" ]; then
1063 kvmerr=`$cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1064 | grep "error: " \
1065 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1066 if test "$kvmerr" != "" ; then
1067 kvm="no - (${kvmerr})"
1068 fi
1069 fi
aliguori7ba1e612008-11-05 16:04:33 +00001070 fi
1071fi
1072
1073##########################################
blueswir1414f0da2008-08-15 18:20:52 +00001074# AIO probe
aliguori3c529d92008-12-12 16:41:40 +00001075AIOLIBS=""
1076
blueswir1414f0da2008-08-15 18:20:52 +00001077if test "$aio" = "yes" ; then
1078 aio=no
1079 cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001080#include <pthread.h>
blueswir1c9db92f2009-01-17 06:49:15 +00001081int main(void) { pthread_mutex_t lock; return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001082EOF
1083 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1084 aio=yes
aliguori3c529d92008-12-12 16:41:40 +00001085 AIOLIBS="-lpthread"
blueswir1414f0da2008-08-15 18:20:52 +00001086 fi
1087fi
1088
aliguoribf9298b2008-12-05 20:05:26 +00001089##########################################
1090# iovec probe
1091cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001092#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001093#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001094#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001095int main(void) { struct iovec iov; return 0; }
1096EOF
1097iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001098if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001099 iovec=yes
1100fi
1101
aurel32f652e6a2008-12-16 10:43:48 +00001102##########################################
1103# fdt probe
1104if test "$fdt" = "yes" ; then
1105 fdt=no
1106 cat > $TMPC << EOF
1107int main(void) { return 0; }
1108EOF
1109 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1110 fdt=yes
1111 fi
1112fi
1113
pbrookcc8ae6d2006-04-23 17:57:59 +00001114# Check if tools are available to build documentation.
ths6c591862007-05-09 13:55:03 +00001115if [ -x "`which texi2html 2>/dev/null`" ] && \
1116 [ -x "`which pod2man 2>/dev/null`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +00001117 build_docs="yes"
1118fi
1119
aliguorida93a1f2008-12-12 20:02:52 +00001120##########################################
1121# Do we need librt
1122cat > $TMPC <<EOF
1123#include <signal.h>
1124#include <time.h>
1125int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1126EOF
1127
1128rt=no
balrog8c7f7572008-12-15 03:15:36 +00001129if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001130 :
balrog8c7f7572008-12-15 03:15:36 +00001131elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001132 rt=yes
1133fi
1134
1135if test "$rt" = "yes" ; then
1136 # Hack, we should have a general purpose LIBS for this sort of thing
1137 AIOLIBS="$AIOLIBS -lrt"
1138fi
1139
bellard11d9f692004-04-02 20:55:59 +00001140if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001141 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001142 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001143 fi
1144 mansuffix=""
1145 datasuffix=""
1146 docsuffix=""
1147 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001148else
pbrook308c3592007-02-27 00:52:01 +00001149 if test -z "$prefix" ; then
1150 prefix="/usr/local"
1151 fi
1152 mansuffix="/share/man"
1153 datasuffix="/share/qemu"
1154 docsuffix="/share/doc/qemu"
1155 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001156fi
bellard5a671352003-10-01 00:13:48 +00001157
bellard43ce4df2003-06-09 19:53:12 +00001158echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001159echo "BIOS directory $prefix$datasuffix"
1160echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001161if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001162echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001163echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001164fi
bellard5a671352003-10-01 00:13:48 +00001165echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001166echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001167echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001168echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001169echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001170echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001171echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001172echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001173echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +00001174echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001175echo "sparse enabled $sparse"
bellard05c2a3e2006-02-08 22:39:17 +00001176echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001177echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001178echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001179if test "$darwin" = "yes" ; then
1180 echo "Cocoa support $cocoa"
1181fi
bellard97a847b2003-08-10 21:36:04 +00001182echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001183if test "$sdl" != "no" ; then
1184 echo "SDL static link $sdl_static"
1185fi
balrog4d3b6f62008-02-10 16:33:14 +00001186echo "curses support $curses"
bellard67b915a2004-03-31 23:37:16 +00001187echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001188echo "Audio drivers $audio_drv_list"
1189echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001190echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001191echo "VNC TLS support $vnc_tls"
1192if test "$vnc_tls" = "yes" ; then
1193 echo " TLS CFLAGS $vnc_tls_cflags"
1194 echo " TLS LIBS $vnc_tls_libs"
1195fi
aliguori2f9606b2009-03-06 20:27:28 +00001196echo "VNC SASL support $vnc_sasl"
1197if test "$vnc_sasl" = "yes" ; then
1198 echo " SASL CFLAGS $vnc_sasl_cflags"
1199 echo " SASL LIBS $vnc_sasl_libs"
1200fi
blueswir131422552007-04-16 18:27:06 +00001201if test -n "$sparc_cpu"; then
1202 echo "Target Sparc Arch $sparc_cpu"
1203fi
bellard07f4ddb2005-04-23 17:44:28 +00001204echo "kqemu support $kqemu"
aurel322e4d9fb2008-04-08 06:01:02 +00001205echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001206echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001207[ ! -z "$uname_release" ] && \
1208echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001209echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001210echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001211echo "AIO support $aio"
ths77755342008-11-27 15:45:16 +00001212echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001213echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001214echo "fdt support $fdt"
bellard67b915a2004-03-31 23:37:16 +00001215
bellard97a847b2003-08-10 21:36:04 +00001216if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001217echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001218fi
malcd4742de2008-11-29 22:04:31 +00001219if [ -s $TMPSDLLOG ]; then
ths20b40c62007-07-11 23:39:45 +00001220 echo "The error log from compiling the libSDL test is: "
malcd4742de2008-11-29 22:04:31 +00001221 cat $TMPSDLLOG
ths20b40c62007-07-11 23:39:45 +00001222fi
bellard24b55b92005-03-01 22:30:41 +00001223#if test "$sdl_static" = "no"; then
1224# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1225#fi
bellard97a847b2003-08-10 21:36:04 +00001226config_mak="config-host.mak"
1227config_h="config-host.h"
1228
bellard7c1f25b2004-04-22 00:02:08 +00001229#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001230
ths15d9ca02007-07-31 23:07:32 +00001231test -f $config_h && mv $config_h ${config_h}~
1232
bellard97a847b2003-08-10 21:36:04 +00001233echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001234printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001235printf " '%s'" "$0" "$@" >> $config_mak
1236echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001237echo "/* Automatically generated by configure - do not modify */" > $config_h
1238
1239echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001240echo "bindir=\${prefix}$binsuffix" >> $config_mak
1241echo "mandir=\${prefix}$mansuffix" >> $config_mak
1242echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001243echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001244echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001245echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001246echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001247echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001248echo "HOST_CC=$host_cc" >> $config_mak
1249echo "AR=$ar" >> $config_mak
1250echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001251# XXX: only use CFLAGS and LDFLAGS ?
1252# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1253# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001254echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001255echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1256echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1257echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001258echo "CFLAGS=$CFLAGS" >> $config_mak
1259echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001260echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +00001261echo "AIOLIBS=$AIOLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001262case "$cpu" in
1263 i386)
1264 echo "ARCH=i386" >> $config_mak
1265 echo "#define HOST_I386 1" >> $config_h
1266 ;;
1267 x86_64)
1268 echo "ARCH=x86_64" >> $config_mak
1269 echo "#define HOST_X86_64 1" >> $config_h
1270 ;;
1271 alpha)
1272 echo "ARCH=alpha" >> $config_mak
1273 echo "#define HOST_ALPHA 1" >> $config_h
1274 ;;
1275 armv4b)
1276 echo "ARCH=arm" >> $config_mak
1277 echo "#define HOST_ARM 1" >> $config_h
1278 ;;
1279 armv4l)
1280 echo "ARCH=arm" >> $config_mak
1281 echo "#define HOST_ARM 1" >> $config_h
1282 ;;
1283 cris)
1284 echo "ARCH=cris" >> $config_mak
1285 echo "#define HOST_CRIS 1" >> $config_h
1286 ;;
1287 hppa)
1288 echo "ARCH=hppa" >> $config_mak
1289 echo "#define HOST_HPPA 1" >> $config_h
1290 ;;
1291 ia64)
1292 echo "ARCH=ia64" >> $config_mak
1293 echo "#define HOST_IA64 1" >> $config_h
1294 ;;
1295 m68k)
1296 echo "ARCH=m68k" >> $config_mak
1297 echo "#define HOST_M68K 1" >> $config_h
1298 ;;
1299 mips)
1300 echo "ARCH=mips" >> $config_mak
1301 echo "#define HOST_MIPS 1" >> $config_h
1302 ;;
1303 mips64)
1304 echo "ARCH=mips64" >> $config_mak
1305 echo "#define HOST_MIPS64 1" >> $config_h
1306 ;;
malcfdf7ed92009-01-14 18:39:52 +00001307 ppc)
1308 echo "ARCH=ppc" >> $config_mak
1309 echo "#define HOST_PPC 1" >> $config_h
1310 ;;
1311 ppc64)
1312 echo "ARCH=ppc64" >> $config_mak
1313 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001314 ;;
1315 s390)
1316 echo "ARCH=s390" >> $config_mak
1317 echo "#define HOST_S390 1" >> $config_h
1318 ;;
1319 sparc)
1320 echo "ARCH=sparc" >> $config_mak
1321 echo "#define HOST_SPARC 1" >> $config_h
1322 ;;
1323 sparc64)
1324 echo "ARCH=sparc64" >> $config_mak
1325 echo "#define HOST_SPARC64 1" >> $config_h
1326 ;;
1327 *)
1328 echo "Unsupported CPU = $cpu"
1329 exit 1
1330 ;;
1331esac
aliguori03b4fe72008-10-07 19:16:17 +00001332if test "$sparse" = "yes" ; then
1333 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1334 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1335 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1336fi
bellard7d132992003-03-06 23:23:54 +00001337if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001338 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1339 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1340fi
bellardb6853692005-06-05 17:10:39 +00001341echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001342if test "$mingw32" = "yes" ; then
1343 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001344 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001345else
1346 cat > $TMPC << EOF
1347#include <byteswap.h>
1348int main(void) { return bswap_32(0); }
1349EOF
aurel32178baee2008-12-08 18:11:57 +00001350 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001351 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1352 fi
blueswir113606772008-12-05 17:54:09 +00001353 cat > $TMPC << EOF
1354#include <sys/endian.h>
1355#include <sys/types.h>
1356#include <machine/bswap.h>
1357int main(void) { return bswap32(0); }
1358EOF
aurel32178baee2008-12-08 18:11:57 +00001359 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001360 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1361 fi
bellard67b915a2004-03-31 23:37:16 +00001362fi
blueswir1128ab2f2008-08-15 18:33:42 +00001363
1364if [ "$openbsd" = "yes" ] ; then
1365 echo "#define ENOTSUP 4096" >> $config_h
1366fi
1367
bellard83fb7ad2004-07-05 21:25:26 +00001368if test "$darwin" = "yes" ; then
1369 echo "CONFIG_DARWIN=yes" >> $config_mak
1370 echo "#define CONFIG_DARWIN 1" >> $config_h
1371fi
malcb29fe3e2008-11-18 01:42:22 +00001372
1373if test "$aix" = "yes" ; then
1374 echo "CONFIG_AIX=yes" >> $config_mak
1375 echo "#define CONFIG_AIX 1" >> $config_h
1376fi
1377
bellardec530c82006-04-25 22:36:06 +00001378if test "$solaris" = "yes" ; then
1379 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001380 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001381 if test "$needs_libsunmath" = "yes" ; then
1382 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1383 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1384 fi
bellardec530c82006-04-25 22:36:06 +00001385fi
blueswir131422552007-04-16 18:27:06 +00001386if test -n "$sparc_cpu"; then
1387 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1388 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1389fi
bellard67b915a2004-03-31 23:37:16 +00001390if test "$gdbstub" = "yes" ; then
1391 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1392 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1393fi
bellard97a847b2003-08-10 21:36:04 +00001394if test "$gprof" = "yes" ; then
1395 echo "TARGET_GPROF=yes" >> $config_mak
1396 echo "#define HAVE_GPROF 1" >> $config_h
1397fi
1398if test "$static" = "yes" ; then
1399 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001400 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001401fi
bellard05c2a3e2006-02-08 22:39:17 +00001402if test $profiler = "yes" ; then
1403 echo "#define CONFIG_PROFILER 1" >> $config_h
1404fi
bellardc20709a2004-04-21 23:27:19 +00001405if test "$slirp" = "yes" ; then
1406 echo "CONFIG_SLIRP=yes" >> $config_mak
1407 echo "#define CONFIG_SLIRP 1" >> $config_h
1408fi
ths8a16d272008-07-19 09:56:24 +00001409if test "$vde" = "yes" ; then
1410 echo "CONFIG_VDE=yes" >> $config_mak
1411 echo "#define CONFIG_VDE 1" >> $config_h
1412 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1413fi
malc0c58ac12008-06-25 21:04:05 +00001414for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001415 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001416 echo "$def=yes" >> $config_mak
1417 echo "#define $def 1" >> $config_h
1418done
1419echo "#define AUDIO_DRIVERS \\" >> $config_h
1420for drv in $audio_drv_list; do
1421 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001422 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001423 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001424 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001425 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1426 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001427 elif test "$drv" = "oss"; then
1428 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001429 fi
1430done
1431echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001432if test "$mixemu" = "yes" ; then
1433 echo "CONFIG_MIXEMU=yes" >> $config_mak
1434 echo "#define CONFIG_MIXEMU 1" >> $config_h
1435fi
ths8d5d2d42007-08-25 01:37:51 +00001436if test "$vnc_tls" = "yes" ; then
1437 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1438 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1439 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1440 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1441fi
aliguori2f9606b2009-03-06 20:27:28 +00001442if test "$vnc_sasl" = "yes" ; then
1443 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1444 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1445 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1446 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1447fi
aliguori76655d62009-03-06 20:27:37 +00001448if test "$fnmatch" = "yes" ; then
1449 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1450fi
pbrookb1a550a2006-04-16 13:28:56 +00001451qemu_version=`head $source_path/VERSION`
1452echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001453echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001454
1455echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001456if [ "$source_path_used" = "yes" ]; then
1457 echo "VPATH=$source_path" >> $config_mak
1458fi
bellard97a847b2003-08-10 21:36:04 +00001459echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001460if [ "$build_docs" = "yes" ] ; then
1461 echo "BUILD_DOCS=yes" >> $config_mak
1462fi
bellard49ecc3f2007-11-07 19:25:15 +00001463if test "$static" = "yes"; then
1464 sdl1=$sdl_static
1465else
1466 sdl1=$sdl
1467fi
1468if test "$sdl1" = "yes" ; then
1469 echo "#define CONFIG_SDL 1" >> $config_h
1470 echo "CONFIG_SDL=yes" >> $config_mak
1471 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1472 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001473 elif test "$sdl_x11" = "yes" ; then
1474 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001475 else
1476 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1477 fi
1478 if [ "${aa}" = "yes" ] ; then
1479 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1480 else
1481 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1482 fi
1483fi
1484if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001485 echo "#define CONFIG_COCOA 1" >> $config_h
1486 echo "CONFIG_COCOA=yes" >> $config_mak
1487fi
1488if test "$curses" = "yes" ; then
1489 echo "#define CONFIG_CURSES 1" >> $config_h
1490 echo "CONFIG_CURSES=yes" >> $config_mak
1491 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001492fi
aurel322e4d9fb2008-04-08 06:01:02 +00001493if test "$brlapi" = "yes" ; then
1494 echo "CONFIG_BRLAPI=yes" >> $config_mak
1495 echo "#define CONFIG_BRLAPI 1" >> $config_h
1496 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1497fi
balrogfb599c92008-09-28 23:49:55 +00001498if test "$bluez" = "yes" ; then
1499 echo "CONFIG_BLUEZ=yes" >> $config_mak
1500 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1501 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1502 echo "#define CONFIG_BLUEZ 1" >> $config_h
1503fi
blueswir1414f0da2008-08-15 18:20:52 +00001504if test "$aio" = "yes" ; then
1505 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001506 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001507fi
ths77755342008-11-27 15:45:16 +00001508if test "$blobs" = "yes" ; then
1509 echo "INSTALL_BLOBS=yes" >> $config_mak
1510fi
aliguoribf9298b2008-12-05 20:05:26 +00001511if test "$iovec" = "yes" ; then
1512 echo "#define HAVE_IOVEC 1" >> $config_h
1513fi
aurel32f652e6a2008-12-16 10:43:48 +00001514if test "$fdt" = "yes" ; then
1515 echo "#define HAVE_FDT 1" >> $config_h
1516 echo "FDT_LIBS=-lfdt" >> $config_mak
1517fi
bellard97a847b2003-08-10 21:36:04 +00001518
bellard83fb7ad2004-07-05 21:25:26 +00001519# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001520if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001521 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001522 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001523 echo "#define _BSD 1" >> $config_h
1524fi
1525
pbrookc5937222006-05-14 11:30:38 +00001526echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1527
blueswir168063642008-11-22 21:03:55 +00001528# USB host support
1529case "$usb" in
1530linux)
1531 echo "HOST_USB=linux" >> $config_mak
1532;;
1533bsd)
1534 echo "HOST_USB=bsd" >> $config_mak
1535;;
1536*)
1537 echo "HOST_USB=stub" >> $config_mak
1538;;
1539esac
1540
pbrookc39e3332007-09-22 16:49:14 +00001541tools=
1542if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1543 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001544 if [ "$linux" = "yes" ] ; then
1545 tools="qemu-nbd\$(EXESUF) $tools"
1546 fi
pbrookc39e3332007-09-22 16:49:14 +00001547fi
1548echo "TOOLS=$tools" >> $config_mak
1549
ths15d9ca02007-07-31 23:07:32 +00001550test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1551
bellard1d14ffa2005-10-30 18:58:22 +00001552for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001553target_dir="$target"
1554config_mak=$target_dir/config.mak
1555config_h=$target_dir/config.h
1556target_cpu=`echo $target | cut -d '-' -f 1`
1557target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001558[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001559[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1560[ "$target_cpu" = "mips" ] && target_bigendian=yes
1561[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1562[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001563[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001564[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001565[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001566[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001567[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001568[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1569[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1570[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001571target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001572target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001573target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001574target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001575target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001576case "$target" in
1577 ${target_cpu}-softmmu)
1578 target_softmmu="yes"
1579 ;;
1580 ${target_cpu}-linux-user)
1581 target_user_only="yes"
1582 target_linux_user="yes"
1583 ;;
1584 ${target_cpu}-darwin-user)
1585 target_user_only="yes"
1586 target_darwin_user="yes"
1587 ;;
blueswir184778502008-10-26 20:33:16 +00001588 ${target_cpu}-bsd-user)
1589 target_user_only="yes"
1590 target_bsd_user="yes"
1591 ;;
pbrook9e407a82007-05-26 16:38:53 +00001592 *)
1593 echo "ERROR: Target '$target' not recognised"
1594 exit 1
1595 ;;
1596esac
ths831b7822007-01-18 20:06:33 +00001597
bellard97ccc682005-07-02 13:32:17 +00001598if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +00001599 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +00001600 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +00001601 echo "To build QEMU without graphical output configure with --disable-gfx-check"
balrog4d3b6f62008-02-10 16:33:14 +00001602 echo "Note that this will disable all output from the virtual graphics card"
1603 echo "except through VNC or curses."
bellard97ccc682005-07-02 13:32:17 +00001604 exit 1;
1605fi
1606
bellard7c1f25b2004-04-22 00:02:08 +00001607#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001608
ths15d9ca02007-07-31 23:07:32 +00001609test -f $config_h && mv $config_h ${config_h}~
1610
bellard97a847b2003-08-10 21:36:04 +00001611mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001612mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001613mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001614if 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 +00001615 mkdir -p $target_dir/nwfpe
1616fi
1617
bellardec530c82006-04-25 22:36:06 +00001618#
1619# don't use ln -sf as not all "ln -sf" over write the file/link
1620#
1621rm -f $target_dir/Makefile
1622ln -s $source_path/Makefile.target $target_dir/Makefile
1623
bellard97a847b2003-08-10 21:36:04 +00001624
1625echo "# Automatically generated by configure - do not modify" > $config_mak
1626echo "/* Automatically generated by configure - do not modify */" > $config_h
1627
1628
1629echo "include ../config-host.mak" >> $config_mak
1630echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001631
pbrooke5fe0c52006-06-11 13:32:59 +00001632bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001633elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001634target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001635interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1636echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001637gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001638
aliguori5985ece2008-11-05 19:59:25 +00001639# Make sure the target and host cpus are compatible
1640if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
malcfdf7ed92009-01-14 18:39:52 +00001641 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001642 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1643 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001644 kvm="no"
1645fi
1646# Disable KVM for linux-user
1647if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1648 kvm="no"
1649fi
1650
aurel322408a522008-04-20 20:19:44 +00001651case "$target_cpu" in
1652 i386)
1653 echo "TARGET_ARCH=i386" >> $config_mak
1654 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1655 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001656 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001657 then
1658 echo "#define USE_KQEMU 1" >> $config_h
1659 fi
aliguori7ba1e612008-11-05 16:04:33 +00001660 if test "$kvm" = "yes" ; then
1661 echo "CONFIG_KVM=yes" >> $config_mak
1662 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001663 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001664 fi
aurel322408a522008-04-20 20:19:44 +00001665 ;;
1666 x86_64)
1667 echo "TARGET_ARCH=x86_64" >> $config_mak
1668 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1669 echo "#define TARGET_I386 1" >> $config_h
1670 echo "#define TARGET_X86_64 1" >> $config_h
1671 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1672 then
1673 echo "#define USE_KQEMU 1" >> $config_h
1674 fi
aliguori7ba1e612008-11-05 16:04:33 +00001675 if test "$kvm" = "yes" ; then
1676 echo "CONFIG_KVM=yes" >> $config_mak
1677 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1678 echo "#define CONFIG_KVM 1" >> $config_h
1679 fi
aurel322408a522008-04-20 20:19:44 +00001680 ;;
1681 alpha)
1682 echo "TARGET_ARCH=alpha" >> $config_mak
1683 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1684 echo "#define TARGET_ALPHA 1" >> $config_h
1685 ;;
1686 arm|armeb)
1687 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001688 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1689 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001690 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001691 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001692 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00001693 ;;
1694 cris)
1695 echo "TARGET_ARCH=cris" >> $config_mak
1696 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1697 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00001698 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001699 ;;
1700 m68k)
1701 echo "TARGET_ARCH=m68k" >> $config_mak
1702 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1703 echo "#define TARGET_M68K 1" >> $config_h
1704 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001705 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00001706 ;;
1707 mips|mipsel)
1708 echo "TARGET_ARCH=mips" >> $config_mak
1709 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1710 echo "#define TARGET_MIPS 1" >> $config_h
1711 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1712 ;;
1713 mipsn32|mipsn32el)
1714 echo "TARGET_ARCH=mipsn32" >> $config_mak
1715 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1716 echo "#define TARGET_MIPS 1" >> $config_h
1717 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1718 ;;
1719 mips64|mips64el)
1720 echo "TARGET_ARCH=mips64" >> $config_mak
1721 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1722 echo "#define TARGET_MIPS 1" >> $config_h
1723 echo "#define TARGET_MIPS64 1" >> $config_h
1724 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1725 ;;
1726 ppc)
1727 echo "TARGET_ARCH=ppc" >> $config_mak
1728 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1729 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001730 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001731 ;;
1732 ppcemb)
1733 echo "TARGET_ARCH=ppcemb" >> $config_mak
1734 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1735 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1736 echo "#define TARGET_PPC 1" >> $config_h
1737 echo "#define TARGET_PPCEMB 1" >> $config_h
aurel32d76d1652008-12-16 10:43:58 +00001738 if test "$kvm" = "yes" ; then
1739 echo "CONFIG_KVM=yes" >> $config_mak
1740 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1741 echo "#define CONFIG_KVM 1" >> $config_h
1742 fi
aurel32c8b35322009-01-24 15:07:34 +00001743 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001744 ;;
1745 ppc64)
1746 echo "TARGET_ARCH=ppc64" >> $config_mak
1747 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1748 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1749 echo "#define TARGET_PPC 1" >> $config_h
1750 echo "#define TARGET_PPC64 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001751 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001752 ;;
1753 ppc64abi32)
1754 echo "TARGET_ARCH=ppc64" >> $config_mak
1755 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1756 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1757 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1758 echo "#define TARGET_PPC 1" >> $config_h
1759 echo "#define TARGET_PPC64 1" >> $config_h
1760 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001761 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001762 ;;
1763 sh4|sh4eb)
1764 echo "TARGET_ARCH=sh4" >> $config_mak
1765 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1766 echo "#define TARGET_SH4 1" >> $config_h
1767 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001768 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001769 ;;
1770 sparc)
1771 echo "TARGET_ARCH=sparc" >> $config_mak
1772 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1773 echo "#define TARGET_SPARC 1" >> $config_h
1774 ;;
1775 sparc64)
1776 echo "TARGET_ARCH=sparc64" >> $config_mak
1777 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1778 echo "#define TARGET_SPARC 1" >> $config_h
1779 echo "#define TARGET_SPARC64 1" >> $config_h
1780 elfload32="yes"
1781 ;;
1782 sparc32plus)
1783 echo "TARGET_ARCH=sparc64" >> $config_mak
1784 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1785 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1786 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1787 echo "#define TARGET_SPARC 1" >> $config_h
1788 echo "#define TARGET_SPARC64 1" >> $config_h
1789 echo "#define TARGET_ABI32 1" >> $config_h
1790 ;;
1791 *)
1792 echo "Unsupported target CPU"
1793 exit 1
1794 ;;
1795esac
bellardde83cd02003-06-15 20:25:43 +00001796if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001797 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1798 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1799fi
1800if test "$target_softmmu" = "yes" ; then
1801 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1802 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00001803fi
bellard997344f2003-10-27 21:10:39 +00001804if test "$target_user_only" = "yes" ; then
1805 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1806 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1807fi
ths831b7822007-01-18 20:06:33 +00001808if test "$target_linux_user" = "yes" ; then
1809 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1810 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1811fi
1812if test "$target_darwin_user" = "yes" ; then
1813 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1814 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1815fi
pbrook56aebc82008-10-11 17:55:29 +00001816list=""
1817if test ! -z "$gdb_xml_files" ; then
1818 for x in $gdb_xml_files; do
1819 list="$list $source_path/gdb-xml/$x"
1820 done
1821fi
1822echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00001823
aurel320938cda2008-04-11 21:36:06 +00001824if test "$target_cpu" = "arm" \
1825 -o "$target_cpu" = "armeb" \
1826 -o "$target_cpu" = "m68k" \
1827 -o "$target_cpu" = "mips" \
1828 -o "$target_cpu" = "mipsel" \
1829 -o "$target_cpu" = "mipsn32" \
1830 -o "$target_cpu" = "mipsn32el" \
1831 -o "$target_cpu" = "mips64" \
1832 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00001833 -o "$target_cpu" = "ppc" \
1834 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00001835 -o "$target_cpu" = "ppc64abi32" \
1836 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00001837 -o "$target_cpu" = "sparc" \
1838 -o "$target_cpu" = "sparc64" \
1839 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00001840 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1841 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1842fi
pbrooke5fe0c52006-06-11 13:32:59 +00001843if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1844 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1845 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1846fi
pbrookbd0c5662008-05-29 14:34:11 +00001847if test "$target_user_only" = "yes" \
1848 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1849 echo "#define USE_NPTL 1" >> $config_h
1850fi
blueswir1cb33da52007-10-09 16:34:29 +00001851# 32 bit ELF loader in addition to native 64 bit loader?
1852if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1853 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1854 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1855fi
blueswir184778502008-10-26 20:33:16 +00001856if test "$target_bsd_user" = "yes" ; then
1857 echo "CONFIG_BSD_USER=yes" >> $config_mak
1858 echo "#define CONFIG_BSD_USER 1" >> $config_h
1859fi
bellard5b0753e2005-03-01 21:37:28 +00001860
ths15d9ca02007-07-31 23:07:32 +00001861test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1862
bellard97a847b2003-08-10 21:36:04 +00001863done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00001864
1865# build tree in object directory if source path is different from current one
1866if test "$source_path_used" = "yes" ; then
bellard49ecc3f2007-11-07 19:25:15 +00001867 DIRS="tests tests/cris slirp audio"
bellard7d132992003-03-06 23:23:54 +00001868 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00001869 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00001870 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00001871 for dir in $DIRS ; do
1872 mkdir -p $dir
1873 done
bellardec530c82006-04-25 22:36:06 +00001874 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00001875 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00001876 rm -f $f
1877 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00001878 done
1879fi