blob: 0ea24c20b3131aab0a3384eb48a9c3a666893630 [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}\
696sparc64-bsd-user \
697"
698 fi
bellard6e20a452005-06-05 15:56:02 +0000699else
pbrookb1a550a2006-04-16 13:28:56 +0000700 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000701fi
pbrook0a8e90f2006-03-19 14:54:16 +0000702if test -z "$target_list" ; then
703 echo "No targets enabled"
704 exit 1
705fi
bellard5327cf42005-01-10 23:18:50 +0000706
bellard7d132992003-03-06 23:23:54 +0000707if test -z "$cross_prefix" ; then
708
709# ---
710# big/little endian test
711cat > $TMPC << EOF
712#include <inttypes.h>
713int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000714 volatile uint32_t i=0x01234567;
715 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000716}
717EOF
718
aurel32178baee2008-12-08 18:11:57 +0000719if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000720$TMPE && bigendian="yes"
721else
722echo big/little test failed
723fi
724
725else
726
727# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000728if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000729 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000730 -o "$cpu" = "m68k" \
731 -o "$cpu" = "mips" \
732 -o "$cpu" = "mips64" \
malcfdf7ed92009-01-14 18:39:52 +0000733 -o "$cpu" = "ppc" \
734 -o "$cpu" = "ppc64" \
aurel320938cda2008-04-11 21:36:06 +0000735 -o "$cpu" = "s390" \
736 -o "$cpu" = "sparc" \
737 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000738 bigendian="yes"
739fi
740
741fi
742
bellardb6853692005-06-05 17:10:39 +0000743# host long bits test
744hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000745if test "$cpu" = "x86_64" \
746 -o "$cpu" = "alpha" \
747 -o "$cpu" = "ia64" \
malcfdf7ed92009-01-14 18:39:52 +0000748 -o "$cpu" = "sparc64" \
749 -o "$cpu" = "ppc64"; then
bellardb6853692005-06-05 17:10:39 +0000750 hostlongbits="64"
751fi
752
pbrookbd0c5662008-05-29 14:34:11 +0000753# Check host NPTL support
754cat > $TMPC <<EOF
755#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000756#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000757void foo()
758{
759#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
760#error bork
761#endif
762}
763EOF
764
balrog8c7f7572008-12-15 03:15:36 +0000765if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000766 :
767else
768 nptl="no"
769fi
770
bellard11d9f692004-04-02 20:55:59 +0000771##########################################
balrogac629222008-10-11 09:56:04 +0000772# zlib check
773
774cat > $TMPC << EOF
775#include <zlib.h>
776int main(void) { zlibVersion(); return 0; }
777EOF
balrog8c7f7572008-12-15 03:15:36 +0000778if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000779 :
780else
781 echo
782 echo "Error: zlib check failed"
783 echo "Make sure to have the zlib libs and headers installed."
784 echo
785 exit 1
786fi
787
788##########################################
bellard11d9f692004-04-02 20:55:59 +0000789# SDL probe
790
791sdl_too_old=no
792
793if test -z "$sdl" ; then
ths069b0bd2007-07-12 00:27:15 +0000794 sdl_config="sdl-config"
795 sdl=no
796 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000797
798cat > $TMPC << EOF
799#include <SDL.h>
800#undef main /* We don't want SDL to override our main() */
801int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
802EOF
balrog8c7f7572008-12-15 03:15:36 +0000803 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 +0000804 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
805 if test "$_sdlversion" -lt 121 ; then
806 sdl_too_old=yes
807 else
808 if test "$cocoa" = "no" ; then
809 sdl=yes
810 fi
811 fi
812
813 # static link with sdl ?
814 if test "$sdl" = "yes" ; then
815 aa="no"
816 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
817 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
818 if [ "$aa" = "yes" ] ; then
819 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000820 fi
bellard11d9f692004-04-02 20:55:59 +0000821
balrog8c7f7572008-12-15 03:15:36 +0000822 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 +0000823 sdl_static=yes
824 fi
825 fi # static link
826 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000827else
ths069b0bd2007-07-12 00:27:15 +0000828 # Make sure to disable cocoa if sdl was set
829 if test "$sdl" = "yes" ; then
830 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000831 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000832 fi
bellarda6e022a2004-04-02 21:55:47 +0000833fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000834
aliguori5368a422009-03-03 17:37:21 +0000835if test "$sdl" = "yes" ; then
836cat > $TMPC <<EOF
837#include <SDL.h>
838#if defined(SDL_VIDEO_DRIVER_X11)
839#include <X11/XKBlib.h>
840#else
841#error No x11 support
842#endif
843int main(void) { return 0; }
844EOF
845 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
846 sdl_x11="yes"
847 fi
848fi
849
ths8f28f3f2007-01-05 21:25:54 +0000850##########################################
ths8d5d2d42007-08-25 01:37:51 +0000851# VNC TLS detection
852if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000853cat > $TMPC <<EOF
854#include <gnutls/gnutls.h>
855int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
856EOF
857 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
858 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
859 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000860 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000861 :
862 else
863 vnc_tls="no"
864 fi
ths8d5d2d42007-08-25 01:37:51 +0000865fi
866
867##########################################
aliguori2f9606b2009-03-06 20:27:28 +0000868# VNC SASL detection
869if test "$vnc_sasl" = "yes" ; then
870cat > $TMPC <<EOF
871#include <sasl/sasl.h>
872#include <stdio.h>
873int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
874EOF
875 # Assuming Cyrus-SASL installed in /usr prefix
876 vnc_sasl_cflags=""
877 vnc_sasl_libs="-lsasl2"
878 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
879 $vnc_sasl_libs 2> /dev/null ; then
880 :
881 else
882 vnc_sasl="no"
883 fi
884fi
885
886##########################################
aliguori76655d62009-03-06 20:27:37 +0000887# fnmatch() probe, used for ACL routines
888fnmatch="no"
889cat > $TMPC << EOF
890#include <fnmatch.h>
891int main(void)
892{
893 fnmatch("foo", "foo", 0);
894 return 0;
895}
896EOF
897if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
898 fnmatch="yes"
899fi
900
901##########################################
ths8a16d272008-07-19 09:56:24 +0000902# vde libraries probe
903if test "$vde" = "yes" ; then
904 cat > $TMPC << EOF
905#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000906int main(void)
907{
908 struct vde_open_args a = {0, 0, 0};
909 vde_open("", "", &a);
910 return 0;
911}
ths8a16d272008-07-19 09:56:24 +0000912EOF
balrog8c7f7572008-12-15 03:15:36 +0000913 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000914 :
915 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000916 vde="no"
ths8a16d272008-07-19 09:56:24 +0000917 fi
918fi
919
920##########################################
malcc2de5c92008-06-28 19:13:06 +0000921# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000922
malcc2de5c92008-06-28 19:13:06 +0000923audio_drv_probe()
924{
925 drv=$1
926 hdr=$2
927 lib=$3
928 exp=$4
929 cfl=$5
930 cat > $TMPC << EOF
931#include <$hdr>
932int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000933EOF
balrog8c7f7572008-12-15 03:15:36 +0000934 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +0000935 :
936 else
937 echo
938 echo "Error: $drv check failed"
939 echo "Make sure to have the $drv libs and headers installed."
940 echo
941 exit 1
942 fi
943}
944
malc2fa7d3b2008-07-29 12:58:44 +0000945audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000946for drv in $audio_drv_list; do
947 case $drv in
948 alsa)
949 audio_drv_probe $drv alsa/asoundlib.h -lasound \
950 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
951 ;;
952
953 fmod)
954 if test -z $fmod_lib || test -z $fmod_inc; then
955 echo
956 echo "Error: You must specify path to FMOD library and headers"
957 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
958 echo
959 exit 1
960 fi
961 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
962 ;;
963
964 esd)
965 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
966 ;;
malcb8e59f12008-07-02 21:03:08 +0000967
968 pa)
969 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
970 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
971 ;;
972
blueswir12f6a1ab2008-08-21 18:00:53 +0000973 oss|sdl|core|wav|dsound)
974 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
975 ;;
976
malce4c63a62008-07-19 16:15:16 +0000977 *)
malc1c9b2a52008-07-19 16:57:30 +0000978 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +0000979 echo
980 echo "Error: Unknown driver '$drv' selected"
981 echo "Possible drivers are: $audio_possible_drivers"
982 echo
983 exit 1
984 }
985 ;;
malcc2de5c92008-06-28 19:13:06 +0000986 esac
987done
ths8f28f3f2007-01-05 21:25:54 +0000988
balrog4d3b6f62008-02-10 16:33:14 +0000989##########################################
aurel322e4d9fb2008-04-08 06:01:02 +0000990# BrlAPI probe
991
992if test -z "$brlapi" ; then
993 brlapi=no
994cat > $TMPC << EOF
995#include <brlapi.h>
996int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
997EOF
aurel32178baee2008-12-08 18:11:57 +0000998 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +0000999 brlapi=yes
1000 fi # brlapi compile test
1001fi # -z $brlapi
1002
1003##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001004# curses probe
1005
1006if test "$curses" = "yes" ; then
1007 curses=no
1008 cat > $TMPC << EOF
1009#include <curses.h>
1010int main(void) { return curses_version(); }
1011EOF
aurel32178baee2008-12-08 18:11:57 +00001012 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +00001013 curses=yes
1014 fi
1015fi # test "$curses"
1016
blueswir1414f0da2008-08-15 18:20:52 +00001017##########################################
balrogfb599c92008-09-28 23:49:55 +00001018# bluez support probe
1019if test "$bluez" = "yes" ; then
1020 `pkg-config bluez` || bluez="no"
1021fi
1022if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +00001023 cat > $TMPC << EOF
1024#include <bluetooth/bluetooth.h>
1025int main(void) { return bt_error(0); }
1026EOF
balrogfb599c92008-09-28 23:49:55 +00001027 bluez_cflags=`pkg-config --cflags bluez`
1028 bluez_libs=`pkg-config --libs bluez`
balrog17e15922008-10-11 12:00:42 +00001029 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001030 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +00001031 :
1032 else
1033 bluez="no"
1034 fi
balrogfb599c92008-09-28 23:49:55 +00001035fi
1036
1037##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001038# kvm probe
1039if test "$kvm" = "yes" ; then
1040 cat > $TMPC <<EOF
1041#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001042#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001043#error Invalid KVM version
1044#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001045#if !defined(KVM_CAP_USER_MEMORY)
1046#error Missing KVM capability KVM_CAP_USER_MEMORY
1047#endif
1048#if !defined(KVM_CAP_SET_TSS_ADDR)
1049#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1050#endif
1051#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1052#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1053#endif
aliguori7ba1e612008-11-05 16:04:33 +00001054int main(void) { return 0; }
1055EOF
aliguorieac30262008-11-05 16:28:56 +00001056 if test "$kerneldir" != "" ; then
1057 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001058 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1059 -a -d "$kerneldir/arch/x86/include" ; then
1060 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001061 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1062 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
aliguori8444eb62009-01-09 20:05:10 +00001063 elif test -d "$kerneldir/arch/$cpu/include" ; then
1064 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1065 fi
aliguorieac30262008-11-05 16:28:56 +00001066 else
1067 kvm_cflags=""
1068 fi
aliguori7ba1e612008-11-05 16:04:33 +00001069 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +00001070 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +00001071 :
1072 else
aliguori9fd8d8d2009-01-15 21:57:30 +00001073 kvm="no";
1074 if [ -x "`which awk 2>/dev/null`" ] && \
1075 [ -x "`which grep 2>/dev/null`" ]; then
blueswir1e4f51002009-03-09 17:36:50 +00001076 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001077 | grep "error: " \
1078 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1079 if test "$kvmerr" != "" ; then
1080 kvm="no - (${kvmerr})"
1081 fi
1082 fi
aliguori7ba1e612008-11-05 16:04:33 +00001083 fi
1084fi
1085
1086##########################################
blueswir1414f0da2008-08-15 18:20:52 +00001087# AIO probe
aliguori3c529d92008-12-12 16:41:40 +00001088AIOLIBS=""
1089
blueswir1414f0da2008-08-15 18:20:52 +00001090if test "$aio" = "yes" ; then
1091 aio=no
1092 cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001093#include <pthread.h>
blueswir1c9db92f2009-01-17 06:49:15 +00001094int main(void) { pthread_mutex_t lock; return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001095EOF
1096 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1097 aio=yes
aliguori3c529d92008-12-12 16:41:40 +00001098 AIOLIBS="-lpthread"
blueswir1414f0da2008-08-15 18:20:52 +00001099 fi
1100fi
1101
aliguoribf9298b2008-12-05 20:05:26 +00001102##########################################
1103# iovec probe
1104cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001105#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001106#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001107#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001108int main(void) { struct iovec iov; return 0; }
1109EOF
1110iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001111if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001112 iovec=yes
1113fi
1114
aurel32f652e6a2008-12-16 10:43:48 +00001115##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001116# preadv probe
1117cat > $TMPC <<EOF
1118#include <sys/types.h>
1119#include <sys/uio.h>
1120#include <unistd.h>
1121int main(void) { preadv; }
1122EOF
1123preadv=no
1124if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1125 preadv=yes
1126fi
1127
1128##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001129# fdt probe
1130if test "$fdt" = "yes" ; then
1131 fdt=no
1132 cat > $TMPC << EOF
1133int main(void) { return 0; }
1134EOF
1135 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1136 fdt=yes
1137 fi
1138fi
1139
pbrookcc8ae6d2006-04-23 17:57:59 +00001140# Check if tools are available to build documentation.
ths6c591862007-05-09 13:55:03 +00001141if [ -x "`which texi2html 2>/dev/null`" ] && \
1142 [ -x "`which pod2man 2>/dev/null`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +00001143 build_docs="yes"
1144fi
1145
aliguorida93a1f2008-12-12 20:02:52 +00001146##########################################
1147# Do we need librt
1148cat > $TMPC <<EOF
1149#include <signal.h>
1150#include <time.h>
1151int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1152EOF
1153
1154rt=no
balrog8c7f7572008-12-15 03:15:36 +00001155if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001156 :
balrog8c7f7572008-12-15 03:15:36 +00001157elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001158 rt=yes
1159fi
1160
1161if test "$rt" = "yes" ; then
1162 # Hack, we should have a general purpose LIBS for this sort of thing
1163 AIOLIBS="$AIOLIBS -lrt"
1164fi
1165
bellard11d9f692004-04-02 20:55:59 +00001166if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001167 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001168 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001169 fi
1170 mansuffix=""
1171 datasuffix=""
1172 docsuffix=""
1173 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001174else
pbrook308c3592007-02-27 00:52:01 +00001175 if test -z "$prefix" ; then
1176 prefix="/usr/local"
1177 fi
1178 mansuffix="/share/man"
1179 datasuffix="/share/qemu"
1180 docsuffix="/share/doc/qemu"
1181 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001182fi
bellard5a671352003-10-01 00:13:48 +00001183
bellard43ce4df2003-06-09 19:53:12 +00001184echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001185echo "BIOS directory $prefix$datasuffix"
1186echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001187if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001188echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001189echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001190fi
bellard5a671352003-10-01 00:13:48 +00001191echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001192echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001193echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001194echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001195echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001196echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001197echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001198echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001199echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +00001200echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001201echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00001202echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00001203echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001204echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001205echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001206if test "$darwin" = "yes" ; then
1207 echo "Cocoa support $cocoa"
1208fi
bellard97a847b2003-08-10 21:36:04 +00001209echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001210if test "$sdl" != "no" ; then
1211 echo "SDL static link $sdl_static"
1212fi
balrog4d3b6f62008-02-10 16:33:14 +00001213echo "curses support $curses"
bellard67b915a2004-03-31 23:37:16 +00001214echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001215echo "Audio drivers $audio_drv_list"
1216echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001217echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001218echo "VNC TLS support $vnc_tls"
1219if test "$vnc_tls" = "yes" ; then
1220 echo " TLS CFLAGS $vnc_tls_cflags"
1221 echo " TLS LIBS $vnc_tls_libs"
1222fi
aliguori2f9606b2009-03-06 20:27:28 +00001223echo "VNC SASL support $vnc_sasl"
1224if test "$vnc_sasl" = "yes" ; then
1225 echo " SASL CFLAGS $vnc_sasl_cflags"
1226 echo " SASL LIBS $vnc_sasl_libs"
1227fi
blueswir131422552007-04-16 18:27:06 +00001228if test -n "$sparc_cpu"; then
1229 echo "Target Sparc Arch $sparc_cpu"
1230fi
bellard07f4ddb2005-04-23 17:44:28 +00001231echo "kqemu support $kqemu"
aurel322e4d9fb2008-04-08 06:01:02 +00001232echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001233echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001234[ ! -z "$uname_release" ] && \
1235echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001236echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001237echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001238echo "AIO support $aio"
ths77755342008-11-27 15:45:16 +00001239echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001240echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001241echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00001242echo "preadv support $preadv"
bellard67b915a2004-03-31 23:37:16 +00001243
bellard97a847b2003-08-10 21:36:04 +00001244if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001245echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001246fi
malcd4742de2008-11-29 22:04:31 +00001247if [ -s $TMPSDLLOG ]; then
ths20b40c62007-07-11 23:39:45 +00001248 echo "The error log from compiling the libSDL test is: "
malcd4742de2008-11-29 22:04:31 +00001249 cat $TMPSDLLOG
ths20b40c62007-07-11 23:39:45 +00001250fi
bellard24b55b92005-03-01 22:30:41 +00001251#if test "$sdl_static" = "no"; then
1252# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1253#fi
bellard97a847b2003-08-10 21:36:04 +00001254config_mak="config-host.mak"
1255config_h="config-host.h"
1256
bellard7c1f25b2004-04-22 00:02:08 +00001257#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001258
ths15d9ca02007-07-31 23:07:32 +00001259test -f $config_h && mv $config_h ${config_h}~
1260
bellard97a847b2003-08-10 21:36:04 +00001261echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001262printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001263printf " '%s'" "$0" "$@" >> $config_mak
1264echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001265echo "/* Automatically generated by configure - do not modify */" > $config_h
1266
1267echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001268echo "bindir=\${prefix}$binsuffix" >> $config_mak
1269echo "mandir=\${prefix}$mansuffix" >> $config_mak
1270echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001271echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001272echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001273echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001274echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001275echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001276echo "HOST_CC=$host_cc" >> $config_mak
1277echo "AR=$ar" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001278# XXX: only use CFLAGS and LDFLAGS ?
1279# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1280# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001281echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001282echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1283echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1284echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001285echo "CFLAGS=$CFLAGS" >> $config_mak
1286echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001287echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +00001288echo "AIOLIBS=$AIOLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001289case "$cpu" in
1290 i386)
1291 echo "ARCH=i386" >> $config_mak
1292 echo "#define HOST_I386 1" >> $config_h
1293 ;;
1294 x86_64)
1295 echo "ARCH=x86_64" >> $config_mak
1296 echo "#define HOST_X86_64 1" >> $config_h
1297 ;;
1298 alpha)
1299 echo "ARCH=alpha" >> $config_mak
1300 echo "#define HOST_ALPHA 1" >> $config_h
1301 ;;
1302 armv4b)
1303 echo "ARCH=arm" >> $config_mak
1304 echo "#define HOST_ARM 1" >> $config_h
1305 ;;
1306 armv4l)
1307 echo "ARCH=arm" >> $config_mak
1308 echo "#define HOST_ARM 1" >> $config_h
1309 ;;
1310 cris)
1311 echo "ARCH=cris" >> $config_mak
1312 echo "#define HOST_CRIS 1" >> $config_h
1313 ;;
1314 hppa)
1315 echo "ARCH=hppa" >> $config_mak
1316 echo "#define HOST_HPPA 1" >> $config_h
1317 ;;
1318 ia64)
1319 echo "ARCH=ia64" >> $config_mak
1320 echo "#define HOST_IA64 1" >> $config_h
1321 ;;
1322 m68k)
1323 echo "ARCH=m68k" >> $config_mak
1324 echo "#define HOST_M68K 1" >> $config_h
1325 ;;
1326 mips)
1327 echo "ARCH=mips" >> $config_mak
1328 echo "#define HOST_MIPS 1" >> $config_h
1329 ;;
1330 mips64)
1331 echo "ARCH=mips64" >> $config_mak
1332 echo "#define HOST_MIPS64 1" >> $config_h
1333 ;;
malcfdf7ed92009-01-14 18:39:52 +00001334 ppc)
1335 echo "ARCH=ppc" >> $config_mak
1336 echo "#define HOST_PPC 1" >> $config_h
1337 ;;
1338 ppc64)
1339 echo "ARCH=ppc64" >> $config_mak
1340 echo "#define HOST_PPC64 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001341 ;;
1342 s390)
1343 echo "ARCH=s390" >> $config_mak
1344 echo "#define HOST_S390 1" >> $config_h
1345 ;;
1346 sparc)
1347 echo "ARCH=sparc" >> $config_mak
1348 echo "#define HOST_SPARC 1" >> $config_h
1349 ;;
1350 sparc64)
1351 echo "ARCH=sparc64" >> $config_mak
1352 echo "#define HOST_SPARC64 1" >> $config_h
1353 ;;
1354 *)
1355 echo "Unsupported CPU = $cpu"
1356 exit 1
1357 ;;
1358esac
aliguori03b4fe72008-10-07 19:16:17 +00001359if test "$sparse" = "yes" ; then
1360 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1361 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1362 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1363fi
aliguori1625af82009-04-05 17:41:02 +00001364if test "$strip_opt" = "yes" ; then
1365 echo "STRIP_OPT=-s" >> $config_mak
1366fi
bellard7d132992003-03-06 23:23:54 +00001367if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001368 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1369 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1370fi
bellardb6853692005-06-05 17:10:39 +00001371echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001372if test "$mingw32" = "yes" ; then
1373 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001374 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001375else
1376 cat > $TMPC << EOF
1377#include <byteswap.h>
1378int main(void) { return bswap_32(0); }
1379EOF
aurel32178baee2008-12-08 18:11:57 +00001380 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001381 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1382 fi
blueswir113606772008-12-05 17:54:09 +00001383 cat > $TMPC << EOF
1384#include <sys/endian.h>
1385#include <sys/types.h>
1386#include <machine/bswap.h>
1387int main(void) { return bswap32(0); }
1388EOF
aurel32178baee2008-12-08 18:11:57 +00001389 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001390 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1391 fi
bellard67b915a2004-03-31 23:37:16 +00001392fi
blueswir1128ab2f2008-08-15 18:33:42 +00001393
1394if [ "$openbsd" = "yes" ] ; then
1395 echo "#define ENOTSUP 4096" >> $config_h
1396fi
1397
bellard83fb7ad2004-07-05 21:25:26 +00001398if test "$darwin" = "yes" ; then
1399 echo "CONFIG_DARWIN=yes" >> $config_mak
1400 echo "#define CONFIG_DARWIN 1" >> $config_h
1401fi
malcb29fe3e2008-11-18 01:42:22 +00001402
1403if test "$aix" = "yes" ; then
1404 echo "CONFIG_AIX=yes" >> $config_mak
1405 echo "#define CONFIG_AIX 1" >> $config_h
1406fi
1407
bellardec530c82006-04-25 22:36:06 +00001408if test "$solaris" = "yes" ; then
1409 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001410 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001411 if test "$needs_libsunmath" = "yes" ; then
1412 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1413 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1414 fi
bellardec530c82006-04-25 22:36:06 +00001415fi
blueswir131422552007-04-16 18:27:06 +00001416if test -n "$sparc_cpu"; then
1417 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1418 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1419fi
bellard67b915a2004-03-31 23:37:16 +00001420if test "$gdbstub" = "yes" ; then
1421 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1422 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1423fi
bellard97a847b2003-08-10 21:36:04 +00001424if test "$gprof" = "yes" ; then
1425 echo "TARGET_GPROF=yes" >> $config_mak
1426 echo "#define HAVE_GPROF 1" >> $config_h
1427fi
1428if test "$static" = "yes" ; then
1429 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001430 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001431fi
bellard05c2a3e2006-02-08 22:39:17 +00001432if test $profiler = "yes" ; then
1433 echo "#define CONFIG_PROFILER 1" >> $config_h
1434fi
bellardc20709a2004-04-21 23:27:19 +00001435if test "$slirp" = "yes" ; then
1436 echo "CONFIG_SLIRP=yes" >> $config_mak
1437 echo "#define CONFIG_SLIRP 1" >> $config_h
1438fi
ths8a16d272008-07-19 09:56:24 +00001439if test "$vde" = "yes" ; then
1440 echo "CONFIG_VDE=yes" >> $config_mak
1441 echo "#define CONFIG_VDE 1" >> $config_h
1442 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1443fi
malc0c58ac12008-06-25 21:04:05 +00001444for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001445 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001446 echo "$def=yes" >> $config_mak
1447 echo "#define $def 1" >> $config_h
1448done
1449echo "#define AUDIO_DRIVERS \\" >> $config_h
1450for drv in $audio_drv_list; do
1451 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001452 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001453 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001454 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001455 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1456 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001457 elif test "$drv" = "oss"; then
1458 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001459 fi
1460done
1461echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001462if test "$mixemu" = "yes" ; then
1463 echo "CONFIG_MIXEMU=yes" >> $config_mak
1464 echo "#define CONFIG_MIXEMU 1" >> $config_h
1465fi
ths8d5d2d42007-08-25 01:37:51 +00001466if test "$vnc_tls" = "yes" ; then
1467 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1468 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1469 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1470 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1471fi
aliguori2f9606b2009-03-06 20:27:28 +00001472if test "$vnc_sasl" = "yes" ; then
1473 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1474 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1475 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1476 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1477fi
aliguori76655d62009-03-06 20:27:37 +00001478if test "$fnmatch" = "yes" ; then
1479 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1480fi
pbrookb1a550a2006-04-16 13:28:56 +00001481qemu_version=`head $source_path/VERSION`
1482echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001483echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001484
pbrook4a19f1e2009-04-07 23:17:49 +00001485echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1486
bellard97a847b2003-08-10 21:36:04 +00001487echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001488if [ "$source_path_used" = "yes" ]; then
1489 echo "VPATH=$source_path" >> $config_mak
1490fi
bellard97a847b2003-08-10 21:36:04 +00001491echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001492if [ "$build_docs" = "yes" ] ; then
1493 echo "BUILD_DOCS=yes" >> $config_mak
1494fi
bellard49ecc3f2007-11-07 19:25:15 +00001495if test "$static" = "yes"; then
1496 sdl1=$sdl_static
1497else
1498 sdl1=$sdl
1499fi
1500if test "$sdl1" = "yes" ; then
1501 echo "#define CONFIG_SDL 1" >> $config_h
1502 echo "CONFIG_SDL=yes" >> $config_mak
1503 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1504 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
aliguori5368a422009-03-03 17:37:21 +00001505 elif test "$sdl_x11" = "yes" ; then
1506 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001507 else
1508 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1509 fi
1510 if [ "${aa}" = "yes" ] ; then
1511 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1512 else
1513 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1514 fi
1515fi
1516if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001517 echo "#define CONFIG_COCOA 1" >> $config_h
1518 echo "CONFIG_COCOA=yes" >> $config_mak
1519fi
1520if test "$curses" = "yes" ; then
1521 echo "#define CONFIG_CURSES 1" >> $config_h
1522 echo "CONFIG_CURSES=yes" >> $config_mak
1523 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001524fi
aurel322e4d9fb2008-04-08 06:01:02 +00001525if test "$brlapi" = "yes" ; then
1526 echo "CONFIG_BRLAPI=yes" >> $config_mak
1527 echo "#define CONFIG_BRLAPI 1" >> $config_h
1528 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1529fi
balrogfb599c92008-09-28 23:49:55 +00001530if test "$bluez" = "yes" ; then
1531 echo "CONFIG_BLUEZ=yes" >> $config_mak
1532 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1533 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1534 echo "#define CONFIG_BLUEZ 1" >> $config_h
1535fi
blueswir1414f0da2008-08-15 18:20:52 +00001536if test "$aio" = "yes" ; then
1537 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001538 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001539fi
ths77755342008-11-27 15:45:16 +00001540if test "$blobs" = "yes" ; then
1541 echo "INSTALL_BLOBS=yes" >> $config_mak
1542fi
aliguoribf9298b2008-12-05 20:05:26 +00001543if test "$iovec" = "yes" ; then
1544 echo "#define HAVE_IOVEC 1" >> $config_h
1545fi
aliguoriceb42de2009-04-07 18:43:28 +00001546if test "$preadv" = "yes" ; then
1547 echo "#define HAVE_PREADV 1" >> $config_h
1548fi
aurel32f652e6a2008-12-16 10:43:48 +00001549if test "$fdt" = "yes" ; then
1550 echo "#define HAVE_FDT 1" >> $config_h
1551 echo "FDT_LIBS=-lfdt" >> $config_mak
1552fi
bellard97a847b2003-08-10 21:36:04 +00001553
bellard83fb7ad2004-07-05 21:25:26 +00001554# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001555if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001556 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001557 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
blueswir1179a2c12009-03-08 08:23:32 +00001558 echo "#define HOST_BSD 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001559fi
1560
pbrookc5937222006-05-14 11:30:38 +00001561echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1562
blueswir168063642008-11-22 21:03:55 +00001563# USB host support
1564case "$usb" in
1565linux)
1566 echo "HOST_USB=linux" >> $config_mak
1567;;
1568bsd)
1569 echo "HOST_USB=bsd" >> $config_mak
1570;;
1571*)
1572 echo "HOST_USB=stub" >> $config_mak
1573;;
1574esac
1575
pbrookc39e3332007-09-22 16:49:14 +00001576tools=
1577if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001578 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001579 if [ "$linux" = "yes" ] ; then
aliguori3dd1f8e2009-04-05 19:29:26 +00001580 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001581 fi
pbrookc39e3332007-09-22 16:49:14 +00001582fi
1583echo "TOOLS=$tools" >> $config_mak
1584
ths15d9ca02007-07-31 23:07:32 +00001585test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1586
bellard1d14ffa2005-10-30 18:58:22 +00001587for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001588target_dir="$target"
1589config_mak=$target_dir/config.mak
1590config_h=$target_dir/config.h
1591target_cpu=`echo $target | cut -d '-' -f 1`
1592target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001593[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001594[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1595[ "$target_cpu" = "mips" ] && target_bigendian=yes
1596[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1597[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001598[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001599[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001600[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001601[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001602[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001603[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1604[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1605[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001606target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001607target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001608target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001609target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001610target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001611case "$target" in
1612 ${target_cpu}-softmmu)
1613 target_softmmu="yes"
1614 ;;
1615 ${target_cpu}-linux-user)
1616 target_user_only="yes"
1617 target_linux_user="yes"
1618 ;;
1619 ${target_cpu}-darwin-user)
1620 target_user_only="yes"
1621 target_darwin_user="yes"
1622 ;;
blueswir184778502008-10-26 20:33:16 +00001623 ${target_cpu}-bsd-user)
1624 target_user_only="yes"
1625 target_bsd_user="yes"
1626 ;;
pbrook9e407a82007-05-26 16:38:53 +00001627 *)
1628 echo "ERROR: Target '$target' not recognised"
1629 exit 1
1630 ;;
1631esac
ths831b7822007-01-18 20:06:33 +00001632
bellard97ccc682005-07-02 13:32:17 +00001633if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +00001634 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +00001635 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +00001636 echo "To build QEMU without graphical output configure with --disable-gfx-check"
balrog4d3b6f62008-02-10 16:33:14 +00001637 echo "Note that this will disable all output from the virtual graphics card"
1638 echo "except through VNC or curses."
bellard97ccc682005-07-02 13:32:17 +00001639 exit 1;
1640fi
1641
bellard7c1f25b2004-04-22 00:02:08 +00001642#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001643
ths15d9ca02007-07-31 23:07:32 +00001644test -f $config_h && mv $config_h ${config_h}~
1645
bellard97a847b2003-08-10 21:36:04 +00001646mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001647mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001648mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001649if 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 +00001650 mkdir -p $target_dir/nwfpe
1651fi
1652
bellardec530c82006-04-25 22:36:06 +00001653#
1654# don't use ln -sf as not all "ln -sf" over write the file/link
1655#
1656rm -f $target_dir/Makefile
1657ln -s $source_path/Makefile.target $target_dir/Makefile
1658
bellard97a847b2003-08-10 21:36:04 +00001659
1660echo "# Automatically generated by configure - do not modify" > $config_mak
1661echo "/* Automatically generated by configure - do not modify */" > $config_h
1662
1663
1664echo "include ../config-host.mak" >> $config_mak
1665echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001666
pbrooke5fe0c52006-06-11 13:32:59 +00001667bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001668elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001669target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001670interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1671echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001672gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001673
aliguori5985ece2008-11-05 19:59:25 +00001674# Make sure the target and host cpus are compatible
1675if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
malcfdf7ed92009-01-14 18:39:52 +00001676 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001677 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1678 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001679 kvm="no"
1680fi
1681# Disable KVM for linux-user
1682if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1683 kvm="no"
1684fi
1685
aurel322408a522008-04-20 20:19:44 +00001686case "$target_cpu" in
1687 i386)
1688 echo "TARGET_ARCH=i386" >> $config_mak
1689 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1690 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001691 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001692 then
1693 echo "#define USE_KQEMU 1" >> $config_h
1694 fi
aliguori7ba1e612008-11-05 16:04:33 +00001695 if test "$kvm" = "yes" ; then
1696 echo "CONFIG_KVM=yes" >> $config_mak
1697 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001698 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001699 fi
aurel322408a522008-04-20 20:19:44 +00001700 ;;
1701 x86_64)
1702 echo "TARGET_ARCH=x86_64" >> $config_mak
1703 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1704 echo "#define TARGET_I386 1" >> $config_h
1705 echo "#define TARGET_X86_64 1" >> $config_h
1706 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1707 then
1708 echo "#define USE_KQEMU 1" >> $config_h
1709 fi
aliguori7ba1e612008-11-05 16:04:33 +00001710 if test "$kvm" = "yes" ; then
1711 echo "CONFIG_KVM=yes" >> $config_mak
1712 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1713 echo "#define CONFIG_KVM 1" >> $config_h
1714 fi
aurel322408a522008-04-20 20:19:44 +00001715 ;;
1716 alpha)
1717 echo "TARGET_ARCH=alpha" >> $config_mak
1718 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1719 echo "#define TARGET_ALPHA 1" >> $config_h
1720 ;;
1721 arm|armeb)
1722 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001723 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1724 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001725 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001726 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001727 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00001728 ;;
1729 cris)
1730 echo "TARGET_ARCH=cris" >> $config_mak
1731 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1732 echo "#define TARGET_CRIS 1" >> $config_h
edgar_igl253bd7f2009-01-07 20:07:09 +00001733 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001734 ;;
1735 m68k)
1736 echo "TARGET_ARCH=m68k" >> $config_mak
1737 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1738 echo "#define TARGET_M68K 1" >> $config_h
1739 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001740 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00001741 ;;
1742 mips|mipsel)
1743 echo "TARGET_ARCH=mips" >> $config_mak
1744 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1745 echo "#define TARGET_MIPS 1" >> $config_h
1746 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1747 ;;
1748 mipsn32|mipsn32el)
1749 echo "TARGET_ARCH=mipsn32" >> $config_mak
1750 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1751 echo "#define TARGET_MIPS 1" >> $config_h
1752 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1753 ;;
1754 mips64|mips64el)
1755 echo "TARGET_ARCH=mips64" >> $config_mak
1756 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1757 echo "#define TARGET_MIPS 1" >> $config_h
1758 echo "#define TARGET_MIPS64 1" >> $config_h
1759 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1760 ;;
1761 ppc)
1762 echo "TARGET_ARCH=ppc" >> $config_mak
1763 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1764 echo "#define TARGET_PPC 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001765 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001766 ;;
1767 ppcemb)
1768 echo "TARGET_ARCH=ppcemb" >> $config_mak
1769 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1770 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1771 echo "#define TARGET_PPC 1" >> $config_h
1772 echo "#define TARGET_PPCEMB 1" >> $config_h
aurel32d76d1652008-12-16 10:43:58 +00001773 if test "$kvm" = "yes" ; then
1774 echo "CONFIG_KVM=yes" >> $config_mak
1775 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1776 echo "#define CONFIG_KVM 1" >> $config_h
1777 fi
aurel32c8b35322009-01-24 15:07:34 +00001778 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001779 ;;
1780 ppc64)
1781 echo "TARGET_ARCH=ppc64" >> $config_mak
1782 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1783 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1784 echo "#define TARGET_PPC 1" >> $config_h
1785 echo "#define TARGET_PPC64 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001786 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001787 ;;
1788 ppc64abi32)
1789 echo "TARGET_ARCH=ppc64" >> $config_mak
1790 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1791 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1792 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1793 echo "#define TARGET_PPC 1" >> $config_h
1794 echo "#define TARGET_PPC64 1" >> $config_h
1795 echo "#define TARGET_ABI32 1" >> $config_h
aurel32c8b35322009-01-24 15:07:34 +00001796 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00001797 ;;
1798 sh4|sh4eb)
1799 echo "TARGET_ARCH=sh4" >> $config_mak
1800 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1801 echo "#define TARGET_SH4 1" >> $config_h
1802 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001803 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001804 ;;
1805 sparc)
1806 echo "TARGET_ARCH=sparc" >> $config_mak
1807 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1808 echo "#define TARGET_SPARC 1" >> $config_h
1809 ;;
1810 sparc64)
1811 echo "TARGET_ARCH=sparc64" >> $config_mak
1812 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1813 echo "#define TARGET_SPARC 1" >> $config_h
1814 echo "#define TARGET_SPARC64 1" >> $config_h
1815 elfload32="yes"
1816 ;;
1817 sparc32plus)
1818 echo "TARGET_ARCH=sparc64" >> $config_mak
1819 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1820 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1821 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1822 echo "#define TARGET_SPARC 1" >> $config_h
1823 echo "#define TARGET_SPARC64 1" >> $config_h
1824 echo "#define TARGET_ABI32 1" >> $config_h
1825 ;;
1826 *)
1827 echo "Unsupported target CPU"
1828 exit 1
1829 ;;
1830esac
bellardde83cd02003-06-15 20:25:43 +00001831if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001832 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1833 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1834fi
1835if test "$target_softmmu" = "yes" ; then
1836 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1837 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00001838fi
bellard997344f2003-10-27 21:10:39 +00001839if test "$target_user_only" = "yes" ; then
1840 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1841 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1842fi
ths831b7822007-01-18 20:06:33 +00001843if test "$target_linux_user" = "yes" ; then
1844 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1845 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1846fi
1847if test "$target_darwin_user" = "yes" ; then
1848 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1849 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1850fi
pbrook56aebc82008-10-11 17:55:29 +00001851list=""
1852if test ! -z "$gdb_xml_files" ; then
1853 for x in $gdb_xml_files; do
1854 list="$list $source_path/gdb-xml/$x"
1855 done
1856fi
1857echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00001858
aurel320938cda2008-04-11 21:36:06 +00001859if test "$target_cpu" = "arm" \
1860 -o "$target_cpu" = "armeb" \
1861 -o "$target_cpu" = "m68k" \
1862 -o "$target_cpu" = "mips" \
1863 -o "$target_cpu" = "mipsel" \
1864 -o "$target_cpu" = "mipsn32" \
1865 -o "$target_cpu" = "mipsn32el" \
1866 -o "$target_cpu" = "mips64" \
1867 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00001868 -o "$target_cpu" = "ppc" \
1869 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00001870 -o "$target_cpu" = "ppc64abi32" \
1871 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00001872 -o "$target_cpu" = "sparc" \
1873 -o "$target_cpu" = "sparc64" \
1874 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00001875 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1876 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1877fi
pbrooke5fe0c52006-06-11 13:32:59 +00001878if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1879 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1880 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1881fi
pbrookbd0c5662008-05-29 14:34:11 +00001882if test "$target_user_only" = "yes" \
1883 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1884 echo "#define USE_NPTL 1" >> $config_h
1885fi
blueswir1cb33da52007-10-09 16:34:29 +00001886# 32 bit ELF loader in addition to native 64 bit loader?
1887if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1888 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1889 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1890fi
blueswir184778502008-10-26 20:33:16 +00001891if test "$target_bsd_user" = "yes" ; then
1892 echo "CONFIG_BSD_USER=yes" >> $config_mak
1893 echo "#define CONFIG_BSD_USER 1" >> $config_h
1894fi
bellard5b0753e2005-03-01 21:37:28 +00001895
ths15d9ca02007-07-31 23:07:32 +00001896test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1897
bellard97a847b2003-08-10 21:36:04 +00001898done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00001899
1900# build tree in object directory if source path is different from current one
1901if test "$source_path_used" = "yes" ; then
bellard49ecc3f2007-11-07 19:25:15 +00001902 DIRS="tests tests/cris slirp audio"
bellard7d132992003-03-06 23:23:54 +00001903 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00001904 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00001905 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00001906 for dir in $DIRS ; do
1907 mkdir -p $dir
1908 done
bellardec530c82006-04-25 22:36:06 +00001909 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00001910 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00001911 rm -f $f
1912 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00001913 done
1914fi