blob: 377f341407a54b02bd1106ecb8f8d054eef34422 [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"
thsc2b84fa2007-02-10 23:21:21 +0000281 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000282 # have to select again, because `uname -m` returns i86pc
283 # even on an x86_64 box.
284 solariscpu=`isainfo -k`
285 if test "${solariscpu}" = "amd64" ; then
286 cpu="x86_64"
287 fi
thsc2b84fa2007-02-10 23:21:21 +0000288 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000289 if test "$solarisrev" -le 9 ; then
290 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
291 needs_libsunmath="yes"
292 else
293 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
294 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
295 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
296 echo "Studio 11 can be downloaded from www.sun.com."
297 exit 1
298 fi
299 fi
300 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000301 kqemu="yes"
302 fi
ths86b2bd92007-02-11 00:31:33 +0000303 fi
ths6b4d2ba2007-05-13 18:02:43 +0000304 if test -f /usr/include/sys/soundcard.h ; then
malc0c58ac12008-06-25 21:04:05 +0000305 audio_drv_list="oss"
ths6b4d2ba2007-05-13 18:02:43 +0000306 fi
malcc2de5c92008-06-28 19:13:06 +0000307 audio_possible_drivers="oss sdl"
ths86b2bd92007-02-11 00:31:33 +0000308;;
malcb29fe3e2008-11-18 01:42:22 +0000309AIX)
310aix="yes"
311make="gmake"
312;;
bellard1d14ffa2005-10-30 18:58:22 +0000313*)
malc0c58ac12008-06-25 21:04:05 +0000314audio_drv_list="oss"
malcb8e59f12008-07-02 21:03:08 +0000315audio_possible_drivers="oss alsa sdl esd pa"
bellard5327cf42005-01-10 23:18:50 +0000316linux="yes"
ths831b7822007-01-18 20:06:33 +0000317linux_user="yes"
blueswir168063642008-11-22 21:03:55 +0000318usb="linux"
bellard07f4ddb2005-04-23 17:44:28 +0000319if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000320 kqemu="yes"
malcc2de5c92008-06-28 19:13:06 +0000321 audio_possible_drivers="$audio_possible_drivers fmod"
bellardc9ec1fe2005-02-10 21:55:30 +0000322fi
bellardfb065182004-11-09 23:09:44 +0000323;;
bellard7d132992003-03-06 23:23:54 +0000324esac
325
bellard7d3505c2004-05-12 19:32:15 +0000326if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000327 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000328 make="gmake"
blueswir168063642008-11-22 21:03:55 +0000329 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000330 fi
blueswir184778502008-10-26 20:33:16 +0000331 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000332fi
333
bellard7d132992003-03-06 23:23:54 +0000334# find source path
pbrookad064842006-04-16 12:41:07 +0000335source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000336source_path_used="no"
337workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000338if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000339 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000340else
341 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000342fi
pbrook724db112008-02-03 19:20:13 +0000343[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000344
bellard85aa5182007-11-11 20:17:03 +0000345werror="no"
bellard0d1e2392007-11-11 20:24:30 +0000346# generate compile errors on warnings for development builds
347#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
348#werror="yes";
349#fi
bellard85aa5182007-11-11 20:17:03 +0000350
bellard7d132992003-03-06 23:23:54 +0000351for opt do
pbrooka46e4032006-04-29 23:05:22 +0000352 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000353 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000354 --help|-h) show_help=yes
355 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000356 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000357 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000358 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000359 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000360 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000361 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000362 ;;
aliguoriac0df512008-12-29 17:14:15 +0000363 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000364 ;;
aliguoriac0df512008-12-29 17:14:15 +0000365 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000366 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000367 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000368 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000369 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000370 ;;
pbrook6a882642006-04-17 13:57:12 +0000371 --install=*) install="$optarg"
372 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000373 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000374 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000375 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000376 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000377 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000378 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000379 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000380 ;;
bellard7d132992003-03-06 23:23:54 +0000381 --enable-gprof) gprof="yes"
382 ;;
bellard43ce4df2003-06-09 19:53:12 +0000383 --static) static="yes"
384 ;;
bellard97a847b2003-08-10 21:36:04 +0000385 --disable-sdl) sdl="no"
386 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000387 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000388 ;;
malcc2de5c92008-06-28 19:13:06 +0000389 --fmod-inc=*) fmod_inc="$optarg"
390 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000391 --oss-lib=*) oss_lib="$optarg"
392 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000393 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000394 ;;
395 --audio-drv-list=*) audio_drv_list="$optarg"
396 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000397 --enable-sparse) sparse="yes"
398 ;;
399 --disable-sparse) sparse="no"
400 ;;
aliguori1625af82009-04-05 17:41:02 +0000401 --disable-strip) strip_opt="no"
402 ;;
ths8d5d2d42007-08-25 01:37:51 +0000403 --disable-vnc-tls) vnc_tls="no"
404 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000405 --disable-vnc-sasl) vnc_sasl="no"
406 ;;
bellard443f1372004-06-04 11:13:20 +0000407 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000408 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000409 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000410 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000411 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000412 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000413 --disable-brlapi) brlapi="no"
414 ;;
balrogfb599c92008-09-28 23:49:55 +0000415 --disable-bluez) bluez="no"
416 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000417 --disable-kvm) kvm="no"
418 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000419 --enable-profiler) profiler="yes"
420 ;;
malcc2de5c92008-06-28 19:13:06 +0000421 --enable-cocoa)
422 cocoa="yes" ;
423 sdl="no" ;
424 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000425 ;;
bellard97ccc682005-07-02 13:32:17 +0000426 --disable-gfx-check) check_gfx="no"
427 ;;
pbrookcad25d62006-03-19 16:31:11 +0000428 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000429 ;;
pbrookcad25d62006-03-19 16:31:11 +0000430 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000431 ;;
ths831b7822007-01-18 20:06:33 +0000432 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000433 ;;
ths831b7822007-01-18 20:06:33 +0000434 --enable-linux-user) linux_user="yes"
435 ;;
436 --disable-darwin-user) darwin_user="no"
437 ;;
438 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000439 ;;
blueswir184778502008-10-26 20:33:16 +0000440 --disable-bsd-user) bsd_user="no"
441 ;;
442 --enable-bsd-user) bsd_user="yes"
443 ;;
pbrookc5937222006-05-14 11:30:38 +0000444 --enable-uname-release=*) uname_release="$optarg"
445 ;;
blueswir131422552007-04-16 18:27:06 +0000446 --sparc_cpu=*)
447 sparc_cpu="$optarg"
448 case $sparc_cpu in
449 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
450 target_cpu="sparc"; cpu="sparc" ;;
451 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
452 target_cpu="sparc"; cpu="sparc" ;;
453 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
454 target_cpu="sparc64"; cpu="sparc64" ;;
455 *) echo "undefined SPARC architecture. Exiting";exit 1;;
456 esac
457 ;;
bellard85aa5182007-11-11 20:17:03 +0000458 --enable-werror) werror="yes"
459 ;;
460 --disable-werror) werror="no"
461 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000462 --disable-curses) curses="no"
463 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000464 --disable-nptl) nptl="no"
465 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000466 --enable-mixemu) mixemu="yes"
467 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000468 --disable-aio) aio="no"
469 ;;
ths77755342008-11-27 15:45:16 +0000470 --disable-blobs) blobs="no"
471 ;;
aliguorieac30262008-11-05 16:28:56 +0000472 --kerneldir=*) kerneldir="$optarg"
473 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000474 --with-pkgversion=*) pkgversion=" ($optarg)"
475 ;;
balrog7f1559c2007-11-17 10:24:32 +0000476 *) echo "ERROR: unknown option $opt"; show_help="yes"
477 ;;
bellard7d132992003-03-06 23:23:54 +0000478 esac
479done
480
ths6f30fa82007-01-05 01:00:47 +0000481# default flags for all hosts
blueswir1ac41a622008-09-14 06:46:31 +0000482CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
blueswir1e0e36fe2008-12-07 19:16:27 +0000483CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
ths6f30fa82007-01-05 01:00:47 +0000484LDFLAGS="$LDFLAGS -g"
bellard85aa5182007-11-11 20:17:03 +0000485if test "$werror" = "yes" ; then
486CFLAGS="$CFLAGS -Werror"
487fi
ths6f30fa82007-01-05 01:00:47 +0000488
blueswir1d2c7c9b2008-11-01 14:50:20 +0000489if test "$solaris" = "no" ; then
490 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
491 LDFLAGS="$LDFLAGS -Wl,--warn-common"
492 fi
blueswir149237ac2008-09-17 19:05:19 +0000493fi
494
blueswir131422552007-04-16 18:27:06 +0000495#
496# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
497# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
498#
bellard40293e52008-01-31 11:32:10 +0000499case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000500 sparc) if test -z "$sparc_cpu" ; then
501 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
502 ARCH_LDFLAGS="-m32"
503 else
504 ARCH_CFLAGS="${SP_CFLAGS}"
505 ARCH_LDFLAGS="${SP_LDFLAGS}"
506 fi
blueswir1762e8232009-04-04 09:21:28 +0000507 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
508 if test "$solaris" = "no" ; then
509 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
510 fi
blueswir131422552007-04-16 18:27:06 +0000511 ;;
512 sparc64) if test -z "$sparc_cpu" ; then
513 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
514 ARCH_LDFLAGS="-m64"
515 else
516 ARCH_CFLAGS="${SP_CFLAGS}"
517 ARCH_LDFLAGS="${SP_LDFLAGS}"
518 fi
blueswir1762e8232009-04-04 09:21:28 +0000519 if test "$solaris" = "no" ; then
520 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
521 else
522 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
523 fi
blueswir131422552007-04-16 18:27:06 +0000524 ;;
ths76d83bd2007-11-18 21:22:10 +0000525 s390)
526 ARCH_CFLAGS="-march=z900"
527 ;;
bellard40293e52008-01-31 11:32:10 +0000528 i386)
529 ARCH_CFLAGS="-m32"
530 ARCH_LDFLAGS="-m32"
531 ;;
532 x86_64)
533 ARCH_CFLAGS="-m64"
534 ARCH_LDFLAGS="-m64"
535 ;;
blueswir131422552007-04-16 18:27:06 +0000536esac
537
pbrookaf5db582006-04-08 14:26:41 +0000538if test x"$show_help" = x"yes" ; then
539cat << EOF
540
541Usage: configure [options]
542Options: [defaults in brackets after descriptions]
543
544EOF
545echo "Standard options:"
546echo " --help print this message"
547echo " --prefix=PREFIX install in PREFIX [$prefix]"
548echo " --interp-prefix=PREFIX where to find shared libraries, etc."
549echo " use %M for cpu name [$interp_prefix]"
550echo " --target-list=LIST set target list [$target_list]"
551echo ""
552echo "kqemu kernel acceleration support:"
553echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000554echo ""
555echo "Advanced options (experts only):"
556echo " --source-path=PATH path of source code [$source_path]"
557echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
558echo " --cc=CC use C compiler CC [$cc]"
559echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
aurel322981fa92009-04-07 19:57:17 +0000560echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
561echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000562echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000563echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000564echo " --static enable static build [$static]"
aliguori890b1652008-10-07 21:22:41 +0000565echo " --enable-sparse enable sparse checker"
566echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000567echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000568echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000569echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000570echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000571echo " --audio-drv-list=LIST set audio drivers list:"
572echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000573echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
574echo " Available cards: $audio_possible_cards"
malc8ff9cbf2008-06-23 18:33:30 +0000575echo " --enable-mixemu enable mixer emulation"
aurel322e4d9fb2008-04-08 06:01:02 +0000576echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000577echo " --disable-vnc-tls disable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000578echo " --disable-vnc-sasl disable SASL encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000579echo " --disable-curses disable curses output"
balrogfb599c92008-09-28 23:49:55 +0000580echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000581echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000582echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000583echo " --enable-system enable all system emulation targets"
584echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000585echo " --enable-linux-user enable all linux usermode emulation targets"
586echo " --disable-linux-user disable all linux usermode emulation targets"
587echo " --enable-darwin-user enable all darwin usermode emulation targets"
588echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000589echo " --enable-bsd-user enable all BSD usermode emulation targets"
590echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000591echo " --fmod-lib path to FMOD library"
592echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000593echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000594echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000595echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000596echo " --disable-vde disable support for vde network"
blueswir1414f0da2008-08-15 18:20:52 +0000597echo " --disable-aio disable AIO support"
ths77755342008-11-27 15:45:16 +0000598echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000599echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000600echo ""
ths5bf08932006-12-23 00:33:26 +0000601echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000602exit 1
603fi
604
bellard67b915a2004-03-31 23:37:16 +0000605if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000606 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000607 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000608 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000609 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000610 bsd_user="no"
aliguori49dc7682009-03-08 16:26:59 +0000611 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
aliguoricd01b4a2008-08-21 19:25:45 +0000612fi
613
aliguori03b4fe72008-10-07 19:16:17 +0000614if test ! -x "$(which cgcc 2>/dev/null)"; then
615 sparse="no"
616fi
617
bellardec530c82006-04-25 22:36:06 +0000618#
619# Solaris specific configure tool chain decisions
620#
621if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000622 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
623 if test -z "$solinst" ; then
624 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
625 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
626 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
627 exit 1
628 fi
629 if test "$solinst" = "/usr/sbin/install" ; then
630 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
631 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
632 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
633 exit 1
634 fi
bellardec530c82006-04-25 22:36:06 +0000635 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
636 if test -z "$sol_ar" ; then
637 echo "Error: No path includes ar"
638 if test -f /usr/ccs/bin/ar ; then
639 echo "Add /usr/ccs/bin to your path and rerun configure"
640 fi
641 exit 1
642 fi
ths5fafdf22007-09-16 21:08:06 +0000643fi
bellardec530c82006-04-25 22:36:06 +0000644
645
bellard5327cf42005-01-10 23:18:50 +0000646if test -z "$target_list" ; then
647# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000648 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000649 target_list="\
650i386-softmmu \
651x86_64-softmmu \
652arm-softmmu \
653cris-softmmu \
654m68k-softmmu \
655mips-softmmu \
656mipsel-softmmu \
657mips64-softmmu \
658mips64el-softmmu \
659ppc-softmmu \
660ppcemb-softmmu \
661ppc64-softmmu \
662sh4-softmmu \
663sh4eb-softmmu \
664sparc-softmmu \
665"
pbrook0a8e90f2006-03-19 14:54:16 +0000666 fi
bellard5327cf42005-01-10 23:18:50 +0000667# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000668 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000669 target_list="${target_list}\
670i386-linux-user \
671x86_64-linux-user \
672alpha-linux-user \
673arm-linux-user \
674armeb-linux-user \
675cris-linux-user \
676m68k-linux-user \
677mips-linux-user \
678mipsel-linux-user \
679ppc-linux-user \
680ppc64-linux-user \
681ppc64abi32-linux-user \
682sh4-linux-user \
683sh4eb-linux-user \
684sparc-linux-user \
685sparc64-linux-user \
686sparc32plus-linux-user \
687"
ths831b7822007-01-18 20:06:33 +0000688 fi
689# the following are Darwin specific
690 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000691 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000692 fi
blueswir184778502008-10-26 20:33:16 +0000693# the following are BSD specific
694 if [ "$bsd_user" = "yes" ] ; then
695 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +0000696i386-bsd-user \
697x86_64-bsd-user \
698sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +0000699sparc64-bsd-user \
700"
701 fi
bellard6e20a452005-06-05 15:56:02 +0000702else
pbrookb1a550a2006-04-16 13:28:56 +0000703 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000704fi
pbrook0a8e90f2006-03-19 14:54:16 +0000705if test -z "$target_list" ; then
706 echo "No targets enabled"
707 exit 1
708fi
bellard5327cf42005-01-10 23:18:50 +0000709
bellard7d132992003-03-06 23:23:54 +0000710if test -z "$cross_prefix" ; then
711
712# ---
713# big/little endian test
714cat > $TMPC << EOF
715#include <inttypes.h>
716int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000717 volatile uint32_t i=0x01234567;
718 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000719}
720EOF
721
aurel32178baee2008-12-08 18:11:57 +0000722if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000723$TMPE && bigendian="yes"
724else
725echo big/little test failed
726fi
727
728else
729
730# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000731if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000732 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000733 -o "$cpu" = "m68k" \
734 -o "$cpu" = "mips" \
735 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000736 -o "$cpu" = "ppc" \
737 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000738 -o "$cpu" = "s390" \
739 -o "$cpu" = "sparc" \
740 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000741 bigendian="yes"
742fi
743
744fi
745
bellardb6853692005-06-05 17:10:39 +0000746# host long bits test
747hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000748if test "$cpu" = "x86_64" \
749 -o "$cpu" = "alpha" \
750 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000751 -o "$cpu" = "sparc64" \
752 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000753 hostlongbits="64"
754fi
755
pbrookbd0c5662008-05-29 14:34:11 +0000756# Check host NPTL support
757cat > $TMPC <<EOF
758#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000759#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000760void foo()
761{
762#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
763#error bork
764#endif
765}
766EOF
767
balrog8c7f7572008-12-15 03:15:36 +0000768if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000769 :
770else
771 nptl="no"
772fi
773
bellard11d9f692004-04-02 20:55:59 +0000774##########################################
balrogac629222008-10-11 09:56:04 +0000775# zlib check
776
777cat > $TMPC << EOF
778#include <zlib.h>
779int main(void) { zlibVersion(); return 0; }
780EOF
balrog8c7f7572008-12-15 03:15:36 +0000781if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000782 :
783else
784 echo
785 echo "Error: zlib check failed"
786 echo "Make sure to have the zlib libs and headers installed."
787 echo
788 exit 1
789fi
790
791##########################################
bellard11d9f692004-04-02 20:55:59 +0000792# SDL probe
793
794sdl_too_old=no
795
796if test -z "$sdl" ; then
ths069b0bd2007-07-12 00:27:15 +0000797 sdl_config="sdl-config"
798 sdl=no
799 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000800
801cat > $TMPC << EOF
802#include <SDL.h>
803#undef main /* We don't want SDL to override our main() */
804int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
805EOF
balrog8c7f7572008-12-15 03:15:36 +0000806 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 +0000807 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
808 if test "$_sdlversion" -lt 121 ; then
809 sdl_too_old=yes
810 else
811 if test "$cocoa" = "no" ; then
812 sdl=yes
813 fi
814 fi
815
816 # static link with sdl ?
817 if test "$sdl" = "yes" ; then
818 aa="no"
819 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
820 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
821 if [ "$aa" = "yes" ] ; then
822 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000823 fi
bellard11d9f692004-04-02 20:55:59 +0000824
balrog8c7f7572008-12-15 03:15:36 +0000825 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 +0000826 sdl_static=yes
827 fi
828 fi # static link
829 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000830else
ths069b0bd2007-07-12 00:27:15 +0000831 # Make sure to disable cocoa if sdl was set
832 if test "$sdl" = "yes" ; then
833 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000834 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000835 fi
bellarda6e022a2004-04-02 21:55:47 +0000836fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000837
aliguori5368a422009-03-03 17:37:21 +0000838if test "$sdl" = "yes" ; then
839cat > $TMPC <<EOF
840#include <SDL.h>
841#if defined(SDL_VIDEO_DRIVER_X11)
842#include <X11/XKBlib.h>
843#else
844#error No x11 support
845#endif
846int main(void) { return 0; }
847EOF
848 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
849 sdl_x11="yes"
850 fi
851fi
852
ths8f28f3f2007-01-05 21:25:54 +0000853##########################################
ths8d5d2d42007-08-25 01:37:51 +0000854# VNC TLS detection
855if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000856cat > $TMPC <<EOF
857#include <gnutls/gnutls.h>
858int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
859EOF
860 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
861 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
862 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000863 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000864 :
865 else
866 vnc_tls="no"
867 fi
ths8d5d2d42007-08-25 01:37:51 +0000868fi
869
870##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000871# VNC SASL detection
872if test "$vnc_sasl" = "yes" ; then
873cat > $TMPC <<EOF
874#include <sasl/sasl.h>
875#include <stdio.h>
876int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
877EOF
878 # Assuming Cyrus-SASL installed in /usr prefix
879 vnc_sasl_cflags=""
880 vnc_sasl_libs="-lsasl2"
881 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
882 $vnc_sasl_libs 2> /dev/null ; then
883 :
884 else
885 vnc_sasl="no"
886 fi
887fi
888
889##########################################
aliguori76655d62009-03-06 20:27:37 +0000890# fnmatch() probe, used for ACL routines
891fnmatch="no"
892cat > $TMPC << EOF
893#include <fnmatch.h>
894int main(void)
895{
896 fnmatch("foo", "foo", 0);
897 return 0;
898}
899EOF
900if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
901 fnmatch="yes"
902fi
903
904##########################################
ths8a16d272008-07-19 09:56:24 +0000905# vde libraries probe
906if test "$vde" = "yes" ; then
907 cat > $TMPC << EOF
908#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000909int main(void)
910{
911 struct vde_open_args a = {0, 0, 0};
912 vde_open("", "", &a);
913 return 0;
914}
ths8a16d272008-07-19 09:56:24 +0000915EOF
balrog8c7f7572008-12-15 03:15:36 +0000916 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000917 :
918 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000919 vde="no"
ths8a16d272008-07-19 09:56:24 +0000920 fi
921fi
922
923##########################################
malcc2de5c92008-06-28 19:13:06 +0000924# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000925
malcc2de5c92008-06-28 19:13:06 +0000926audio_drv_probe()
927{
928 drv=$1
929 hdr=$2
930 lib=$3
931 exp=$4
932 cfl=$5
933 cat > $TMPC << EOF
934#include <$hdr>
935int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000936EOF
balrog8c7f7572008-12-15 03:15:36 +0000937 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +0000938 :
939 else
940 echo
941 echo "Error: $drv check failed"
942 echo "Make sure to have the $drv libs and headers installed."
943 echo
944 exit 1
945 fi
946}
947
malc2fa7d3b2008-07-29 12:58:44 +0000948audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000949for drv in $audio_drv_list; do
950 case $drv in
951 alsa)
952 audio_drv_probe $drv alsa/asoundlib.h -lasound \
953 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
954 ;;
955
956 fmod)
957 if test -z $fmod_lib || test -z $fmod_inc; then
958 echo
959 echo "Error: You must specify path to FMOD library and headers"
960 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
961 echo
962 exit 1
963 fi
964 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
965 ;;
966
967 esd)
968 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
969 ;;
malcb8e59f12008-07-02 21:03:08 +0000970
971 pa)
972 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
973 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
974 ;;
975
blueswir12f6a1ab2008-08-21 18:00:53 +0000976 oss|sdl|core|wav|dsound)
977 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
978 ;;
979
malce4c63a62008-07-19 16:15:16 +0000980 *)
malc1c9b2a52008-07-19 16:57:30 +0000981 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +0000982 echo
983 echo "Error: Unknown driver '$drv' selected"
984 echo "Possible drivers are: $audio_possible_drivers"
985 echo
986 exit 1
987 }
988 ;;
malcc2de5c92008-06-28 19:13:06 +0000989 esac
990done
ths8f28f3f2007-01-05 21:25:54 +0000991
balrog4d3b6f62008-02-10 16:33:14 +0000992##########################################
aurel322e4d9fb2008-04-08 06:01:02 +0000993# BrlAPI probe
994
995if test -z "$brlapi" ; then
996 brlapi=no
997cat > $TMPC << EOF
998#include <brlapi.h>
999int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1000EOF
aurel32178baee2008-12-08 18:11:57 +00001001 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +00001002 brlapi=yes
1003 fi # brlapi compile test
1004fi # -z $brlapi
1005
1006##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001007# curses probe
1008
1009if test "$curses" = "yes" ; then
1010 curses=no
1011 cat > $TMPC << EOF
1012#include <curses.h>
1013int main(void) { return curses_version(); }
1014EOF
aurel32178baee2008-12-08 18:11:57 +00001015 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +00001016 curses=yes
1017 fi
1018fi # test "$curses"
1019
blueswir1414f0da2008-08-15 18:20:52 +00001020##########################################
balrogfb599c92008-09-28 23:49:55 +00001021# bluez support probe
1022if test "$bluez" = "yes" ; then
1023 `pkg-config bluez` || bluez="no"
1024fi
1025if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001026 cat > $TMPC << EOF
1027#include <bluetooth/bluetooth.h>
1028int main(void) { return bt_error(0); }
1029EOF
balrogfb599c92008-09-28 23:49:55 +00001030 bluez_cflags=`pkg-config --cflags bluez`
1031 bluez_libs=`pkg-config --libs bluez`
balrog17e15922008-10-11 12:00:42 +00001032 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001033 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001034 :
1035 else
1036 bluez="no"
1037 fi
balrogfb599c92008-09-28 23:49:55 +00001038fi
1039
1040##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001041# kvm probe
1042if test "$kvm" = "yes" ; then
1043 cat > $TMPC <<EOF
1044#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001045#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001046#error Invalid KVM version
1047#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001048#if !defined(KVM_CAP_USER_MEMORY)
1049#error Missing KVM capability KVM_CAP_USER_MEMORY
1050#endif
1051#if !defined(KVM_CAP_SET_TSS_ADDR)
1052#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1053#endif
1054#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1055#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1056#endif
aliguori7ba1e612008-11-05 16:04:33 +00001057int main(void) { return 0; }
1058EOF
aliguorieac30262008-11-05 16:28:56 +00001059 if test "$kerneldir" != "" ; then
1060 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001061 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1062 -a -d "$kerneldir/arch/x86/include" ; then
1063 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001064 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1065 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001066 elif test -d "$kerneldir/arch/$cpu/include" ; then
1067 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1068 fi
aliguorieac30262008-11-05 16:28:56 +00001069 else
1070 kvm_cflags=""
1071 fi
aliguori7ba1e612008-11-05 16:04:33 +00001072 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001073 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001074 :
1075 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001076 kvm="no";
1077 if [ -x "`which awk 2>/dev/null`" ] && \
1078 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001079 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001080 | grep "error: " \
1081 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1082 if test "$kvmerr" != "" ; then
1083 kvm="no - (${kvmerr})"
1084 fi
1085 fi
aliguori7ba1e612008-11-05 16:04:33 +00001086 fi
1087fi
1088
1089##########################################
blueswir1414f0da2008-08-15 18:20:52 +00001090# AIO probe
aliguori3c529d92008-12-12 16:41:40 +00001091AIOLIBS=""
1092
blueswir1414f0da2008-08-15 18:20:52 +00001093if test "$aio" = "yes" ; then
1094 aio=no
1095 cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001096#include <pthread.h>
blueswir1c9db92f2009-01-17 06:49:15 +00001097int main(void) { pthread_mutex_t lock; return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001098EOF
1099 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1100 aio=yes
aliguori3c529d92008-12-12 16:41:40 +00001101 AIOLIBS="-lpthread"
blueswir1414f0da2008-08-15 18:20:52 +00001102 fi
1103fi
1104
aliguoribf9298b2008-12-05 20:05:26 +00001105##########################################
1106# iovec probe
1107cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001108#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001109#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001110#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001111int main(void) { struct iovec iov; return 0; }
1112EOF
1113iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001114if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001115 iovec=yes
1116fi
1117
aurel32f652e6a2008-12-16 10:43:48 +00001118##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001119# preadv probe
1120cat > $TMPC <<EOF
1121#include <sys/types.h>
1122#include <sys/uio.h>
1123#include <unistd.h>
1124int main(void) { preadv; }
1125EOF
1126preadv=no
1127if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1128 preadv=yes
1129fi
1130
1131##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001132# fdt probe
1133if test "$fdt" = "yes" ; then
1134 fdt=no
1135 cat > $TMPC << EOF
1136int main(void) { return 0; }
1137EOF
1138 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1139 fdt=yes
1140 fi
1141fi
1142
pbrookcc8ae6d2006-04-23 17:57:59 +00001143# Check if tools are available to build documentation.
ths6c591862007-05-09 13:55:03 +00001144if [ -x "`which texi2html 2>/dev/null`" ] && \
1145 [ -x "`which pod2man 2>/dev/null`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +00001146 build_docs="yes"
1147fi
1148
aliguorida93a1f2008-12-12 20:02:52 +00001149##########################################
1150# Do we need librt
1151cat > $TMPC <<EOF
1152#include <signal.h>
1153#include <time.h>
1154int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1155EOF
1156
1157rt=no
balrog8c7f7572008-12-15 03:15:36 +00001158if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001159 :
balrog8c7f7572008-12-15 03:15:36 +00001160elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001161 rt=yes
1162fi
1163
1164if test "$rt" = "yes" ; then
1165 # Hack, we should have a general purpose LIBS for this sort of thing
1166 AIOLIBS="$AIOLIBS -lrt"
1167fi
1168
bellard11d9f692004-04-02 20:55:59 +00001169if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001170 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001171 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001172 fi
1173 mansuffix=""
1174 datasuffix=""
1175 docsuffix=""
1176 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001177else
pbrook308c3592007-02-27 00:52:01 +00001178 if test -z "$prefix" ; then
1179 prefix="/usr/local"
1180 fi
1181 mansuffix="/share/man"
1182 datasuffix="/share/qemu"
1183 docsuffix="/share/doc/qemu"
1184 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001185fi
bellard5a671352003-10-01 00:13:48 +00001186
bellard43ce4df2003-06-09 19:53:12 +00001187echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001188echo "BIOS directory $prefix$datasuffix"
1189echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001190if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001191echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001192echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001193fi
bellard5a671352003-10-01 00:13:48 +00001194echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001195echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001196echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001197echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001198echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001199echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001200echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001201echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001202echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +00001203echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001204echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00001205echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00001206echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001207echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001208echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001209if test "$darwin" = "yes" ; then
1210 echo "Cocoa support $cocoa"
1211fi
bellard97a847b2003-08-10 21:36:04 +00001212echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001213if test "$sdl" != "no" ; then
1214 echo "SDL static link $sdl_static"
1215fi
balrog4d3b6f62008-02-10 16:33:14 +00001216echo "curses support $curses"
bellard67b915a2004-03-31 23:37:16 +00001217echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001218echo "Audio drivers $audio_drv_list"
1219echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001220echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001221echo "VNC TLS support $vnc_tls"
1222if test "$vnc_tls" = "yes" ; then
1223 echo " TLS CFLAGS $vnc_tls_cflags"
1224 echo " TLS LIBS $vnc_tls_libs"
1225fi
aliguori2f9606b2009-03-06 20:27:28 +00001226echo "VNC SASL support $vnc_sasl"
1227if test "$vnc_sasl" = "yes" ; then
1228 echo " SASL CFLAGS $vnc_sasl_cflags"
1229 echo " SASL LIBS $vnc_sasl_libs"
1230fi
blueswir131422552007-04-16 18:27:06 +00001231if test -n "$sparc_cpu"; then
1232 echo "Target Sparc Arch $sparc_cpu"
1233fi
bellard07f4ddb2005-04-23 17:44:28 +00001234echo "kqemu support $kqemu"
aurel322e4d9fb2008-04-08 06:01:02 +00001235echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001236echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001237[ ! -z "$uname_release" ] && \
1238echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001239echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001240echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001241echo "AIO support $aio"
ths77755342008-11-27 15:45:16 +00001242echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001243echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001244echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00001245echo "preadv support $preadv"
bellard67b915a2004-03-31 23:37:16 +00001246
bellard97a847b2003-08-10 21:36:04 +00001247if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001248echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001249fi
malcd4742de2008-11-29 22:04:31 +00001250if [ -s $TMPSDLLOG ]; then
ths20b40c62007-07-11 23:39:45 +00001251 echo "The error log from compiling the libSDL test is: "
malcd4742de2008-11-29 22:04:31 +00001252 cat $TMPSDLLOG
ths20b40c62007-07-11 23:39:45 +00001253fi
bellard24b55b92005-03-01 22:30:41 +00001254#if test "$sdl_static" = "no"; then
1255# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1256#fi
bellard97a847b2003-08-10 21:36:04 +00001257config_mak="config-host.mak"
1258config_h="config-host.h"
1259
bellard7c1f25b2004-04-22 00:02:08 +00001260#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001261
ths15d9ca02007-07-31 23:07:32 +00001262test -f $config_h && mv $config_h ${config_h}~
1263
bellard97a847b2003-08-10 21:36:04 +00001264echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001265printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001266printf " '%s'" "$0" "$@" >> $config_mak
1267echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001268echo "/* Automatically generated by configure - do not modify */" > $config_h
1269
1270echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001271echo "bindir=\${prefix}$binsuffix" >> $config_mak
1272echo "mandir=\${prefix}$mansuffix" >> $config_mak
1273echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001274echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001275echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001276echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001277echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001278echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001279echo "HOST_CC=$host_cc" >> $config_mak
1280echo "AR=$ar" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001281# XXX: only use CFLAGS and LDFLAGS ?
1282# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1283# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001284echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001285echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1286echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1287echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001288echo "CFLAGS=$CFLAGS" >> $config_mak
1289echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001290echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +00001291echo "AIOLIBS=$AIOLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001292case "$cpu" in
1293 i386)
1294 echo "ARCH=i386" >> $config_mak
1295 echo "#define HOST_I386 1" >> $config_h
1296 ;;
1297 x86_64)
1298 echo "ARCH=x86_64" >> $config_mak
1299 echo "#define HOST_X86_64 1" >> $config_h
1300 ;;
1301 alpha)
1302 echo "ARCH=alpha" >> $config_mak
1303 echo "#define HOST_ALPHA 1" >> $config_h
1304 ;;
1305 armv4b)
1306 echo "ARCH=arm" >> $config_mak
1307 echo "#define HOST_ARM 1" >> $config_h
1308 ;;
1309 armv4l)
1310 echo "ARCH=arm" >> $config_mak
1311 echo "#define HOST_ARM 1" >> $config_h
1312 ;;
1313 cris)
1314 echo "ARCH=cris" >> $config_mak
1315 echo "#define HOST_CRIS 1" >> $config_h
1316 ;;
1317 hppa)
1318 echo "ARCH=hppa" >> $config_mak
1319 echo "#define HOST_HPPA 1" >> $config_h
1320 ;;
1321 ia64)
1322 echo "ARCH=ia64" >> $config_mak
1323 echo "#define HOST_IA64 1" >> $config_h
1324 ;;
1325 m68k)
1326 echo "ARCH=m68k" >> $config_mak
1327 echo "#define HOST_M68K 1" >> $config_h
1328 ;;
1329 mips)
1330 echo "ARCH=mips" >> $config_mak
1331 echo "#define HOST_MIPS 1" >> $config_h
1332 ;;
1333 mips64)
1334 echo "ARCH=mips64" >> $config_mak
1335 echo "#define HOST_MIPS64 1" >> $config_h
1336 ;;
malcfdf7ed92009-01-14 18:39:52 +00001337 ppc)
1338 echo "ARCH=ppc" >> $config_mak
1339 echo "#define HOST_PPC 1" >> $config_h
1340 ;;
1341 ppc64)
1342 echo "ARCH=ppc64" >> $config_mak
1343 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001344 ;;
1345 s390)
1346 echo "ARCH=s390" >> $config_mak
1347 echo "#define HOST_S390 1" >> $config_h
1348 ;;
1349 sparc)
1350 echo "ARCH=sparc" >> $config_mak
1351 echo "#define HOST_SPARC 1" >> $config_h
1352 ;;
1353 sparc64)
1354 echo "ARCH=sparc64" >> $config_mak
1355 echo "#define HOST_SPARC64 1" >> $config_h
1356 ;;
1357 *)
1358 echo "Unsupported CPU = $cpu"
1359 exit 1
1360 ;;
1361esac
aliguori03b4fe72008-10-07 19:16:17 +00001362if test "$sparse" = "yes" ; then
1363 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1364 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1365 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1366fi
aliguori1625af82009-04-05 17:41:02 +00001367if test "$strip_opt" = "yes" ; then
1368 echo "STRIP_OPT=-s" >> $config_mak
1369fi
bellard7d132992003-03-06 23:23:54 +00001370if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001371 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1372 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1373fi
bellardb6853692005-06-05 17:10:39 +00001374echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001375if test "$mingw32" = "yes" ; then
1376 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001377 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001378else
1379 cat > $TMPC << EOF
1380#include <byteswap.h>
1381int main(void) { return bswap_32(0); }
1382EOF
aurel32178baee2008-12-08 18:11:57 +00001383 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001384 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1385 fi
blueswir113606772008-12-05 17:54:09 +00001386 cat > $TMPC << EOF
1387#include <sys/endian.h>
1388#include <sys/types.h>
1389#include <machine/bswap.h>
1390int main(void) { return bswap32(0); }
1391EOF
aurel32178baee2008-12-08 18:11:57 +00001392 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001393 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1394 fi
bellard67b915a2004-03-31 23:37:16 +00001395fi
blueswir1128ab2f2008-08-15 18:33:42 +00001396
1397if [ "$openbsd" = "yes" ] ; then
1398 echo "#define ENOTSUP 4096" >> $config_h
1399fi
1400
bellard83fb7ad2004-07-05 21:25:26 +00001401if test "$darwin" = "yes" ; then
1402 echo "CONFIG_DARWIN=yes" >> $config_mak
1403 echo "#define CONFIG_DARWIN 1" >> $config_h
1404fi
malcb29fe3e2008-11-18 01:42:22 +00001405
1406if test "$aix" = "yes" ; then
1407 echo "CONFIG_AIX=yes" >> $config_mak
1408 echo "#define CONFIG_AIX 1" >> $config_h
1409fi
1410
bellardec530c82006-04-25 22:36:06 +00001411if test "$solaris" = "yes" ; then
1412 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001413 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001414 if test "$needs_libsunmath" = "yes" ; then
1415 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1416 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1417 fi
bellardec530c82006-04-25 22:36:06 +00001418fi
blueswir131422552007-04-16 18:27:06 +00001419if test -n "$sparc_cpu"; then
1420 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1421 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1422fi
bellard67b915a2004-03-31 23:37:16 +00001423if test "$gdbstub" = "yes" ; then
1424 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1425 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1426fi
bellard97a847b2003-08-10 21:36:04 +00001427if test "$gprof" = "yes" ; then
1428 echo "TARGET_GPROF=yes" >> $config_mak
1429 echo "#define HAVE_GPROF 1" >> $config_h
1430fi
1431if test "$static" = "yes" ; then
1432 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001433 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001434fi
bellard05c2a3e2006-02-08 22:39:17 +00001435if test $profiler = "yes" ; then
1436 echo "#define CONFIG_PROFILER 1" >> $config_h
1437fi
bellardc20709a2004-04-21 23:27:19 +00001438if test "$slirp" = "yes" ; then
1439 echo "CONFIG_SLIRP=yes" >> $config_mak
1440 echo "#define CONFIG_SLIRP 1" >> $config_h
1441fi
ths8a16d272008-07-19 09:56:24 +00001442if test "$vde" = "yes" ; then
1443 echo "CONFIG_VDE=yes" >> $config_mak
1444 echo "#define CONFIG_VDE 1" >> $config_h
1445 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1446fi
malc0c58ac12008-06-25 21:04:05 +00001447for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001448 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001449 echo "$def=yes" >> $config_mak
1450 echo "#define $def 1" >> $config_h
1451done
1452echo "#define AUDIO_DRIVERS \\" >> $config_h
1453for drv in $audio_drv_list; do
1454 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001455 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001456 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001457 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001458 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1459 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001460 elif test "$drv" = "oss"; then
1461 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001462 fi
1463done
1464echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001465if test "$mixemu" = "yes" ; then
1466 echo "CONFIG_MIXEMU=yes" >> $config_mak
1467 echo "#define CONFIG_MIXEMU 1" >> $config_h
1468fi
ths8d5d2d42007-08-25 01:37:51 +00001469if test "$vnc_tls" = "yes" ; then
1470 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1471 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1472 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1473 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1474fi
aliguori2f9606b2009-03-06 20:27:28 +00001475if test "$vnc_sasl" = "yes" ; then
1476 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1477 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1478 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1479 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1480fi
aliguori76655d62009-03-06 20:27:37 +00001481if test "$fnmatch" = "yes" ; then
1482 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1483fi
pbrookb1a550a2006-04-16 13:28:56 +00001484qemu_version=`head $source_path/VERSION`
1485echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001486echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001487
pbrook4a19f1e2009-04-07 23:17:49 +00001488echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1489
bellard97a847b2003-08-10 21:36:04 +00001490echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001491if [ "$source_path_used" = "yes" ]; then
1492 echo "VPATH=$source_path" >> $config_mak
1493fi
bellard97a847b2003-08-10 21:36:04 +00001494echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001495if [ "$build_docs" = "yes" ] ; then
1496 echo "BUILD_DOCS=yes" >> $config_mak
1497fi
bellard49ecc3f2007-11-07 19:25:15 +00001498if test "$static" = "yes"; then
1499 sdl1=$sdl_static
1500else
1501 sdl1=$sdl
1502fi
1503if test "$sdl1" = "yes" ; then
1504 echo "#define CONFIG_SDL 1" >> $config_h
1505 echo "CONFIG_SDL=yes" >> $config_mak
1506 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1507 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001508 elif test "$sdl_x11" = "yes" ; then
1509 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001510 else
1511 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1512 fi
1513 if [ "${aa}" = "yes" ] ; then
1514 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1515 else
1516 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1517 fi
1518fi
1519if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001520 echo "#define CONFIG_COCOA 1" >> $config_h
1521 echo "CONFIG_COCOA=yes" >> $config_mak
1522fi
1523if test "$curses" = "yes" ; then
1524 echo "#define CONFIG_CURSES 1" >> $config_h
1525 echo "CONFIG_CURSES=yes" >> $config_mak
1526 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001527fi
aurel322e4d9fb2008-04-08 06:01:02 +00001528if test "$brlapi" = "yes" ; then
1529 echo "CONFIG_BRLAPI=yes" >> $config_mak
1530 echo "#define CONFIG_BRLAPI 1" >> $config_h
1531 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1532fi
balrogfb599c92008-09-28 23:49:55 +00001533if test "$bluez" = "yes" ; then
1534 echo "CONFIG_BLUEZ=yes" >> $config_mak
1535 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1536 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1537 echo "#define CONFIG_BLUEZ 1" >> $config_h
1538fi
blueswir1414f0da2008-08-15 18:20:52 +00001539if test "$aio" = "yes" ; then
1540 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001541 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001542fi
ths77755342008-11-27 15:45:16 +00001543if test "$blobs" = "yes" ; then
1544 echo "INSTALL_BLOBS=yes" >> $config_mak
1545fi
aliguoribf9298b2008-12-05 20:05:26 +00001546if test "$iovec" = "yes" ; then
1547 echo "#define HAVE_IOVEC 1" >> $config_h
1548fi
aliguoriceb42de2009-04-07 18:43:28 +00001549if test "$preadv" = "yes" ; then
1550 echo "#define HAVE_PREADV 1" >> $config_h
1551fi
aurel32f652e6a2008-12-16 10:43:48 +00001552if test "$fdt" = "yes" ; then
1553 echo "#define HAVE_FDT 1" >> $config_h
1554 echo "FDT_LIBS=-lfdt" >> $config_mak
1555fi
bellard97a847b2003-08-10 21:36:04 +00001556
bellard83fb7ad2004-07-05 21:25:26 +00001557# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001558if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001559 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001560 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
blueswir1179a2c12009-03-08 08:23:32 +00001561 echo "#define HOST_BSD 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001562fi
1563
pbrookc5937222006-05-14 11:30:38 +00001564echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1565
blueswir168063642008-11-22 21:03:55 +00001566# USB host support
1567case "$usb" in
1568linux)
1569 echo "HOST_USB=linux" >> $config_mak
1570;;
1571bsd)
1572 echo "HOST_USB=bsd" >> $config_mak
1573;;
1574*)
1575 echo "HOST_USB=stub" >> $config_mak
1576;;
1577esac
1578
pbrookc39e3332007-09-22 16:49:14 +00001579tools=
1580if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001581 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001582 if [ "$linux" = "yes" ] ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001583 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001584 fi
pbrookc39e3332007-09-22 16:49:14 +00001585fi
1586echo "TOOLS=$tools" >> $config_mak
1587
ths15d9ca02007-07-31 23:07:32 +00001588test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1589
bellard1d14ffa2005-10-30 18:58:22 +00001590for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001591target_dir="$target"
1592config_mak=$target_dir/config.mak
1593config_h=$target_dir/config.h
1594target_cpu=`echo $target | cut -d '-' -f 1`
1595target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001596[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001597[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1598[ "$target_cpu" = "mips" ] && target_bigendian=yes
1599[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1600[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001601[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001602[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001603[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001604[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001605[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001606[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1607[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1608[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001609target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001610target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001611target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001612target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001613target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001614case "$target" in
1615 ${target_cpu}-softmmu)
1616 target_softmmu="yes"
1617 ;;
1618 ${target_cpu}-linux-user)
1619 target_user_only="yes"
1620 target_linux_user="yes"
1621 ;;
1622 ${target_cpu}-darwin-user)
1623 target_user_only="yes"
1624 target_darwin_user="yes"
1625 ;;
blueswir184778502008-10-26 20:33:16 +00001626 ${target_cpu}-bsd-user)
1627 target_user_only="yes"
1628 target_bsd_user="yes"
1629 ;;
pbrook9e407a82007-05-26 16:38:53 +00001630 *)
1631 echo "ERROR: Target '$target' not recognised"
1632 exit 1
1633 ;;
1634esac
ths831b7822007-01-18 20:06:33 +00001635
bellard97ccc682005-07-02 13:32:17 +00001636if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +00001637 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +00001638 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +00001639 echo "To build QEMU without graphical output configure with --disable-gfx-check"
balrog4d3b6f62008-02-10 16:33:14 +00001640 echo "Note that this will disable all output from the virtual graphics card"
1641 echo "except through VNC or curses."
bellard97ccc682005-07-02 13:32:17 +00001642 exit 1;
1643fi
1644
bellard7c1f25b2004-04-22 00:02:08 +00001645#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001646
ths15d9ca02007-07-31 23:07:32 +00001647test -f $config_h && mv $config_h ${config_h}~
1648
bellard97a847b2003-08-10 21:36:04 +00001649mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001650mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001651mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001652if 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 +00001653 mkdir -p $target_dir/nwfpe
1654fi
1655
bellardec530c82006-04-25 22:36:06 +00001656#
1657# don't use ln -sf as not all "ln -sf" over write the file/link
1658#
1659rm -f $target_dir/Makefile
1660ln -s $source_path/Makefile.target $target_dir/Makefile
1661
bellard97a847b2003-08-10 21:36:04 +00001662
1663echo "# Automatically generated by configure - do not modify" > $config_mak
1664echo "/* Automatically generated by configure - do not modify */" > $config_h
1665
1666
1667echo "include ../config-host.mak" >> $config_mak
1668echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001669
pbrooke5fe0c52006-06-11 13:32:59 +00001670bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001671elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001672target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001673interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1674echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001675gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001676
aliguori5985ece2008-11-05 19:59:25 +00001677# Make sure the target and host cpus are compatible
1678if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
malcfdf7ed92009-01-14 18:39:52 +00001679 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001680 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1681 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001682 kvm="no"
1683fi
1684# Disable KVM for linux-user
1685if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1686 kvm="no"
1687fi
1688
aurel322408a522008-04-20 20:19:44 +00001689case "$target_cpu" in
1690 i386)
1691 echo "TARGET_ARCH=i386" >> $config_mak
1692 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1693 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001694 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001695 then
1696 echo "#define USE_KQEMU 1" >> $config_h
1697 fi
aliguori7ba1e612008-11-05 16:04:33 +00001698 if test "$kvm" = "yes" ; then
1699 echo "CONFIG_KVM=yes" >> $config_mak
1700 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001701 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001702 fi
aurel322408a522008-04-20 20:19:44 +00001703 ;;
1704 x86_64)
1705 echo "TARGET_ARCH=x86_64" >> $config_mak
1706 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1707 echo "#define TARGET_I386 1" >> $config_h
1708 echo "#define TARGET_X86_64 1" >> $config_h
1709 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1710 then
1711 echo "#define USE_KQEMU 1" >> $config_h
1712 fi
aliguori7ba1e612008-11-05 16:04:33 +00001713 if test "$kvm" = "yes" ; then
1714 echo "CONFIG_KVM=yes" >> $config_mak
1715 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1716 echo "#define CONFIG_KVM 1" >> $config_h
1717 fi
aurel322408a522008-04-20 20:19:44 +00001718 ;;
1719 alpha)
1720 echo "TARGET_ARCH=alpha" >> $config_mak
1721 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1722 echo "#define TARGET_ALPHA 1" >> $config_h
1723 ;;
1724 arm|armeb)
1725 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001726 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1727 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001728 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001729 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001730 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00001731 ;;
1732 cris)
1733 echo "TARGET_ARCH=cris" >> $config_mak
1734 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1735 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00001736 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001737 ;;
1738 m68k)
1739 echo "TARGET_ARCH=m68k" >> $config_mak
1740 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1741 echo "#define TARGET_M68K 1" >> $config_h
1742 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001743 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00001744 ;;
1745 mips|mipsel)
1746 echo "TARGET_ARCH=mips" >> $config_mak
1747 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1748 echo "#define TARGET_MIPS 1" >> $config_h
1749 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1750 ;;
1751 mipsn32|mipsn32el)
1752 echo "TARGET_ARCH=mipsn32" >> $config_mak
1753 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1754 echo "#define TARGET_MIPS 1" >> $config_h
1755 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1756 ;;
1757 mips64|mips64el)
1758 echo "TARGET_ARCH=mips64" >> $config_mak
1759 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1760 echo "#define TARGET_MIPS 1" >> $config_h
1761 echo "#define TARGET_MIPS64 1" >> $config_h
1762 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1763 ;;
1764 ppc)
1765 echo "TARGET_ARCH=ppc" >> $config_mak
1766 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1767 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001768 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001769 ;;
1770 ppcemb)
1771 echo "TARGET_ARCH=ppcemb" >> $config_mak
1772 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1773 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1774 echo "#define TARGET_PPC 1" >> $config_h
1775 echo "#define TARGET_PPCEMB 1" >> $config_h
aurel32d76d1652008-12-16 10:43:58 +00001776 if test "$kvm" = "yes" ; then
1777 echo "CONFIG_KVM=yes" >> $config_mak
1778 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1779 echo "#define CONFIG_KVM 1" >> $config_h
1780 fi
aurel32c8b35322009-01-24 15:07:34 +00001781 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001782 ;;
1783 ppc64)
1784 echo "TARGET_ARCH=ppc64" >> $config_mak
1785 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1786 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1787 echo "#define TARGET_PPC 1" >> $config_h
1788 echo "#define TARGET_PPC64 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001789 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001790 ;;
1791 ppc64abi32)
1792 echo "TARGET_ARCH=ppc64" >> $config_mak
1793 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1794 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1795 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1796 echo "#define TARGET_PPC 1" >> $config_h
1797 echo "#define TARGET_PPC64 1" >> $config_h
1798 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001799 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001800 ;;
1801 sh4|sh4eb)
1802 echo "TARGET_ARCH=sh4" >> $config_mak
1803 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1804 echo "#define TARGET_SH4 1" >> $config_h
1805 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001806 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001807 ;;
1808 sparc)
1809 echo "TARGET_ARCH=sparc" >> $config_mak
1810 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1811 echo "#define TARGET_SPARC 1" >> $config_h
1812 ;;
1813 sparc64)
1814 echo "TARGET_ARCH=sparc64" >> $config_mak
1815 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1816 echo "#define TARGET_SPARC 1" >> $config_h
1817 echo "#define TARGET_SPARC64 1" >> $config_h
1818 elfload32="yes"
1819 ;;
1820 sparc32plus)
1821 echo "TARGET_ARCH=sparc64" >> $config_mak
1822 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1823 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1824 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1825 echo "#define TARGET_SPARC 1" >> $config_h
1826 echo "#define TARGET_SPARC64 1" >> $config_h
1827 echo "#define TARGET_ABI32 1" >> $config_h
1828 ;;
1829 *)
1830 echo "Unsupported target CPU"
1831 exit 1
1832 ;;
1833esac
bellardde83cd02003-06-15 20:25:43 +00001834if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001835 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1836 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1837fi
1838if test "$target_softmmu" = "yes" ; then
1839 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1840 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00001841fi
bellard997344f2003-10-27 21:10:39 +00001842if test "$target_user_only" = "yes" ; then
1843 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1844 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1845fi
ths831b7822007-01-18 20:06:33 +00001846if test "$target_linux_user" = "yes" ; then
1847 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1848 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1849fi
1850if test "$target_darwin_user" = "yes" ; then
1851 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1852 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1853fi
pbrook56aebc82008-10-11 17:55:29 +00001854list=""
1855if test ! -z "$gdb_xml_files" ; then
1856 for x in $gdb_xml_files; do
1857 list="$list $source_path/gdb-xml/$x"
1858 done
1859fi
1860echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00001861
aurel320938cda2008-04-11 21:36:06 +00001862if test "$target_cpu" = "arm" \
1863 -o "$target_cpu" = "armeb" \
1864 -o "$target_cpu" = "m68k" \
1865 -o "$target_cpu" = "mips" \
1866 -o "$target_cpu" = "mipsel" \
1867 -o "$target_cpu" = "mipsn32" \
1868 -o "$target_cpu" = "mipsn32el" \
1869 -o "$target_cpu" = "mips64" \
1870 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00001871 -o "$target_cpu" = "ppc" \
1872 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00001873 -o "$target_cpu" = "ppc64abi32" \
1874 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00001875 -o "$target_cpu" = "sparc" \
1876 -o "$target_cpu" = "sparc64" \
1877 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00001878 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1879 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1880fi
pbrooke5fe0c52006-06-11 13:32:59 +00001881if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1882 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1883 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1884fi
pbrookbd0c5662008-05-29 14:34:11 +00001885if test "$target_user_only" = "yes" \
1886 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1887 echo "#define USE_NPTL 1" >> $config_h
1888fi
blueswir1cb33da52007-10-09 16:34:29 +00001889# 32 bit ELF loader in addition to native 64 bit loader?
1890if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1891 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1892 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1893fi
blueswir184778502008-10-26 20:33:16 +00001894if test "$target_bsd_user" = "yes" ; then
1895 echo "CONFIG_BSD_USER=yes" >> $config_mak
1896 echo "#define CONFIG_BSD_USER 1" >> $config_h
1897fi
bellard5b0753e2005-03-01 21:37:28 +00001898
ths15d9ca02007-07-31 23:07:32 +00001899test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1900
bellard97a847b2003-08-10 21:36:04 +00001901done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00001902
1903# build tree in object directory if source path is different from current one
1904if test "$source_path_used" = "yes" ; then
bellard49ecc3f2007-11-07 19:25:15 +00001905 DIRS="tests tests/cris slirp audio"
bellard7d132992003-03-06 23:23:54 +00001906 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00001907 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00001908 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00001909 for dir in $DIRS ; do
1910 mkdir -p $dir
1911 done
bellardec530c82006-04-25 22:36:06 +00001912 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00001913 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00001914 rm -f $f
1915 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00001916 done
1917fi