blob: 86821360387cc525d353d6065ec15533db9cd757 [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"
aurel32f8393942009-04-13 18:45:38 +0000156debug_tcg="no"
aliguori03b4fe72008-10-07 19:16:17 +0000157sparse="no"
aliguori1625af82009-04-05 17:41:02 +0000158strip_opt="yes"
bellard7d132992003-03-06 23:23:54 +0000159bigendian="no"
bellard67b915a2004-03-31 23:37:16 +0000160mingw32="no"
161EXESUF=""
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"
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"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500179build_docs="yes"
pbrookc5937222006-05-14 11:30:38 +0000180uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000181curses="yes"
Alexander Graf769ce762009-05-11 17:41:42 +0200182curl="yes"
aliguorie5d355d2009-04-24 18:03:15 +0000183pthread="yes"
blueswir1414f0da2008-08-15 18:20:52 +0000184aio="yes"
aliguorie5d355d2009-04-24 18:03:15 +0000185io_thread="no"
pbrookbd0c5662008-05-29 14:34:11 +0000186nptl="yes"
malc8ff9cbf2008-06-23 18:33:30 +0000187mixemu="no"
balrogfb599c92008-09-28 23:49:55 +0000188bluez="yes"
aliguori7ba1e612008-11-05 16:04:33 +0000189kvm="yes"
aliguorieac30262008-11-05 16:28:56 +0000190kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000191aix="no"
ths77755342008-11-27 15:45:16 +0000192blobs="yes"
aurel32f652e6a2008-12-16 10:43:48 +0000193fdt="yes"
Anthony Liguorif92f8af2009-05-20 13:01:02 -0500194sdl="yes"
aliguori5368a422009-03-03 17:37:21 +0000195sdl_x11="no"
aliguorie37630c2009-04-22 15:19:10 +0000196xen="yes"
pbrook4a19f1e2009-04-07 23:17:49 +0000197pkgversion=""
bellard7d132992003-03-06 23:23:54 +0000198
199# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000200if check_define __linux__ ; then
201 targetos="Linux"
202elif check_define _WIN32 ; then
203 targetos='MINGW32'
blueswir1169dc5d2009-04-13 17:19:26 +0000204elif check_define __OpenBSD__ ; then
205 targetos='OpenBSD'
206elif check_define __sun__ ; then
207 targetos='SunOS'
aliguoriac0df512008-12-29 17:14:15 +0000208else
209 targetos=`uname -s`
210fi
bellard7d132992003-03-06 23:23:54 +0000211case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000212CYGWIN*)
213mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000214OS_CFLAGS="-mno-cygwin"
thsdb8d7dd2007-07-12 09:29:18 +0000215if [ "$cpu" = "i386" ] ; then
216 kqemu="yes"
217fi
malcc2de5c92008-06-28 19:13:06 +0000218audio_possible_drivers="sdl"
bellardc326e0a2005-04-23 18:30:28 +0000219;;
bellard67b915a2004-03-31 23:37:16 +0000220MINGW32*)
221mingw32="yes"
thsdb8d7dd2007-07-12 09:29:18 +0000222if [ "$cpu" = "i386" ] ; then
223 kqemu="yes"
224fi
malcc2de5c92008-06-28 19:13:06 +0000225audio_possible_drivers="dsound sdl fmod"
bellard67b915a2004-03-31 23:37:16 +0000226;;
ths5c40d2b2007-06-23 16:03:36 +0000227GNU/kFreeBSD)
malc0c58ac12008-06-25 21:04:05 +0000228audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000229audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000230if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
231 kqemu="yes"
232fi
233;;
bellard7d3505c2004-05-12 19:32:15 +0000234FreeBSD)
235bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000236audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000237audio_possible_drivers="oss sdl esd pa"
bellarde99f9062005-07-28 21:45:38 +0000238if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000239 kqemu="yes"
240fi
bellard7d3505c2004-05-12 19:32:15 +0000241;;
blueswir1c5e97232009-03-07 20:06:23 +0000242DragonFly)
243bsd="yes"
244audio_drv_list="oss"
245audio_possible_drivers="oss sdl esd pa"
246if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
247 kqemu="yes"
248fi
249aio="no"
250;;
bellard7d3505c2004-05-12 19:32:15 +0000251NetBSD)
252bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000253audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000254audio_possible_drivers="oss sdl esd"
blueswir18ef92a82008-11-22 20:24:29 +0000255oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000256;;
257OpenBSD)
258bsd="yes"
blueswir1128ab2f2008-08-15 18:33:42 +0000259openbsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000260audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000261audio_possible_drivers="oss sdl esd"
blueswir12f6a1ab2008-08-21 18:00:53 +0000262oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000263;;
bellard83fb7ad2004-07-05 21:25:26 +0000264Darwin)
265bsd="yes"
266darwin="yes"
aliguori1b0f9cc2009-01-26 15:37:40 +0000267# 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 +0000268if [ "$cpu" = "i386" ] ; then
269 is_x86_64=`sysctl -n hw.optional.x86_64`
270 [ "$is_x86_64" = "1" ] && cpu=x86_64
aliguori1b0f9cc2009-01-26 15:37:40 +0000271fi
272if [ "$cpu" = "x86_64" ] ; then
273 OS_CFLAGS="-arch x86_64"
274 LDFLAGS="-arch x86_64"
275else
276 OS_CFLAGS="-mdynamic-no-pic"
277fi
ths831b7822007-01-18 20:06:33 +0000278darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000279cocoa="yes"
malc0c58ac12008-06-25 21:04:05 +0000280audio_drv_list="coreaudio"
malcc2de5c92008-06-28 19:13:06 +0000281audio_possible_drivers="coreaudio sdl fmod"
thsc2c59c32008-01-08 00:00:20 +0000282OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
bellard83fb7ad2004-07-05 21:25:26 +0000283;;
bellardec530c82006-04-25 22:36:06 +0000284SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000285 solaris="yes"
286 make="gmake"
287 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000288 needs_libsunmath="no"
blueswir1acda94b2009-04-13 16:23:22 +0000289 kvm="no"
thsc2b84fa2007-02-10 23:21:21 +0000290 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000291 # have to select again, because `uname -m` returns i86pc
292 # even on an x86_64 box.
293 solariscpu=`isainfo -k`
294 if test "${solariscpu}" = "amd64" ; then
295 cpu="x86_64"
296 fi
thsc2b84fa2007-02-10 23:21:21 +0000297 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000298 if test "$solarisrev" -le 9 ; then
299 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
300 needs_libsunmath="yes"
301 else
302 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
303 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
304 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
305 echo "Studio 11 can be downloaded from www.sun.com."
306 exit 1
307 fi
308 fi
309 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000310 kqemu="yes"
311 fi
ths86b2bd92007-02-11 00:31:33 +0000312 fi
ths6b4d2ba2007-05-13 18:02:43 +0000313 if test -f /usr/include/sys/soundcard.h ; then
malc0c58ac12008-06-25 21:04:05 +0000314 audio_drv_list="oss"
ths6b4d2ba2007-05-13 18:02:43 +0000315 fi
malcc2de5c92008-06-28 19:13:06 +0000316 audio_possible_drivers="oss sdl"
blueswir114d483e2009-04-13 16:27:08 +0000317 OS_CFLAGS=-std=gnu99
ths86b2bd92007-02-11 00:31:33 +0000318;;
malcb29fe3e2008-11-18 01:42:22 +0000319AIX)
320aix="yes"
321make="gmake"
322;;
bellard1d14ffa2005-10-30 18:58:22 +0000323*)
malc0c58ac12008-06-25 21:04:05 +0000324audio_drv_list="oss"
malcb8e59f12008-07-02 21:03:08 +0000325audio_possible_drivers="oss alsa sdl esd pa"
bellard5327cf42005-01-10 23:18:50 +0000326linux="yes"
ths831b7822007-01-18 20:06:33 +0000327linux_user="yes"
blueswir168063642008-11-22 21:03:55 +0000328usb="linux"
bellard07f4ddb2005-04-23 17:44:28 +0000329if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000330 kqemu="yes"
malcc2de5c92008-06-28 19:13:06 +0000331 audio_possible_drivers="$audio_possible_drivers fmod"
bellardc9ec1fe2005-02-10 21:55:30 +0000332fi
bellardfb065182004-11-09 23:09:44 +0000333;;
bellard7d132992003-03-06 23:23:54 +0000334esac
335
bellard7d3505c2004-05-12 19:32:15 +0000336if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000337 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000338 make="gmake"
blueswir168063642008-11-22 21:03:55 +0000339 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000340 fi
blueswir184778502008-10-26 20:33:16 +0000341 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000342fi
343
bellard7d132992003-03-06 23:23:54 +0000344# find source path
pbrookad064842006-04-16 12:41:07 +0000345source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000346source_path_used="no"
347workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000348if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000349 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000350else
351 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000352fi
pbrook724db112008-02-03 19:20:13 +0000353[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000354
bellard85aa5182007-11-11 20:17:03 +0000355werror="no"
bellard0d1e2392007-11-11 20:24:30 +0000356# generate compile errors on warnings for development builds
357#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
358#werror="yes";
359#fi
bellard85aa5182007-11-11 20:17:03 +0000360
bellard7d132992003-03-06 23:23:54 +0000361for opt do
pbrooka46e4032006-04-29 23:05:22 +0000362 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000363 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000364 --help|-h) show_help=yes
365 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000366 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000367 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000368 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000369 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000370 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000371 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000372 ;;
aliguoriac0df512008-12-29 17:14:15 +0000373 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000374 ;;
aliguoriac0df512008-12-29 17:14:15 +0000375 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000376 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000377 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000378 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000379 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000380 ;;
pbrook6a882642006-04-17 13:57:12 +0000381 --install=*) install="$optarg"
382 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000383 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000384 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000385 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000386 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000387 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000388 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000389 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000390 ;;
bellard7d132992003-03-06 23:23:54 +0000391 --enable-gprof) gprof="yes"
392 ;;
bellard43ce4df2003-06-09 19:53:12 +0000393 --static) static="yes"
394 ;;
bellard97a847b2003-08-10 21:36:04 +0000395 --disable-sdl) sdl="no"
396 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000397 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000398 ;;
malcc2de5c92008-06-28 19:13:06 +0000399 --fmod-inc=*) fmod_inc="$optarg"
400 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000401 --oss-lib=*) oss_lib="$optarg"
402 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000403 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000404 ;;
405 --audio-drv-list=*) audio_drv_list="$optarg"
406 ;;
aurel32f8393942009-04-13 18:45:38 +0000407 --enable-debug-tcg) debug_tcg="yes"
408 ;;
409 --disable-debug-tcg) debug_tcg="no"
410 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000411 --enable-sparse) sparse="yes"
412 ;;
413 --disable-sparse) sparse="no"
414 ;;
aliguori1625af82009-04-05 17:41:02 +0000415 --disable-strip) strip_opt="no"
416 ;;
ths8d5d2d42007-08-25 01:37:51 +0000417 --disable-vnc-tls) vnc_tls="no"
418 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000419 --disable-vnc-sasl) vnc_sasl="no"
420 ;;
bellard443f1372004-06-04 11:13:20 +0000421 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000422 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000423 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000424 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000425 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000426 ;;
aliguorie37630c2009-04-22 15:19:10 +0000427 --disable-xen) xen="no"
428 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000429 --disable-brlapi) brlapi="no"
430 ;;
balrogfb599c92008-09-28 23:49:55 +0000431 --disable-bluez) bluez="no"
432 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000433 --disable-kvm) kvm="no"
434 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000435 --enable-profiler) profiler="yes"
436 ;;
malcc2de5c92008-06-28 19:13:06 +0000437 --enable-cocoa)
438 cocoa="yes" ;
439 sdl="no" ;
440 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000441 ;;
pbrookcad25d62006-03-19 16:31:11 +0000442 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000443 ;;
pbrookcad25d62006-03-19 16:31:11 +0000444 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000445 ;;
ths831b7822007-01-18 20:06:33 +0000446 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000447 ;;
ths831b7822007-01-18 20:06:33 +0000448 --enable-linux-user) linux_user="yes"
449 ;;
450 --disable-darwin-user) darwin_user="no"
451 ;;
452 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000453 ;;
blueswir184778502008-10-26 20:33:16 +0000454 --disable-bsd-user) bsd_user="no"
455 ;;
456 --enable-bsd-user) bsd_user="yes"
457 ;;
pbrookc5937222006-05-14 11:30:38 +0000458 --enable-uname-release=*) uname_release="$optarg"
459 ;;
blueswir131422552007-04-16 18:27:06 +0000460 --sparc_cpu=*)
461 sparc_cpu="$optarg"
462 case $sparc_cpu in
463 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
464 target_cpu="sparc"; cpu="sparc" ;;
465 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
466 target_cpu="sparc"; cpu="sparc" ;;
467 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
468 target_cpu="sparc64"; cpu="sparc64" ;;
469 *) echo "undefined SPARC architecture. Exiting";exit 1;;
470 esac
471 ;;
bellard85aa5182007-11-11 20:17:03 +0000472 --enable-werror) werror="yes"
473 ;;
474 --disable-werror) werror="no"
475 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000476 --disable-curses) curses="no"
477 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200478 --disable-curl) curl="no"
479 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000480 --disable-nptl) nptl="no"
481 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000482 --enable-mixemu) mixemu="yes"
483 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000484 --disable-pthread) pthread="no"
485 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000486 --disable-aio) aio="no"
487 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000488 --enable-io-thread) io_thread="yes"
489 ;;
ths77755342008-11-27 15:45:16 +0000490 --disable-blobs) blobs="no"
491 ;;
aliguorieac30262008-11-05 16:28:56 +0000492 --kerneldir=*) kerneldir="$optarg"
493 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000494 --with-pkgversion=*) pkgversion=" ($optarg)"
495 ;;
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500496 --disable-docs) build_docs="no"
497 ;;
balrog7f1559c2007-11-17 10:24:32 +0000498 *) echo "ERROR: unknown option $opt"; show_help="yes"
499 ;;
bellard7d132992003-03-06 23:23:54 +0000500 esac
501done
502
ths6f30fa82007-01-05 01:00:47 +0000503# default flags for all hosts
blueswir1ac41a622008-09-14 06:46:31 +0000504CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
blueswir1e0e36fe2008-12-07 19:16:27 +0000505CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
ths6f30fa82007-01-05 01:00:47 +0000506LDFLAGS="$LDFLAGS -g"
bellard85aa5182007-11-11 20:17:03 +0000507if test "$werror" = "yes" ; then
508CFLAGS="$CFLAGS -Werror"
509fi
ths6f30fa82007-01-05 01:00:47 +0000510
blueswir1d2c7c9b2008-11-01 14:50:20 +0000511if test "$solaris" = "no" ; then
512 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
513 LDFLAGS="$LDFLAGS -Wl,--warn-common"
514 fi
blueswir149237ac2008-09-17 19:05:19 +0000515fi
516
blueswir131422552007-04-16 18:27:06 +0000517#
518# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
519# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
520#
bellard40293e52008-01-31 11:32:10 +0000521case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000522 sparc) if test -z "$sparc_cpu" ; then
523 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
524 ARCH_LDFLAGS="-m32"
525 else
526 ARCH_CFLAGS="${SP_CFLAGS}"
527 ARCH_LDFLAGS="${SP_LDFLAGS}"
528 fi
blueswir1762e8232009-04-04 09:21:28 +0000529 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
530 if test "$solaris" = "no" ; then
531 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
532 fi
blueswir131422552007-04-16 18:27:06 +0000533 ;;
534 sparc64) if test -z "$sparc_cpu" ; then
535 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
536 ARCH_LDFLAGS="-m64"
537 else
538 ARCH_CFLAGS="${SP_CFLAGS}"
539 ARCH_LDFLAGS="${SP_LDFLAGS}"
540 fi
blueswir1762e8232009-04-04 09:21:28 +0000541 if test "$solaris" = "no" ; then
542 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
543 else
544 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
545 fi
blueswir131422552007-04-16 18:27:06 +0000546 ;;
ths76d83bd2007-11-18 21:22:10 +0000547 s390)
548 ARCH_CFLAGS="-march=z900"
549 ;;
bellard40293e52008-01-31 11:32:10 +0000550 i386)
551 ARCH_CFLAGS="-m32"
552 ARCH_LDFLAGS="-m32"
553 ;;
554 x86_64)
555 ARCH_CFLAGS="-m64"
556 ARCH_LDFLAGS="-m64"
557 ;;
blueswir131422552007-04-16 18:27:06 +0000558esac
559
pbrookaf5db582006-04-08 14:26:41 +0000560if test x"$show_help" = x"yes" ; then
561cat << EOF
562
563Usage: configure [options]
564Options: [defaults in brackets after descriptions]
565
566EOF
567echo "Standard options:"
568echo " --help print this message"
569echo " --prefix=PREFIX install in PREFIX [$prefix]"
570echo " --interp-prefix=PREFIX where to find shared libraries, etc."
571echo " use %M for cpu name [$interp_prefix]"
572echo " --target-list=LIST set target list [$target_list]"
573echo ""
574echo "kqemu kernel acceleration support:"
575echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000576echo ""
577echo "Advanced options (experts only):"
578echo " --source-path=PATH path of source code [$source_path]"
579echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
580echo " --cc=CC use C compiler CC [$cc]"
581echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
aurel322981fa92009-04-07 19:57:17 +0000582echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
583echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000584echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000585echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000586echo " --static enable static build [$static]"
aurel32f8393942009-04-13 18:45:38 +0000587echo " --enable-debug-tcg enable TCG debugging"
588echo " --disable-debug-tcg disable TCG debugging (default)"
aliguori890b1652008-10-07 21:22:41 +0000589echo " --enable-sparse enable sparse checker"
590echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000591echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000592echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000593echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000594echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000595echo " --audio-drv-list=LIST set audio drivers list:"
596echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000597echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
598echo " Available cards: $audio_possible_cards"
malc8ff9cbf2008-06-23 18:33:30 +0000599echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +0000600echo " --disable-xen disable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +0000601echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000602echo " --disable-vnc-tls disable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000603echo " --disable-vnc-sasl disable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000604echo " --disable-curses disable curses output"
Alexander Graf769ce762009-05-11 17:41:42 +0200605echo " --disable-curl disable curl connectivity"
balrogfb599c92008-09-28 23:49:55 +0000606echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000607echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000608echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000609echo " --enable-system enable all system emulation targets"
610echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000611echo " --enable-linux-user enable all linux usermode emulation targets"
612echo " --disable-linux-user disable all linux usermode emulation targets"
613echo " --enable-darwin-user enable all darwin usermode emulation targets"
614echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000615echo " --enable-bsd-user enable all BSD usermode emulation targets"
616echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000617echo " --fmod-lib path to FMOD library"
618echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000619echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000620echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000621echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000622echo " --disable-vde disable support for vde network"
aliguorie5d355d2009-04-24 18:03:15 +0000623echo " --disable-pthread disable pthread support"
blueswir1414f0da2008-08-15 18:20:52 +0000624echo " --disable-aio disable AIO support"
aliguorie5d355d2009-04-24 18:03:15 +0000625echo " --enable-io-thread enable IO thread"
ths77755342008-11-27 15:45:16 +0000626echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000627echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000628echo ""
ths5bf08932006-12-23 00:33:26 +0000629echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000630exit 1
631fi
632
bellard67b915a2004-03-31 23:37:16 +0000633if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000634 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000635 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000636 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000637 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000638 bsd_user="no"
aliguori49dc7682009-03-08 16:26:59 +0000639 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
aliguoricd01b4a2008-08-21 19:25:45 +0000640fi
641
aliguori03b4fe72008-10-07 19:16:17 +0000642if test ! -x "$(which cgcc 2>/dev/null)"; then
643 sparse="no"
644fi
645
bellardec530c82006-04-25 22:36:06 +0000646#
647# Solaris specific configure tool chain decisions
648#
649if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000650 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
651 if test -z "$solinst" ; then
652 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
653 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
654 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
655 exit 1
656 fi
657 if test "$solinst" = "/usr/sbin/install" ; then
658 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
659 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
660 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
661 exit 1
662 fi
bellardec530c82006-04-25 22:36:06 +0000663 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
664 if test -z "$sol_ar" ; then
665 echo "Error: No path includes ar"
666 if test -f /usr/ccs/bin/ar ; then
667 echo "Add /usr/ccs/bin to your path and rerun configure"
668 fi
669 exit 1
670 fi
ths5fafdf22007-09-16 21:08:06 +0000671fi
bellardec530c82006-04-25 22:36:06 +0000672
673
bellard5327cf42005-01-10 23:18:50 +0000674if test -z "$target_list" ; then
675# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000676 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000677 target_list="\
678i386-softmmu \
679x86_64-softmmu \
680arm-softmmu \
681cris-softmmu \
682m68k-softmmu \
683mips-softmmu \
684mipsel-softmmu \
685mips64-softmmu \
686mips64el-softmmu \
687ppc-softmmu \
688ppcemb-softmmu \
689ppc64-softmmu \
690sh4-softmmu \
691sh4eb-softmmu \
692sparc-softmmu \
693"
pbrook0a8e90f2006-03-19 14:54:16 +0000694 fi
bellard5327cf42005-01-10 23:18:50 +0000695# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000696 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000697 target_list="${target_list}\
698i386-linux-user \
699x86_64-linux-user \
700alpha-linux-user \
701arm-linux-user \
702armeb-linux-user \
703cris-linux-user \
704m68k-linux-user \
705mips-linux-user \
706mipsel-linux-user \
707ppc-linux-user \
708ppc64-linux-user \
709ppc64abi32-linux-user \
710sh4-linux-user \
711sh4eb-linux-user \
712sparc-linux-user \
713sparc64-linux-user \
714sparc32plus-linux-user \
715"
ths831b7822007-01-18 20:06:33 +0000716 fi
717# the following are Darwin specific
718 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000719 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000720 fi
blueswir184778502008-10-26 20:33:16 +0000721# the following are BSD specific
722 if [ "$bsd_user" = "yes" ] ; then
723 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +0000724i386-bsd-user \
725x86_64-bsd-user \
726sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +0000727sparc64-bsd-user \
728"
729 fi
bellard6e20a452005-06-05 15:56:02 +0000730else
pbrookb1a550a2006-04-16 13:28:56 +0000731 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000732fi
pbrook0a8e90f2006-03-19 14:54:16 +0000733if test -z "$target_list" ; then
734 echo "No targets enabled"
735 exit 1
736fi
bellard5327cf42005-01-10 23:18:50 +0000737
bellard7d132992003-03-06 23:23:54 +0000738if test -z "$cross_prefix" ; then
739
740# ---
741# big/little endian test
742cat > $TMPC << EOF
743#include <inttypes.h>
744int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000745 volatile uint32_t i=0x01234567;
746 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000747}
748EOF
749
aurel32178baee2008-12-08 18:11:57 +0000750if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000751$TMPE && bigendian="yes"
752else
753echo big/little test failed
754fi
755
756else
757
758# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000759if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000760 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000761 -o "$cpu" = "m68k" \
762 -o "$cpu" = "mips" \
763 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000764 -o "$cpu" = "ppc" \
765 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000766 -o "$cpu" = "s390" \
767 -o "$cpu" = "sparc" \
768 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000769 bigendian="yes"
770fi
771
772fi
773
bellardb6853692005-06-05 17:10:39 +0000774# host long bits test
775hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000776if test "$cpu" = "x86_64" \
777 -o "$cpu" = "alpha" \
778 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000779 -o "$cpu" = "sparc64" \
780 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000781 hostlongbits="64"
782fi
783
pbrookbd0c5662008-05-29 14:34:11 +0000784# Check host NPTL support
785cat > $TMPC <<EOF
786#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000787#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000788void foo()
789{
790#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
791#error bork
792#endif
793}
794EOF
795
balrog8c7f7572008-12-15 03:15:36 +0000796if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000797 :
798else
799 nptl="no"
800fi
801
bellard11d9f692004-04-02 20:55:59 +0000802##########################################
balrogac629222008-10-11 09:56:04 +0000803# zlib check
804
805cat > $TMPC << EOF
806#include <zlib.h>
807int main(void) { zlibVersion(); return 0; }
808EOF
balrog8c7f7572008-12-15 03:15:36 +0000809if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000810 :
811else
812 echo
813 echo "Error: zlib check failed"
814 echo "Make sure to have the zlib libs and headers installed."
815 echo
816 exit 1
817fi
818
819##########################################
aliguorie37630c2009-04-22 15:19:10 +0000820# xen probe
821
822if test "$xen" = "yes" ; then
823cat > $TMPC <<EOF
824#include <xenctrl.h>
825#include <xs.h>
826int main(void) { xs_daemon_open; xc_interface_open; }
827EOF
Jan Kiszka918a6082009-04-27 17:16:55 +0000828 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null > /dev/null ; then
aliguorie37630c2009-04-22 15:19:10 +0000829 :
830 else
831 xen="no"
832 fi
833fi
834
835##########################################
bellard11d9f692004-04-02 20:55:59 +0000836# SDL probe
837
838sdl_too_old=no
839
Anthony Liguorif92f8af2009-05-20 13:01:02 -0500840if test "$sdl" = "yes" ; then
ths069b0bd2007-07-12 00:27:15 +0000841 sdl_config="sdl-config"
842 sdl=no
843 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000844
845cat > $TMPC << EOF
846#include <SDL.h>
847#undef main /* We don't want SDL to override our main() */
848int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
849EOF
balrog8c7f7572008-12-15 03:15:36 +0000850 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 +0000851 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
852 if test "$_sdlversion" -lt 121 ; then
853 sdl_too_old=yes
854 else
855 if test "$cocoa" = "no" ; then
856 sdl=yes
857 fi
858 fi
859
860 # static link with sdl ?
861 if test "$sdl" = "yes" ; then
862 aa="no"
863 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
864 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
865 if [ "$aa" = "yes" ] ; then
866 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000867 fi
bellard11d9f692004-04-02 20:55:59 +0000868
balrog8c7f7572008-12-15 03:15:36 +0000869 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 +0000870 sdl_static=yes
871 fi
872 fi # static link
873 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000874else
ths069b0bd2007-07-12 00:27:15 +0000875 # Make sure to disable cocoa if sdl was set
876 if test "$sdl" = "yes" ; then
877 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000878 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000879 fi
bellarda6e022a2004-04-02 21:55:47 +0000880fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000881
aliguori5368a422009-03-03 17:37:21 +0000882if test "$sdl" = "yes" ; then
883cat > $TMPC <<EOF
884#include <SDL.h>
885#if defined(SDL_VIDEO_DRIVER_X11)
886#include <X11/XKBlib.h>
887#else
888#error No x11 support
889#endif
890int main(void) { return 0; }
891EOF
892 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
893 sdl_x11="yes"
894 fi
895fi
896
ths8f28f3f2007-01-05 21:25:54 +0000897##########################################
ths8d5d2d42007-08-25 01:37:51 +0000898# VNC TLS detection
899if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000900cat > $TMPC <<EOF
901#include <gnutls/gnutls.h>
902int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
903EOF
904 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
905 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
906 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000907 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000908 :
909 else
910 vnc_tls="no"
911 fi
ths8d5d2d42007-08-25 01:37:51 +0000912fi
913
914##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000915# VNC SASL detection
916if test "$vnc_sasl" = "yes" ; then
917cat > $TMPC <<EOF
918#include <sasl/sasl.h>
919#include <stdio.h>
920int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
921EOF
922 # Assuming Cyrus-SASL installed in /usr prefix
923 vnc_sasl_cflags=""
924 vnc_sasl_libs="-lsasl2"
925 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
Jan Kiszka918a6082009-04-27 17:16:55 +0000926 $vnc_sasl_libs 2> /dev/null > /dev/null ; then
aliguori2f9606b2009-03-06 20:27:28 +0000927 :
928 else
929 vnc_sasl="no"
930 fi
931fi
932
933##########################################
aliguori76655d62009-03-06 20:27:37 +0000934# fnmatch() probe, used for ACL routines
935fnmatch="no"
936cat > $TMPC << EOF
937#include <fnmatch.h>
938int main(void)
939{
940 fnmatch("foo", "foo", 0);
941 return 0;
942}
943EOF
944if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
945 fnmatch="yes"
946fi
947
948##########################################
ths8a16d272008-07-19 09:56:24 +0000949# vde libraries probe
950if test "$vde" = "yes" ; then
951 cat > $TMPC << EOF
952#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000953int main(void)
954{
955 struct vde_open_args a = {0, 0, 0};
956 vde_open("", "", &a);
957 return 0;
958}
ths8a16d272008-07-19 09:56:24 +0000959EOF
balrog8c7f7572008-12-15 03:15:36 +0000960 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000961 :
962 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000963 vde="no"
ths8a16d272008-07-19 09:56:24 +0000964 fi
965fi
966
967##########################################
malcc2de5c92008-06-28 19:13:06 +0000968# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000969
malcc2de5c92008-06-28 19:13:06 +0000970audio_drv_probe()
971{
972 drv=$1
973 hdr=$2
974 lib=$3
975 exp=$4
976 cfl=$5
977 cat > $TMPC << EOF
978#include <$hdr>
979int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000980EOF
balrog8c7f7572008-12-15 03:15:36 +0000981 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +0000982 :
983 else
984 echo
985 echo "Error: $drv check failed"
986 echo "Make sure to have the $drv libs and headers installed."
987 echo
988 exit 1
989 fi
990}
991
malc2fa7d3b2008-07-29 12:58:44 +0000992audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000993for drv in $audio_drv_list; do
994 case $drv in
995 alsa)
996 audio_drv_probe $drv alsa/asoundlib.h -lasound \
997 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
998 ;;
999
1000 fmod)
1001 if test -z $fmod_lib || test -z $fmod_inc; then
1002 echo
1003 echo "Error: You must specify path to FMOD library and headers"
1004 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1005 echo
1006 exit 1
1007 fi
1008 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1009 ;;
1010
1011 esd)
1012 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1013 ;;
malcb8e59f12008-07-02 21:03:08 +00001014
1015 pa)
1016 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1017 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1018 ;;
1019
blueswir12f6a1ab2008-08-21 18:00:53 +00001020 oss|sdl|core|wav|dsound)
1021 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1022 ;;
1023
malce4c63a62008-07-19 16:15:16 +00001024 *)
malc1c9b2a52008-07-19 16:57:30 +00001025 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001026 echo
1027 echo "Error: Unknown driver '$drv' selected"
1028 echo "Possible drivers are: $audio_possible_drivers"
1029 echo
1030 exit 1
1031 }
1032 ;;
malcc2de5c92008-06-28 19:13:06 +00001033 esac
1034done
ths8f28f3f2007-01-05 21:25:54 +00001035
balrog4d3b6f62008-02-10 16:33:14 +00001036##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001037# BrlAPI probe
1038
1039if test -z "$brlapi" ; then
1040 brlapi=no
1041cat > $TMPC << EOF
1042#include <brlapi.h>
1043int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1044EOF
aurel32178baee2008-12-08 18:11:57 +00001045 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +00001046 brlapi=yes
1047 fi # brlapi compile test
1048fi # -z $brlapi
1049
1050##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001051# curses probe
1052
1053if test "$curses" = "yes" ; then
1054 curses=no
1055 cat > $TMPC << EOF
1056#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001057#ifdef __OpenBSD__
1058#define resize_term resizeterm
1059#endif
1060int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001061EOF
aurel32178baee2008-12-08 18:11:57 +00001062 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +00001063 curses=yes
1064 fi
1065fi # test "$curses"
1066
blueswir1414f0da2008-08-15 18:20:52 +00001067##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02001068# curl probe
1069
1070if test "$curl" = "yes" ; then
1071 curl=no
1072 cat > $TMPC << EOF
1073#include <curl/curl.h>
1074int main(void) { return curl_easy_init(); }
1075EOF
Paul Brook52368552009-05-22 17:22:38 +01001076 curl_libs=`curl-config --libs 2>/dev/null`
Alexander Graf769ce762009-05-11 17:41:42 +02001077 if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1078 curl=yes
1079 fi
1080fi # test "$curl"
1081
1082##########################################
balrogfb599c92008-09-28 23:49:55 +00001083# bluez support probe
1084if test "$bluez" = "yes" ; then
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001085 `pkg-config bluez 2> /dev/null` || bluez="no"
balrogfb599c92008-09-28 23:49:55 +00001086fi
1087if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001088 cat > $TMPC << EOF
1089#include <bluetooth/bluetooth.h>
1090int main(void) { return bt_error(0); }
1091EOF
Blue Swirlefcfd0c2009-04-28 17:05:24 +00001092 bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
1093 bluez_libs=`pkg-config --libs bluez 2> /dev/null`
balrog17e15922008-10-11 12:00:42 +00001094 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001095 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001096 :
1097 else
1098 bluez="no"
1099 fi
balrogfb599c92008-09-28 23:49:55 +00001100fi
1101
1102##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001103# kvm probe
1104if test "$kvm" = "yes" ; then
1105 cat > $TMPC <<EOF
1106#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001107#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001108#error Invalid KVM version
1109#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001110#if !defined(KVM_CAP_USER_MEMORY)
1111#error Missing KVM capability KVM_CAP_USER_MEMORY
1112#endif
1113#if !defined(KVM_CAP_SET_TSS_ADDR)
1114#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1115#endif
1116#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1117#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1118#endif
aliguori7ba1e612008-11-05 16:04:33 +00001119int main(void) { return 0; }
1120EOF
aliguorieac30262008-11-05 16:28:56 +00001121 if test "$kerneldir" != "" ; then
1122 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001123 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1124 -a -d "$kerneldir/arch/x86/include" ; then
1125 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001126 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1127 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001128 elif test -d "$kerneldir/arch/$cpu/include" ; then
1129 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1130 fi
aliguorieac30262008-11-05 16:28:56 +00001131 else
1132 kvm_cflags=""
1133 fi
aliguori7ba1e612008-11-05 16:04:33 +00001134 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001135 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001136 :
1137 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001138 kvm="no";
1139 if [ -x "`which awk 2>/dev/null`" ] && \
1140 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001141 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001142 | grep "error: " \
1143 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1144 if test "$kvmerr" != "" ; then
1145 kvm="no - (${kvmerr})"
1146 fi
1147 fi
aliguori7ba1e612008-11-05 16:04:33 +00001148 fi
1149fi
1150
1151##########################################
aliguorie5d355d2009-04-24 18:03:15 +00001152# pthread probe
1153PTHREADLIBS=""
aliguori3c529d92008-12-12 16:41:40 +00001154
aliguorie5d355d2009-04-24 18:03:15 +00001155if test "$pthread" = yes; then
1156 pthread=no
1157cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001158#include <pthread.h>
blueswir1c9db92f2009-01-17 06:49:15 +00001159int main(void) { pthread_mutex_t lock; return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001160EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001161 if $cc $ARCH_CFLAGS -o $TMPE $PTHREADLIBS $TMPC 2> /dev/null > /dev/null ; then
aliguorie5d355d2009-04-24 18:03:15 +00001162 pthread=yes
1163 PTHREADLIBS="-lpthread"
blueswir1414f0da2008-08-15 18:20:52 +00001164 fi
1165fi
1166
aliguorie5d355d2009-04-24 18:03:15 +00001167if test "$pthread" = no; then
1168 aio=no
1169 io_thread=no
1170fi
1171
aliguoribf9298b2008-12-05 20:05:26 +00001172##########################################
1173# iovec probe
1174cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001175#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001176#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001177#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001178int main(void) { struct iovec iov; return 0; }
1179EOF
1180iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001181if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001182 iovec=yes
1183fi
1184
aurel32f652e6a2008-12-16 10:43:48 +00001185##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001186# preadv probe
1187cat > $TMPC <<EOF
1188#include <sys/types.h>
1189#include <sys/uio.h>
1190#include <unistd.h>
1191int main(void) { preadv; }
1192EOF
1193preadv=no
1194if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1195 preadv=yes
1196fi
1197
1198##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001199# fdt probe
1200if test "$fdt" = "yes" ; then
1201 fdt=no
1202 cat > $TMPC << EOF
1203int main(void) { return 0; }
1204EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001205 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null > /dev/null ; then
aurel32f652e6a2008-12-16 10:43:48 +00001206 fdt=yes
1207 fi
1208fi
1209
aurel323b3f24a2009-04-15 16:12:13 +00001210#
1211# Check for xxxat() functions when we are building linux-user
1212# emulator. This is done because older glibc versions don't
1213# have syscall stubs for these implemented.
1214#
1215atfile=no
1216if [ "$linux_user" = "yes" ] ; then
1217 cat > $TMPC << EOF
1218#define _ATFILE_SOURCE
1219#include <sys/types.h>
1220#include <fcntl.h>
1221#include <unistd.h>
1222
1223int
1224main(void)
1225{
1226 /* try to unlink nonexisting file */
1227 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1228}
1229EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001230 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
aurel323b3f24a2009-04-15 16:12:13 +00001231 atfile=yes
1232 fi
1233fi
1234
aurel3239386ac2009-04-15 19:48:17 +00001235# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00001236# emulator. This is done because older glibc versions don't
1237# have syscall stubs for these implemented. In that case we
1238# don't provide them even if kernel supports them.
1239#
1240inotify=no
1241if [ "$linux_user" = "yes" ] ; then
1242 cat > $TMPC << EOF
1243#include <sys/inotify.h>
1244
1245int
1246main(void)
1247{
1248 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00001249 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00001250}
1251EOF
Jan Kiszka918a6082009-04-27 17:16:55 +00001252 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
aurel323b3f24a2009-04-15 16:12:13 +00001253 inotify=yes
1254 fi
1255fi
1256
pbrookcc8ae6d2006-04-23 17:57:59 +00001257# Check if tools are available to build documentation.
Anthony Liguori70ec5dc2009-05-14 08:25:04 -05001258if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
1259 build_docs="no"
pbrookcc8ae6d2006-04-23 17:57:59 +00001260fi
1261
aliguorida93a1f2008-12-12 20:02:52 +00001262##########################################
1263# Do we need librt
aliguorie5d355d2009-04-24 18:03:15 +00001264CLOCKLIBS=""
aliguorida93a1f2008-12-12 20:02:52 +00001265cat > $TMPC <<EOF
1266#include <signal.h>
1267#include <time.h>
1268int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1269EOF
1270
1271rt=no
balrog8c7f7572008-12-15 03:15:36 +00001272if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001273 :
balrog8c7f7572008-12-15 03:15:36 +00001274elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001275 rt=yes
1276fi
1277
1278if test "$rt" = "yes" ; then
aliguorie5d355d2009-04-24 18:03:15 +00001279 CLOCKLIBS="-lrt"
aliguorida93a1f2008-12-12 20:02:52 +00001280fi
1281
bellard11d9f692004-04-02 20:55:59 +00001282if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001283 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001284 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001285 fi
1286 mansuffix=""
1287 datasuffix=""
1288 docsuffix=""
1289 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001290else
pbrook308c3592007-02-27 00:52:01 +00001291 if test -z "$prefix" ; then
1292 prefix="/usr/local"
1293 fi
1294 mansuffix="/share/man"
1295 datasuffix="/share/qemu"
1296 docsuffix="/share/doc/qemu"
1297 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001298fi
bellard5a671352003-10-01 00:13:48 +00001299
bellard43ce4df2003-06-09 19:53:12 +00001300echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001301echo "BIOS directory $prefix$datasuffix"
1302echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001303if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001304echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001305echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001306fi
bellard5a671352003-10-01 00:13:48 +00001307echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001308echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001309echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001310echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001311echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001312echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001313echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001314echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001315echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00001316echo "tcg debug enabled $debug_tcg"
bellard43ce4df2003-06-09 19:53:12 +00001317echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001318echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00001319echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00001320echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001321echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001322echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001323if test "$darwin" = "yes" ; then
1324 echo "Cocoa support $cocoa"
1325fi
bellard97a847b2003-08-10 21:36:04 +00001326echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001327if test "$sdl" != "no" ; then
1328 echo "SDL static link $sdl_static"
1329fi
balrog4d3b6f62008-02-10 16:33:14 +00001330echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02001331echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00001332echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001333echo "Audio drivers $audio_drv_list"
1334echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001335echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001336echo "VNC TLS support $vnc_tls"
1337if test "$vnc_tls" = "yes" ; then
1338 echo " TLS CFLAGS $vnc_tls_cflags"
1339 echo " TLS LIBS $vnc_tls_libs"
1340fi
aliguori2f9606b2009-03-06 20:27:28 +00001341echo "VNC SASL support $vnc_sasl"
1342if test "$vnc_sasl" = "yes" ; then
1343 echo " SASL CFLAGS $vnc_sasl_cflags"
1344 echo " SASL LIBS $vnc_sasl_libs"
1345fi
blueswir131422552007-04-16 18:27:06 +00001346if test -n "$sparc_cpu"; then
1347 echo "Target Sparc Arch $sparc_cpu"
1348fi
bellard07f4ddb2005-04-23 17:44:28 +00001349echo "kqemu support $kqemu"
aliguorie37630c2009-04-22 15:19:10 +00001350echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00001351echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001352echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001353[ ! -z "$uname_release" ] && \
1354echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001355echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001356echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001357echo "AIO support $aio"
aliguorie5d355d2009-04-24 18:03:15 +00001358echo "IO thread $io_thread"
ths77755342008-11-27 15:45:16 +00001359echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001360echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001361echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00001362echo "preadv support $preadv"
bellard67b915a2004-03-31 23:37:16 +00001363
bellard97a847b2003-08-10 21:36:04 +00001364if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001365echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001366fi
bellard24b55b92005-03-01 22:30:41 +00001367#if test "$sdl_static" = "no"; then
1368# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1369#fi
bellard97a847b2003-08-10 21:36:04 +00001370config_mak="config-host.mak"
1371config_h="config-host.h"
1372
bellard7c1f25b2004-04-22 00:02:08 +00001373#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001374
ths15d9ca02007-07-31 23:07:32 +00001375test -f $config_h && mv $config_h ${config_h}~
1376
bellard97a847b2003-08-10 21:36:04 +00001377echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001378printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001379printf " '%s'" "$0" "$@" >> $config_mak
1380echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001381echo "/* Automatically generated by configure - do not modify */" > $config_h
1382
1383echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001384echo "bindir=\${prefix}$binsuffix" >> $config_mak
1385echo "mandir=\${prefix}$mansuffix" >> $config_mak
1386echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001387echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001388echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001389echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001390echo "INSTALL=$install" >> $config_mak
aliguori58f8aea2009-04-18 15:36:02 +00001391echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1392echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1393echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001394echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001395echo "HOST_CC=$host_cc" >> $config_mak
1396echo "AR=$ar" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001397# XXX: only use CFLAGS and LDFLAGS ?
1398# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1399# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001400echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001401echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1402echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1403echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001404echo "CFLAGS=$CFLAGS" >> $config_mak
1405echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001406echo "EXESUF=$EXESUF" >> $config_mak
aliguorie5d355d2009-04-24 18:03:15 +00001407echo "PTHREADLIBS=$PTHREADLIBS" >> $config_mak
1408echo "CLOCKLIBS=$CLOCKLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001409case "$cpu" in
1410 i386)
1411 echo "ARCH=i386" >> $config_mak
1412 echo "#define HOST_I386 1" >> $config_h
1413 ;;
1414 x86_64)
1415 echo "ARCH=x86_64" >> $config_mak
1416 echo "#define HOST_X86_64 1" >> $config_h
1417 ;;
1418 alpha)
1419 echo "ARCH=alpha" >> $config_mak
1420 echo "#define HOST_ALPHA 1" >> $config_h
1421 ;;
1422 armv4b)
1423 echo "ARCH=arm" >> $config_mak
1424 echo "#define HOST_ARM 1" >> $config_h
1425 ;;
1426 armv4l)
1427 echo "ARCH=arm" >> $config_mak
1428 echo "#define HOST_ARM 1" >> $config_h
1429 ;;
1430 cris)
1431 echo "ARCH=cris" >> $config_mak
1432 echo "#define HOST_CRIS 1" >> $config_h
1433 ;;
1434 hppa)
1435 echo "ARCH=hppa" >> $config_mak
1436 echo "#define HOST_HPPA 1" >> $config_h
1437 ;;
1438 ia64)
1439 echo "ARCH=ia64" >> $config_mak
1440 echo "#define HOST_IA64 1" >> $config_h
1441 ;;
1442 m68k)
1443 echo "ARCH=m68k" >> $config_mak
1444 echo "#define HOST_M68K 1" >> $config_h
1445 ;;
1446 mips)
1447 echo "ARCH=mips" >> $config_mak
1448 echo "#define HOST_MIPS 1" >> $config_h
1449 ;;
1450 mips64)
1451 echo "ARCH=mips64" >> $config_mak
1452 echo "#define HOST_MIPS64 1" >> $config_h
1453 ;;
malcfdf7ed92009-01-14 18:39:52 +00001454 ppc)
1455 echo "ARCH=ppc" >> $config_mak
1456 echo "#define HOST_PPC 1" >> $config_h
1457 ;;
1458 ppc64)
1459 echo "ARCH=ppc64" >> $config_mak
1460 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001461 ;;
1462 s390)
1463 echo "ARCH=s390" >> $config_mak
1464 echo "#define HOST_S390 1" >> $config_h
1465 ;;
1466 sparc)
1467 echo "ARCH=sparc" >> $config_mak
1468 echo "#define HOST_SPARC 1" >> $config_h
1469 ;;
1470 sparc64)
1471 echo "ARCH=sparc64" >> $config_mak
1472 echo "#define HOST_SPARC64 1" >> $config_h
1473 ;;
1474 *)
1475 echo "Unsupported CPU = $cpu"
1476 exit 1
1477 ;;
1478esac
aurel32f8393942009-04-13 18:45:38 +00001479if test "$debug_tcg" = "yes" ; then
1480 echo "#define DEBUG_TCG 1" >> $config_h
1481fi
aliguori03b4fe72008-10-07 19:16:17 +00001482if test "$sparse" = "yes" ; then
1483 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1484 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1485 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1486fi
aliguori1625af82009-04-05 17:41:02 +00001487if test "$strip_opt" = "yes" ; then
1488 echo "STRIP_OPT=-s" >> $config_mak
1489fi
bellard7d132992003-03-06 23:23:54 +00001490if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001491 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1492 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1493fi
bellardb6853692005-06-05 17:10:39 +00001494echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001495if test "$mingw32" = "yes" ; then
1496 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001497 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001498else
1499 cat > $TMPC << EOF
1500#include <byteswap.h>
1501int main(void) { return bswap_32(0); }
1502EOF
aurel32178baee2008-12-08 18:11:57 +00001503 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001504 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1505 fi
blueswir113606772008-12-05 17:54:09 +00001506 cat > $TMPC << EOF
1507#include <sys/endian.h>
1508#include <sys/types.h>
1509#include <machine/bswap.h>
1510int main(void) { return bswap32(0); }
1511EOF
aurel32178baee2008-12-08 18:11:57 +00001512 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001513 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1514 fi
bellard67b915a2004-03-31 23:37:16 +00001515fi
blueswir1128ab2f2008-08-15 18:33:42 +00001516
1517if [ "$openbsd" = "yes" ] ; then
1518 echo "#define ENOTSUP 4096" >> $config_h
1519fi
1520
bellard83fb7ad2004-07-05 21:25:26 +00001521if test "$darwin" = "yes" ; then
1522 echo "CONFIG_DARWIN=yes" >> $config_mak
1523 echo "#define CONFIG_DARWIN 1" >> $config_h
1524fi
malcb29fe3e2008-11-18 01:42:22 +00001525
1526if test "$aix" = "yes" ; then
1527 echo "CONFIG_AIX=yes" >> $config_mak
1528 echo "#define CONFIG_AIX 1" >> $config_h
1529fi
1530
bellardec530c82006-04-25 22:36:06 +00001531if test "$solaris" = "yes" ; then
1532 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001533 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001534 if test "$needs_libsunmath" = "yes" ; then
1535 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1536 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1537 fi
bellardec530c82006-04-25 22:36:06 +00001538fi
blueswir131422552007-04-16 18:27:06 +00001539if test -n "$sparc_cpu"; then
1540 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1541 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1542fi
bellard97a847b2003-08-10 21:36:04 +00001543if test "$gprof" = "yes" ; then
1544 echo "TARGET_GPROF=yes" >> $config_mak
1545 echo "#define HAVE_GPROF 1" >> $config_h
1546fi
1547if test "$static" = "yes" ; then
1548 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001549 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001550fi
bellard05c2a3e2006-02-08 22:39:17 +00001551if test $profiler = "yes" ; then
1552 echo "#define CONFIG_PROFILER 1" >> $config_h
1553fi
bellardc20709a2004-04-21 23:27:19 +00001554if test "$slirp" = "yes" ; then
1555 echo "CONFIG_SLIRP=yes" >> $config_mak
1556 echo "#define CONFIG_SLIRP 1" >> $config_h
1557fi
ths8a16d272008-07-19 09:56:24 +00001558if test "$vde" = "yes" ; then
1559 echo "CONFIG_VDE=yes" >> $config_mak
1560 echo "#define CONFIG_VDE 1" >> $config_h
1561 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1562fi
malc0c58ac12008-06-25 21:04:05 +00001563for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001564 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001565 echo "$def=yes" >> $config_mak
1566 echo "#define $def 1" >> $config_h
1567done
1568echo "#define AUDIO_DRIVERS \\" >> $config_h
1569for drv in $audio_drv_list; do
1570 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001571 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001572 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001573 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001574 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1575 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001576 elif test "$drv" = "oss"; then
1577 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001578 fi
1579done
1580echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001581if test "$mixemu" = "yes" ; then
1582 echo "CONFIG_MIXEMU=yes" >> $config_mak
1583 echo "#define CONFIG_MIXEMU 1" >> $config_h
1584fi
ths8d5d2d42007-08-25 01:37:51 +00001585if test "$vnc_tls" = "yes" ; then
1586 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1587 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1588 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1589 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1590fi
aliguori2f9606b2009-03-06 20:27:28 +00001591if test "$vnc_sasl" = "yes" ; then
1592 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1593 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1594 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1595 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1596fi
aliguori76655d62009-03-06 20:27:37 +00001597if test "$fnmatch" = "yes" ; then
1598 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1599fi
pbrookb1a550a2006-04-16 13:28:56 +00001600qemu_version=`head $source_path/VERSION`
1601echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001602echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001603
pbrook4a19f1e2009-04-07 23:17:49 +00001604echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1605
bellard97a847b2003-08-10 21:36:04 +00001606echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001607if [ "$source_path_used" = "yes" ]; then
1608 echo "VPATH=$source_path" >> $config_mak
1609fi
bellard97a847b2003-08-10 21:36:04 +00001610echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001611if [ "$build_docs" = "yes" ] ; then
1612 echo "BUILD_DOCS=yes" >> $config_mak
1613fi
bellard49ecc3f2007-11-07 19:25:15 +00001614if test "$static" = "yes"; then
1615 sdl1=$sdl_static
1616else
1617 sdl1=$sdl
1618fi
1619if test "$sdl1" = "yes" ; then
1620 echo "#define CONFIG_SDL 1" >> $config_h
1621 echo "CONFIG_SDL=yes" >> $config_mak
1622 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1623 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001624 elif test "$sdl_x11" = "yes" ; then
1625 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001626 else
1627 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1628 fi
1629 if [ "${aa}" = "yes" ] ; then
1630 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1631 else
1632 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1633 fi
1634fi
1635if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001636 echo "#define CONFIG_COCOA 1" >> $config_h
1637 echo "CONFIG_COCOA=yes" >> $config_mak
1638fi
1639if test "$curses" = "yes" ; then
1640 echo "#define CONFIG_CURSES 1" >> $config_h
1641 echo "CONFIG_CURSES=yes" >> $config_mak
1642 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001643fi
aurel323b3f24a2009-04-15 16:12:13 +00001644if test "$atfile" = "yes" ; then
1645 echo "#define CONFIG_ATFILE 1" >> $config_h
1646fi
1647if test "$inotify" = "yes" ; then
1648 echo "#define CONFIG_INOTIFY 1" >> $config_h
1649fi
Alexander Graf769ce762009-05-11 17:41:42 +02001650if test "$curl" = "yes" ; then
1651 echo "CONFIG_CURL=yes" >> $config_mak
1652 echo "CURL_LIBS=$curl_libs" >> $config_mak
1653 echo "#define CONFIG_CURL 1" >> $config_h
1654fi
aurel322e4d9fb2008-04-08 06:01:02 +00001655if test "$brlapi" = "yes" ; then
1656 echo "CONFIG_BRLAPI=yes" >> $config_mak
1657 echo "#define CONFIG_BRLAPI 1" >> $config_h
1658 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1659fi
balrogfb599c92008-09-28 23:49:55 +00001660if test "$bluez" = "yes" ; then
1661 echo "CONFIG_BLUEZ=yes" >> $config_mak
1662 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1663 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1664 echo "#define CONFIG_BLUEZ 1" >> $config_h
1665fi
aliguorie37630c2009-04-22 15:19:10 +00001666if test "$xen" = "yes" ; then
aliguori9306acb2009-04-22 15:19:44 +00001667 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
aliguorie37630c2009-04-22 15:19:10 +00001668fi
blueswir1414f0da2008-08-15 18:20:52 +00001669if test "$aio" = "yes" ; then
1670 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001671 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001672fi
aliguorie5d355d2009-04-24 18:03:15 +00001673if test "$io_thread" = "yes" ; then
1674 echo "CONFIG_IOTHREAD=yes" >> $config_mak
1675 echo "#define CONFIG_IOTHREAD 1" >> $config_h
1676fi
ths77755342008-11-27 15:45:16 +00001677if test "$blobs" = "yes" ; then
1678 echo "INSTALL_BLOBS=yes" >> $config_mak
1679fi
aliguoribf9298b2008-12-05 20:05:26 +00001680if test "$iovec" = "yes" ; then
1681 echo "#define HAVE_IOVEC 1" >> $config_h
1682fi
aliguoriceb42de2009-04-07 18:43:28 +00001683if test "$preadv" = "yes" ; then
1684 echo "#define HAVE_PREADV 1" >> $config_h
1685fi
aurel32f652e6a2008-12-16 10:43:48 +00001686if test "$fdt" = "yes" ; then
1687 echo "#define HAVE_FDT 1" >> $config_h
1688 echo "FDT_LIBS=-lfdt" >> $config_mak
1689fi
bellard97a847b2003-08-10 21:36:04 +00001690
bellard83fb7ad2004-07-05 21:25:26 +00001691# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001692if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001693 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001694 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
blueswir1179a2c12009-03-08 08:23:32 +00001695 echo "#define HOST_BSD 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001696fi
1697
pbrookc5937222006-05-14 11:30:38 +00001698echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1699
blueswir168063642008-11-22 21:03:55 +00001700# USB host support
1701case "$usb" in
1702linux)
1703 echo "HOST_USB=linux" >> $config_mak
1704;;
1705bsd)
1706 echo "HOST_USB=bsd" >> $config_mak
1707;;
1708*)
1709 echo "HOST_USB=stub" >> $config_mak
1710;;
1711esac
1712
Anthony Liguori9abbdbf2009-05-12 09:55:27 -05001713# Determine what linker flags to use to force archive inclusion
1714check_linker_flags()
1715{
1716 $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 -Wl,$2 >/dev/null 2>/dev/null
1717}
1718
1719cat > $TMPC << EOF
1720int main(void) { }
1721EOF
1722if check_linker_flags --whole-archive --no-whole-archive ; then
1723 # GNU ld
1724 echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_mak
1725 echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_mak
1726elif check_linker_flags -z,allextract -z,defaultextract ; then
1727 # Solaris ld
1728 echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_mak
1729 echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_mak
1730else
1731 echo "Error: your linker does not support --whole-archive or -z."
1732 echo "Please report to qemu-devel@nongnu.org"
1733 exit 1
1734fi
1735
Blue Swirl2567f572009-05-21 15:54:48 +00001736if test "$xen" = "yes" ;
1737 then
1738 echo "CONFIG_XEN=yes" >> $config_mak
1739fi
1740
pbrookc39e3332007-09-22 16:49:14 +00001741tools=
1742if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001743 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001744 if [ "$linux" = "yes" ] ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001745 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001746 fi
pbrookc39e3332007-09-22 16:49:14 +00001747fi
1748echo "TOOLS=$tools" >> $config_mak
1749
Paul Brook370ab982009-05-26 15:07:56 +01001750if test -f ${config_h}~ ; then
1751 if cmp -s $config_h ${config_h}~ ; then
1752 mv ${config_h}~ $config_h
1753 else
1754 rm ${config_h}~
1755 fi
1756fi
1757
Paul Brook1ad21342009-05-19 16:17:58 +01001758config_host_mak=${config_mak}
ths15d9ca02007-07-31 23:07:32 +00001759
bellard1d14ffa2005-10-30 18:58:22 +00001760for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001761target_dir="$target"
1762config_mak=$target_dir/config.mak
1763config_h=$target_dir/config.h
1764target_cpu=`echo $target | cut -d '-' -f 1`
1765target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001766[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001767[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1768[ "$target_cpu" = "mips" ] && target_bigendian=yes
1769[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1770[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001771[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001772[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001773[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001774[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001775[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001776[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1777[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1778[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001779target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001780target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001781target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001782target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001783target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001784case "$target" in
1785 ${target_cpu}-softmmu)
1786 target_softmmu="yes"
1787 ;;
1788 ${target_cpu}-linux-user)
1789 target_user_only="yes"
1790 target_linux_user="yes"
1791 ;;
1792 ${target_cpu}-darwin-user)
1793 target_user_only="yes"
1794 target_darwin_user="yes"
1795 ;;
blueswir184778502008-10-26 20:33:16 +00001796 ${target_cpu}-bsd-user)
1797 target_user_only="yes"
1798 target_bsd_user="yes"
1799 ;;
pbrook9e407a82007-05-26 16:38:53 +00001800 *)
1801 echo "ERROR: Target '$target' not recognised"
1802 exit 1
1803 ;;
1804esac
ths831b7822007-01-18 20:06:33 +00001805
bellard7c1f25b2004-04-22 00:02:08 +00001806#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001807
ths15d9ca02007-07-31 23:07:32 +00001808test -f $config_h && mv $config_h ${config_h}~
1809
bellard97a847b2003-08-10 21:36:04 +00001810mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001811mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001812mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001813if 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 +00001814 mkdir -p $target_dir/nwfpe
1815fi
1816
bellardec530c82006-04-25 22:36:06 +00001817#
1818# don't use ln -sf as not all "ln -sf" over write the file/link
1819#
1820rm -f $target_dir/Makefile
1821ln -s $source_path/Makefile.target $target_dir/Makefile
1822
bellard97a847b2003-08-10 21:36:04 +00001823
1824echo "# Automatically generated by configure - do not modify" > $config_mak
1825echo "/* Automatically generated by configure - do not modify */" > $config_h
1826
1827
1828echo "include ../config-host.mak" >> $config_mak
1829echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001830
pbrooke5fe0c52006-06-11 13:32:59 +00001831bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001832elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001833target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001834interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1835echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001836gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001837
aliguori5985ece2008-11-05 19:59:25 +00001838# Make sure the target and host cpus are compatible
1839if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
malcfdf7ed92009-01-14 18:39:52 +00001840 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001841 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1842 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001843 kvm="no"
1844fi
1845# Disable KVM for linux-user
1846if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1847 kvm="no"
1848fi
1849
aurel322408a522008-04-20 20:19:44 +00001850case "$target_cpu" in
1851 i386)
1852 echo "TARGET_ARCH=i386" >> $config_mak
1853 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1854 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001855 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001856 then
blueswir12d6ebb02009-04-18 19:25:43 +00001857 echo "CONFIG_KQEMU=yes" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001858 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001859 fi
aliguori7ba1e612008-11-05 16:04:33 +00001860 if test "$kvm" = "yes" ; then
1861 echo "CONFIG_KVM=yes" >> $config_mak
1862 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001863 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001864 fi
aliguorie37630c2009-04-22 15:19:10 +00001865 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
1866 then
1867 echo "CONFIG_XEN=yes" >> $config_mak
1868 echo "#define CONFIG_XEN 1" >> $config_h
1869 fi
Paul Brook1ad21342009-05-19 16:17:58 +01001870 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001871 ;;
1872 x86_64)
1873 echo "TARGET_ARCH=x86_64" >> $config_mak
1874 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1875 echo "#define TARGET_I386 1" >> $config_h
1876 echo "#define TARGET_X86_64 1" >> $config_h
1877 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1878 then
blueswir12d6ebb02009-04-18 19:25:43 +00001879 echo "CONFIG_KQEMU=yes" >> $config_mak
blueswir1640f42e2009-04-19 10:18:01 +00001880 echo "#define CONFIG_KQEMU 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001881 fi
aliguori7ba1e612008-11-05 16:04:33 +00001882 if test "$kvm" = "yes" ; then
1883 echo "CONFIG_KVM=yes" >> $config_mak
1884 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1885 echo "#define CONFIG_KVM 1" >> $config_h
1886 fi
aliguorie37630c2009-04-22 15:19:10 +00001887 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
1888 then
1889 echo "CONFIG_XEN=yes" >> $config_mak
1890 echo "#define CONFIG_XEN 1" >> $config_h
1891 fi
Paul Brook1ad21342009-05-19 16:17:58 +01001892 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001893 ;;
1894 alpha)
1895 echo "TARGET_ARCH=alpha" >> $config_mak
1896 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1897 echo "#define TARGET_ALPHA 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001898 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001899 ;;
1900 arm|armeb)
1901 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001902 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1903 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001904 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001905 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001906 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001907 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001908 ;;
1909 cris)
1910 echo "TARGET_ARCH=cris" >> $config_mak
1911 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1912 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00001913 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001914 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001915 ;;
1916 m68k)
1917 echo "TARGET_ARCH=m68k" >> $config_mak
1918 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1919 echo "#define TARGET_M68K 1" >> $config_h
1920 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001921 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001922 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001923 ;;
1924 mips|mipsel)
1925 echo "TARGET_ARCH=mips" >> $config_mak
1926 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1927 echo "#define TARGET_MIPS 1" >> $config_h
1928 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001929 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001930 ;;
1931 mipsn32|mipsn32el)
1932 echo "TARGET_ARCH=mipsn32" >> $config_mak
1933 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1934 echo "#define TARGET_MIPS 1" >> $config_h
1935 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001936 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001937 ;;
1938 mips64|mips64el)
1939 echo "TARGET_ARCH=mips64" >> $config_mak
1940 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1941 echo "#define TARGET_MIPS 1" >> $config_h
1942 echo "#define TARGET_MIPS64 1" >> $config_h
1943 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001944 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001945 ;;
1946 ppc)
1947 echo "TARGET_ARCH=ppc" >> $config_mak
1948 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1949 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001950 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001951 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001952 ;;
1953 ppcemb)
1954 echo "TARGET_ARCH=ppcemb" >> $config_mak
1955 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1956 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1957 echo "#define TARGET_PPC 1" >> $config_h
1958 echo "#define TARGET_PPCEMB 1" >> $config_h
aurel32d76d1652008-12-16 10:43:58 +00001959 if test "$kvm" = "yes" ; then
1960 echo "CONFIG_KVM=yes" >> $config_mak
1961 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1962 echo "#define CONFIG_KVM 1" >> $config_h
1963 fi
aurel32c8b35322009-01-24 15:07:34 +00001964 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001965 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001966 ;;
1967 ppc64)
1968 echo "TARGET_ARCH=ppc64" >> $config_mak
1969 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1970 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1971 echo "#define TARGET_PPC 1" >> $config_h
1972 echo "#define TARGET_PPC64 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001973 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001974 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001975 ;;
1976 ppc64abi32)
1977 echo "TARGET_ARCH=ppc64" >> $config_mak
1978 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1979 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1980 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1981 echo "#define TARGET_PPC 1" >> $config_h
1982 echo "#define TARGET_PPC64 1" >> $config_h
1983 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001984 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01001985 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00001986 ;;
1987 sh4|sh4eb)
1988 echo "TARGET_ARCH=sh4" >> $config_mak
1989 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1990 echo "#define TARGET_SH4 1" >> $config_h
1991 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001992 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01001993 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00001994 ;;
1995 sparc)
1996 echo "TARGET_ARCH=sparc" >> $config_mak
1997 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1998 echo "#define TARGET_SPARC 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01001999 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002000 ;;
2001 sparc64)
2002 echo "TARGET_ARCH=sparc64" >> $config_mak
2003 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2004 echo "#define TARGET_SPARC 1" >> $config_h
2005 echo "#define TARGET_SPARC64 1" >> $config_h
2006 elfload32="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002007 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002008 ;;
2009 sparc32plus)
2010 echo "TARGET_ARCH=sparc64" >> $config_mak
2011 echo "TARGET_ABI_DIR=sparc" >> $config_mak
2012 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
2013 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2014 echo "#define TARGET_SPARC 1" >> $config_h
2015 echo "#define TARGET_SPARC64 1" >> $config_h
2016 echo "#define TARGET_ABI32 1" >> $config_h
Paul Brook1ad21342009-05-19 16:17:58 +01002017 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002018 ;;
2019 *)
2020 echo "Unsupported target CPU"
2021 exit 1
2022 ;;
2023esac
Paul Brook1ad21342009-05-19 16:17:58 +01002024if [ $target_phys_bits -lt $hostlongbits ] ; then
2025 target_phys_bits=$hostlongbits
2026fi
2027echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
2028echo "#define TARGET_PHYS_ADDR_BITS $target_phys_bits" >> $config_h
2029echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
bellardde83cd02003-06-15 20:25:43 +00002030if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00002031 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
2032 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
2033fi
2034if test "$target_softmmu" = "yes" ; then
2035 echo "CONFIG_SOFTMMU=yes" >> $config_mak
2036 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00002037fi
bellard997344f2003-10-27 21:10:39 +00002038if test "$target_user_only" = "yes" ; then
2039 echo "CONFIG_USER_ONLY=yes" >> $config_mak
2040 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2041fi
ths831b7822007-01-18 20:06:33 +00002042if test "$target_linux_user" = "yes" ; then
2043 echo "CONFIG_LINUX_USER=yes" >> $config_mak
2044 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2045fi
2046if test "$target_darwin_user" = "yes" ; then
2047 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
2048 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2049fi
pbrook56aebc82008-10-11 17:55:29 +00002050list=""
2051if test ! -z "$gdb_xml_files" ; then
2052 for x in $gdb_xml_files; do
2053 list="$list $source_path/gdb-xml/$x"
2054 done
2055fi
2056echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00002057
aurel320938cda2008-04-11 21:36:06 +00002058if test "$target_cpu" = "arm" \
2059 -o "$target_cpu" = "armeb" \
2060 -o "$target_cpu" = "m68k" \
2061 -o "$target_cpu" = "mips" \
2062 -o "$target_cpu" = "mipsel" \
2063 -o "$target_cpu" = "mipsn32" \
2064 -o "$target_cpu" = "mipsn32el" \
2065 -o "$target_cpu" = "mips64" \
2066 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00002067 -o "$target_cpu" = "ppc" \
2068 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00002069 -o "$target_cpu" = "ppc64abi32" \
2070 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00002071 -o "$target_cpu" = "sparc" \
2072 -o "$target_cpu" = "sparc64" \
2073 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00002074 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2075 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2076fi
pbrooke5fe0c52006-06-11 13:32:59 +00002077if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2078 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2079 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2080fi
pbrookbd0c5662008-05-29 14:34:11 +00002081if test "$target_user_only" = "yes" \
2082 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2083 echo "#define USE_NPTL 1" >> $config_h
2084fi
blueswir1cb33da52007-10-09 16:34:29 +00002085# 32 bit ELF loader in addition to native 64 bit loader?
2086if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2087 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2088 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2089fi
blueswir184778502008-10-26 20:33:16 +00002090if test "$target_bsd_user" = "yes" ; then
2091 echo "CONFIG_BSD_USER=yes" >> $config_mak
2092 echo "#define CONFIG_BSD_USER 1" >> $config_h
2093fi
bellard5b0753e2005-03-01 21:37:28 +00002094
ths15d9ca02007-07-31 23:07:32 +00002095test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2096
bellard97a847b2003-08-10 21:36:04 +00002097done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00002098
2099# build tree in object directory if source path is different from current one
2100if test "$source_path_used" = "yes" ; then
Anthony Liguori019d6b82009-05-09 17:14:19 -05002101 DIRS="tests tests/cris slirp audio block"
bellard7d132992003-03-06 23:23:54 +00002102 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00002103 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00002104 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00002105 for dir in $DIRS ; do
2106 mkdir -p $dir
2107 done
bellardec530c82006-04-25 22:36:06 +00002108 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00002109 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00002110 rm -f $f
2111 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00002112 done
2113fi
Paul Brook1ad21342009-05-19 16:17:58 +01002114
2115for hwlib in 32 64; do
2116 d=libhw$hwlib
2117 mkdir -p $d
2118 rm -f $d/Makefile
2119 ln -s $source_path/Makefile.hw $d/Makefile
2120 echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2121 echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2122done