blob: 412828e9bae6d0b7346c2c7667846828e2bc5ddf [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"
aliguori1625af82009-04-05 17:41:02 +0000157strip_opt="yes"
bellard7d132992003-03-06 23:23:54 +0000158bigendian="no"
bellard67b915a2004-03-31 23:37:16 +0000159mingw32="no"
160EXESUF=""
161gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +0000162slirp="yes"
aliguorie0e6c8c02008-07-23 18:14:33 +0000163vde="yes"
bellard102a52e2004-11-14 19:57:29 +0000164fmod_lib=""
165fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +0000166oss_lib=""
ths8d5d2d42007-08-25 01:37:51 +0000167vnc_tls="yes"
aliguori2f9606b2009-03-06 20:27:28 +0000168vnc_sasl="yes"
pbrookb1a550a2006-04-16 13:28:56 +0000169bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000170linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000171solaris="no"
bellardc9ec1fe2005-02-10 21:55:30 +0000172kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +0000173profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000174cocoa="no"
bellard97ccc682005-07-02 13:32:17 +0000175check_gfx="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000176softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000177linux_user="no"
178darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000179bsd_user="no"
pbrookcc8ae6d2006-04-23 17:57:59 +0000180build_docs="no"
pbrookc5937222006-05-14 11:30:38 +0000181uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000182curses="yes"
blueswir1414f0da2008-08-15 18:20:52 +0000183aio="yes"
pbrookbd0c5662008-05-29 14:34:11 +0000184nptl="yes"
malc8ff9cbf2008-06-23 18:33:30 +0000185mixemu="no"
balrogfb599c92008-09-28 23:49:55 +0000186bluez="yes"
aliguori7ba1e612008-11-05 16:04:33 +0000187kvm="yes"
aliguorieac30262008-11-05 16:28:56 +0000188kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000189aix="no"
ths77755342008-11-27 15:45:16 +0000190blobs="yes"
aurel32f652e6a2008-12-16 10:43:48 +0000191fdt="yes"
aliguori5368a422009-03-03 17:37:21 +0000192sdl_x11="no"
bellard7d132992003-03-06 23:23:54 +0000193
194# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000195if check_define __linux__ ; then
196 targetos="Linux"
197elif check_define _WIN32 ; then
198 targetos='MINGW32'
199else
200 targetos=`uname -s`
201fi
bellard7d132992003-03-06 23:23:54 +0000202case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000203CYGWIN*)
204mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000205OS_CFLAGS="-mno-cygwin"
thsdb8d7dd2007-07-12 09:29:18 +0000206if [ "$cpu" = "i386" ] ; then
207 kqemu="yes"
208fi
malcc2de5c92008-06-28 19:13:06 +0000209audio_possible_drivers="sdl"
bellardc326e0a2005-04-23 18:30:28 +0000210;;
bellard67b915a2004-03-31 23:37:16 +0000211MINGW32*)
212mingw32="yes"
thsdb8d7dd2007-07-12 09:29:18 +0000213if [ "$cpu" = "i386" ] ; then
214 kqemu="yes"
215fi
malcc2de5c92008-06-28 19:13:06 +0000216audio_possible_drivers="dsound sdl fmod"
bellard67b915a2004-03-31 23:37:16 +0000217;;
ths5c40d2b2007-06-23 16:03:36 +0000218GNU/kFreeBSD)
malc0c58ac12008-06-25 21:04:05 +0000219audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000220audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000221if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
222 kqemu="yes"
223fi
224;;
bellard7d3505c2004-05-12 19:32:15 +0000225FreeBSD)
226bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000227audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000228audio_possible_drivers="oss sdl esd pa"
bellarde99f9062005-07-28 21:45:38 +0000229if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000230 kqemu="yes"
231fi
bellard7d3505c2004-05-12 19:32:15 +0000232;;
blueswir1c5e97232009-03-07 20:06:23 +0000233DragonFly)
234bsd="yes"
235audio_drv_list="oss"
236audio_possible_drivers="oss sdl esd pa"
237if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
238 kqemu="yes"
239fi
240aio="no"
241;;
bellard7d3505c2004-05-12 19:32:15 +0000242NetBSD)
243bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000244audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000245audio_possible_drivers="oss sdl esd"
blueswir18ef92a82008-11-22 20:24:29 +0000246oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000247;;
248OpenBSD)
249bsd="yes"
blueswir1128ab2f2008-08-15 18:33:42 +0000250openbsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000251audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000252audio_possible_drivers="oss sdl esd"
blueswir12f6a1ab2008-08-21 18:00:53 +0000253oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000254;;
bellard83fb7ad2004-07-05 21:25:26 +0000255Darwin)
256bsd="yes"
257darwin="yes"
aliguori1b0f9cc2009-01-26 15:37:40 +0000258# 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 +0000259if [ "$cpu" = "i386" ] ; then
260 is_x86_64=`sysctl -n hw.optional.x86_64`
261 [ "$is_x86_64" = "1" ] && cpu=x86_64
aliguori1b0f9cc2009-01-26 15:37:40 +0000262fi
263if [ "$cpu" = "x86_64" ] ; then
264 OS_CFLAGS="-arch x86_64"
265 LDFLAGS="-arch x86_64"
266else
267 OS_CFLAGS="-mdynamic-no-pic"
268fi
ths831b7822007-01-18 20:06:33 +0000269darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000270cocoa="yes"
malc0c58ac12008-06-25 21:04:05 +0000271audio_drv_list="coreaudio"
malcc2de5c92008-06-28 19:13:06 +0000272audio_possible_drivers="coreaudio sdl fmod"
thsc2c59c32008-01-08 00:00:20 +0000273OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
bellard83fb7ad2004-07-05 21:25:26 +0000274;;
bellardec530c82006-04-25 22:36:06 +0000275SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000276 solaris="yes"
277 make="gmake"
278 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000279 needs_libsunmath="no"
thsc2b84fa2007-02-10 23:21:21 +0000280 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000281 # have to select again, because `uname -m` returns i86pc
282 # even on an x86_64 box.
283 solariscpu=`isainfo -k`
284 if test "${solariscpu}" = "amd64" ; then
285 cpu="x86_64"
286 fi
thsc2b84fa2007-02-10 23:21:21 +0000287 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000288 if test "$solarisrev" -le 9 ; then
289 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
290 needs_libsunmath="yes"
291 else
292 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
293 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
294 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
295 echo "Studio 11 can be downloaded from www.sun.com."
296 exit 1
297 fi
298 fi
299 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000300 kqemu="yes"
301 fi
ths86b2bd92007-02-11 00:31:33 +0000302 fi
ths6b4d2ba2007-05-13 18:02:43 +0000303 if test -f /usr/include/sys/soundcard.h ; then
malc0c58ac12008-06-25 21:04:05 +0000304 audio_drv_list="oss"
ths6b4d2ba2007-05-13 18:02:43 +0000305 fi
malcc2de5c92008-06-28 19:13:06 +0000306 audio_possible_drivers="oss sdl"
ths86b2bd92007-02-11 00:31:33 +0000307;;
malcb29fe3e2008-11-18 01:42:22 +0000308AIX)
309aix="yes"
310make="gmake"
311;;
bellard1d14ffa2005-10-30 18:58:22 +0000312*)
malc0c58ac12008-06-25 21:04:05 +0000313audio_drv_list="oss"
malcb8e59f12008-07-02 21:03:08 +0000314audio_possible_drivers="oss alsa sdl esd pa"
bellard5327cf42005-01-10 23:18:50 +0000315linux="yes"
ths831b7822007-01-18 20:06:33 +0000316linux_user="yes"
blueswir168063642008-11-22 21:03:55 +0000317usb="linux"
bellard07f4ddb2005-04-23 17:44:28 +0000318if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000319 kqemu="yes"
malcc2de5c92008-06-28 19:13:06 +0000320 audio_possible_drivers="$audio_possible_drivers fmod"
bellardc9ec1fe2005-02-10 21:55:30 +0000321fi
bellardfb065182004-11-09 23:09:44 +0000322;;
bellard7d132992003-03-06 23:23:54 +0000323esac
324
bellard7d3505c2004-05-12 19:32:15 +0000325if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000326 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000327 make="gmake"
blueswir168063642008-11-22 21:03:55 +0000328 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000329 fi
blueswir184778502008-10-26 20:33:16 +0000330 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000331fi
332
bellard7d132992003-03-06 23:23:54 +0000333# find source path
pbrookad064842006-04-16 12:41:07 +0000334source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000335source_path_used="no"
336workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000337if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000338 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000339else
340 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000341fi
pbrook724db112008-02-03 19:20:13 +0000342[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000343
bellard85aa5182007-11-11 20:17:03 +0000344werror="no"
bellard0d1e2392007-11-11 20:24:30 +0000345# generate compile errors on warnings for development builds
346#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
347#werror="yes";
348#fi
bellard85aa5182007-11-11 20:17:03 +0000349
bellard7d132992003-03-06 23:23:54 +0000350for opt do
pbrooka46e4032006-04-29 23:05:22 +0000351 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000352 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000353 --help|-h) show_help=yes
354 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000355 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000356 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000357 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000358 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000359 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000360 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000361 ;;
aliguoriac0df512008-12-29 17:14:15 +0000362 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000363 ;;
aliguoriac0df512008-12-29 17:14:15 +0000364 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000365 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000366 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000367 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000368 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000369 ;;
pbrook6a882642006-04-17 13:57:12 +0000370 --install=*) install="$optarg"
371 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000372 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000373 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000374 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000375 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000376 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000377 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000378 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000379 ;;
bellard7d132992003-03-06 23:23:54 +0000380 --enable-gprof) gprof="yes"
381 ;;
bellard43ce4df2003-06-09 19:53:12 +0000382 --static) static="yes"
383 ;;
bellard97a847b2003-08-10 21:36:04 +0000384 --disable-sdl) sdl="no"
385 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000386 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000387 ;;
malcc2de5c92008-06-28 19:13:06 +0000388 --fmod-inc=*) fmod_inc="$optarg"
389 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000390 --oss-lib=*) oss_lib="$optarg"
391 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000392 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000393 ;;
394 --audio-drv-list=*) audio_drv_list="$optarg"
395 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000396 --enable-sparse) sparse="yes"
397 ;;
398 --disable-sparse) sparse="no"
399 ;;
aliguori1625af82009-04-05 17:41:02 +0000400 --disable-strip) strip_opt="no"
401 ;;
ths8d5d2d42007-08-25 01:37:51 +0000402 --disable-vnc-tls) vnc_tls="no"
403 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000404 --disable-vnc-sasl) vnc_sasl="no"
405 ;;
bellard443f1372004-06-04 11:13:20 +0000406 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000407 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000408 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000409 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000410 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000411 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000412 --disable-brlapi) brlapi="no"
413 ;;
balrogfb599c92008-09-28 23:49:55 +0000414 --disable-bluez) bluez="no"
415 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000416 --disable-kvm) kvm="no"
417 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000418 --enable-profiler) profiler="yes"
419 ;;
malcc2de5c92008-06-28 19:13:06 +0000420 --enable-cocoa)
421 cocoa="yes" ;
422 sdl="no" ;
423 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000424 ;;
bellard97ccc682005-07-02 13:32:17 +0000425 --disable-gfx-check) check_gfx="no"
426 ;;
pbrookcad25d62006-03-19 16:31:11 +0000427 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000428 ;;
pbrookcad25d62006-03-19 16:31:11 +0000429 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000430 ;;
ths831b7822007-01-18 20:06:33 +0000431 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000432 ;;
ths831b7822007-01-18 20:06:33 +0000433 --enable-linux-user) linux_user="yes"
434 ;;
435 --disable-darwin-user) darwin_user="no"
436 ;;
437 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000438 ;;
blueswir184778502008-10-26 20:33:16 +0000439 --disable-bsd-user) bsd_user="no"
440 ;;
441 --enable-bsd-user) bsd_user="yes"
442 ;;
pbrookc5937222006-05-14 11:30:38 +0000443 --enable-uname-release=*) uname_release="$optarg"
444 ;;
blueswir131422552007-04-16 18:27:06 +0000445 --sparc_cpu=*)
446 sparc_cpu="$optarg"
447 case $sparc_cpu in
448 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
449 target_cpu="sparc"; cpu="sparc" ;;
450 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
451 target_cpu="sparc"; cpu="sparc" ;;
452 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
453 target_cpu="sparc64"; cpu="sparc64" ;;
454 *) echo "undefined SPARC architecture. Exiting";exit 1;;
455 esac
456 ;;
bellard85aa5182007-11-11 20:17:03 +0000457 --enable-werror) werror="yes"
458 ;;
459 --disable-werror) werror="no"
460 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000461 --disable-curses) curses="no"
462 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000463 --disable-nptl) nptl="no"
464 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000465 --enable-mixemu) mixemu="yes"
466 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000467 --disable-aio) aio="no"
468 ;;
ths77755342008-11-27 15:45:16 +0000469 --disable-blobs) blobs="no"
470 ;;
aliguorieac30262008-11-05 16:28:56 +0000471 --kerneldir=*) kerneldir="$optarg"
472 ;;
balrog7f1559c2007-11-17 10:24:32 +0000473 *) echo "ERROR: unknown option $opt"; show_help="yes"
474 ;;
bellard7d132992003-03-06 23:23:54 +0000475 esac
476done
477
ths6f30fa82007-01-05 01:00:47 +0000478# default flags for all hosts
blueswir1ac41a622008-09-14 06:46:31 +0000479CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
blueswir1e0e36fe2008-12-07 19:16:27 +0000480CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
ths6f30fa82007-01-05 01:00:47 +0000481LDFLAGS="$LDFLAGS -g"
bellard85aa5182007-11-11 20:17:03 +0000482if test "$werror" = "yes" ; then
483CFLAGS="$CFLAGS -Werror"
484fi
ths6f30fa82007-01-05 01:00:47 +0000485
blueswir1d2c7c9b2008-11-01 14:50:20 +0000486if test "$solaris" = "no" ; then
487 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
488 LDFLAGS="$LDFLAGS -Wl,--warn-common"
489 fi
blueswir149237ac2008-09-17 19:05:19 +0000490fi
491
blueswir131422552007-04-16 18:27:06 +0000492#
493# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
494# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
495#
bellard40293e52008-01-31 11:32:10 +0000496case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000497 sparc) if test -z "$sparc_cpu" ; then
498 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
499 ARCH_LDFLAGS="-m32"
500 else
501 ARCH_CFLAGS="${SP_CFLAGS}"
502 ARCH_LDFLAGS="${SP_LDFLAGS}"
503 fi
blueswir1762e8232009-04-04 09:21:28 +0000504 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
505 if test "$solaris" = "no" ; then
506 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
507 fi
blueswir131422552007-04-16 18:27:06 +0000508 ;;
509 sparc64) if test -z "$sparc_cpu" ; then
510 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
511 ARCH_LDFLAGS="-m64"
512 else
513 ARCH_CFLAGS="${SP_CFLAGS}"
514 ARCH_LDFLAGS="${SP_LDFLAGS}"
515 fi
blueswir1762e8232009-04-04 09:21:28 +0000516 if test "$solaris" = "no" ; then
517 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
518 else
519 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
520 fi
blueswir131422552007-04-16 18:27:06 +0000521 ;;
ths76d83bd2007-11-18 21:22:10 +0000522 s390)
523 ARCH_CFLAGS="-march=z900"
524 ;;
bellard40293e52008-01-31 11:32:10 +0000525 i386)
526 ARCH_CFLAGS="-m32"
527 ARCH_LDFLAGS="-m32"
528 ;;
529 x86_64)
530 ARCH_CFLAGS="-m64"
531 ARCH_LDFLAGS="-m64"
532 ;;
blueswir131422552007-04-16 18:27:06 +0000533esac
534
pbrookaf5db582006-04-08 14:26:41 +0000535if test x"$show_help" = x"yes" ; then
536cat << EOF
537
538Usage: configure [options]
539Options: [defaults in brackets after descriptions]
540
541EOF
542echo "Standard options:"
543echo " --help print this message"
544echo " --prefix=PREFIX install in PREFIX [$prefix]"
545echo " --interp-prefix=PREFIX where to find shared libraries, etc."
546echo " use %M for cpu name [$interp_prefix]"
547echo " --target-list=LIST set target list [$target_list]"
548echo ""
549echo "kqemu kernel acceleration support:"
550echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000551echo ""
552echo "Advanced options (experts only):"
553echo " --source-path=PATH path of source code [$source_path]"
554echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
555echo " --cc=CC use C compiler CC [$cc]"
556echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
557echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000558echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000559echo " --static enable static build [$static]"
aliguori890b1652008-10-07 21:22:41 +0000560echo " --enable-sparse enable sparse checker"
561echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000562echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000563echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000564echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000565echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000566echo " --audio-drv-list=LIST set audio drivers list:"
567echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000568echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
569echo " Available cards: $audio_possible_cards"
malc8ff9cbf2008-06-23 18:33:30 +0000570echo " --enable-mixemu enable mixer emulation"
aurel322e4d9fb2008-04-08 06:01:02 +0000571echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000572echo " --disable-vnc-tls disable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000573echo " --disable-vnc-sasl disable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000574echo " --disable-curses disable curses output"
balrogfb599c92008-09-28 23:49:55 +0000575echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000576echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000577echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000578echo " --enable-system enable all system emulation targets"
579echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000580echo " --enable-linux-user enable all linux usermode emulation targets"
581echo " --disable-linux-user disable all linux usermode emulation targets"
582echo " --enable-darwin-user enable all darwin usermode emulation targets"
583echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000584echo " --enable-bsd-user enable all BSD usermode emulation targets"
585echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000586echo " --fmod-lib path to FMOD library"
587echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000588echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000589echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000590echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000591echo " --disable-vde disable support for vde network"
blueswir1414f0da2008-08-15 18:20:52 +0000592echo " --disable-aio disable AIO support"
ths77755342008-11-27 15:45:16 +0000593echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000594echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000595echo ""
ths5bf08932006-12-23 00:33:26 +0000596echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000597exit 1
598fi
599
bellard67b915a2004-03-31 23:37:16 +0000600if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000601 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000602 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000603 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000604 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000605 bsd_user="no"
aliguori49dc7682009-03-08 16:26:59 +0000606 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
aliguoricd01b4a2008-08-21 19:25:45 +0000607fi
608
aliguori03b4fe72008-10-07 19:16:17 +0000609if test ! -x "$(which cgcc 2>/dev/null)"; then
610 sparse="no"
611fi
612
bellardec530c82006-04-25 22:36:06 +0000613#
614# Solaris specific configure tool chain decisions
615#
616if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000617 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
618 if test -z "$solinst" ; then
619 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
620 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
621 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
622 exit 1
623 fi
624 if test "$solinst" = "/usr/sbin/install" ; then
625 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
626 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
627 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
628 exit 1
629 fi
bellardec530c82006-04-25 22:36:06 +0000630 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
631 if test -z "$sol_ar" ; then
632 echo "Error: No path includes ar"
633 if test -f /usr/ccs/bin/ar ; then
634 echo "Add /usr/ccs/bin to your path and rerun configure"
635 fi
636 exit 1
637 fi
ths5fafdf22007-09-16 21:08:06 +0000638fi
bellardec530c82006-04-25 22:36:06 +0000639
640
bellard5327cf42005-01-10 23:18:50 +0000641if test -z "$target_list" ; then
642# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000643 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000644 target_list="\
645i386-softmmu \
646x86_64-softmmu \
647arm-softmmu \
648cris-softmmu \
649m68k-softmmu \
650mips-softmmu \
651mipsel-softmmu \
652mips64-softmmu \
653mips64el-softmmu \
654ppc-softmmu \
655ppcemb-softmmu \
656ppc64-softmmu \
657sh4-softmmu \
658sh4eb-softmmu \
659sparc-softmmu \
660"
pbrook0a8e90f2006-03-19 14:54:16 +0000661 fi
bellard5327cf42005-01-10 23:18:50 +0000662# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000663 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000664 target_list="${target_list}\
665i386-linux-user \
666x86_64-linux-user \
667alpha-linux-user \
668arm-linux-user \
669armeb-linux-user \
670cris-linux-user \
671m68k-linux-user \
672mips-linux-user \
673mipsel-linux-user \
674ppc-linux-user \
675ppc64-linux-user \
676ppc64abi32-linux-user \
677sh4-linux-user \
678sh4eb-linux-user \
679sparc-linux-user \
680sparc64-linux-user \
681sparc32plus-linux-user \
682"
ths831b7822007-01-18 20:06:33 +0000683 fi
684# the following are Darwin specific
685 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000686 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000687 fi
blueswir184778502008-10-26 20:33:16 +0000688# the following are BSD specific
689 if [ "$bsd_user" = "yes" ] ; then
690 target_list="${target_list}\
691sparc64-bsd-user \
692"
693 fi
bellard6e20a452005-06-05 15:56:02 +0000694else
pbrookb1a550a2006-04-16 13:28:56 +0000695 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000696fi
pbrook0a8e90f2006-03-19 14:54:16 +0000697if test -z "$target_list" ; then
698 echo "No targets enabled"
699 exit 1
700fi
bellard5327cf42005-01-10 23:18:50 +0000701
bellard7d132992003-03-06 23:23:54 +0000702if test -z "$cross_prefix" ; then
703
704# ---
705# big/little endian test
706cat > $TMPC << EOF
707#include <inttypes.h>
708int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000709 volatile uint32_t i=0x01234567;
710 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000711}
712EOF
713
aurel32178baee2008-12-08 18:11:57 +0000714if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000715$TMPE && bigendian="yes"
716else
717echo big/little test failed
718fi
719
720else
721
722# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000723if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000724 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000725 -o "$cpu" = "m68k" \
726 -o "$cpu" = "mips" \
727 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000728 -o "$cpu" = "ppc" \
729 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000730 -o "$cpu" = "s390" \
731 -o "$cpu" = "sparc" \
732 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000733 bigendian="yes"
734fi
735
736fi
737
bellardb6853692005-06-05 17:10:39 +0000738# host long bits test
739hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000740if test "$cpu" = "x86_64" \
741 -o "$cpu" = "alpha" \
742 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000743 -o "$cpu" = "sparc64" \
744 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000745 hostlongbits="64"
746fi
747
pbrookbd0c5662008-05-29 14:34:11 +0000748# Check host NPTL support
749cat > $TMPC <<EOF
750#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000751#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000752void foo()
753{
754#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
755#error bork
756#endif
757}
758EOF
759
balrog8c7f7572008-12-15 03:15:36 +0000760if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000761 :
762else
763 nptl="no"
764fi
765
bellard11d9f692004-04-02 20:55:59 +0000766##########################################
balrogac629222008-10-11 09:56:04 +0000767# zlib check
768
769cat > $TMPC << EOF
770#include <zlib.h>
771int main(void) { zlibVersion(); return 0; }
772EOF
balrog8c7f7572008-12-15 03:15:36 +0000773if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000774 :
775else
776 echo
777 echo "Error: zlib check failed"
778 echo "Make sure to have the zlib libs and headers installed."
779 echo
780 exit 1
781fi
782
783##########################################
bellard11d9f692004-04-02 20:55:59 +0000784# SDL probe
785
786sdl_too_old=no
787
788if test -z "$sdl" ; then
ths069b0bd2007-07-12 00:27:15 +0000789 sdl_config="sdl-config"
790 sdl=no
791 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000792
793cat > $TMPC << EOF
794#include <SDL.h>
795#undef main /* We don't want SDL to override our main() */
796int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
797EOF
balrog8c7f7572008-12-15 03:15:36 +0000798 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 +0000799 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
800 if test "$_sdlversion" -lt 121 ; then
801 sdl_too_old=yes
802 else
803 if test "$cocoa" = "no" ; then
804 sdl=yes
805 fi
806 fi
807
808 # static link with sdl ?
809 if test "$sdl" = "yes" ; then
810 aa="no"
811 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
812 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
813 if [ "$aa" = "yes" ] ; then
814 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000815 fi
bellard11d9f692004-04-02 20:55:59 +0000816
balrog8c7f7572008-12-15 03:15:36 +0000817 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 +0000818 sdl_static=yes
819 fi
820 fi # static link
821 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000822else
ths069b0bd2007-07-12 00:27:15 +0000823 # Make sure to disable cocoa if sdl was set
824 if test "$sdl" = "yes" ; then
825 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000826 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000827 fi
bellarda6e022a2004-04-02 21:55:47 +0000828fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000829
aliguori5368a422009-03-03 17:37:21 +0000830if test "$sdl" = "yes" ; then
831cat > $TMPC <<EOF
832#include <SDL.h>
833#if defined(SDL_VIDEO_DRIVER_X11)
834#include <X11/XKBlib.h>
835#else
836#error No x11 support
837#endif
838int main(void) { return 0; }
839EOF
840 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
841 sdl_x11="yes"
842 fi
843fi
844
ths8f28f3f2007-01-05 21:25:54 +0000845##########################################
ths8d5d2d42007-08-25 01:37:51 +0000846# VNC TLS detection
847if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000848cat > $TMPC <<EOF
849#include <gnutls/gnutls.h>
850int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
851EOF
852 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
853 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
854 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000855 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000856 :
857 else
858 vnc_tls="no"
859 fi
ths8d5d2d42007-08-25 01:37:51 +0000860fi
861
862##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000863# VNC SASL detection
864if test "$vnc_sasl" = "yes" ; then
865cat > $TMPC <<EOF
866#include <sasl/sasl.h>
867#include <stdio.h>
868int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
869EOF
870 # Assuming Cyrus-SASL installed in /usr prefix
871 vnc_sasl_cflags=""
872 vnc_sasl_libs="-lsasl2"
873 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
874 $vnc_sasl_libs 2> /dev/null ; then
875 :
876 else
877 vnc_sasl="no"
878 fi
879fi
880
881##########################################
aliguori76655d62009-03-06 20:27:37 +0000882# fnmatch() probe, used for ACL routines
883fnmatch="no"
884cat > $TMPC << EOF
885#include <fnmatch.h>
886int main(void)
887{
888 fnmatch("foo", "foo", 0);
889 return 0;
890}
891EOF
892if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
893 fnmatch="yes"
894fi
895
896##########################################
ths8a16d272008-07-19 09:56:24 +0000897# vde libraries probe
898if test "$vde" = "yes" ; then
899 cat > $TMPC << EOF
900#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000901int main(void)
902{
903 struct vde_open_args a = {0, 0, 0};
904 vde_open("", "", &a);
905 return 0;
906}
ths8a16d272008-07-19 09:56:24 +0000907EOF
balrog8c7f7572008-12-15 03:15:36 +0000908 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000909 :
910 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000911 vde="no"
ths8a16d272008-07-19 09:56:24 +0000912 fi
913fi
914
915##########################################
malcc2de5c92008-06-28 19:13:06 +0000916# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000917
malcc2de5c92008-06-28 19:13:06 +0000918audio_drv_probe()
919{
920 drv=$1
921 hdr=$2
922 lib=$3
923 exp=$4
924 cfl=$5
925 cat > $TMPC << EOF
926#include <$hdr>
927int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000928EOF
balrog8c7f7572008-12-15 03:15:36 +0000929 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +0000930 :
931 else
932 echo
933 echo "Error: $drv check failed"
934 echo "Make sure to have the $drv libs and headers installed."
935 echo
936 exit 1
937 fi
938}
939
malc2fa7d3b2008-07-29 12:58:44 +0000940audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000941for drv in $audio_drv_list; do
942 case $drv in
943 alsa)
944 audio_drv_probe $drv alsa/asoundlib.h -lasound \
945 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
946 ;;
947
948 fmod)
949 if test -z $fmod_lib || test -z $fmod_inc; then
950 echo
951 echo "Error: You must specify path to FMOD library and headers"
952 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
953 echo
954 exit 1
955 fi
956 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
957 ;;
958
959 esd)
960 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
961 ;;
malcb8e59f12008-07-02 21:03:08 +0000962
963 pa)
964 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
965 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
966 ;;
967
blueswir12f6a1ab2008-08-21 18:00:53 +0000968 oss|sdl|core|wav|dsound)
969 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
970 ;;
971
malce4c63a62008-07-19 16:15:16 +0000972 *)
malc1c9b2a52008-07-19 16:57:30 +0000973 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +0000974 echo
975 echo "Error: Unknown driver '$drv' selected"
976 echo "Possible drivers are: $audio_possible_drivers"
977 echo
978 exit 1
979 }
980 ;;
malcc2de5c92008-06-28 19:13:06 +0000981 esac
982done
ths8f28f3f2007-01-05 21:25:54 +0000983
balrog4d3b6f62008-02-10 16:33:14 +0000984##########################################
aurel322e4d9fb2008-04-08 06:01:02 +0000985# BrlAPI probe
986
987if test -z "$brlapi" ; then
988 brlapi=no
989cat > $TMPC << EOF
990#include <brlapi.h>
991int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
992EOF
aurel32178baee2008-12-08 18:11:57 +0000993 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +0000994 brlapi=yes
995 fi # brlapi compile test
996fi # -z $brlapi
997
998##########################################
balrog4d3b6f62008-02-10 16:33:14 +0000999# curses probe
1000
1001if test "$curses" = "yes" ; then
1002 curses=no
1003 cat > $TMPC << EOF
1004#include <curses.h>
1005int main(void) { return curses_version(); }
1006EOF
aurel32178baee2008-12-08 18:11:57 +00001007 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +00001008 curses=yes
1009 fi
1010fi # test "$curses"
1011
blueswir1414f0da2008-08-15 18:20:52 +00001012##########################################
balrogfb599c92008-09-28 23:49:55 +00001013# bluez support probe
1014if test "$bluez" = "yes" ; then
1015 `pkg-config bluez` || bluez="no"
1016fi
1017if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001018 cat > $TMPC << EOF
1019#include <bluetooth/bluetooth.h>
1020int main(void) { return bt_error(0); }
1021EOF
balrogfb599c92008-09-28 23:49:55 +00001022 bluez_cflags=`pkg-config --cflags bluez`
1023 bluez_libs=`pkg-config --libs bluez`
balrog17e15922008-10-11 12:00:42 +00001024 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001025 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001026 :
1027 else
1028 bluez="no"
1029 fi
balrogfb599c92008-09-28 23:49:55 +00001030fi
1031
1032##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001033# kvm probe
1034if test "$kvm" = "yes" ; then
1035 cat > $TMPC <<EOF
1036#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001037#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001038#error Invalid KVM version
1039#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001040#if !defined(KVM_CAP_USER_MEMORY)
1041#error Missing KVM capability KVM_CAP_USER_MEMORY
1042#endif
1043#if !defined(KVM_CAP_SET_TSS_ADDR)
1044#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1045#endif
1046#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1047#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1048#endif
aliguori7ba1e612008-11-05 16:04:33 +00001049int main(void) { return 0; }
1050EOF
aliguorieac30262008-11-05 16:28:56 +00001051 if test "$kerneldir" != "" ; then
1052 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001053 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1054 -a -d "$kerneldir/arch/x86/include" ; then
1055 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001056 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1057 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001058 elif test -d "$kerneldir/arch/$cpu/include" ; then
1059 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1060 fi
aliguorieac30262008-11-05 16:28:56 +00001061 else
1062 kvm_cflags=""
1063 fi
aliguori7ba1e612008-11-05 16:04:33 +00001064 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001065 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001066 :
1067 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001068 kvm="no";
1069 if [ -x "`which awk 2>/dev/null`" ] && \
1070 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001071 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001072 | grep "error: " \
1073 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1074 if test "$kvmerr" != "" ; then
1075 kvm="no - (${kvmerr})"
1076 fi
1077 fi
aliguori7ba1e612008-11-05 16:04:33 +00001078 fi
1079fi
1080
1081##########################################
blueswir1414f0da2008-08-15 18:20:52 +00001082# AIO probe
aliguori3c529d92008-12-12 16:41:40 +00001083AIOLIBS=""
1084
blueswir1414f0da2008-08-15 18:20:52 +00001085if test "$aio" = "yes" ; then
1086 aio=no
1087 cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001088#include <pthread.h>
blueswir1c9db92f2009-01-17 06:49:15 +00001089int main(void) { pthread_mutex_t lock; return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001090EOF
1091 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1092 aio=yes
aliguori3c529d92008-12-12 16:41:40 +00001093 AIOLIBS="-lpthread"
blueswir1414f0da2008-08-15 18:20:52 +00001094 fi
1095fi
1096
aliguoribf9298b2008-12-05 20:05:26 +00001097##########################################
1098# iovec probe
1099cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001100#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001101#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001102#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001103int main(void) { struct iovec iov; return 0; }
1104EOF
1105iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001106if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001107 iovec=yes
1108fi
1109
aurel32f652e6a2008-12-16 10:43:48 +00001110##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001111# preadv probe
1112cat > $TMPC <<EOF
1113#include <sys/types.h>
1114#include <sys/uio.h>
1115#include <unistd.h>
1116int main(void) { preadv; }
1117EOF
1118preadv=no
1119if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1120 preadv=yes
1121fi
1122
1123##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001124# fdt probe
1125if test "$fdt" = "yes" ; then
1126 fdt=no
1127 cat > $TMPC << EOF
1128int main(void) { return 0; }
1129EOF
1130 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1131 fdt=yes
1132 fi
1133fi
1134
pbrookcc8ae6d2006-04-23 17:57:59 +00001135# Check if tools are available to build documentation.
ths6c591862007-05-09 13:55:03 +00001136if [ -x "`which texi2html 2>/dev/null`" ] && \
1137 [ -x "`which pod2man 2>/dev/null`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +00001138 build_docs="yes"
1139fi
1140
aliguorida93a1f2008-12-12 20:02:52 +00001141##########################################
1142# Do we need librt
1143cat > $TMPC <<EOF
1144#include <signal.h>
1145#include <time.h>
1146int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1147EOF
1148
1149rt=no
balrog8c7f7572008-12-15 03:15:36 +00001150if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001151 :
balrog8c7f7572008-12-15 03:15:36 +00001152elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001153 rt=yes
1154fi
1155
1156if test "$rt" = "yes" ; then
1157 # Hack, we should have a general purpose LIBS for this sort of thing
1158 AIOLIBS="$AIOLIBS -lrt"
1159fi
1160
bellard11d9f692004-04-02 20:55:59 +00001161if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001162 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001163 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001164 fi
1165 mansuffix=""
1166 datasuffix=""
1167 docsuffix=""
1168 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001169else
pbrook308c3592007-02-27 00:52:01 +00001170 if test -z "$prefix" ; then
1171 prefix="/usr/local"
1172 fi
1173 mansuffix="/share/man"
1174 datasuffix="/share/qemu"
1175 docsuffix="/share/doc/qemu"
1176 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001177fi
bellard5a671352003-10-01 00:13:48 +00001178
bellard43ce4df2003-06-09 19:53:12 +00001179echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001180echo "BIOS directory $prefix$datasuffix"
1181echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001182if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001183echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001184echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001185fi
bellard5a671352003-10-01 00:13:48 +00001186echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001187echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001188echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001189echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001190echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001191echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001192echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001193echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001194echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +00001195echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001196echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00001197echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00001198echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001199echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001200echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001201if test "$darwin" = "yes" ; then
1202 echo "Cocoa support $cocoa"
1203fi
bellard97a847b2003-08-10 21:36:04 +00001204echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001205if test "$sdl" != "no" ; then
1206 echo "SDL static link $sdl_static"
1207fi
balrog4d3b6f62008-02-10 16:33:14 +00001208echo "curses support $curses"
bellard67b915a2004-03-31 23:37:16 +00001209echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001210echo "Audio drivers $audio_drv_list"
1211echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001212echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001213echo "VNC TLS support $vnc_tls"
1214if test "$vnc_tls" = "yes" ; then
1215 echo " TLS CFLAGS $vnc_tls_cflags"
1216 echo " TLS LIBS $vnc_tls_libs"
1217fi
aliguori2f9606b2009-03-06 20:27:28 +00001218echo "VNC SASL support $vnc_sasl"
1219if test "$vnc_sasl" = "yes" ; then
1220 echo " SASL CFLAGS $vnc_sasl_cflags"
1221 echo " SASL LIBS $vnc_sasl_libs"
1222fi
blueswir131422552007-04-16 18:27:06 +00001223if test -n "$sparc_cpu"; then
1224 echo "Target Sparc Arch $sparc_cpu"
1225fi
bellard07f4ddb2005-04-23 17:44:28 +00001226echo "kqemu support $kqemu"
aurel322e4d9fb2008-04-08 06:01:02 +00001227echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001228echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001229[ ! -z "$uname_release" ] && \
1230echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001231echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001232echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001233echo "AIO support $aio"
ths77755342008-11-27 15:45:16 +00001234echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001235echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001236echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00001237echo "preadv support $preadv"
bellard67b915a2004-03-31 23:37:16 +00001238
bellard97a847b2003-08-10 21:36:04 +00001239if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001240echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001241fi
malcd4742de2008-11-29 22:04:31 +00001242if [ -s $TMPSDLLOG ]; then
ths20b40c62007-07-11 23:39:45 +00001243 echo "The error log from compiling the libSDL test is: "
malcd4742de2008-11-29 22:04:31 +00001244 cat $TMPSDLLOG
ths20b40c62007-07-11 23:39:45 +00001245fi
bellard24b55b92005-03-01 22:30:41 +00001246#if test "$sdl_static" = "no"; then
1247# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1248#fi
bellard97a847b2003-08-10 21:36:04 +00001249config_mak="config-host.mak"
1250config_h="config-host.h"
1251
bellard7c1f25b2004-04-22 00:02:08 +00001252#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001253
ths15d9ca02007-07-31 23:07:32 +00001254test -f $config_h && mv $config_h ${config_h}~
1255
bellard97a847b2003-08-10 21:36:04 +00001256echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001257printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001258printf " '%s'" "$0" "$@" >> $config_mak
1259echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001260echo "/* Automatically generated by configure - do not modify */" > $config_h
1261
1262echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001263echo "bindir=\${prefix}$binsuffix" >> $config_mak
1264echo "mandir=\${prefix}$mansuffix" >> $config_mak
1265echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001266echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001267echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001268echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001269echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001270echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001271echo "HOST_CC=$host_cc" >> $config_mak
1272echo "AR=$ar" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001273# XXX: only use CFLAGS and LDFLAGS ?
1274# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1275# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001276echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001277echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1278echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1279echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001280echo "CFLAGS=$CFLAGS" >> $config_mak
1281echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001282echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +00001283echo "AIOLIBS=$AIOLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001284case "$cpu" in
1285 i386)
1286 echo "ARCH=i386" >> $config_mak
1287 echo "#define HOST_I386 1" >> $config_h
1288 ;;
1289 x86_64)
1290 echo "ARCH=x86_64" >> $config_mak
1291 echo "#define HOST_X86_64 1" >> $config_h
1292 ;;
1293 alpha)
1294 echo "ARCH=alpha" >> $config_mak
1295 echo "#define HOST_ALPHA 1" >> $config_h
1296 ;;
1297 armv4b)
1298 echo "ARCH=arm" >> $config_mak
1299 echo "#define HOST_ARM 1" >> $config_h
1300 ;;
1301 armv4l)
1302 echo "ARCH=arm" >> $config_mak
1303 echo "#define HOST_ARM 1" >> $config_h
1304 ;;
1305 cris)
1306 echo "ARCH=cris" >> $config_mak
1307 echo "#define HOST_CRIS 1" >> $config_h
1308 ;;
1309 hppa)
1310 echo "ARCH=hppa" >> $config_mak
1311 echo "#define HOST_HPPA 1" >> $config_h
1312 ;;
1313 ia64)
1314 echo "ARCH=ia64" >> $config_mak
1315 echo "#define HOST_IA64 1" >> $config_h
1316 ;;
1317 m68k)
1318 echo "ARCH=m68k" >> $config_mak
1319 echo "#define HOST_M68K 1" >> $config_h
1320 ;;
1321 mips)
1322 echo "ARCH=mips" >> $config_mak
1323 echo "#define HOST_MIPS 1" >> $config_h
1324 ;;
1325 mips64)
1326 echo "ARCH=mips64" >> $config_mak
1327 echo "#define HOST_MIPS64 1" >> $config_h
1328 ;;
malcfdf7ed92009-01-14 18:39:52 +00001329 ppc)
1330 echo "ARCH=ppc" >> $config_mak
1331 echo "#define HOST_PPC 1" >> $config_h
1332 ;;
1333 ppc64)
1334 echo "ARCH=ppc64" >> $config_mak
1335 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001336 ;;
1337 s390)
1338 echo "ARCH=s390" >> $config_mak
1339 echo "#define HOST_S390 1" >> $config_h
1340 ;;
1341 sparc)
1342 echo "ARCH=sparc" >> $config_mak
1343 echo "#define HOST_SPARC 1" >> $config_h
1344 ;;
1345 sparc64)
1346 echo "ARCH=sparc64" >> $config_mak
1347 echo "#define HOST_SPARC64 1" >> $config_h
1348 ;;
1349 *)
1350 echo "Unsupported CPU = $cpu"
1351 exit 1
1352 ;;
1353esac
aliguori03b4fe72008-10-07 19:16:17 +00001354if test "$sparse" = "yes" ; then
1355 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1356 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1357 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1358fi
aliguori1625af82009-04-05 17:41:02 +00001359if test "$strip_opt" = "yes" ; then
1360 echo "STRIP_OPT=-s" >> $config_mak
1361fi
bellard7d132992003-03-06 23:23:54 +00001362if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001363 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1364 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1365fi
bellardb6853692005-06-05 17:10:39 +00001366echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001367if test "$mingw32" = "yes" ; then
1368 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001369 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001370else
1371 cat > $TMPC << EOF
1372#include <byteswap.h>
1373int main(void) { return bswap_32(0); }
1374EOF
aurel32178baee2008-12-08 18:11:57 +00001375 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001376 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1377 fi
blueswir113606772008-12-05 17:54:09 +00001378 cat > $TMPC << EOF
1379#include <sys/endian.h>
1380#include <sys/types.h>
1381#include <machine/bswap.h>
1382int main(void) { return bswap32(0); }
1383EOF
aurel32178baee2008-12-08 18:11:57 +00001384 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001385 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1386 fi
bellard67b915a2004-03-31 23:37:16 +00001387fi
blueswir1128ab2f2008-08-15 18:33:42 +00001388
1389if [ "$openbsd" = "yes" ] ; then
1390 echo "#define ENOTSUP 4096" >> $config_h
1391fi
1392
bellard83fb7ad2004-07-05 21:25:26 +00001393if test "$darwin" = "yes" ; then
1394 echo "CONFIG_DARWIN=yes" >> $config_mak
1395 echo "#define CONFIG_DARWIN 1" >> $config_h
1396fi
malcb29fe3e2008-11-18 01:42:22 +00001397
1398if test "$aix" = "yes" ; then
1399 echo "CONFIG_AIX=yes" >> $config_mak
1400 echo "#define CONFIG_AIX 1" >> $config_h
1401fi
1402
bellardec530c82006-04-25 22:36:06 +00001403if test "$solaris" = "yes" ; then
1404 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001405 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001406 if test "$needs_libsunmath" = "yes" ; then
1407 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1408 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1409 fi
bellardec530c82006-04-25 22:36:06 +00001410fi
blueswir131422552007-04-16 18:27:06 +00001411if test -n "$sparc_cpu"; then
1412 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1413 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1414fi
bellard67b915a2004-03-31 23:37:16 +00001415if test "$gdbstub" = "yes" ; then
1416 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1417 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1418fi
bellard97a847b2003-08-10 21:36:04 +00001419if test "$gprof" = "yes" ; then
1420 echo "TARGET_GPROF=yes" >> $config_mak
1421 echo "#define HAVE_GPROF 1" >> $config_h
1422fi
1423if test "$static" = "yes" ; then
1424 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001425 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001426fi
bellard05c2a3e2006-02-08 22:39:17 +00001427if test $profiler = "yes" ; then
1428 echo "#define CONFIG_PROFILER 1" >> $config_h
1429fi
bellardc20709a2004-04-21 23:27:19 +00001430if test "$slirp" = "yes" ; then
1431 echo "CONFIG_SLIRP=yes" >> $config_mak
1432 echo "#define CONFIG_SLIRP 1" >> $config_h
1433fi
ths8a16d272008-07-19 09:56:24 +00001434if test "$vde" = "yes" ; then
1435 echo "CONFIG_VDE=yes" >> $config_mak
1436 echo "#define CONFIG_VDE 1" >> $config_h
1437 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1438fi
malc0c58ac12008-06-25 21:04:05 +00001439for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001440 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001441 echo "$def=yes" >> $config_mak
1442 echo "#define $def 1" >> $config_h
1443done
1444echo "#define AUDIO_DRIVERS \\" >> $config_h
1445for drv in $audio_drv_list; do
1446 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001447 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001448 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001449 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001450 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1451 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001452 elif test "$drv" = "oss"; then
1453 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001454 fi
1455done
1456echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001457if test "$mixemu" = "yes" ; then
1458 echo "CONFIG_MIXEMU=yes" >> $config_mak
1459 echo "#define CONFIG_MIXEMU 1" >> $config_h
1460fi
ths8d5d2d42007-08-25 01:37:51 +00001461if test "$vnc_tls" = "yes" ; then
1462 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1463 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1464 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1465 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1466fi
aliguori2f9606b2009-03-06 20:27:28 +00001467if test "$vnc_sasl" = "yes" ; then
1468 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1469 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1470 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1471 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1472fi
aliguori76655d62009-03-06 20:27:37 +00001473if test "$fnmatch" = "yes" ; then
1474 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1475fi
pbrookb1a550a2006-04-16 13:28:56 +00001476qemu_version=`head $source_path/VERSION`
1477echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001478echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001479
1480echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001481if [ "$source_path_used" = "yes" ]; then
1482 echo "VPATH=$source_path" >> $config_mak
1483fi
bellard97a847b2003-08-10 21:36:04 +00001484echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001485if [ "$build_docs" = "yes" ] ; then
1486 echo "BUILD_DOCS=yes" >> $config_mak
1487fi
bellard49ecc3f2007-11-07 19:25:15 +00001488if test "$static" = "yes"; then
1489 sdl1=$sdl_static
1490else
1491 sdl1=$sdl
1492fi
1493if test "$sdl1" = "yes" ; then
1494 echo "#define CONFIG_SDL 1" >> $config_h
1495 echo "CONFIG_SDL=yes" >> $config_mak
1496 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1497 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001498 elif test "$sdl_x11" = "yes" ; then
1499 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001500 else
1501 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1502 fi
1503 if [ "${aa}" = "yes" ] ; then
1504 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1505 else
1506 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1507 fi
1508fi
1509if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001510 echo "#define CONFIG_COCOA 1" >> $config_h
1511 echo "CONFIG_COCOA=yes" >> $config_mak
1512fi
1513if test "$curses" = "yes" ; then
1514 echo "#define CONFIG_CURSES 1" >> $config_h
1515 echo "CONFIG_CURSES=yes" >> $config_mak
1516 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001517fi
aurel322e4d9fb2008-04-08 06:01:02 +00001518if test "$brlapi" = "yes" ; then
1519 echo "CONFIG_BRLAPI=yes" >> $config_mak
1520 echo "#define CONFIG_BRLAPI 1" >> $config_h
1521 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1522fi
balrogfb599c92008-09-28 23:49:55 +00001523if test "$bluez" = "yes" ; then
1524 echo "CONFIG_BLUEZ=yes" >> $config_mak
1525 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1526 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1527 echo "#define CONFIG_BLUEZ 1" >> $config_h
1528fi
blueswir1414f0da2008-08-15 18:20:52 +00001529if test "$aio" = "yes" ; then
1530 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001531 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001532fi
ths77755342008-11-27 15:45:16 +00001533if test "$blobs" = "yes" ; then
1534 echo "INSTALL_BLOBS=yes" >> $config_mak
1535fi
aliguoribf9298b2008-12-05 20:05:26 +00001536if test "$iovec" = "yes" ; then
1537 echo "#define HAVE_IOVEC 1" >> $config_h
1538fi
aliguoriceb42de2009-04-07 18:43:28 +00001539if test "$preadv" = "yes" ; then
1540 echo "#define HAVE_PREADV 1" >> $config_h
1541fi
aurel32f652e6a2008-12-16 10:43:48 +00001542if test "$fdt" = "yes" ; then
1543 echo "#define HAVE_FDT 1" >> $config_h
1544 echo "FDT_LIBS=-lfdt" >> $config_mak
1545fi
bellard97a847b2003-08-10 21:36:04 +00001546
bellard83fb7ad2004-07-05 21:25:26 +00001547# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001548if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001549 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001550 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
blueswir1179a2c12009-03-08 08:23:32 +00001551 echo "#define HOST_BSD 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001552fi
1553
pbrookc5937222006-05-14 11:30:38 +00001554echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1555
blueswir168063642008-11-22 21:03:55 +00001556# USB host support
1557case "$usb" in
1558linux)
1559 echo "HOST_USB=linux" >> $config_mak
1560;;
1561bsd)
1562 echo "HOST_USB=bsd" >> $config_mak
1563;;
1564*)
1565 echo "HOST_USB=stub" >> $config_mak
1566;;
1567esac
1568
pbrookc39e3332007-09-22 16:49:14 +00001569tools=
1570if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001571 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001572 if [ "$linux" = "yes" ] ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001573 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001574 fi
pbrookc39e3332007-09-22 16:49:14 +00001575fi
1576echo "TOOLS=$tools" >> $config_mak
1577
ths15d9ca02007-07-31 23:07:32 +00001578test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1579
bellard1d14ffa2005-10-30 18:58:22 +00001580for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001581target_dir="$target"
1582config_mak=$target_dir/config.mak
1583config_h=$target_dir/config.h
1584target_cpu=`echo $target | cut -d '-' -f 1`
1585target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001586[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001587[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1588[ "$target_cpu" = "mips" ] && target_bigendian=yes
1589[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1590[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001591[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001592[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001593[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001594[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001595[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001596[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1597[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1598[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001599target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001600target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001601target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001602target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001603target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001604case "$target" in
1605 ${target_cpu}-softmmu)
1606 target_softmmu="yes"
1607 ;;
1608 ${target_cpu}-linux-user)
1609 target_user_only="yes"
1610 target_linux_user="yes"
1611 ;;
1612 ${target_cpu}-darwin-user)
1613 target_user_only="yes"
1614 target_darwin_user="yes"
1615 ;;
blueswir184778502008-10-26 20:33:16 +00001616 ${target_cpu}-bsd-user)
1617 target_user_only="yes"
1618 target_bsd_user="yes"
1619 ;;
pbrook9e407a82007-05-26 16:38:53 +00001620 *)
1621 echo "ERROR: Target '$target' not recognised"
1622 exit 1
1623 ;;
1624esac
ths831b7822007-01-18 20:06:33 +00001625
bellard97ccc682005-07-02 13:32:17 +00001626if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +00001627 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +00001628 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +00001629 echo "To build QEMU without graphical output configure with --disable-gfx-check"
balrog4d3b6f62008-02-10 16:33:14 +00001630 echo "Note that this will disable all output from the virtual graphics card"
1631 echo "except through VNC or curses."
bellard97ccc682005-07-02 13:32:17 +00001632 exit 1;
1633fi
1634
bellard7c1f25b2004-04-22 00:02:08 +00001635#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001636
ths15d9ca02007-07-31 23:07:32 +00001637test -f $config_h && mv $config_h ${config_h}~
1638
bellard97a847b2003-08-10 21:36:04 +00001639mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001640mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001641mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001642if 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 +00001643 mkdir -p $target_dir/nwfpe
1644fi
1645
bellardec530c82006-04-25 22:36:06 +00001646#
1647# don't use ln -sf as not all "ln -sf" over write the file/link
1648#
1649rm -f $target_dir/Makefile
1650ln -s $source_path/Makefile.target $target_dir/Makefile
1651
bellard97a847b2003-08-10 21:36:04 +00001652
1653echo "# Automatically generated by configure - do not modify" > $config_mak
1654echo "/* Automatically generated by configure - do not modify */" > $config_h
1655
1656
1657echo "include ../config-host.mak" >> $config_mak
1658echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001659
pbrooke5fe0c52006-06-11 13:32:59 +00001660bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001661elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001662target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001663interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1664echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001665gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001666
aliguori5985ece2008-11-05 19:59:25 +00001667# Make sure the target and host cpus are compatible
1668if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
malcfdf7ed92009-01-14 18:39:52 +00001669 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001670 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1671 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001672 kvm="no"
1673fi
1674# Disable KVM for linux-user
1675if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1676 kvm="no"
1677fi
1678
aurel322408a522008-04-20 20:19:44 +00001679case "$target_cpu" in
1680 i386)
1681 echo "TARGET_ARCH=i386" >> $config_mak
1682 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1683 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001684 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001685 then
1686 echo "#define USE_KQEMU 1" >> $config_h
1687 fi
aliguori7ba1e612008-11-05 16:04:33 +00001688 if test "$kvm" = "yes" ; then
1689 echo "CONFIG_KVM=yes" >> $config_mak
1690 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001691 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001692 fi
aurel322408a522008-04-20 20:19:44 +00001693 ;;
1694 x86_64)
1695 echo "TARGET_ARCH=x86_64" >> $config_mak
1696 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1697 echo "#define TARGET_I386 1" >> $config_h
1698 echo "#define TARGET_X86_64 1" >> $config_h
1699 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1700 then
1701 echo "#define USE_KQEMU 1" >> $config_h
1702 fi
aliguori7ba1e612008-11-05 16:04:33 +00001703 if test "$kvm" = "yes" ; then
1704 echo "CONFIG_KVM=yes" >> $config_mak
1705 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1706 echo "#define CONFIG_KVM 1" >> $config_h
1707 fi
aurel322408a522008-04-20 20:19:44 +00001708 ;;
1709 alpha)
1710 echo "TARGET_ARCH=alpha" >> $config_mak
1711 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1712 echo "#define TARGET_ALPHA 1" >> $config_h
1713 ;;
1714 arm|armeb)
1715 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001716 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1717 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001718 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001719 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001720 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00001721 ;;
1722 cris)
1723 echo "TARGET_ARCH=cris" >> $config_mak
1724 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1725 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00001726 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001727 ;;
1728 m68k)
1729 echo "TARGET_ARCH=m68k" >> $config_mak
1730 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1731 echo "#define TARGET_M68K 1" >> $config_h
1732 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001733 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00001734 ;;
1735 mips|mipsel)
1736 echo "TARGET_ARCH=mips" >> $config_mak
1737 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1738 echo "#define TARGET_MIPS 1" >> $config_h
1739 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1740 ;;
1741 mipsn32|mipsn32el)
1742 echo "TARGET_ARCH=mipsn32" >> $config_mak
1743 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1744 echo "#define TARGET_MIPS 1" >> $config_h
1745 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1746 ;;
1747 mips64|mips64el)
1748 echo "TARGET_ARCH=mips64" >> $config_mak
1749 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1750 echo "#define TARGET_MIPS 1" >> $config_h
1751 echo "#define TARGET_MIPS64 1" >> $config_h
1752 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1753 ;;
1754 ppc)
1755 echo "TARGET_ARCH=ppc" >> $config_mak
1756 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1757 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001758 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001759 ;;
1760 ppcemb)
1761 echo "TARGET_ARCH=ppcemb" >> $config_mak
1762 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1763 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1764 echo "#define TARGET_PPC 1" >> $config_h
1765 echo "#define TARGET_PPCEMB 1" >> $config_h
aurel32d76d1652008-12-16 10:43:58 +00001766 if test "$kvm" = "yes" ; then
1767 echo "CONFIG_KVM=yes" >> $config_mak
1768 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1769 echo "#define CONFIG_KVM 1" >> $config_h
1770 fi
aurel32c8b35322009-01-24 15:07:34 +00001771 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001772 ;;
1773 ppc64)
1774 echo "TARGET_ARCH=ppc64" >> $config_mak
1775 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1776 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1777 echo "#define TARGET_PPC 1" >> $config_h
1778 echo "#define TARGET_PPC64 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001779 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001780 ;;
1781 ppc64abi32)
1782 echo "TARGET_ARCH=ppc64" >> $config_mak
1783 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1784 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1785 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1786 echo "#define TARGET_PPC 1" >> $config_h
1787 echo "#define TARGET_PPC64 1" >> $config_h
1788 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001789 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001790 ;;
1791 sh4|sh4eb)
1792 echo "TARGET_ARCH=sh4" >> $config_mak
1793 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1794 echo "#define TARGET_SH4 1" >> $config_h
1795 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001796 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001797 ;;
1798 sparc)
1799 echo "TARGET_ARCH=sparc" >> $config_mak
1800 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1801 echo "#define TARGET_SPARC 1" >> $config_h
1802 ;;
1803 sparc64)
1804 echo "TARGET_ARCH=sparc64" >> $config_mak
1805 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1806 echo "#define TARGET_SPARC 1" >> $config_h
1807 echo "#define TARGET_SPARC64 1" >> $config_h
1808 elfload32="yes"
1809 ;;
1810 sparc32plus)
1811 echo "TARGET_ARCH=sparc64" >> $config_mak
1812 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1813 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1814 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1815 echo "#define TARGET_SPARC 1" >> $config_h
1816 echo "#define TARGET_SPARC64 1" >> $config_h
1817 echo "#define TARGET_ABI32 1" >> $config_h
1818 ;;
1819 *)
1820 echo "Unsupported target CPU"
1821 exit 1
1822 ;;
1823esac
bellardde83cd02003-06-15 20:25:43 +00001824if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001825 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1826 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1827fi
1828if test "$target_softmmu" = "yes" ; then
1829 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1830 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00001831fi
bellard997344f2003-10-27 21:10:39 +00001832if test "$target_user_only" = "yes" ; then
1833 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1834 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1835fi
ths831b7822007-01-18 20:06:33 +00001836if test "$target_linux_user" = "yes" ; then
1837 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1838 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1839fi
1840if test "$target_darwin_user" = "yes" ; then
1841 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1842 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1843fi
pbrook56aebc82008-10-11 17:55:29 +00001844list=""
1845if test ! -z "$gdb_xml_files" ; then
1846 for x in $gdb_xml_files; do
1847 list="$list $source_path/gdb-xml/$x"
1848 done
1849fi
1850echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00001851
aurel320938cda2008-04-11 21:36:06 +00001852if test "$target_cpu" = "arm" \
1853 -o "$target_cpu" = "armeb" \
1854 -o "$target_cpu" = "m68k" \
1855 -o "$target_cpu" = "mips" \
1856 -o "$target_cpu" = "mipsel" \
1857 -o "$target_cpu" = "mipsn32" \
1858 -o "$target_cpu" = "mipsn32el" \
1859 -o "$target_cpu" = "mips64" \
1860 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00001861 -o "$target_cpu" = "ppc" \
1862 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00001863 -o "$target_cpu" = "ppc64abi32" \
1864 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00001865 -o "$target_cpu" = "sparc" \
1866 -o "$target_cpu" = "sparc64" \
1867 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00001868 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1869 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1870fi
pbrooke5fe0c52006-06-11 13:32:59 +00001871if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1872 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1873 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1874fi
pbrookbd0c5662008-05-29 14:34:11 +00001875if test "$target_user_only" = "yes" \
1876 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1877 echo "#define USE_NPTL 1" >> $config_h
1878fi
blueswir1cb33da52007-10-09 16:34:29 +00001879# 32 bit ELF loader in addition to native 64 bit loader?
1880if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1881 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1882 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1883fi
blueswir184778502008-10-26 20:33:16 +00001884if test "$target_bsd_user" = "yes" ; then
1885 echo "CONFIG_BSD_USER=yes" >> $config_mak
1886 echo "#define CONFIG_BSD_USER 1" >> $config_h
1887fi
bellard5b0753e2005-03-01 21:37:28 +00001888
ths15d9ca02007-07-31 23:07:32 +00001889test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1890
bellard97a847b2003-08-10 21:36:04 +00001891done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00001892
1893# build tree in object directory if source path is different from current one
1894if test "$source_path_used" = "yes" ; then
bellard49ecc3f2007-11-07 19:25:15 +00001895 DIRS="tests tests/cris slirp audio"
bellard7d132992003-03-06 23:23:54 +00001896 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00001897 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00001898 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00001899 for dir in $DIRS ; do
1900 mkdir -p $dir
1901 done
bellardec530c82006-04-25 22:36:06 +00001902 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00001903 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00001904 rm -f $f
1905 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00001906 done
1907fi