blob: ed6e582a396cea37b9e6d876aa077b3d6bf7b4e5 [file] [log] [blame]
bellard7d132992003-03-06 23:23:54 +00001#!/bin/sh
2#
bellard3ef693a2003-03-23 20:17:16 +00003# qemu configure script (c) 2003 Fabrice Bellard
bellard7d132992003-03-06 23:23:54 +00004#
5# set temporary file name
6if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10else
11 TMPDIR1="/tmp"
12fi
13
bellard3ef693a2003-03-23 20:17:16 +000014TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
malc9d56d2d2008-09-30 19:44:32 +000018TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
malcd4742de2008-11-29 22:04:31 +000019TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
bellard7d132992003-03-06 23:23:54 +000020
malcd4742de2008-11-29 22:04:31 +000021trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
malc9ac81bb2008-11-29 20:09:56 +000022
bellard7d132992003-03-06 23:23:54 +000023# default parameters
bellard11d9f692004-04-02 20:55:59 +000024prefix=""
bellard1e43adf2003-09-30 20:54:24 +000025interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000026static="no"
bellard7d132992003-03-06 23:23:54 +000027cross_prefix=""
28cc="gcc"
malc0c58ac12008-06-25 21:04:05 +000029audio_drv_list=""
malc4c9b53e2009-01-09 10:46:34 +000030audio_card_list="ac97 es1370 sb16"
31audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
bellard7d132992003-03-06 23:23:54 +000032host_cc="gcc"
33ar="ar"
34make="make"
pbrook6a882642006-04-17 13:57:12 +000035install="install"
bellard7d132992003-03-06 23:23:54 +000036strip="strip"
aliguoriac0df512008-12-29 17:14:15 +000037
38# parse CC options first
39for opt do
40 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
41 case "$opt" in
42 --cross-prefix=*) cross_prefix="$optarg"
43 ;;
44 --cc=*) cc="$optarg"
45 ;;
46 esac
47done
48
49# OS specific
50# Using uname is really, really broken. Once we have the right set of checks
51# we can eliminate it's usage altogether
52
53cc="${cross_prefix}${cc}"
54ar="${cross_prefix}${ar}"
55strip="${cross_prefix}${strip}"
56
57# check that the C compiler works.
58cat > $TMPC <<EOF
59int main(void) {}
60EOF
61
62if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
63 : C compiler works ok
64else
65 echo "ERROR: \"$cc\" either does not exist or does not work"
66 exit 1
67fi
68
69check_define() {
70cat > $TMPC <<EOF
71#if !defined($1)
72#error Not defined
73#endif
74int main(void) { return 0; }
75EOF
76 $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
77}
78
79if check_define __i386__ ; then
80 cpu="i386"
81elif check_define __x86_64__ ; then
82 cpu="x86_64"
blueswir13aa9bd62008-12-31 16:55:26 +000083elif check_define __sparc__ ; then
84 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
85 # They must be specified using --sparc_cpu
86 if check_define __arch64__ ; then
87 cpu="sparc64"
88 else
89 cpu="sparc"
90 fi
malcfdf7ed92009-01-14 18:39:52 +000091elif check_define _ARCH_PPC ; then
92 if check_define _ARCH_PPC64 ; then
93 cpu="ppc64"
94 else
95 cpu="ppc"
96 fi
aliguoriac0df512008-12-29 17:14:15 +000097else
malcfdf7ed92009-01-14 18:39:52 +000098 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +000099fi
100
bellard5327cf42005-01-10 23:18:50 +0000101target_list=""
bellard7d132992003-03-06 23:23:54 +0000102case "$cpu" in
103 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000104 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000105 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000106 x86_64|amd64)
107 cpu="x86_64"
108 ;;
109 alpha)
110 cpu="alpha"
111 ;;
bellardba680552005-03-13 09:49:52 +0000112 armv*b)
bellard808c4952004-12-19 23:33:47 +0000113 cpu="armv4b"
114 ;;
bellardba680552005-03-13 09:49:52 +0000115 armv*l)
bellard7d132992003-03-06 23:23:54 +0000116 cpu="armv4l"
117 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000118 cris)
119 cpu="cris"
bellard7d132992003-03-06 23:23:54 +0000120 ;;
aurel32f54b3f92008-04-12 20:14:54 +0000121 parisc|parisc64)
122 cpu="hppa"
123 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000124 ia64)
125 cpu="ia64"
126 ;;
127 m68k)
128 cpu="m68k"
bellard7d132992003-03-06 23:23:54 +0000129 ;;
130 mips)
131 cpu="mips"
132 ;;
thsfbe4f652007-04-01 11:16:48 +0000133 mips64)
134 cpu="mips64"
135 ;;
malcfdf7ed92009-01-14 18:39:52 +0000136 ppc)
137 cpu="ppc"
138 ;;
139 ppc64)
140 cpu="ppc64"
thse7daa602007-10-08 13:38:27 +0000141 ;;
ths0e7b8a92007-08-01 00:09:31 +0000142 s390*)
bellardfb3e5842003-03-29 17:32:36 +0000143 cpu="s390"
144 ;;
blueswir131422552007-04-16 18:27:06 +0000145 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000146 cpu="sparc"
147 ;;
148 sparc64)
149 cpu="sparc64"
150 ;;
bellard7d132992003-03-06 23:23:54 +0000151 *)
152 cpu="unknown"
153 ;;
154esac
155gprof="no"
aliguori03b4fe72008-10-07 19:16:17 +0000156sparse="no"
aliguori1625af82009-04-05 17:41:02 +0000157strip_opt="yes"
bellard7d132992003-03-06 23:23:54 +0000158bigendian="no"
bellard67b915a2004-03-31 23:37:16 +0000159mingw32="no"
160EXESUF=""
161gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +0000162slirp="yes"
aliguorie0e6c8c02008-07-23 18:14:33 +0000163vde="yes"
bellard102a52e2004-11-14 19:57:29 +0000164fmod_lib=""
165fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +0000166oss_lib=""
ths8d5d2d42007-08-25 01:37:51 +0000167vnc_tls="yes"
aliguori2f9606b2009-03-06 20:27:28 +0000168vnc_sasl="yes"
pbrookb1a550a2006-04-16 13:28:56 +0000169bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000170linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000171solaris="no"
bellardc9ec1fe2005-02-10 21:55:30 +0000172kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +0000173profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000174cocoa="no"
bellard97ccc682005-07-02 13:32:17 +0000175check_gfx="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000176softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000177linux_user="no"
178darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000179bsd_user="no"
pbrookcc8ae6d2006-04-23 17:57:59 +0000180build_docs="no"
pbrookc5937222006-05-14 11:30:38 +0000181uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000182curses="yes"
blueswir1414f0da2008-08-15 18:20:52 +0000183aio="yes"
pbrookbd0c5662008-05-29 14:34:11 +0000184nptl="yes"
malc8ff9cbf2008-06-23 18:33:30 +0000185mixemu="no"
balrogfb599c92008-09-28 23:49:55 +0000186bluez="yes"
aliguori7ba1e612008-11-05 16:04:33 +0000187kvm="yes"
aliguorieac30262008-11-05 16:28:56 +0000188kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000189aix="no"
ths77755342008-11-27 15:45:16 +0000190blobs="yes"
aurel32f652e6a2008-12-16 10:43:48 +0000191fdt="yes"
aliguori5368a422009-03-03 17:37:21 +0000192sdl_x11="no"
pbrook4a19f1e2009-04-07 23:17:49 +0000193pkgversion=""
bellard7d132992003-03-06 23:23:54 +0000194
195# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000196if check_define __linux__ ; then
197 targetos="Linux"
198elif check_define _WIN32 ; then
199 targetos='MINGW32'
200else
201 targetos=`uname -s`
202fi
bellard7d132992003-03-06 23:23:54 +0000203case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000204CYGWIN*)
205mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000206OS_CFLAGS="-mno-cygwin"
thsdb8d7dd2007-07-12 09:29:18 +0000207if [ "$cpu" = "i386" ] ; then
208 kqemu="yes"
209fi
malcc2de5c92008-06-28 19:13:06 +0000210audio_possible_drivers="sdl"
bellardc326e0a2005-04-23 18:30:28 +0000211;;
bellard67b915a2004-03-31 23:37:16 +0000212MINGW32*)
213mingw32="yes"
thsdb8d7dd2007-07-12 09:29:18 +0000214if [ "$cpu" = "i386" ] ; then
215 kqemu="yes"
216fi
malcc2de5c92008-06-28 19:13:06 +0000217audio_possible_drivers="dsound sdl fmod"
bellard67b915a2004-03-31 23:37:16 +0000218;;
ths5c40d2b2007-06-23 16:03:36 +0000219GNU/kFreeBSD)
malc0c58ac12008-06-25 21:04:05 +0000220audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000221audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000222if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
223 kqemu="yes"
224fi
225;;
bellard7d3505c2004-05-12 19:32:15 +0000226FreeBSD)
227bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000228audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000229audio_possible_drivers="oss sdl esd pa"
bellarde99f9062005-07-28 21:45:38 +0000230if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000231 kqemu="yes"
232fi
bellard7d3505c2004-05-12 19:32:15 +0000233;;
blueswir1c5e97232009-03-07 20:06:23 +0000234DragonFly)
235bsd="yes"
236audio_drv_list="oss"
237audio_possible_drivers="oss sdl esd pa"
238if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
239 kqemu="yes"
240fi
241aio="no"
242;;
bellard7d3505c2004-05-12 19:32:15 +0000243NetBSD)
244bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000245audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000246audio_possible_drivers="oss sdl esd"
blueswir18ef92a82008-11-22 20:24:29 +0000247oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000248;;
249OpenBSD)
250bsd="yes"
blueswir1128ab2f2008-08-15 18:33:42 +0000251openbsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000252audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000253audio_possible_drivers="oss sdl esd"
blueswir12f6a1ab2008-08-21 18:00:53 +0000254oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000255;;
bellard83fb7ad2004-07-05 21:25:26 +0000256Darwin)
257bsd="yes"
258darwin="yes"
aliguori1b0f9cc2009-01-26 15:37:40 +0000259# 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 +0000260if [ "$cpu" = "i386" ] ; then
261 is_x86_64=`sysctl -n hw.optional.x86_64`
262 [ "$is_x86_64" = "1" ] && cpu=x86_64
aliguori1b0f9cc2009-01-26 15:37:40 +0000263fi
264if [ "$cpu" = "x86_64" ] ; then
265 OS_CFLAGS="-arch x86_64"
266 LDFLAGS="-arch x86_64"
267else
268 OS_CFLAGS="-mdynamic-no-pic"
269fi
ths831b7822007-01-18 20:06:33 +0000270darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000271cocoa="yes"
malc0c58ac12008-06-25 21:04:05 +0000272audio_drv_list="coreaudio"
malcc2de5c92008-06-28 19:13:06 +0000273audio_possible_drivers="coreaudio sdl fmod"
thsc2c59c32008-01-08 00:00:20 +0000274OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
bellard83fb7ad2004-07-05 21:25:26 +0000275;;
bellardec530c82006-04-25 22:36:06 +0000276SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000277 solaris="yes"
278 make="gmake"
279 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000280 needs_libsunmath="no"
blueswir1acda94b2009-04-13 16:23:22 +0000281 kvm="no"
thsc2b84fa2007-02-10 23:21:21 +0000282 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000283 # have to select again, because `uname -m` returns i86pc
284 # even on an x86_64 box.
285 solariscpu=`isainfo -k`
286 if test "${solariscpu}" = "amd64" ; then
287 cpu="x86_64"
288 fi
thsc2b84fa2007-02-10 23:21:21 +0000289 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000290 if test "$solarisrev" -le 9 ; then
291 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
292 needs_libsunmath="yes"
293 else
294 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
295 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
296 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
297 echo "Studio 11 can be downloaded from www.sun.com."
298 exit 1
299 fi
300 fi
301 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000302 kqemu="yes"
303 fi
ths86b2bd92007-02-11 00:31:33 +0000304 fi
ths6b4d2ba2007-05-13 18:02:43 +0000305 if test -f /usr/include/sys/soundcard.h ; then
malc0c58ac12008-06-25 21:04:05 +0000306 audio_drv_list="oss"
ths6b4d2ba2007-05-13 18:02:43 +0000307 fi
malcc2de5c92008-06-28 19:13:06 +0000308 audio_possible_drivers="oss sdl"
ths86b2bd92007-02-11 00:31:33 +0000309;;
malcb29fe3e2008-11-18 01:42:22 +0000310AIX)
311aix="yes"
312make="gmake"
313;;
bellard1d14ffa2005-10-30 18:58:22 +0000314*)
malc0c58ac12008-06-25 21:04:05 +0000315audio_drv_list="oss"
malcb8e59f12008-07-02 21:03:08 +0000316audio_possible_drivers="oss alsa sdl esd pa"
bellard5327cf42005-01-10 23:18:50 +0000317linux="yes"
ths831b7822007-01-18 20:06:33 +0000318linux_user="yes"
blueswir168063642008-11-22 21:03:55 +0000319usb="linux"
bellard07f4ddb2005-04-23 17:44:28 +0000320if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000321 kqemu="yes"
malcc2de5c92008-06-28 19:13:06 +0000322 audio_possible_drivers="$audio_possible_drivers fmod"
bellardc9ec1fe2005-02-10 21:55:30 +0000323fi
bellardfb065182004-11-09 23:09:44 +0000324;;
bellard7d132992003-03-06 23:23:54 +0000325esac
326
bellard7d3505c2004-05-12 19:32:15 +0000327if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000328 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000329 make="gmake"
blueswir168063642008-11-22 21:03:55 +0000330 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000331 fi
blueswir184778502008-10-26 20:33:16 +0000332 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000333fi
334
bellard7d132992003-03-06 23:23:54 +0000335# find source path
pbrookad064842006-04-16 12:41:07 +0000336source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000337source_path_used="no"
338workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000339if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000340 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000341else
342 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000343fi
pbrook724db112008-02-03 19:20:13 +0000344[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000345
bellard85aa5182007-11-11 20:17:03 +0000346werror="no"
bellard0d1e2392007-11-11 20:24:30 +0000347# generate compile errors on warnings for development builds
348#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
349#werror="yes";
350#fi
bellard85aa5182007-11-11 20:17:03 +0000351
bellard7d132992003-03-06 23:23:54 +0000352for opt do
pbrooka46e4032006-04-29 23:05:22 +0000353 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000354 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000355 --help|-h) show_help=yes
356 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000357 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000358 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000359 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000360 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000361 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000362 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000363 ;;
aliguoriac0df512008-12-29 17:14:15 +0000364 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000365 ;;
aliguoriac0df512008-12-29 17:14:15 +0000366 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000367 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000368 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000369 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000370 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000371 ;;
pbrook6a882642006-04-17 13:57:12 +0000372 --install=*) install="$optarg"
373 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000374 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000375 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000376 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000377 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000378 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000379 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000380 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000381 ;;
bellard7d132992003-03-06 23:23:54 +0000382 --enable-gprof) gprof="yes"
383 ;;
bellard43ce4df2003-06-09 19:53:12 +0000384 --static) static="yes"
385 ;;
bellard97a847b2003-08-10 21:36:04 +0000386 --disable-sdl) sdl="no"
387 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000388 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000389 ;;
malcc2de5c92008-06-28 19:13:06 +0000390 --fmod-inc=*) fmod_inc="$optarg"
391 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000392 --oss-lib=*) oss_lib="$optarg"
393 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000394 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000395 ;;
396 --audio-drv-list=*) audio_drv_list="$optarg"
397 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000398 --enable-sparse) sparse="yes"
399 ;;
400 --disable-sparse) sparse="no"
401 ;;
aliguori1625af82009-04-05 17:41:02 +0000402 --disable-strip) strip_opt="no"
403 ;;
ths8d5d2d42007-08-25 01:37:51 +0000404 --disable-vnc-tls) vnc_tls="no"
405 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000406 --disable-vnc-sasl) vnc_sasl="no"
407 ;;
bellard443f1372004-06-04 11:13:20 +0000408 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000409 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000410 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000411 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000412 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000413 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000414 --disable-brlapi) brlapi="no"
415 ;;
balrogfb599c92008-09-28 23:49:55 +0000416 --disable-bluez) bluez="no"
417 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000418 --disable-kvm) kvm="no"
419 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000420 --enable-profiler) profiler="yes"
421 ;;
malcc2de5c92008-06-28 19:13:06 +0000422 --enable-cocoa)
423 cocoa="yes" ;
424 sdl="no" ;
425 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000426 ;;
bellard97ccc682005-07-02 13:32:17 +0000427 --disable-gfx-check) check_gfx="no"
428 ;;
pbrookcad25d62006-03-19 16:31:11 +0000429 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000430 ;;
pbrookcad25d62006-03-19 16:31:11 +0000431 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000432 ;;
ths831b7822007-01-18 20:06:33 +0000433 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000434 ;;
ths831b7822007-01-18 20:06:33 +0000435 --enable-linux-user) linux_user="yes"
436 ;;
437 --disable-darwin-user) darwin_user="no"
438 ;;
439 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000440 ;;
blueswir184778502008-10-26 20:33:16 +0000441 --disable-bsd-user) bsd_user="no"
442 ;;
443 --enable-bsd-user) bsd_user="yes"
444 ;;
pbrookc5937222006-05-14 11:30:38 +0000445 --enable-uname-release=*) uname_release="$optarg"
446 ;;
blueswir131422552007-04-16 18:27:06 +0000447 --sparc_cpu=*)
448 sparc_cpu="$optarg"
449 case $sparc_cpu in
450 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
451 target_cpu="sparc"; cpu="sparc" ;;
452 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
453 target_cpu="sparc"; cpu="sparc" ;;
454 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
455 target_cpu="sparc64"; cpu="sparc64" ;;
456 *) echo "undefined SPARC architecture. Exiting";exit 1;;
457 esac
458 ;;
bellard85aa5182007-11-11 20:17:03 +0000459 --enable-werror) werror="yes"
460 ;;
461 --disable-werror) werror="no"
462 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000463 --disable-curses) curses="no"
464 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000465 --disable-nptl) nptl="no"
466 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000467 --enable-mixemu) mixemu="yes"
468 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000469 --disable-aio) aio="no"
470 ;;
ths77755342008-11-27 15:45:16 +0000471 --disable-blobs) blobs="no"
472 ;;
aliguorieac30262008-11-05 16:28:56 +0000473 --kerneldir=*) kerneldir="$optarg"
474 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000475 --with-pkgversion=*) pkgversion=" ($optarg)"
476 ;;
balrog7f1559c2007-11-17 10:24:32 +0000477 *) echo "ERROR: unknown option $opt"; show_help="yes"
478 ;;
bellard7d132992003-03-06 23:23:54 +0000479 esac
480done
481
ths6f30fa82007-01-05 01:00:47 +0000482# default flags for all hosts
blueswir1ac41a622008-09-14 06:46:31 +0000483CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
blueswir1e0e36fe2008-12-07 19:16:27 +0000484CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
ths6f30fa82007-01-05 01:00:47 +0000485LDFLAGS="$LDFLAGS -g"
bellard85aa5182007-11-11 20:17:03 +0000486if test "$werror" = "yes" ; then
487CFLAGS="$CFLAGS -Werror"
488fi
ths6f30fa82007-01-05 01:00:47 +0000489
blueswir1d2c7c9b2008-11-01 14:50:20 +0000490if test "$solaris" = "no" ; then
491 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
492 LDFLAGS="$LDFLAGS -Wl,--warn-common"
493 fi
blueswir149237ac2008-09-17 19:05:19 +0000494fi
495
blueswir131422552007-04-16 18:27:06 +0000496#
497# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
498# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
499#
bellard40293e52008-01-31 11:32:10 +0000500case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000501 sparc) if test -z "$sparc_cpu" ; then
502 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
503 ARCH_LDFLAGS="-m32"
504 else
505 ARCH_CFLAGS="${SP_CFLAGS}"
506 ARCH_LDFLAGS="${SP_LDFLAGS}"
507 fi
blueswir1762e8232009-04-04 09:21:28 +0000508 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
509 if test "$solaris" = "no" ; then
510 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
511 fi
blueswir131422552007-04-16 18:27:06 +0000512 ;;
513 sparc64) if test -z "$sparc_cpu" ; then
514 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
515 ARCH_LDFLAGS="-m64"
516 else
517 ARCH_CFLAGS="${SP_CFLAGS}"
518 ARCH_LDFLAGS="${SP_LDFLAGS}"
519 fi
blueswir1762e8232009-04-04 09:21:28 +0000520 if test "$solaris" = "no" ; then
521 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
522 else
523 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
524 fi
blueswir131422552007-04-16 18:27:06 +0000525 ;;
ths76d83bd2007-11-18 21:22:10 +0000526 s390)
527 ARCH_CFLAGS="-march=z900"
528 ;;
bellard40293e52008-01-31 11:32:10 +0000529 i386)
530 ARCH_CFLAGS="-m32"
531 ARCH_LDFLAGS="-m32"
532 ;;
533 x86_64)
534 ARCH_CFLAGS="-m64"
535 ARCH_LDFLAGS="-m64"
536 ;;
blueswir131422552007-04-16 18:27:06 +0000537esac
538
pbrookaf5db582006-04-08 14:26:41 +0000539if test x"$show_help" = x"yes" ; then
540cat << EOF
541
542Usage: configure [options]
543Options: [defaults in brackets after descriptions]
544
545EOF
546echo "Standard options:"
547echo " --help print this message"
548echo " --prefix=PREFIX install in PREFIX [$prefix]"
549echo " --interp-prefix=PREFIX where to find shared libraries, etc."
550echo " use %M for cpu name [$interp_prefix]"
551echo " --target-list=LIST set target list [$target_list]"
552echo ""
553echo "kqemu kernel acceleration support:"
554echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000555echo ""
556echo "Advanced options (experts only):"
557echo " --source-path=PATH path of source code [$source_path]"
558echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
559echo " --cc=CC use C compiler CC [$cc]"
560echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
aurel322981fa92009-04-07 19:57:17 +0000561echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
562echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000563echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000564echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000565echo " --static enable static build [$static]"
aliguori890b1652008-10-07 21:22:41 +0000566echo " --enable-sparse enable sparse checker"
567echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000568echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000569echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000570echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000571echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000572echo " --audio-drv-list=LIST set audio drivers list:"
573echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000574echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
575echo " Available cards: $audio_possible_cards"
malc8ff9cbf2008-06-23 18:33:30 +0000576echo " --enable-mixemu enable mixer emulation"
aurel322e4d9fb2008-04-08 06:01:02 +0000577echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000578echo " --disable-vnc-tls disable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000579echo " --disable-vnc-sasl disable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000580echo " --disable-curses disable curses output"
balrogfb599c92008-09-28 23:49:55 +0000581echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000582echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000583echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000584echo " --enable-system enable all system emulation targets"
585echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000586echo " --enable-linux-user enable all linux usermode emulation targets"
587echo " --disable-linux-user disable all linux usermode emulation targets"
588echo " --enable-darwin-user enable all darwin usermode emulation targets"
589echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000590echo " --enable-bsd-user enable all BSD usermode emulation targets"
591echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000592echo " --fmod-lib path to FMOD library"
593echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000594echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000595echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000596echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000597echo " --disable-vde disable support for vde network"
blueswir1414f0da2008-08-15 18:20:52 +0000598echo " --disable-aio disable AIO support"
ths77755342008-11-27 15:45:16 +0000599echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000600echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000601echo ""
ths5bf08932006-12-23 00:33:26 +0000602echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000603exit 1
604fi
605
bellard67b915a2004-03-31 23:37:16 +0000606if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000607 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000608 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000609 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000610 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000611 bsd_user="no"
aliguori49dc7682009-03-08 16:26:59 +0000612 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
aliguoricd01b4a2008-08-21 19:25:45 +0000613fi
614
aliguori03b4fe72008-10-07 19:16:17 +0000615if test ! -x "$(which cgcc 2>/dev/null)"; then
616 sparse="no"
617fi
618
bellardec530c82006-04-25 22:36:06 +0000619#
620# Solaris specific configure tool chain decisions
621#
622if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000623 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
624 if test -z "$solinst" ; then
625 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
626 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
627 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
628 exit 1
629 fi
630 if test "$solinst" = "/usr/sbin/install" ; then
631 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
632 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
633 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
634 exit 1
635 fi
bellardec530c82006-04-25 22:36:06 +0000636 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
637 if test -z "$sol_ar" ; then
638 echo "Error: No path includes ar"
639 if test -f /usr/ccs/bin/ar ; then
640 echo "Add /usr/ccs/bin to your path and rerun configure"
641 fi
642 exit 1
643 fi
ths5fafdf22007-09-16 21:08:06 +0000644fi
bellardec530c82006-04-25 22:36:06 +0000645
646
bellard5327cf42005-01-10 23:18:50 +0000647if test -z "$target_list" ; then
648# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000649 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000650 target_list="\
651i386-softmmu \
652x86_64-softmmu \
653arm-softmmu \
654cris-softmmu \
655m68k-softmmu \
656mips-softmmu \
657mipsel-softmmu \
658mips64-softmmu \
659mips64el-softmmu \
660ppc-softmmu \
661ppcemb-softmmu \
662ppc64-softmmu \
663sh4-softmmu \
664sh4eb-softmmu \
665sparc-softmmu \
666"
pbrook0a8e90f2006-03-19 14:54:16 +0000667 fi
bellard5327cf42005-01-10 23:18:50 +0000668# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000669 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000670 target_list="${target_list}\
671i386-linux-user \
672x86_64-linux-user \
673alpha-linux-user \
674arm-linux-user \
675armeb-linux-user \
676cris-linux-user \
677m68k-linux-user \
678mips-linux-user \
679mipsel-linux-user \
680ppc-linux-user \
681ppc64-linux-user \
682ppc64abi32-linux-user \
683sh4-linux-user \
684sh4eb-linux-user \
685sparc-linux-user \
686sparc64-linux-user \
687sparc32plus-linux-user \
688"
ths831b7822007-01-18 20:06:33 +0000689 fi
690# the following are Darwin specific
691 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000692 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000693 fi
blueswir184778502008-10-26 20:33:16 +0000694# the following are BSD specific
695 if [ "$bsd_user" = "yes" ] ; then
696 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +0000697i386-bsd-user \
698x86_64-bsd-user \
699sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +0000700sparc64-bsd-user \
701"
702 fi
bellard6e20a452005-06-05 15:56:02 +0000703else
pbrookb1a550a2006-04-16 13:28:56 +0000704 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000705fi
pbrook0a8e90f2006-03-19 14:54:16 +0000706if test -z "$target_list" ; then
707 echo "No targets enabled"
708 exit 1
709fi
bellard5327cf42005-01-10 23:18:50 +0000710
bellard7d132992003-03-06 23:23:54 +0000711if test -z "$cross_prefix" ; then
712
713# ---
714# big/little endian test
715cat > $TMPC << EOF
716#include <inttypes.h>
717int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000718 volatile uint32_t i=0x01234567;
719 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000720}
721EOF
722
aurel32178baee2008-12-08 18:11:57 +0000723if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000724$TMPE && bigendian="yes"
725else
726echo big/little test failed
727fi
728
729else
730
731# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000732if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000733 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000734 -o "$cpu" = "m68k" \
735 -o "$cpu" = "mips" \
736 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000737 -o "$cpu" = "ppc" \
738 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000739 -o "$cpu" = "s390" \
740 -o "$cpu" = "sparc" \
741 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000742 bigendian="yes"
743fi
744
745fi
746
bellardb6853692005-06-05 17:10:39 +0000747# host long bits test
748hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000749if test "$cpu" = "x86_64" \
750 -o "$cpu" = "alpha" \
751 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000752 -o "$cpu" = "sparc64" \
753 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000754 hostlongbits="64"
755fi
756
pbrookbd0c5662008-05-29 14:34:11 +0000757# Check host NPTL support
758cat > $TMPC <<EOF
759#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000760#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000761void foo()
762{
763#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
764#error bork
765#endif
766}
767EOF
768
balrog8c7f7572008-12-15 03:15:36 +0000769if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000770 :
771else
772 nptl="no"
773fi
774
bellard11d9f692004-04-02 20:55:59 +0000775##########################################
balrogac629222008-10-11 09:56:04 +0000776# zlib check
777
778cat > $TMPC << EOF
779#include <zlib.h>
780int main(void) { zlibVersion(); return 0; }
781EOF
balrog8c7f7572008-12-15 03:15:36 +0000782if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000783 :
784else
785 echo
786 echo "Error: zlib check failed"
787 echo "Make sure to have the zlib libs and headers installed."
788 echo
789 exit 1
790fi
791
792##########################################
bellard11d9f692004-04-02 20:55:59 +0000793# SDL probe
794
795sdl_too_old=no
796
797if test -z "$sdl" ; then
ths069b0bd2007-07-12 00:27:15 +0000798 sdl_config="sdl-config"
799 sdl=no
800 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000801
802cat > $TMPC << EOF
803#include <SDL.h>
804#undef main /* We don't want SDL to override our main() */
805int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
806EOF
balrog8c7f7572008-12-15 03:15:36 +0000807 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 +0000808 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
809 if test "$_sdlversion" -lt 121 ; then
810 sdl_too_old=yes
811 else
812 if test "$cocoa" = "no" ; then
813 sdl=yes
814 fi
815 fi
816
817 # static link with sdl ?
818 if test "$sdl" = "yes" ; then
819 aa="no"
820 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
821 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
822 if [ "$aa" = "yes" ] ; then
823 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000824 fi
bellard11d9f692004-04-02 20:55:59 +0000825
balrog8c7f7572008-12-15 03:15:36 +0000826 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 +0000827 sdl_static=yes
828 fi
829 fi # static link
830 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000831else
ths069b0bd2007-07-12 00:27:15 +0000832 # Make sure to disable cocoa if sdl was set
833 if test "$sdl" = "yes" ; then
834 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000835 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000836 fi
bellarda6e022a2004-04-02 21:55:47 +0000837fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000838
aliguori5368a422009-03-03 17:37:21 +0000839if test "$sdl" = "yes" ; then
840cat > $TMPC <<EOF
841#include <SDL.h>
842#if defined(SDL_VIDEO_DRIVER_X11)
843#include <X11/XKBlib.h>
844#else
845#error No x11 support
846#endif
847int main(void) { return 0; }
848EOF
849 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
850 sdl_x11="yes"
851 fi
852fi
853
ths8f28f3f2007-01-05 21:25:54 +0000854##########################################
ths8d5d2d42007-08-25 01:37:51 +0000855# VNC TLS detection
856if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000857cat > $TMPC <<EOF
858#include <gnutls/gnutls.h>
859int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
860EOF
861 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
862 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
863 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000864 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000865 :
866 else
867 vnc_tls="no"
868 fi
ths8d5d2d42007-08-25 01:37:51 +0000869fi
870
871##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000872# VNC SASL detection
873if test "$vnc_sasl" = "yes" ; then
874cat > $TMPC <<EOF
875#include <sasl/sasl.h>
876#include <stdio.h>
877int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
878EOF
879 # Assuming Cyrus-SASL installed in /usr prefix
880 vnc_sasl_cflags=""
881 vnc_sasl_libs="-lsasl2"
882 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
883 $vnc_sasl_libs 2> /dev/null ; then
884 :
885 else
886 vnc_sasl="no"
887 fi
888fi
889
890##########################################
aliguori76655d62009-03-06 20:27:37 +0000891# fnmatch() probe, used for ACL routines
892fnmatch="no"
893cat > $TMPC << EOF
894#include <fnmatch.h>
895int main(void)
896{
897 fnmatch("foo", "foo", 0);
898 return 0;
899}
900EOF
901if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
902 fnmatch="yes"
903fi
904
905##########################################
ths8a16d272008-07-19 09:56:24 +0000906# vde libraries probe
907if test "$vde" = "yes" ; then
908 cat > $TMPC << EOF
909#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000910int main(void)
911{
912 struct vde_open_args a = {0, 0, 0};
913 vde_open("", "", &a);
914 return 0;
915}
ths8a16d272008-07-19 09:56:24 +0000916EOF
balrog8c7f7572008-12-15 03:15:36 +0000917 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000918 :
919 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000920 vde="no"
ths8a16d272008-07-19 09:56:24 +0000921 fi
922fi
923
924##########################################
malcc2de5c92008-06-28 19:13:06 +0000925# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000926
malcc2de5c92008-06-28 19:13:06 +0000927audio_drv_probe()
928{
929 drv=$1
930 hdr=$2
931 lib=$3
932 exp=$4
933 cfl=$5
934 cat > $TMPC << EOF
935#include <$hdr>
936int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000937EOF
balrog8c7f7572008-12-15 03:15:36 +0000938 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +0000939 :
940 else
941 echo
942 echo "Error: $drv check failed"
943 echo "Make sure to have the $drv libs and headers installed."
944 echo
945 exit 1
946 fi
947}
948
malc2fa7d3b2008-07-29 12:58:44 +0000949audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000950for drv in $audio_drv_list; do
951 case $drv in
952 alsa)
953 audio_drv_probe $drv alsa/asoundlib.h -lasound \
954 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
955 ;;
956
957 fmod)
958 if test -z $fmod_lib || test -z $fmod_inc; then
959 echo
960 echo "Error: You must specify path to FMOD library and headers"
961 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
962 echo
963 exit 1
964 fi
965 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
966 ;;
967
968 esd)
969 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
970 ;;
malcb8e59f12008-07-02 21:03:08 +0000971
972 pa)
973 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
974 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
975 ;;
976
blueswir12f6a1ab2008-08-21 18:00:53 +0000977 oss|sdl|core|wav|dsound)
978 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
979 ;;
980
malce4c63a62008-07-19 16:15:16 +0000981 *)
malc1c9b2a52008-07-19 16:57:30 +0000982 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +0000983 echo
984 echo "Error: Unknown driver '$drv' selected"
985 echo "Possible drivers are: $audio_possible_drivers"
986 echo
987 exit 1
988 }
989 ;;
malcc2de5c92008-06-28 19:13:06 +0000990 esac
991done
ths8f28f3f2007-01-05 21:25:54 +0000992
balrog4d3b6f62008-02-10 16:33:14 +0000993##########################################
aurel322e4d9fb2008-04-08 06:01:02 +0000994# BrlAPI probe
995
996if test -z "$brlapi" ; then
997 brlapi=no
998cat > $TMPC << EOF
999#include <brlapi.h>
1000int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1001EOF
aurel32178baee2008-12-08 18:11:57 +00001002 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +00001003 brlapi=yes
1004 fi # brlapi compile test
1005fi # -z $brlapi
1006
1007##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001008# curses probe
1009
1010if test "$curses" = "yes" ; then
1011 curses=no
1012 cat > $TMPC << EOF
1013#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001014#ifdef __OpenBSD__
1015#define resize_term resizeterm
1016#endif
1017int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001018EOF
aurel32178baee2008-12-08 18:11:57 +00001019 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +00001020 curses=yes
1021 fi
1022fi # test "$curses"
1023
blueswir1414f0da2008-08-15 18:20:52 +00001024##########################################
balrogfb599c92008-09-28 23:49:55 +00001025# bluez support probe
1026if test "$bluez" = "yes" ; then
1027 `pkg-config bluez` || bluez="no"
1028fi
1029if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001030 cat > $TMPC << EOF
1031#include <bluetooth/bluetooth.h>
1032int main(void) { return bt_error(0); }
1033EOF
balrogfb599c92008-09-28 23:49:55 +00001034 bluez_cflags=`pkg-config --cflags bluez`
1035 bluez_libs=`pkg-config --libs bluez`
balrog17e15922008-10-11 12:00:42 +00001036 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001037 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001038 :
1039 else
1040 bluez="no"
1041 fi
balrogfb599c92008-09-28 23:49:55 +00001042fi
1043
1044##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001045# kvm probe
1046if test "$kvm" = "yes" ; then
1047 cat > $TMPC <<EOF
1048#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001049#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001050#error Invalid KVM version
1051#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001052#if !defined(KVM_CAP_USER_MEMORY)
1053#error Missing KVM capability KVM_CAP_USER_MEMORY
1054#endif
1055#if !defined(KVM_CAP_SET_TSS_ADDR)
1056#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1057#endif
1058#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1059#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1060#endif
aliguori7ba1e612008-11-05 16:04:33 +00001061int main(void) { return 0; }
1062EOF
aliguorieac30262008-11-05 16:28:56 +00001063 if test "$kerneldir" != "" ; then
1064 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001065 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1066 -a -d "$kerneldir/arch/x86/include" ; then
1067 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001068 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1069 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001070 elif test -d "$kerneldir/arch/$cpu/include" ; then
1071 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1072 fi
aliguorieac30262008-11-05 16:28:56 +00001073 else
1074 kvm_cflags=""
1075 fi
aliguori7ba1e612008-11-05 16:04:33 +00001076 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001077 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001078 :
1079 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001080 kvm="no";
1081 if [ -x "`which awk 2>/dev/null`" ] && \
1082 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001083 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001084 | grep "error: " \
1085 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1086 if test "$kvmerr" != "" ; then
1087 kvm="no - (${kvmerr})"
1088 fi
1089 fi
aliguori7ba1e612008-11-05 16:04:33 +00001090 fi
1091fi
1092
1093##########################################
blueswir1414f0da2008-08-15 18:20:52 +00001094# AIO probe
aliguori3c529d92008-12-12 16:41:40 +00001095AIOLIBS=""
1096
blueswir1414f0da2008-08-15 18:20:52 +00001097if test "$aio" = "yes" ; then
1098 aio=no
1099 cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001100#include <pthread.h>
blueswir1c9db92f2009-01-17 06:49:15 +00001101int main(void) { pthread_mutex_t lock; return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001102EOF
1103 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1104 aio=yes
aliguori3c529d92008-12-12 16:41:40 +00001105 AIOLIBS="-lpthread"
blueswir1414f0da2008-08-15 18:20:52 +00001106 fi
1107fi
1108
aliguoribf9298b2008-12-05 20:05:26 +00001109##########################################
1110# iovec probe
1111cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001112#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001113#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001114#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001115int main(void) { struct iovec iov; return 0; }
1116EOF
1117iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001118if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001119 iovec=yes
1120fi
1121
aurel32f652e6a2008-12-16 10:43:48 +00001122##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001123# preadv probe
1124cat > $TMPC <<EOF
1125#include <sys/types.h>
1126#include <sys/uio.h>
1127#include <unistd.h>
1128int main(void) { preadv; }
1129EOF
1130preadv=no
1131if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1132 preadv=yes
1133fi
1134
1135##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001136# fdt probe
1137if test "$fdt" = "yes" ; then
1138 fdt=no
1139 cat > $TMPC << EOF
1140int main(void) { return 0; }
1141EOF
1142 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1143 fdt=yes
1144 fi
1145fi
1146
pbrookcc8ae6d2006-04-23 17:57:59 +00001147# Check if tools are available to build documentation.
ths6c591862007-05-09 13:55:03 +00001148if [ -x "`which texi2html 2>/dev/null`" ] && \
1149 [ -x "`which pod2man 2>/dev/null`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +00001150 build_docs="yes"
1151fi
1152
aliguorida93a1f2008-12-12 20:02:52 +00001153##########################################
1154# Do we need librt
1155cat > $TMPC <<EOF
1156#include <signal.h>
1157#include <time.h>
1158int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1159EOF
1160
1161rt=no
balrog8c7f7572008-12-15 03:15:36 +00001162if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001163 :
balrog8c7f7572008-12-15 03:15:36 +00001164elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001165 rt=yes
1166fi
1167
1168if test "$rt" = "yes" ; then
1169 # Hack, we should have a general purpose LIBS for this sort of thing
1170 AIOLIBS="$AIOLIBS -lrt"
1171fi
1172
bellard11d9f692004-04-02 20:55:59 +00001173if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001174 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001175 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001176 fi
1177 mansuffix=""
1178 datasuffix=""
1179 docsuffix=""
1180 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001181else
pbrook308c3592007-02-27 00:52:01 +00001182 if test -z "$prefix" ; then
1183 prefix="/usr/local"
1184 fi
1185 mansuffix="/share/man"
1186 datasuffix="/share/qemu"
1187 docsuffix="/share/doc/qemu"
1188 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001189fi
bellard5a671352003-10-01 00:13:48 +00001190
bellard43ce4df2003-06-09 19:53:12 +00001191echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001192echo "BIOS directory $prefix$datasuffix"
1193echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001194if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001195echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001196echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001197fi
bellard5a671352003-10-01 00:13:48 +00001198echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001199echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001200echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001201echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001202echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001203echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001204echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001205echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001206echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +00001207echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001208echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00001209echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00001210echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001211echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001212echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001213if test "$darwin" = "yes" ; then
1214 echo "Cocoa support $cocoa"
1215fi
bellard97a847b2003-08-10 21:36:04 +00001216echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001217if test "$sdl" != "no" ; then
1218 echo "SDL static link $sdl_static"
1219fi
balrog4d3b6f62008-02-10 16:33:14 +00001220echo "curses support $curses"
bellard67b915a2004-03-31 23:37:16 +00001221echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001222echo "Audio drivers $audio_drv_list"
1223echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001224echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001225echo "VNC TLS support $vnc_tls"
1226if test "$vnc_tls" = "yes" ; then
1227 echo " TLS CFLAGS $vnc_tls_cflags"
1228 echo " TLS LIBS $vnc_tls_libs"
1229fi
aliguori2f9606b2009-03-06 20:27:28 +00001230echo "VNC SASL support $vnc_sasl"
1231if test "$vnc_sasl" = "yes" ; then
1232 echo " SASL CFLAGS $vnc_sasl_cflags"
1233 echo " SASL LIBS $vnc_sasl_libs"
1234fi
blueswir131422552007-04-16 18:27:06 +00001235if test -n "$sparc_cpu"; then
1236 echo "Target Sparc Arch $sparc_cpu"
1237fi
bellard07f4ddb2005-04-23 17:44:28 +00001238echo "kqemu support $kqemu"
aurel322e4d9fb2008-04-08 06:01:02 +00001239echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001240echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001241[ ! -z "$uname_release" ] && \
1242echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001243echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001244echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001245echo "AIO support $aio"
ths77755342008-11-27 15:45:16 +00001246echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001247echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001248echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00001249echo "preadv support $preadv"
bellard67b915a2004-03-31 23:37:16 +00001250
bellard97a847b2003-08-10 21:36:04 +00001251if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001252echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001253fi
malcd4742de2008-11-29 22:04:31 +00001254if [ -s $TMPSDLLOG ]; then
ths20b40c62007-07-11 23:39:45 +00001255 echo "The error log from compiling the libSDL test is: "
malcd4742de2008-11-29 22:04:31 +00001256 cat $TMPSDLLOG
ths20b40c62007-07-11 23:39:45 +00001257fi
bellard24b55b92005-03-01 22:30:41 +00001258#if test "$sdl_static" = "no"; then
1259# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1260#fi
bellard97a847b2003-08-10 21:36:04 +00001261config_mak="config-host.mak"
1262config_h="config-host.h"
1263
bellard7c1f25b2004-04-22 00:02:08 +00001264#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001265
ths15d9ca02007-07-31 23:07:32 +00001266test -f $config_h && mv $config_h ${config_h}~
1267
bellard97a847b2003-08-10 21:36:04 +00001268echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001269printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001270printf " '%s'" "$0" "$@" >> $config_mak
1271echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001272echo "/* Automatically generated by configure - do not modify */" > $config_h
1273
1274echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001275echo "bindir=\${prefix}$binsuffix" >> $config_mak
1276echo "mandir=\${prefix}$mansuffix" >> $config_mak
1277echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001278echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001279echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001280echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001281echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001282echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001283echo "HOST_CC=$host_cc" >> $config_mak
1284echo "AR=$ar" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001285# XXX: only use CFLAGS and LDFLAGS ?
1286# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1287# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001288echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001289echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1290echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1291echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001292echo "CFLAGS=$CFLAGS" >> $config_mak
1293echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001294echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +00001295echo "AIOLIBS=$AIOLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001296case "$cpu" in
1297 i386)
1298 echo "ARCH=i386" >> $config_mak
1299 echo "#define HOST_I386 1" >> $config_h
1300 ;;
1301 x86_64)
1302 echo "ARCH=x86_64" >> $config_mak
1303 echo "#define HOST_X86_64 1" >> $config_h
1304 ;;
1305 alpha)
1306 echo "ARCH=alpha" >> $config_mak
1307 echo "#define HOST_ALPHA 1" >> $config_h
1308 ;;
1309 armv4b)
1310 echo "ARCH=arm" >> $config_mak
1311 echo "#define HOST_ARM 1" >> $config_h
1312 ;;
1313 armv4l)
1314 echo "ARCH=arm" >> $config_mak
1315 echo "#define HOST_ARM 1" >> $config_h
1316 ;;
1317 cris)
1318 echo "ARCH=cris" >> $config_mak
1319 echo "#define HOST_CRIS 1" >> $config_h
1320 ;;
1321 hppa)
1322 echo "ARCH=hppa" >> $config_mak
1323 echo "#define HOST_HPPA 1" >> $config_h
1324 ;;
1325 ia64)
1326 echo "ARCH=ia64" >> $config_mak
1327 echo "#define HOST_IA64 1" >> $config_h
1328 ;;
1329 m68k)
1330 echo "ARCH=m68k" >> $config_mak
1331 echo "#define HOST_M68K 1" >> $config_h
1332 ;;
1333 mips)
1334 echo "ARCH=mips" >> $config_mak
1335 echo "#define HOST_MIPS 1" >> $config_h
1336 ;;
1337 mips64)
1338 echo "ARCH=mips64" >> $config_mak
1339 echo "#define HOST_MIPS64 1" >> $config_h
1340 ;;
malcfdf7ed92009-01-14 18:39:52 +00001341 ppc)
1342 echo "ARCH=ppc" >> $config_mak
1343 echo "#define HOST_PPC 1" >> $config_h
1344 ;;
1345 ppc64)
1346 echo "ARCH=ppc64" >> $config_mak
1347 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001348 ;;
1349 s390)
1350 echo "ARCH=s390" >> $config_mak
1351 echo "#define HOST_S390 1" >> $config_h
1352 ;;
1353 sparc)
1354 echo "ARCH=sparc" >> $config_mak
1355 echo "#define HOST_SPARC 1" >> $config_h
1356 ;;
1357 sparc64)
1358 echo "ARCH=sparc64" >> $config_mak
1359 echo "#define HOST_SPARC64 1" >> $config_h
1360 ;;
1361 *)
1362 echo "Unsupported CPU = $cpu"
1363 exit 1
1364 ;;
1365esac
aliguori03b4fe72008-10-07 19:16:17 +00001366if test "$sparse" = "yes" ; then
1367 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1368 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1369 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1370fi
aliguori1625af82009-04-05 17:41:02 +00001371if test "$strip_opt" = "yes" ; then
1372 echo "STRIP_OPT=-s" >> $config_mak
1373fi
bellard7d132992003-03-06 23:23:54 +00001374if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001375 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1376 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1377fi
bellardb6853692005-06-05 17:10:39 +00001378echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001379if test "$mingw32" = "yes" ; then
1380 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001381 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001382else
1383 cat > $TMPC << EOF
1384#include <byteswap.h>
1385int main(void) { return bswap_32(0); }
1386EOF
aurel32178baee2008-12-08 18:11:57 +00001387 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001388 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1389 fi
blueswir113606772008-12-05 17:54:09 +00001390 cat > $TMPC << EOF
1391#include <sys/endian.h>
1392#include <sys/types.h>
1393#include <machine/bswap.h>
1394int main(void) { return bswap32(0); }
1395EOF
aurel32178baee2008-12-08 18:11:57 +00001396 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001397 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1398 fi
bellard67b915a2004-03-31 23:37:16 +00001399fi
blueswir1128ab2f2008-08-15 18:33:42 +00001400
1401if [ "$openbsd" = "yes" ] ; then
1402 echo "#define ENOTSUP 4096" >> $config_h
1403fi
1404
bellard83fb7ad2004-07-05 21:25:26 +00001405if test "$darwin" = "yes" ; then
1406 echo "CONFIG_DARWIN=yes" >> $config_mak
1407 echo "#define CONFIG_DARWIN 1" >> $config_h
1408fi
malcb29fe3e2008-11-18 01:42:22 +00001409
1410if test "$aix" = "yes" ; then
1411 echo "CONFIG_AIX=yes" >> $config_mak
1412 echo "#define CONFIG_AIX 1" >> $config_h
1413fi
1414
bellardec530c82006-04-25 22:36:06 +00001415if test "$solaris" = "yes" ; then
1416 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001417 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001418 if test "$needs_libsunmath" = "yes" ; then
1419 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1420 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1421 fi
bellardec530c82006-04-25 22:36:06 +00001422fi
blueswir131422552007-04-16 18:27:06 +00001423if test -n "$sparc_cpu"; then
1424 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1425 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1426fi
bellard67b915a2004-03-31 23:37:16 +00001427if test "$gdbstub" = "yes" ; then
1428 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1429 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1430fi
bellard97a847b2003-08-10 21:36:04 +00001431if test "$gprof" = "yes" ; then
1432 echo "TARGET_GPROF=yes" >> $config_mak
1433 echo "#define HAVE_GPROF 1" >> $config_h
1434fi
1435if test "$static" = "yes" ; then
1436 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001437 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001438fi
bellard05c2a3e2006-02-08 22:39:17 +00001439if test $profiler = "yes" ; then
1440 echo "#define CONFIG_PROFILER 1" >> $config_h
1441fi
bellardc20709a2004-04-21 23:27:19 +00001442if test "$slirp" = "yes" ; then
1443 echo "CONFIG_SLIRP=yes" >> $config_mak
1444 echo "#define CONFIG_SLIRP 1" >> $config_h
1445fi
ths8a16d272008-07-19 09:56:24 +00001446if test "$vde" = "yes" ; then
1447 echo "CONFIG_VDE=yes" >> $config_mak
1448 echo "#define CONFIG_VDE 1" >> $config_h
1449 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1450fi
malc0c58ac12008-06-25 21:04:05 +00001451for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001452 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001453 echo "$def=yes" >> $config_mak
1454 echo "#define $def 1" >> $config_h
1455done
1456echo "#define AUDIO_DRIVERS \\" >> $config_h
1457for drv in $audio_drv_list; do
1458 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001459 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001460 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001461 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001462 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1463 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001464 elif test "$drv" = "oss"; then
1465 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001466 fi
1467done
1468echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001469if test "$mixemu" = "yes" ; then
1470 echo "CONFIG_MIXEMU=yes" >> $config_mak
1471 echo "#define CONFIG_MIXEMU 1" >> $config_h
1472fi
ths8d5d2d42007-08-25 01:37:51 +00001473if test "$vnc_tls" = "yes" ; then
1474 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1475 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1476 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1477 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1478fi
aliguori2f9606b2009-03-06 20:27:28 +00001479if test "$vnc_sasl" = "yes" ; then
1480 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1481 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1482 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1483 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1484fi
aliguori76655d62009-03-06 20:27:37 +00001485if test "$fnmatch" = "yes" ; then
1486 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1487fi
pbrookb1a550a2006-04-16 13:28:56 +00001488qemu_version=`head $source_path/VERSION`
1489echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001490echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001491
pbrook4a19f1e2009-04-07 23:17:49 +00001492echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1493
bellard97a847b2003-08-10 21:36:04 +00001494echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001495if [ "$source_path_used" = "yes" ]; then
1496 echo "VPATH=$source_path" >> $config_mak
1497fi
bellard97a847b2003-08-10 21:36:04 +00001498echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001499if [ "$build_docs" = "yes" ] ; then
1500 echo "BUILD_DOCS=yes" >> $config_mak
1501fi
bellard49ecc3f2007-11-07 19:25:15 +00001502if test "$static" = "yes"; then
1503 sdl1=$sdl_static
1504else
1505 sdl1=$sdl
1506fi
1507if test "$sdl1" = "yes" ; then
1508 echo "#define CONFIG_SDL 1" >> $config_h
1509 echo "CONFIG_SDL=yes" >> $config_mak
1510 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1511 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001512 elif test "$sdl_x11" = "yes" ; then
1513 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001514 else
1515 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1516 fi
1517 if [ "${aa}" = "yes" ] ; then
1518 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1519 else
1520 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1521 fi
1522fi
1523if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001524 echo "#define CONFIG_COCOA 1" >> $config_h
1525 echo "CONFIG_COCOA=yes" >> $config_mak
1526fi
1527if test "$curses" = "yes" ; then
1528 echo "#define CONFIG_CURSES 1" >> $config_h
1529 echo "CONFIG_CURSES=yes" >> $config_mak
1530 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001531fi
aurel322e4d9fb2008-04-08 06:01:02 +00001532if test "$brlapi" = "yes" ; then
1533 echo "CONFIG_BRLAPI=yes" >> $config_mak
1534 echo "#define CONFIG_BRLAPI 1" >> $config_h
1535 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1536fi
balrogfb599c92008-09-28 23:49:55 +00001537if test "$bluez" = "yes" ; then
1538 echo "CONFIG_BLUEZ=yes" >> $config_mak
1539 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1540 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1541 echo "#define CONFIG_BLUEZ 1" >> $config_h
1542fi
blueswir1414f0da2008-08-15 18:20:52 +00001543if test "$aio" = "yes" ; then
1544 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001545 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001546fi
ths77755342008-11-27 15:45:16 +00001547if test "$blobs" = "yes" ; then
1548 echo "INSTALL_BLOBS=yes" >> $config_mak
1549fi
aliguoribf9298b2008-12-05 20:05:26 +00001550if test "$iovec" = "yes" ; then
1551 echo "#define HAVE_IOVEC 1" >> $config_h
1552fi
aliguoriceb42de2009-04-07 18:43:28 +00001553if test "$preadv" = "yes" ; then
1554 echo "#define HAVE_PREADV 1" >> $config_h
1555fi
aurel32f652e6a2008-12-16 10:43:48 +00001556if test "$fdt" = "yes" ; then
1557 echo "#define HAVE_FDT 1" >> $config_h
1558 echo "FDT_LIBS=-lfdt" >> $config_mak
1559fi
bellard97a847b2003-08-10 21:36:04 +00001560
bellard83fb7ad2004-07-05 21:25:26 +00001561# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001562if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001563 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001564 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
blueswir1179a2c12009-03-08 08:23:32 +00001565 echo "#define HOST_BSD 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001566fi
1567
pbrookc5937222006-05-14 11:30:38 +00001568echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1569
blueswir168063642008-11-22 21:03:55 +00001570# USB host support
1571case "$usb" in
1572linux)
1573 echo "HOST_USB=linux" >> $config_mak
1574;;
1575bsd)
1576 echo "HOST_USB=bsd" >> $config_mak
1577;;
1578*)
1579 echo "HOST_USB=stub" >> $config_mak
1580;;
1581esac
1582
pbrookc39e3332007-09-22 16:49:14 +00001583tools=
1584if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001585 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001586 if [ "$linux" = "yes" ] ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001587 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001588 fi
pbrookc39e3332007-09-22 16:49:14 +00001589fi
1590echo "TOOLS=$tools" >> $config_mak
1591
ths15d9ca02007-07-31 23:07:32 +00001592test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1593
bellard1d14ffa2005-10-30 18:58:22 +00001594for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001595target_dir="$target"
1596config_mak=$target_dir/config.mak
1597config_h=$target_dir/config.h
1598target_cpu=`echo $target | cut -d '-' -f 1`
1599target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001600[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001601[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1602[ "$target_cpu" = "mips" ] && target_bigendian=yes
1603[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1604[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001605[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001606[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001607[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001608[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001609[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001610[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1611[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1612[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001613target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001614target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001615target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001616target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001617target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001618case "$target" in
1619 ${target_cpu}-softmmu)
1620 target_softmmu="yes"
1621 ;;
1622 ${target_cpu}-linux-user)
1623 target_user_only="yes"
1624 target_linux_user="yes"
1625 ;;
1626 ${target_cpu}-darwin-user)
1627 target_user_only="yes"
1628 target_darwin_user="yes"
1629 ;;
blueswir184778502008-10-26 20:33:16 +00001630 ${target_cpu}-bsd-user)
1631 target_user_only="yes"
1632 target_bsd_user="yes"
1633 ;;
pbrook9e407a82007-05-26 16:38:53 +00001634 *)
1635 echo "ERROR: Target '$target' not recognised"
1636 exit 1
1637 ;;
1638esac
ths831b7822007-01-18 20:06:33 +00001639
bellard97ccc682005-07-02 13:32:17 +00001640if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +00001641 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +00001642 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +00001643 echo "To build QEMU without graphical output configure with --disable-gfx-check"
balrog4d3b6f62008-02-10 16:33:14 +00001644 echo "Note that this will disable all output from the virtual graphics card"
1645 echo "except through VNC or curses."
bellard97ccc682005-07-02 13:32:17 +00001646 exit 1;
1647fi
1648
bellard7c1f25b2004-04-22 00:02:08 +00001649#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001650
ths15d9ca02007-07-31 23:07:32 +00001651test -f $config_h && mv $config_h ${config_h}~
1652
bellard97a847b2003-08-10 21:36:04 +00001653mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001654mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001655mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001656if 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 +00001657 mkdir -p $target_dir/nwfpe
1658fi
1659
bellardec530c82006-04-25 22:36:06 +00001660#
1661# don't use ln -sf as not all "ln -sf" over write the file/link
1662#
1663rm -f $target_dir/Makefile
1664ln -s $source_path/Makefile.target $target_dir/Makefile
1665
bellard97a847b2003-08-10 21:36:04 +00001666
1667echo "# Automatically generated by configure - do not modify" > $config_mak
1668echo "/* Automatically generated by configure - do not modify */" > $config_h
1669
1670
1671echo "include ../config-host.mak" >> $config_mak
1672echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001673
pbrooke5fe0c52006-06-11 13:32:59 +00001674bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001675elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001676target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001677interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1678echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001679gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001680
aliguori5985ece2008-11-05 19:59:25 +00001681# Make sure the target and host cpus are compatible
1682if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
malcfdf7ed92009-01-14 18:39:52 +00001683 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001684 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1685 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001686 kvm="no"
1687fi
1688# Disable KVM for linux-user
1689if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1690 kvm="no"
1691fi
1692
aurel322408a522008-04-20 20:19:44 +00001693case "$target_cpu" in
1694 i386)
1695 echo "TARGET_ARCH=i386" >> $config_mak
1696 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1697 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001698 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001699 then
1700 echo "#define USE_KQEMU 1" >> $config_h
1701 fi
aliguori7ba1e612008-11-05 16:04:33 +00001702 if test "$kvm" = "yes" ; then
1703 echo "CONFIG_KVM=yes" >> $config_mak
1704 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001705 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001706 fi
aurel322408a522008-04-20 20:19:44 +00001707 ;;
1708 x86_64)
1709 echo "TARGET_ARCH=x86_64" >> $config_mak
1710 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1711 echo "#define TARGET_I386 1" >> $config_h
1712 echo "#define TARGET_X86_64 1" >> $config_h
1713 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1714 then
1715 echo "#define USE_KQEMU 1" >> $config_h
1716 fi
aliguori7ba1e612008-11-05 16:04:33 +00001717 if test "$kvm" = "yes" ; then
1718 echo "CONFIG_KVM=yes" >> $config_mak
1719 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1720 echo "#define CONFIG_KVM 1" >> $config_h
1721 fi
aurel322408a522008-04-20 20:19:44 +00001722 ;;
1723 alpha)
1724 echo "TARGET_ARCH=alpha" >> $config_mak
1725 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1726 echo "#define TARGET_ALPHA 1" >> $config_h
1727 ;;
1728 arm|armeb)
1729 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001730 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1731 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001732 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001733 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001734 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00001735 ;;
1736 cris)
1737 echo "TARGET_ARCH=cris" >> $config_mak
1738 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1739 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00001740 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001741 ;;
1742 m68k)
1743 echo "TARGET_ARCH=m68k" >> $config_mak
1744 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1745 echo "#define TARGET_M68K 1" >> $config_h
1746 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001747 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00001748 ;;
1749 mips|mipsel)
1750 echo "TARGET_ARCH=mips" >> $config_mak
1751 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1752 echo "#define TARGET_MIPS 1" >> $config_h
1753 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1754 ;;
1755 mipsn32|mipsn32el)
1756 echo "TARGET_ARCH=mipsn32" >> $config_mak
1757 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1758 echo "#define TARGET_MIPS 1" >> $config_h
1759 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1760 ;;
1761 mips64|mips64el)
1762 echo "TARGET_ARCH=mips64" >> $config_mak
1763 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1764 echo "#define TARGET_MIPS 1" >> $config_h
1765 echo "#define TARGET_MIPS64 1" >> $config_h
1766 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1767 ;;
1768 ppc)
1769 echo "TARGET_ARCH=ppc" >> $config_mak
1770 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1771 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001772 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001773 ;;
1774 ppcemb)
1775 echo "TARGET_ARCH=ppcemb" >> $config_mak
1776 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1777 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1778 echo "#define TARGET_PPC 1" >> $config_h
1779 echo "#define TARGET_PPCEMB 1" >> $config_h
aurel32d76d1652008-12-16 10:43:58 +00001780 if test "$kvm" = "yes" ; then
1781 echo "CONFIG_KVM=yes" >> $config_mak
1782 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1783 echo "#define CONFIG_KVM 1" >> $config_h
1784 fi
aurel32c8b35322009-01-24 15:07:34 +00001785 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001786 ;;
1787 ppc64)
1788 echo "TARGET_ARCH=ppc64" >> $config_mak
1789 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1790 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1791 echo "#define TARGET_PPC 1" >> $config_h
1792 echo "#define TARGET_PPC64 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001793 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001794 ;;
1795 ppc64abi32)
1796 echo "TARGET_ARCH=ppc64" >> $config_mak
1797 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1798 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1799 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1800 echo "#define TARGET_PPC 1" >> $config_h
1801 echo "#define TARGET_PPC64 1" >> $config_h
1802 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001803 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001804 ;;
1805 sh4|sh4eb)
1806 echo "TARGET_ARCH=sh4" >> $config_mak
1807 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1808 echo "#define TARGET_SH4 1" >> $config_h
1809 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001810 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001811 ;;
1812 sparc)
1813 echo "TARGET_ARCH=sparc" >> $config_mak
1814 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1815 echo "#define TARGET_SPARC 1" >> $config_h
1816 ;;
1817 sparc64)
1818 echo "TARGET_ARCH=sparc64" >> $config_mak
1819 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1820 echo "#define TARGET_SPARC 1" >> $config_h
1821 echo "#define TARGET_SPARC64 1" >> $config_h
1822 elfload32="yes"
1823 ;;
1824 sparc32plus)
1825 echo "TARGET_ARCH=sparc64" >> $config_mak
1826 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1827 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1828 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1829 echo "#define TARGET_SPARC 1" >> $config_h
1830 echo "#define TARGET_SPARC64 1" >> $config_h
1831 echo "#define TARGET_ABI32 1" >> $config_h
1832 ;;
1833 *)
1834 echo "Unsupported target CPU"
1835 exit 1
1836 ;;
1837esac
bellardde83cd02003-06-15 20:25:43 +00001838if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001839 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1840 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1841fi
1842if test "$target_softmmu" = "yes" ; then
1843 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1844 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00001845fi
bellard997344f2003-10-27 21:10:39 +00001846if test "$target_user_only" = "yes" ; then
1847 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1848 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1849fi
ths831b7822007-01-18 20:06:33 +00001850if test "$target_linux_user" = "yes" ; then
1851 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1852 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1853fi
1854if test "$target_darwin_user" = "yes" ; then
1855 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1856 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1857fi
pbrook56aebc82008-10-11 17:55:29 +00001858list=""
1859if test ! -z "$gdb_xml_files" ; then
1860 for x in $gdb_xml_files; do
1861 list="$list $source_path/gdb-xml/$x"
1862 done
1863fi
1864echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00001865
aurel320938cda2008-04-11 21:36:06 +00001866if test "$target_cpu" = "arm" \
1867 -o "$target_cpu" = "armeb" \
1868 -o "$target_cpu" = "m68k" \
1869 -o "$target_cpu" = "mips" \
1870 -o "$target_cpu" = "mipsel" \
1871 -o "$target_cpu" = "mipsn32" \
1872 -o "$target_cpu" = "mipsn32el" \
1873 -o "$target_cpu" = "mips64" \
1874 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00001875 -o "$target_cpu" = "ppc" \
1876 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00001877 -o "$target_cpu" = "ppc64abi32" \
1878 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00001879 -o "$target_cpu" = "sparc" \
1880 -o "$target_cpu" = "sparc64" \
1881 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00001882 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1883 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1884fi
pbrooke5fe0c52006-06-11 13:32:59 +00001885if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1886 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1887 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1888fi
pbrookbd0c5662008-05-29 14:34:11 +00001889if test "$target_user_only" = "yes" \
1890 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1891 echo "#define USE_NPTL 1" >> $config_h
1892fi
blueswir1cb33da52007-10-09 16:34:29 +00001893# 32 bit ELF loader in addition to native 64 bit loader?
1894if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1895 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1896 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1897fi
blueswir184778502008-10-26 20:33:16 +00001898if test "$target_bsd_user" = "yes" ; then
1899 echo "CONFIG_BSD_USER=yes" >> $config_mak
1900 echo "#define CONFIG_BSD_USER 1" >> $config_h
1901fi
bellard5b0753e2005-03-01 21:37:28 +00001902
ths15d9ca02007-07-31 23:07:32 +00001903test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1904
bellard97a847b2003-08-10 21:36:04 +00001905done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00001906
1907# build tree in object directory if source path is different from current one
1908if test "$source_path_used" = "yes" ; then
bellard49ecc3f2007-11-07 19:25:15 +00001909 DIRS="tests tests/cris slirp audio"
bellard7d132992003-03-06 23:23:54 +00001910 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00001911 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00001912 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00001913 for dir in $DIRS ; do
1914 mkdir -p $dir
1915 done
bellardec530c82006-04-25 22:36:06 +00001916 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00001917 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00001918 rm -f $f
1919 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00001920 done
1921fi