blob: 264a108101cee60b5ab864825b89950b3250bd50 [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=""
30audio_card_list=""
bellard7d132992003-03-06 23:23:54 +000031host_cc="gcc"
32ar="ar"
33make="make"
pbrook6a882642006-04-17 13:57:12 +000034install="install"
bellard7d132992003-03-06 23:23:54 +000035strip="strip"
aliguoriac0df512008-12-29 17:14:15 +000036
37# parse CC options first
38for opt do
39 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
40 case "$opt" in
41 --cross-prefix=*) cross_prefix="$optarg"
42 ;;
43 --cc=*) cc="$optarg"
44 ;;
45 esac
46done
47
48# OS specific
49# Using uname is really, really broken. Once we have the right set of checks
50# we can eliminate it's usage altogether
51
52cc="${cross_prefix}${cc}"
53ar="${cross_prefix}${ar}"
54strip="${cross_prefix}${strip}"
55
56# check that the C compiler works.
57cat > $TMPC <<EOF
58int main(void) {}
59EOF
60
61if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
62 : C compiler works ok
63else
64 echo "ERROR: \"$cc\" either does not exist or does not work"
65 exit 1
66fi
67
68check_define() {
69cat > $TMPC <<EOF
70#if !defined($1)
71#error Not defined
72#endif
73int main(void) { return 0; }
74EOF
75 $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
76}
77
78if check_define __i386__ ; then
79 cpu="i386"
80elif check_define __x86_64__ ; then
81 cpu="x86_64"
82else
83 cpu=`test $(uname -s) = AIX && uname -p || uname -m`
84fi
85
bellard5327cf42005-01-10 23:18:50 +000086target_list=""
bellard7d132992003-03-06 23:23:54 +000087case "$cpu" in
88 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +000089 cpu="i386"
bellard7d132992003-03-06 23:23:54 +000090 ;;
aurel32aaa5fa12008-04-11 22:04:22 +000091 x86_64|amd64)
92 cpu="x86_64"
93 ;;
94 alpha)
95 cpu="alpha"
96 ;;
bellardba680552005-03-13 09:49:52 +000097 armv*b)
bellard808c4952004-12-19 23:33:47 +000098 cpu="armv4b"
99 ;;
bellardba680552005-03-13 09:49:52 +0000100 armv*l)
bellard7d132992003-03-06 23:23:54 +0000101 cpu="armv4l"
102 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000103 cris)
104 cpu="cris"
bellard7d132992003-03-06 23:23:54 +0000105 ;;
aurel32f54b3f92008-04-12 20:14:54 +0000106 parisc|parisc64)
107 cpu="hppa"
108 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000109 ia64)
110 cpu="ia64"
111 ;;
112 m68k)
113 cpu="m68k"
bellard7d132992003-03-06 23:23:54 +0000114 ;;
115 mips)
116 cpu="mips"
117 ;;
thsfbe4f652007-04-01 11:16:48 +0000118 mips64)
119 cpu="mips64"
120 ;;
malcb29fe3e2008-11-18 01:42:22 +0000121 "Power Macintosh"|ppc|ppc64|powerpc)
aurel32aaa5fa12008-04-11 22:04:22 +0000122 cpu="powerpc"
thse7daa602007-10-08 13:38:27 +0000123 ;;
ths0e7b8a92007-08-01 00:09:31 +0000124 s390*)
bellardfb3e5842003-03-29 17:32:36 +0000125 cpu="s390"
126 ;;
blueswir131422552007-04-16 18:27:06 +0000127 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000128 cpu="sparc"
129 ;;
130 sparc64)
131 cpu="sparc64"
132 ;;
bellard7d132992003-03-06 23:23:54 +0000133 *)
134 cpu="unknown"
135 ;;
136esac
137gprof="no"
aliguori03b4fe72008-10-07 19:16:17 +0000138sparse="no"
bellard7d132992003-03-06 23:23:54 +0000139bigendian="no"
bellard67b915a2004-03-31 23:37:16 +0000140mingw32="no"
141EXESUF=""
142gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +0000143slirp="yes"
aliguorie0e6c8c02008-07-23 18:14:33 +0000144vde="yes"
bellard102a52e2004-11-14 19:57:29 +0000145fmod_lib=""
146fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +0000147oss_lib=""
ths8d5d2d42007-08-25 01:37:51 +0000148vnc_tls="yes"
pbrookb1a550a2006-04-16 13:28:56 +0000149bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000150linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000151solaris="no"
bellardc9ec1fe2005-02-10 21:55:30 +0000152kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +0000153profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000154cocoa="no"
bellard97ccc682005-07-02 13:32:17 +0000155check_gfx="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000156softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000157linux_user="no"
158darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000159bsd_user="no"
pbrookcc8ae6d2006-04-23 17:57:59 +0000160build_docs="no"
pbrookc5937222006-05-14 11:30:38 +0000161uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000162curses="yes"
blueswir1414f0da2008-08-15 18:20:52 +0000163aio="yes"
pbrookbd0c5662008-05-29 14:34:11 +0000164nptl="yes"
malc8ff9cbf2008-06-23 18:33:30 +0000165mixemu="no"
balrogfb599c92008-09-28 23:49:55 +0000166bluez="yes"
aliguori7ba1e612008-11-05 16:04:33 +0000167kvm="yes"
aliguorieac30262008-11-05 16:28:56 +0000168kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000169aix="no"
ths77755342008-11-27 15:45:16 +0000170blobs="yes"
aurel32f652e6a2008-12-16 10:43:48 +0000171fdt="yes"
bellard7d132992003-03-06 23:23:54 +0000172
173# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000174if check_define __linux__ ; then
175 targetos="Linux"
176elif check_define _WIN32 ; then
177 targetos='MINGW32'
178else
179 targetos=`uname -s`
180fi
bellard7d132992003-03-06 23:23:54 +0000181case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000182CYGWIN*)
183mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000184OS_CFLAGS="-mno-cygwin"
thsdb8d7dd2007-07-12 09:29:18 +0000185if [ "$cpu" = "i386" ] ; then
186 kqemu="yes"
187fi
malcc2de5c92008-06-28 19:13:06 +0000188audio_possible_drivers="sdl"
bellardc326e0a2005-04-23 18:30:28 +0000189;;
bellard67b915a2004-03-31 23:37:16 +0000190MINGW32*)
191mingw32="yes"
thsdb8d7dd2007-07-12 09:29:18 +0000192if [ "$cpu" = "i386" ] ; then
193 kqemu="yes"
194fi
malcc2de5c92008-06-28 19:13:06 +0000195audio_possible_drivers="dsound sdl fmod"
bellard67b915a2004-03-31 23:37:16 +0000196;;
ths5c40d2b2007-06-23 16:03:36 +0000197GNU/kFreeBSD)
malc0c58ac12008-06-25 21:04:05 +0000198audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000199audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000200if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
201 kqemu="yes"
202fi
203;;
bellard7d3505c2004-05-12 19:32:15 +0000204FreeBSD)
205bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000206audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000207audio_possible_drivers="oss sdl esd pa"
bellarde99f9062005-07-28 21:45:38 +0000208if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000209 kqemu="yes"
210fi
bellard7d3505c2004-05-12 19:32:15 +0000211;;
212NetBSD)
213bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000214audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000215audio_possible_drivers="oss sdl esd"
blueswir18ef92a82008-11-22 20:24:29 +0000216oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000217;;
218OpenBSD)
219bsd="yes"
blueswir1128ab2f2008-08-15 18:33:42 +0000220openbsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000221audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000222audio_possible_drivers="oss sdl esd"
blueswir12f6a1ab2008-08-21 18:00:53 +0000223oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000224;;
bellard83fb7ad2004-07-05 21:25:26 +0000225Darwin)
226bsd="yes"
227darwin="yes"
ths831b7822007-01-18 20:06:33 +0000228darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000229cocoa="yes"
malc0c58ac12008-06-25 21:04:05 +0000230audio_drv_list="coreaudio"
malcc2de5c92008-06-28 19:13:06 +0000231audio_possible_drivers="coreaudio sdl fmod"
ths6f30fa82007-01-05 01:00:47 +0000232OS_CFLAGS="-mdynamic-no-pic"
thsc2c59c32008-01-08 00:00:20 +0000233OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
bellard83fb7ad2004-07-05 21:25:26 +0000234;;
bellardec530c82006-04-25 22:36:06 +0000235SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000236 solaris="yes"
237 make="gmake"
238 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000239 needs_libsunmath="no"
thsc2b84fa2007-02-10 23:21:21 +0000240 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000241 # have to select again, because `uname -m` returns i86pc
242 # even on an x86_64 box.
243 solariscpu=`isainfo -k`
244 if test "${solariscpu}" = "amd64" ; then
245 cpu="x86_64"
246 fi
thsc2b84fa2007-02-10 23:21:21 +0000247 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000248 if test "$solarisrev" -le 9 ; then
249 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
250 needs_libsunmath="yes"
251 else
252 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
253 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
254 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
255 echo "Studio 11 can be downloaded from www.sun.com."
256 exit 1
257 fi
258 fi
259 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000260 kqemu="yes"
261 fi
ths86b2bd92007-02-11 00:31:33 +0000262 fi
ths6b4d2ba2007-05-13 18:02:43 +0000263 if test -f /usr/include/sys/soundcard.h ; then
malc0c58ac12008-06-25 21:04:05 +0000264 audio_drv_list="oss"
ths6b4d2ba2007-05-13 18:02:43 +0000265 fi
malcc2de5c92008-06-28 19:13:06 +0000266 audio_possible_drivers="oss sdl"
ths86b2bd92007-02-11 00:31:33 +0000267;;
malcb29fe3e2008-11-18 01:42:22 +0000268AIX)
269aix="yes"
270make="gmake"
271;;
bellard1d14ffa2005-10-30 18:58:22 +0000272*)
malc0c58ac12008-06-25 21:04:05 +0000273audio_drv_list="oss"
malcb8e59f12008-07-02 21:03:08 +0000274audio_possible_drivers="oss alsa sdl esd pa"
bellard5327cf42005-01-10 23:18:50 +0000275linux="yes"
ths831b7822007-01-18 20:06:33 +0000276linux_user="yes"
blueswir168063642008-11-22 21:03:55 +0000277usb="linux"
bellard07f4ddb2005-04-23 17:44:28 +0000278if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000279 kqemu="yes"
malcc2de5c92008-06-28 19:13:06 +0000280 audio_possible_drivers="$audio_possible_drivers fmod"
bellardc9ec1fe2005-02-10 21:55:30 +0000281fi
bellardfb065182004-11-09 23:09:44 +0000282;;
bellard7d132992003-03-06 23:23:54 +0000283esac
284
bellard7d3505c2004-05-12 19:32:15 +0000285if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000286 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000287 make="gmake"
blueswir168063642008-11-22 21:03:55 +0000288 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000289 fi
blueswir184778502008-10-26 20:33:16 +0000290 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000291fi
292
bellard7d132992003-03-06 23:23:54 +0000293# find source path
pbrookad064842006-04-16 12:41:07 +0000294source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000295source_path_used="no"
296workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000297if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000298 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000299else
300 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000301fi
pbrook724db112008-02-03 19:20:13 +0000302[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000303
bellard85aa5182007-11-11 20:17:03 +0000304werror="no"
bellard0d1e2392007-11-11 20:24:30 +0000305# generate compile errors on warnings for development builds
306#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
307#werror="yes";
308#fi
bellard85aa5182007-11-11 20:17:03 +0000309
bellard7d132992003-03-06 23:23:54 +0000310for opt do
pbrooka46e4032006-04-29 23:05:22 +0000311 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000312 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000313 --help|-h) show_help=yes
314 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000315 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000316 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000317 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000318 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000319 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000320 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000321 ;;
aliguoriac0df512008-12-29 17:14:15 +0000322 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000323 ;;
aliguoriac0df512008-12-29 17:14:15 +0000324 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000325 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000326 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000327 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000328 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000329 ;;
pbrook6a882642006-04-17 13:57:12 +0000330 --install=*) install="$optarg"
331 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000332 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000333 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000334 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000335 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000336 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000337 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000338 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000339 ;;
bellard7d132992003-03-06 23:23:54 +0000340 --enable-gprof) gprof="yes"
341 ;;
bellard43ce4df2003-06-09 19:53:12 +0000342 --static) static="yes"
343 ;;
bellard97a847b2003-08-10 21:36:04 +0000344 --disable-sdl) sdl="no"
345 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000346 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000347 ;;
malcc2de5c92008-06-28 19:13:06 +0000348 --fmod-inc=*) fmod_inc="$optarg"
349 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000350 --oss-lib=*) oss_lib="$optarg"
351 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000352 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000353 ;;
354 --audio-drv-list=*) audio_drv_list="$optarg"
355 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000356 --enable-sparse) sparse="yes"
357 ;;
358 --disable-sparse) sparse="no"
359 ;;
ths8d5d2d42007-08-25 01:37:51 +0000360 --disable-vnc-tls) vnc_tls="no"
361 ;;
bellard443f1372004-06-04 11:13:20 +0000362 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000363 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000364 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000365 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000366 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000367 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000368 --disable-brlapi) brlapi="no"
369 ;;
balrogfb599c92008-09-28 23:49:55 +0000370 --disable-bluez) bluez="no"
371 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000372 --disable-kvm) kvm="no"
373 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000374 --enable-profiler) profiler="yes"
375 ;;
malcc2de5c92008-06-28 19:13:06 +0000376 --enable-cocoa)
377 cocoa="yes" ;
378 sdl="no" ;
379 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000380 ;;
bellard97ccc682005-07-02 13:32:17 +0000381 --disable-gfx-check) check_gfx="no"
382 ;;
pbrookcad25d62006-03-19 16:31:11 +0000383 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000384 ;;
pbrookcad25d62006-03-19 16:31:11 +0000385 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000386 ;;
ths831b7822007-01-18 20:06:33 +0000387 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000388 ;;
ths831b7822007-01-18 20:06:33 +0000389 --enable-linux-user) linux_user="yes"
390 ;;
391 --disable-darwin-user) darwin_user="no"
392 ;;
393 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000394 ;;
blueswir184778502008-10-26 20:33:16 +0000395 --disable-bsd-user) bsd_user="no"
396 ;;
397 --enable-bsd-user) bsd_user="yes"
398 ;;
pbrookc5937222006-05-14 11:30:38 +0000399 --enable-uname-release=*) uname_release="$optarg"
400 ;;
blueswir131422552007-04-16 18:27:06 +0000401 --sparc_cpu=*)
402 sparc_cpu="$optarg"
403 case $sparc_cpu in
404 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
405 target_cpu="sparc"; cpu="sparc" ;;
406 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
407 target_cpu="sparc"; cpu="sparc" ;;
408 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
409 target_cpu="sparc64"; cpu="sparc64" ;;
410 *) echo "undefined SPARC architecture. Exiting";exit 1;;
411 esac
412 ;;
bellard85aa5182007-11-11 20:17:03 +0000413 --enable-werror) werror="yes"
414 ;;
415 --disable-werror) werror="no"
416 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000417 --disable-curses) curses="no"
418 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000419 --disable-nptl) nptl="no"
420 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000421 --enable-mixemu) mixemu="yes"
422 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000423 --disable-aio) aio="no"
424 ;;
ths77755342008-11-27 15:45:16 +0000425 --disable-blobs) blobs="no"
426 ;;
aliguorieac30262008-11-05 16:28:56 +0000427 --kerneldir=*) kerneldir="$optarg"
428 ;;
balrog7f1559c2007-11-17 10:24:32 +0000429 *) echo "ERROR: unknown option $opt"; show_help="yes"
430 ;;
bellard7d132992003-03-06 23:23:54 +0000431 esac
432done
433
ths6f30fa82007-01-05 01:00:47 +0000434# default flags for all hosts
blueswir1ac41a622008-09-14 06:46:31 +0000435CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
blueswir1e0e36fe2008-12-07 19:16:27 +0000436CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
ths6f30fa82007-01-05 01:00:47 +0000437LDFLAGS="$LDFLAGS -g"
bellard85aa5182007-11-11 20:17:03 +0000438if test "$werror" = "yes" ; then
439CFLAGS="$CFLAGS -Werror"
440fi
ths6f30fa82007-01-05 01:00:47 +0000441
blueswir1d2c7c9b2008-11-01 14:50:20 +0000442if test "$solaris" = "no" ; then
443 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
444 LDFLAGS="$LDFLAGS -Wl,--warn-common"
445 fi
blueswir149237ac2008-09-17 19:05:19 +0000446fi
447
blueswir131422552007-04-16 18:27:06 +0000448#
449# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
450# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
451#
bellard40293e52008-01-31 11:32:10 +0000452case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000453 sparc) if test -z "$sparc_cpu" ; then
454 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
455 ARCH_LDFLAGS="-m32"
456 else
457 ARCH_CFLAGS="${SP_CFLAGS}"
458 ARCH_LDFLAGS="${SP_LDFLAGS}"
459 fi
460 ;;
461 sparc64) if test -z "$sparc_cpu" ; then
462 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
463 ARCH_LDFLAGS="-m64"
464 else
465 ARCH_CFLAGS="${SP_CFLAGS}"
466 ARCH_LDFLAGS="${SP_LDFLAGS}"
467 fi
468 ;;
ths76d83bd2007-11-18 21:22:10 +0000469 s390)
470 ARCH_CFLAGS="-march=z900"
471 ;;
bellard40293e52008-01-31 11:32:10 +0000472 i386)
473 ARCH_CFLAGS="-m32"
474 ARCH_LDFLAGS="-m32"
475 ;;
476 x86_64)
477 ARCH_CFLAGS="-m64"
478 ARCH_LDFLAGS="-m64"
479 ;;
blueswir131422552007-04-16 18:27:06 +0000480esac
481
pbrookaf5db582006-04-08 14:26:41 +0000482if test x"$show_help" = x"yes" ; then
483cat << EOF
484
485Usage: configure [options]
486Options: [defaults in brackets after descriptions]
487
488EOF
489echo "Standard options:"
490echo " --help print this message"
491echo " --prefix=PREFIX install in PREFIX [$prefix]"
492echo " --interp-prefix=PREFIX where to find shared libraries, etc."
493echo " use %M for cpu name [$interp_prefix]"
494echo " --target-list=LIST set target list [$target_list]"
495echo ""
496echo "kqemu kernel acceleration support:"
497echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000498echo ""
499echo "Advanced options (experts only):"
500echo " --source-path=PATH path of source code [$source_path]"
501echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
502echo " --cc=CC use C compiler CC [$cc]"
503echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
504echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000505echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000506echo " --static enable static build [$static]"
aliguori890b1652008-10-07 21:22:41 +0000507echo " --enable-sparse enable sparse checker"
508echo " --disable-sparse disable sparse checker (default)"
bellard85aa5182007-11-11 20:17:03 +0000509echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000510echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000511echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000512echo " --audio-drv-list=LIST set audio drivers list:"
513echo " Available drivers: $audio_possible_drivers"
514echo " --audio-card-list=LIST set list of additional emulated audio cards"
515echo " Available cards: ac97 adlib cs4231a gus"
malc8ff9cbf2008-06-23 18:33:30 +0000516echo " --enable-mixemu enable mixer emulation"
aurel322e4d9fb2008-04-08 06:01:02 +0000517echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000518echo " --disable-vnc-tls disable TLS encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000519echo " --disable-curses disable curses output"
balrogfb599c92008-09-28 23:49:55 +0000520echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000521echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000522echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000523echo " --enable-system enable all system emulation targets"
524echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000525echo " --enable-linux-user enable all linux usermode emulation targets"
526echo " --disable-linux-user disable all linux usermode emulation targets"
527echo " --enable-darwin-user enable all darwin usermode emulation targets"
528echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000529echo " --enable-bsd-user enable all BSD usermode emulation targets"
530echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000531echo " --fmod-lib path to FMOD library"
532echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000533echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000534echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000535echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000536echo " --disable-vde disable support for vde network"
blueswir1414f0da2008-08-15 18:20:52 +0000537echo " --disable-aio disable AIO support"
ths77755342008-11-27 15:45:16 +0000538echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000539echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000540echo ""
ths5bf08932006-12-23 00:33:26 +0000541echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000542exit 1
543fi
544
bellard67b915a2004-03-31 23:37:16 +0000545if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000546 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000547 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000548 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000549 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000550 bsd_user="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000551fi
552
aliguori03b4fe72008-10-07 19:16:17 +0000553if test ! -x "$(which cgcc 2>/dev/null)"; then
554 sparse="no"
555fi
556
bellardec530c82006-04-25 22:36:06 +0000557#
558# Solaris specific configure tool chain decisions
559#
560if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000561 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
562 if test -z "$solinst" ; then
563 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
564 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
565 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
566 exit 1
567 fi
568 if test "$solinst" = "/usr/sbin/install" ; then
569 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
570 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
571 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
572 exit 1
573 fi
bellardec530c82006-04-25 22:36:06 +0000574 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
575 if test -z "$sol_ar" ; then
576 echo "Error: No path includes ar"
577 if test -f /usr/ccs/bin/ar ; then
578 echo "Add /usr/ccs/bin to your path and rerun configure"
579 fi
580 exit 1
581 fi
ths5fafdf22007-09-16 21:08:06 +0000582fi
bellardec530c82006-04-25 22:36:06 +0000583
584
bellard5327cf42005-01-10 23:18:50 +0000585if test -z "$target_list" ; then
586# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000587 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000588 target_list="\
589i386-softmmu \
590x86_64-softmmu \
591arm-softmmu \
592cris-softmmu \
593m68k-softmmu \
594mips-softmmu \
595mipsel-softmmu \
596mips64-softmmu \
597mips64el-softmmu \
598ppc-softmmu \
599ppcemb-softmmu \
600ppc64-softmmu \
601sh4-softmmu \
602sh4eb-softmmu \
603sparc-softmmu \
604"
pbrook0a8e90f2006-03-19 14:54:16 +0000605 fi
bellard5327cf42005-01-10 23:18:50 +0000606# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000607 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000608 target_list="${target_list}\
609i386-linux-user \
610x86_64-linux-user \
611alpha-linux-user \
612arm-linux-user \
613armeb-linux-user \
614cris-linux-user \
615m68k-linux-user \
616mips-linux-user \
617mipsel-linux-user \
618ppc-linux-user \
619ppc64-linux-user \
620ppc64abi32-linux-user \
621sh4-linux-user \
622sh4eb-linux-user \
623sparc-linux-user \
624sparc64-linux-user \
625sparc32plus-linux-user \
626"
ths831b7822007-01-18 20:06:33 +0000627 fi
628# the following are Darwin specific
629 if [ "$darwin_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000630 target_list="$target_list i386-darwin-user ppc-darwin-user"
bellard5327cf42005-01-10 23:18:50 +0000631 fi
blueswir184778502008-10-26 20:33:16 +0000632# the following are BSD specific
633 if [ "$bsd_user" = "yes" ] ; then
634 target_list="${target_list}\
635sparc64-bsd-user \
636"
637 fi
bellard6e20a452005-06-05 15:56:02 +0000638else
pbrookb1a550a2006-04-16 13:28:56 +0000639 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000640fi
pbrook0a8e90f2006-03-19 14:54:16 +0000641if test -z "$target_list" ; then
642 echo "No targets enabled"
643 exit 1
644fi
bellard5327cf42005-01-10 23:18:50 +0000645
bellard7d132992003-03-06 23:23:54 +0000646if test -z "$cross_prefix" ; then
647
648# ---
649# big/little endian test
650cat > $TMPC << EOF
651#include <inttypes.h>
652int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000653 volatile uint32_t i=0x01234567;
654 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000655}
656EOF
657
aurel32178baee2008-12-08 18:11:57 +0000658if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000659$TMPE && bigendian="yes"
660else
661echo big/little test failed
662fi
663
664else
665
666# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000667if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000668 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000669 -o "$cpu" = "m68k" \
670 -o "$cpu" = "mips" \
671 -o "$cpu" = "mips64" \
672 -o "$cpu" = "powerpc" \
673 -o "$cpu" = "s390" \
674 -o "$cpu" = "sparc" \
675 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000676 bigendian="yes"
677fi
678
679fi
680
bellardb6853692005-06-05 17:10:39 +0000681# host long bits test
682hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000683if test "$cpu" = "x86_64" \
684 -o "$cpu" = "alpha" \
685 -o "$cpu" = "ia64" \
686 -o "$cpu" = "sparc64"; then
bellardb6853692005-06-05 17:10:39 +0000687 hostlongbits="64"
688fi
689
malc810260a2008-07-23 19:17:46 +0000690# ppc specific hostlongbits selection
691if test "$cpu" = "powerpc" ; then
malc9d56d2d2008-09-30 19:44:32 +0000692 if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev/null </dev/null; then
693 grep -q __powerpc64__ $TMPI && hostlongbits=64
malc810260a2008-07-23 19:17:46 +0000694 else
695 echo hostlongbits test failed
malcba69a082008-07-24 17:51:36 +0000696 exit 1
malc810260a2008-07-23 19:17:46 +0000697 fi
698fi
699
bellarde8cd23d2003-06-25 16:08:13 +0000700# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000701cat > $TMPC <<EOF
702int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000703}
704EOF
705
pbrookbd0c5662008-05-29 14:34:11 +0000706# Check host NPTL support
707cat > $TMPC <<EOF
708#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000709#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000710void foo()
711{
712#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
713#error bork
714#endif
715}
716EOF
717
balrog8c7f7572008-12-15 03:15:36 +0000718if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000719 :
720else
721 nptl="no"
722fi
723
bellard11d9f692004-04-02 20:55:59 +0000724##########################################
balrogac629222008-10-11 09:56:04 +0000725# zlib check
726
727cat > $TMPC << EOF
728#include <zlib.h>
729int main(void) { zlibVersion(); return 0; }
730EOF
balrog8c7f7572008-12-15 03:15:36 +0000731if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000732 :
733else
734 echo
735 echo "Error: zlib check failed"
736 echo "Make sure to have the zlib libs and headers installed."
737 echo
738 exit 1
739fi
740
741##########################################
bellard11d9f692004-04-02 20:55:59 +0000742# SDL probe
743
744sdl_too_old=no
745
746if test -z "$sdl" ; then
ths069b0bd2007-07-12 00:27:15 +0000747 sdl_config="sdl-config"
748 sdl=no
749 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000750
751cat > $TMPC << EOF
752#include <SDL.h>
753#undef main /* We don't want SDL to override our main() */
754int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
755EOF
balrog8c7f7572008-12-15 03:15:36 +0000756 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 +0000757 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
758 if test "$_sdlversion" -lt 121 ; then
759 sdl_too_old=yes
760 else
761 if test "$cocoa" = "no" ; then
762 sdl=yes
763 fi
764 fi
765
766 # static link with sdl ?
767 if test "$sdl" = "yes" ; then
768 aa="no"
769 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
770 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
771 if [ "$aa" = "yes" ] ; then
772 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000773 fi
bellard11d9f692004-04-02 20:55:59 +0000774
balrog8c7f7572008-12-15 03:15:36 +0000775 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 +0000776 sdl_static=yes
777 fi
778 fi # static link
779 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000780else
ths069b0bd2007-07-12 00:27:15 +0000781 # Make sure to disable cocoa if sdl was set
782 if test "$sdl" = "yes" ; then
783 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000784 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000785 fi
bellarda6e022a2004-04-02 21:55:47 +0000786fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000787
ths8f28f3f2007-01-05 21:25:54 +0000788##########################################
ths8d5d2d42007-08-25 01:37:51 +0000789# VNC TLS detection
790if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000791cat > $TMPC <<EOF
792#include <gnutls/gnutls.h>
793int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
794EOF
795 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
796 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
797 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000798 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000799 :
800 else
801 vnc_tls="no"
802 fi
ths8d5d2d42007-08-25 01:37:51 +0000803fi
804
805##########################################
ths8a16d272008-07-19 09:56:24 +0000806# vde libraries probe
807if test "$vde" = "yes" ; then
808 cat > $TMPC << EOF
809#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000810int main(void)
811{
812 struct vde_open_args a = {0, 0, 0};
813 vde_open("", "", &a);
814 return 0;
815}
ths8a16d272008-07-19 09:56:24 +0000816EOF
balrog8c7f7572008-12-15 03:15:36 +0000817 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000818 :
819 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000820 vde="no"
ths8a16d272008-07-19 09:56:24 +0000821 fi
822fi
823
824##########################################
malcc2de5c92008-06-28 19:13:06 +0000825# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000826
malcc2de5c92008-06-28 19:13:06 +0000827audio_drv_probe()
828{
829 drv=$1
830 hdr=$2
831 lib=$3
832 exp=$4
833 cfl=$5
834 cat > $TMPC << EOF
835#include <$hdr>
836int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000837EOF
balrog8c7f7572008-12-15 03:15:36 +0000838 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +0000839 :
840 else
841 echo
842 echo "Error: $drv check failed"
843 echo "Make sure to have the $drv libs and headers installed."
844 echo
845 exit 1
846 fi
847}
848
malc2fa7d3b2008-07-29 12:58:44 +0000849audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000850for drv in $audio_drv_list; do
851 case $drv in
852 alsa)
853 audio_drv_probe $drv alsa/asoundlib.h -lasound \
854 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
855 ;;
856
857 fmod)
858 if test -z $fmod_lib || test -z $fmod_inc; then
859 echo
860 echo "Error: You must specify path to FMOD library and headers"
861 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
862 echo
863 exit 1
864 fi
865 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
866 ;;
867
868 esd)
869 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
870 ;;
malcb8e59f12008-07-02 21:03:08 +0000871
872 pa)
873 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
874 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
875 ;;
876
blueswir12f6a1ab2008-08-21 18:00:53 +0000877 oss|sdl|core|wav|dsound)
878 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
879 ;;
880
malce4c63a62008-07-19 16:15:16 +0000881 *)
malc1c9b2a52008-07-19 16:57:30 +0000882 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +0000883 echo
884 echo "Error: Unknown driver '$drv' selected"
885 echo "Possible drivers are: $audio_possible_drivers"
886 echo
887 exit 1
888 }
889 ;;
malcc2de5c92008-06-28 19:13:06 +0000890 esac
891done
ths8f28f3f2007-01-05 21:25:54 +0000892
balrog4d3b6f62008-02-10 16:33:14 +0000893##########################################
aurel322e4d9fb2008-04-08 06:01:02 +0000894# BrlAPI probe
895
896if test -z "$brlapi" ; then
897 brlapi=no
898cat > $TMPC << EOF
899#include <brlapi.h>
900int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
901EOF
aurel32178baee2008-12-08 18:11:57 +0000902 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +0000903 brlapi=yes
904 fi # brlapi compile test
905fi # -z $brlapi
906
907##########################################
balrog4d3b6f62008-02-10 16:33:14 +0000908# curses probe
909
910if test "$curses" = "yes" ; then
911 curses=no
912 cat > $TMPC << EOF
913#include <curses.h>
914int main(void) { return curses_version(); }
915EOF
aurel32178baee2008-12-08 18:11:57 +0000916 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +0000917 curses=yes
918 fi
919fi # test "$curses"
920
blueswir1414f0da2008-08-15 18:20:52 +0000921##########################################
balrogfb599c92008-09-28 23:49:55 +0000922# bluez support probe
923if test "$bluez" = "yes" ; then
924 `pkg-config bluez` || bluez="no"
925fi
926if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +0000927 cat > $TMPC << EOF
928#include <bluetooth/bluetooth.h>
929int main(void) { return bt_error(0); }
930EOF
balrogfb599c92008-09-28 23:49:55 +0000931 bluez_cflags=`pkg-config --cflags bluez`
932 bluez_libs=`pkg-config --libs bluez`
balrog17e15922008-10-11 12:00:42 +0000933 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000934 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +0000935 :
936 else
937 bluez="no"
938 fi
balrogfb599c92008-09-28 23:49:55 +0000939fi
940
941##########################################
aliguori7ba1e612008-11-05 16:04:33 +0000942# kvm probe
943if test "$kvm" = "yes" ; then
944 cat > $TMPC <<EOF
945#include <linux/kvm.h>
946#if !defined(KVM_API_VERSION) || \
947 KVM_API_VERSION < 12 || \
948 KVM_API_VERSION > 12 || \
949 !defined(KVM_CAP_USER_MEMORY) || \
aliguorid85dc282008-12-09 19:59:09 +0000950 !defined(KVM_CAP_SET_TSS_ADDR) || \
951 !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
aliguori7ba1e612008-11-05 16:04:33 +0000952#error Invalid KVM version
953#endif
954int main(void) { return 0; }
955EOF
aliguorieac30262008-11-05 16:28:56 +0000956 if test "$kerneldir" != "" ; then
957 kvm_cflags=-I"$kerneldir"/include
958 else
959 kvm_cflags=""
960 fi
aliguori7ba1e612008-11-05 16:04:33 +0000961 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000962 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +0000963 :
964 else
965 kvm="no"
966 fi
967fi
968
969##########################################
blueswir1414f0da2008-08-15 18:20:52 +0000970# AIO probe
aliguori3c529d92008-12-12 16:41:40 +0000971AIOLIBS=""
972
blueswir1414f0da2008-08-15 18:20:52 +0000973if test "$aio" = "yes" ; then
974 aio=no
975 cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +0000976#include <pthread.h>
977int main(void) { pthread_mutex_t lock; return 0; }
blueswir1414f0da2008-08-15 18:20:52 +0000978EOF
979 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
980 aio=yes
aliguori3c529d92008-12-12 16:41:40 +0000981 AIOLIBS="-lpthread"
blueswir1414f0da2008-08-15 18:20:52 +0000982 fi
983fi
984
aliguoribf9298b2008-12-05 20:05:26 +0000985##########################################
986# iovec probe
987cat > $TMPC <<EOF
988#include <sys/uio.h>
989int main(void) { struct iovec iov; return 0; }
990EOF
991iovec=no
balrog8c7f7572008-12-15 03:15:36 +0000992if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +0000993 iovec=yes
994fi
995
aurel32f652e6a2008-12-16 10:43:48 +0000996##########################################
997# fdt probe
998if test "$fdt" = "yes" ; then
999 fdt=no
1000 cat > $TMPC << EOF
1001int main(void) { return 0; }
1002EOF
1003 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1004 fdt=yes
1005 fi
1006fi
1007
pbrookcc8ae6d2006-04-23 17:57:59 +00001008# Check if tools are available to build documentation.
ths6c591862007-05-09 13:55:03 +00001009if [ -x "`which texi2html 2>/dev/null`" ] && \
1010 [ -x "`which pod2man 2>/dev/null`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +00001011 build_docs="yes"
1012fi
1013
aliguorida93a1f2008-12-12 20:02:52 +00001014##########################################
1015# Do we need librt
1016cat > $TMPC <<EOF
1017#include <signal.h>
1018#include <time.h>
1019int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1020EOF
1021
1022rt=no
balrog8c7f7572008-12-15 03:15:36 +00001023if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001024 :
balrog8c7f7572008-12-15 03:15:36 +00001025elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001026 rt=yes
1027fi
1028
1029if test "$rt" = "yes" ; then
1030 # Hack, we should have a general purpose LIBS for this sort of thing
1031 AIOLIBS="$AIOLIBS -lrt"
1032fi
1033
bellard11d9f692004-04-02 20:55:59 +00001034if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001035 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001036 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001037 fi
1038 mansuffix=""
1039 datasuffix=""
1040 docsuffix=""
1041 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001042else
pbrook308c3592007-02-27 00:52:01 +00001043 if test -z "$prefix" ; then
1044 prefix="/usr/local"
1045 fi
1046 mansuffix="/share/man"
1047 datasuffix="/share/qemu"
1048 docsuffix="/share/doc/qemu"
1049 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001050fi
bellard5a671352003-10-01 00:13:48 +00001051
bellard43ce4df2003-06-09 19:53:12 +00001052echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001053echo "BIOS directory $prefix$datasuffix"
1054echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001055if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001056echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001057echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001058fi
bellard5a671352003-10-01 00:13:48 +00001059echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001060echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001061echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001062echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001063echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001064echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001065echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001066echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001067echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +00001068echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001069echo "sparse enabled $sparse"
bellard05c2a3e2006-02-08 22:39:17 +00001070echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001071echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001072echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001073if test "$darwin" = "yes" ; then
1074 echo "Cocoa support $cocoa"
1075fi
bellard97a847b2003-08-10 21:36:04 +00001076echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001077if test "$sdl" != "no" ; then
1078 echo "SDL static link $sdl_static"
1079fi
balrog4d3b6f62008-02-10 16:33:14 +00001080echo "curses support $curses"
bellard67b915a2004-03-31 23:37:16 +00001081echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001082echo "Audio drivers $audio_drv_list"
1083echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001084echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001085echo "VNC TLS support $vnc_tls"
1086if test "$vnc_tls" = "yes" ; then
1087 echo " TLS CFLAGS $vnc_tls_cflags"
1088 echo " TLS LIBS $vnc_tls_libs"
1089fi
blueswir131422552007-04-16 18:27:06 +00001090if test -n "$sparc_cpu"; then
1091 echo "Target Sparc Arch $sparc_cpu"
1092fi
bellard07f4ddb2005-04-23 17:44:28 +00001093echo "kqemu support $kqemu"
aurel322e4d9fb2008-04-08 06:01:02 +00001094echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001095echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001096[ ! -z "$uname_release" ] && \
1097echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001098echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001099echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001100echo "AIO support $aio"
ths77755342008-11-27 15:45:16 +00001101echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001102echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001103echo "fdt support $fdt"
bellard67b915a2004-03-31 23:37:16 +00001104
bellard97a847b2003-08-10 21:36:04 +00001105if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001106echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001107fi
malcd4742de2008-11-29 22:04:31 +00001108if [ -s $TMPSDLLOG ]; then
ths20b40c62007-07-11 23:39:45 +00001109 echo "The error log from compiling the libSDL test is: "
malcd4742de2008-11-29 22:04:31 +00001110 cat $TMPSDLLOG
ths20b40c62007-07-11 23:39:45 +00001111fi
bellard24b55b92005-03-01 22:30:41 +00001112#if test "$sdl_static" = "no"; then
1113# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1114#fi
bellard97a847b2003-08-10 21:36:04 +00001115config_mak="config-host.mak"
1116config_h="config-host.h"
1117
bellard7c1f25b2004-04-22 00:02:08 +00001118#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001119
ths15d9ca02007-07-31 23:07:32 +00001120test -f $config_h && mv $config_h ${config_h}~
1121
bellard97a847b2003-08-10 21:36:04 +00001122echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001123printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001124printf " '%s'" "$0" "$@" >> $config_mak
1125echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001126echo "/* Automatically generated by configure - do not modify */" > $config_h
1127
1128echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001129echo "bindir=\${prefix}$binsuffix" >> $config_mak
1130echo "mandir=\${prefix}$mansuffix" >> $config_mak
1131echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001132echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001133echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001134echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001135echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001136echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001137echo "HOST_CC=$host_cc" >> $config_mak
1138echo "AR=$ar" >> $config_mak
1139echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001140# XXX: only use CFLAGS and LDFLAGS ?
1141# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1142# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001143echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001144echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1145echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1146echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001147echo "CFLAGS=$CFLAGS" >> $config_mak
1148echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001149echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +00001150echo "AIOLIBS=$AIOLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001151case "$cpu" in
1152 i386)
1153 echo "ARCH=i386" >> $config_mak
1154 echo "#define HOST_I386 1" >> $config_h
1155 ;;
1156 x86_64)
1157 echo "ARCH=x86_64" >> $config_mak
1158 echo "#define HOST_X86_64 1" >> $config_h
1159 ;;
1160 alpha)
1161 echo "ARCH=alpha" >> $config_mak
1162 echo "#define HOST_ALPHA 1" >> $config_h
1163 ;;
1164 armv4b)
1165 echo "ARCH=arm" >> $config_mak
1166 echo "#define HOST_ARM 1" >> $config_h
1167 ;;
1168 armv4l)
1169 echo "ARCH=arm" >> $config_mak
1170 echo "#define HOST_ARM 1" >> $config_h
1171 ;;
1172 cris)
1173 echo "ARCH=cris" >> $config_mak
1174 echo "#define HOST_CRIS 1" >> $config_h
1175 ;;
1176 hppa)
1177 echo "ARCH=hppa" >> $config_mak
1178 echo "#define HOST_HPPA 1" >> $config_h
1179 ;;
1180 ia64)
1181 echo "ARCH=ia64" >> $config_mak
1182 echo "#define HOST_IA64 1" >> $config_h
1183 ;;
1184 m68k)
1185 echo "ARCH=m68k" >> $config_mak
1186 echo "#define HOST_M68K 1" >> $config_h
1187 ;;
1188 mips)
1189 echo "ARCH=mips" >> $config_mak
1190 echo "#define HOST_MIPS 1" >> $config_h
1191 ;;
1192 mips64)
1193 echo "ARCH=mips64" >> $config_mak
1194 echo "#define HOST_MIPS64 1" >> $config_h
1195 ;;
1196 powerpc)
malc810260a2008-07-23 19:17:46 +00001197 if test "$hostlongbits" = "32"; then
1198 echo "ARCH=ppc" >> $config_mak
1199 echo "#define HOST_PPC 1" >> $config_h
1200 else
1201 echo "ARCH=ppc64" >> $config_mak
1202 echo "#define HOST_PPC64 1" >> $config_h
1203 fi
aurel322408a522008-04-20 20:19:44 +00001204 ;;
1205 s390)
1206 echo "ARCH=s390" >> $config_mak
1207 echo "#define HOST_S390 1" >> $config_h
1208 ;;
1209 sparc)
1210 echo "ARCH=sparc" >> $config_mak
1211 echo "#define HOST_SPARC 1" >> $config_h
1212 ;;
1213 sparc64)
1214 echo "ARCH=sparc64" >> $config_mak
1215 echo "#define HOST_SPARC64 1" >> $config_h
1216 ;;
1217 *)
1218 echo "Unsupported CPU = $cpu"
1219 exit 1
1220 ;;
1221esac
aliguori03b4fe72008-10-07 19:16:17 +00001222if test "$sparse" = "yes" ; then
1223 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1224 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1225 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1226fi
bellard7d132992003-03-06 23:23:54 +00001227if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001228 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1229 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1230fi
bellardb6853692005-06-05 17:10:39 +00001231echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001232if test "$mingw32" = "yes" ; then
1233 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001234 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001235else
1236 cat > $TMPC << EOF
1237#include <byteswap.h>
1238int main(void) { return bswap_32(0); }
1239EOF
aurel32178baee2008-12-08 18:11:57 +00001240 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001241 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1242 fi
blueswir113606772008-12-05 17:54:09 +00001243 cat > $TMPC << EOF
1244#include <sys/endian.h>
1245#include <sys/types.h>
1246#include <machine/bswap.h>
1247int main(void) { return bswap32(0); }
1248EOF
aurel32178baee2008-12-08 18:11:57 +00001249 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001250 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1251 fi
bellard67b915a2004-03-31 23:37:16 +00001252fi
blueswir1128ab2f2008-08-15 18:33:42 +00001253
1254if [ "$openbsd" = "yes" ] ; then
1255 echo "#define ENOTSUP 4096" >> $config_h
1256fi
1257
bellard83fb7ad2004-07-05 21:25:26 +00001258if test "$darwin" = "yes" ; then
1259 echo "CONFIG_DARWIN=yes" >> $config_mak
1260 echo "#define CONFIG_DARWIN 1" >> $config_h
1261fi
malcb29fe3e2008-11-18 01:42:22 +00001262
1263if test "$aix" = "yes" ; then
1264 echo "CONFIG_AIX=yes" >> $config_mak
1265 echo "#define CONFIG_AIX 1" >> $config_h
1266fi
1267
bellardec530c82006-04-25 22:36:06 +00001268if test "$solaris" = "yes" ; then
1269 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001270 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001271 if test "$needs_libsunmath" = "yes" ; then
1272 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1273 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1274 fi
bellardec530c82006-04-25 22:36:06 +00001275fi
blueswir131422552007-04-16 18:27:06 +00001276if test -n "$sparc_cpu"; then
1277 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1278 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1279fi
bellard67b915a2004-03-31 23:37:16 +00001280if test "$gdbstub" = "yes" ; then
1281 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1282 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1283fi
bellard97a847b2003-08-10 21:36:04 +00001284if test "$gprof" = "yes" ; then
1285 echo "TARGET_GPROF=yes" >> $config_mak
1286 echo "#define HAVE_GPROF 1" >> $config_h
1287fi
1288if test "$static" = "yes" ; then
1289 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001290 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001291fi
bellard05c2a3e2006-02-08 22:39:17 +00001292if test $profiler = "yes" ; then
1293 echo "#define CONFIG_PROFILER 1" >> $config_h
1294fi
bellardc20709a2004-04-21 23:27:19 +00001295if test "$slirp" = "yes" ; then
1296 echo "CONFIG_SLIRP=yes" >> $config_mak
1297 echo "#define CONFIG_SLIRP 1" >> $config_h
1298fi
ths8a16d272008-07-19 09:56:24 +00001299if test "$vde" = "yes" ; then
1300 echo "CONFIG_VDE=yes" >> $config_mak
1301 echo "#define CONFIG_VDE 1" >> $config_h
1302 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1303fi
malc0c58ac12008-06-25 21:04:05 +00001304for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001305 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001306 echo "$def=yes" >> $config_mak
1307 echo "#define $def 1" >> $config_h
1308done
1309echo "#define AUDIO_DRIVERS \\" >> $config_h
1310for drv in $audio_drv_list; do
1311 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001312 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001313 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001314 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001315 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1316 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001317 elif test "$drv" = "oss"; then
1318 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001319 fi
1320done
1321echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001322if test "$mixemu" = "yes" ; then
1323 echo "CONFIG_MIXEMU=yes" >> $config_mak
1324 echo "#define CONFIG_MIXEMU 1" >> $config_h
1325fi
ths8d5d2d42007-08-25 01:37:51 +00001326if test "$vnc_tls" = "yes" ; then
1327 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1328 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1329 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1330 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1331fi
pbrookb1a550a2006-04-16 13:28:56 +00001332qemu_version=`head $source_path/VERSION`
1333echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001334echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001335
1336echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001337if [ "$source_path_used" = "yes" ]; then
1338 echo "VPATH=$source_path" >> $config_mak
1339fi
bellard97a847b2003-08-10 21:36:04 +00001340echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001341if [ "$build_docs" = "yes" ] ; then
1342 echo "BUILD_DOCS=yes" >> $config_mak
1343fi
bellard49ecc3f2007-11-07 19:25:15 +00001344if test "$static" = "yes"; then
1345 sdl1=$sdl_static
1346else
1347 sdl1=$sdl
1348fi
1349if test "$sdl1" = "yes" ; then
1350 echo "#define CONFIG_SDL 1" >> $config_h
1351 echo "CONFIG_SDL=yes" >> $config_mak
1352 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1353 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1354 else
1355 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1356 fi
1357 if [ "${aa}" = "yes" ] ; then
1358 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1359 else
1360 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1361 fi
1362fi
1363if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001364 echo "#define CONFIG_COCOA 1" >> $config_h
1365 echo "CONFIG_COCOA=yes" >> $config_mak
1366fi
1367if test "$curses" = "yes" ; then
1368 echo "#define CONFIG_CURSES 1" >> $config_h
1369 echo "CONFIG_CURSES=yes" >> $config_mak
1370 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001371fi
aurel322e4d9fb2008-04-08 06:01:02 +00001372if test "$brlapi" = "yes" ; then
1373 echo "CONFIG_BRLAPI=yes" >> $config_mak
1374 echo "#define CONFIG_BRLAPI 1" >> $config_h
1375 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1376fi
balrogfb599c92008-09-28 23:49:55 +00001377if test "$bluez" = "yes" ; then
1378 echo "CONFIG_BLUEZ=yes" >> $config_mak
1379 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1380 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1381 echo "#define CONFIG_BLUEZ 1" >> $config_h
1382fi
blueswir1414f0da2008-08-15 18:20:52 +00001383if test "$aio" = "yes" ; then
1384 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001385 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001386fi
ths77755342008-11-27 15:45:16 +00001387if test "$blobs" = "yes" ; then
1388 echo "INSTALL_BLOBS=yes" >> $config_mak
1389fi
aliguoribf9298b2008-12-05 20:05:26 +00001390if test "$iovec" = "yes" ; then
1391 echo "#define HAVE_IOVEC 1" >> $config_h
1392fi
aurel32f652e6a2008-12-16 10:43:48 +00001393if test "$fdt" = "yes" ; then
1394 echo "#define HAVE_FDT 1" >> $config_h
1395 echo "FDT_LIBS=-lfdt" >> $config_mak
1396fi
bellard97a847b2003-08-10 21:36:04 +00001397
bellard83fb7ad2004-07-05 21:25:26 +00001398# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001399if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001400 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001401 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001402 echo "#define _BSD 1" >> $config_h
1403fi
1404
pbrookc5937222006-05-14 11:30:38 +00001405echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1406
blueswir168063642008-11-22 21:03:55 +00001407# USB host support
1408case "$usb" in
1409linux)
1410 echo "HOST_USB=linux" >> $config_mak
1411;;
1412bsd)
1413 echo "HOST_USB=bsd" >> $config_mak
1414;;
1415*)
1416 echo "HOST_USB=stub" >> $config_mak
1417;;
1418esac
1419
pbrookc39e3332007-09-22 16:49:14 +00001420tools=
1421if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1422 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001423 if [ "$linux" = "yes" ] ; then
1424 tools="qemu-nbd\$(EXESUF) $tools"
1425 fi
pbrookc39e3332007-09-22 16:49:14 +00001426fi
1427echo "TOOLS=$tools" >> $config_mak
1428
ths15d9ca02007-07-31 23:07:32 +00001429test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1430
bellard1d14ffa2005-10-30 18:58:22 +00001431for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001432target_dir="$target"
1433config_mak=$target_dir/config.mak
1434config_h=$target_dir/config.h
1435target_cpu=`echo $target | cut -d '-' -f 1`
1436target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001437[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001438[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1439[ "$target_cpu" = "mips" ] && target_bigendian=yes
1440[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1441[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001442[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001443[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001444[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001445[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001446[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001447[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1448[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1449[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001450target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001451target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001452target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001453target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001454target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001455case "$target" in
1456 ${target_cpu}-softmmu)
1457 target_softmmu="yes"
1458 ;;
1459 ${target_cpu}-linux-user)
1460 target_user_only="yes"
1461 target_linux_user="yes"
1462 ;;
1463 ${target_cpu}-darwin-user)
1464 target_user_only="yes"
1465 target_darwin_user="yes"
1466 ;;
blueswir184778502008-10-26 20:33:16 +00001467 ${target_cpu}-bsd-user)
1468 target_user_only="yes"
1469 target_bsd_user="yes"
1470 ;;
pbrook9e407a82007-05-26 16:38:53 +00001471 *)
1472 echo "ERROR: Target '$target' not recognised"
1473 exit 1
1474 ;;
1475esac
ths831b7822007-01-18 20:06:33 +00001476
bellard97ccc682005-07-02 13:32:17 +00001477if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +00001478 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +00001479 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +00001480 echo "To build QEMU without graphical output configure with --disable-gfx-check"
balrog4d3b6f62008-02-10 16:33:14 +00001481 echo "Note that this will disable all output from the virtual graphics card"
1482 echo "except through VNC or curses."
bellard97ccc682005-07-02 13:32:17 +00001483 exit 1;
1484fi
1485
bellard7c1f25b2004-04-22 00:02:08 +00001486#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001487
ths15d9ca02007-07-31 23:07:32 +00001488test -f $config_h && mv $config_h ${config_h}~
1489
bellard97a847b2003-08-10 21:36:04 +00001490mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001491mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001492mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001493if 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 +00001494 mkdir -p $target_dir/nwfpe
1495fi
1496
bellardec530c82006-04-25 22:36:06 +00001497#
1498# don't use ln -sf as not all "ln -sf" over write the file/link
1499#
1500rm -f $target_dir/Makefile
1501ln -s $source_path/Makefile.target $target_dir/Makefile
1502
bellard97a847b2003-08-10 21:36:04 +00001503
1504echo "# Automatically generated by configure - do not modify" > $config_mak
1505echo "/* Automatically generated by configure - do not modify */" > $config_h
1506
1507
1508echo "include ../config-host.mak" >> $config_mak
1509echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001510
pbrooke5fe0c52006-06-11 13:32:59 +00001511bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001512elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001513target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001514interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1515echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001516gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001517
aliguori5985ece2008-11-05 19:59:25 +00001518# Make sure the target and host cpus are compatible
1519if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
aurel32d76d1652008-12-16 10:43:58 +00001520 \( "$target_cpu" = "ppcemb" -a "$cpu" = "powerpc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001521 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1522 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001523 kvm="no"
1524fi
1525# Disable KVM for linux-user
1526if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1527 kvm="no"
1528fi
1529
aurel322408a522008-04-20 20:19:44 +00001530case "$target_cpu" in
1531 i386)
1532 echo "TARGET_ARCH=i386" >> $config_mak
1533 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1534 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001535 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001536 then
1537 echo "#define USE_KQEMU 1" >> $config_h
1538 fi
aliguori7ba1e612008-11-05 16:04:33 +00001539 if test "$kvm" = "yes" ; then
1540 echo "CONFIG_KVM=yes" >> $config_mak
1541 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001542 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001543 fi
aurel322408a522008-04-20 20:19:44 +00001544 ;;
1545 x86_64)
1546 echo "TARGET_ARCH=x86_64" >> $config_mak
1547 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1548 echo "#define TARGET_I386 1" >> $config_h
1549 echo "#define TARGET_X86_64 1" >> $config_h
1550 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1551 then
1552 echo "#define USE_KQEMU 1" >> $config_h
1553 fi
aliguori7ba1e612008-11-05 16:04:33 +00001554 if test "$kvm" = "yes" ; then
1555 echo "CONFIG_KVM=yes" >> $config_mak
1556 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1557 echo "#define CONFIG_KVM 1" >> $config_h
1558 fi
aurel322408a522008-04-20 20:19:44 +00001559 ;;
1560 alpha)
1561 echo "TARGET_ARCH=alpha" >> $config_mak
1562 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1563 echo "#define TARGET_ALPHA 1" >> $config_h
1564 ;;
1565 arm|armeb)
1566 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001567 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1568 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001569 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001570 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001571 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00001572 ;;
1573 cris)
1574 echo "TARGET_ARCH=cris" >> $config_mak
1575 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1576 echo "#define TARGET_CRIS 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001577 ;;
1578 m68k)
1579 echo "TARGET_ARCH=m68k" >> $config_mak
1580 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1581 echo "#define TARGET_M68K 1" >> $config_h
1582 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001583 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00001584 ;;
1585 mips|mipsel)
1586 echo "TARGET_ARCH=mips" >> $config_mak
1587 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1588 echo "#define TARGET_MIPS 1" >> $config_h
1589 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1590 ;;
1591 mipsn32|mipsn32el)
1592 echo "TARGET_ARCH=mipsn32" >> $config_mak
1593 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1594 echo "#define TARGET_MIPS 1" >> $config_h
1595 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1596 ;;
1597 mips64|mips64el)
1598 echo "TARGET_ARCH=mips64" >> $config_mak
1599 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1600 echo "#define TARGET_MIPS 1" >> $config_h
1601 echo "#define TARGET_MIPS64 1" >> $config_h
1602 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1603 ;;
1604 ppc)
1605 echo "TARGET_ARCH=ppc" >> $config_mak
1606 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1607 echo "#define TARGET_PPC 1" >> $config_h
1608 ;;
1609 ppcemb)
1610 echo "TARGET_ARCH=ppcemb" >> $config_mak
1611 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1612 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1613 echo "#define TARGET_PPC 1" >> $config_h
1614 echo "#define TARGET_PPCEMB 1" >> $config_h
aurel32d76d1652008-12-16 10:43:58 +00001615 if test "$kvm" = "yes" ; then
1616 echo "CONFIG_KVM=yes" >> $config_mak
1617 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1618 echo "#define CONFIG_KVM 1" >> $config_h
1619 fi
aurel322408a522008-04-20 20:19:44 +00001620 ;;
1621 ppc64)
1622 echo "TARGET_ARCH=ppc64" >> $config_mak
1623 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1624 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1625 echo "#define TARGET_PPC 1" >> $config_h
1626 echo "#define TARGET_PPC64 1" >> $config_h
1627 ;;
1628 ppc64abi32)
1629 echo "TARGET_ARCH=ppc64" >> $config_mak
1630 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1631 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1632 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1633 echo "#define TARGET_PPC 1" >> $config_h
1634 echo "#define TARGET_PPC64 1" >> $config_h
1635 echo "#define TARGET_ABI32 1" >> $config_h
1636 ;;
1637 sh4|sh4eb)
1638 echo "TARGET_ARCH=sh4" >> $config_mak
1639 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1640 echo "#define TARGET_SH4 1" >> $config_h
1641 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001642 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001643 ;;
1644 sparc)
1645 echo "TARGET_ARCH=sparc" >> $config_mak
1646 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1647 echo "#define TARGET_SPARC 1" >> $config_h
1648 ;;
1649 sparc64)
1650 echo "TARGET_ARCH=sparc64" >> $config_mak
1651 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1652 echo "#define TARGET_SPARC 1" >> $config_h
1653 echo "#define TARGET_SPARC64 1" >> $config_h
1654 elfload32="yes"
1655 ;;
1656 sparc32plus)
1657 echo "TARGET_ARCH=sparc64" >> $config_mak
1658 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1659 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1660 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1661 echo "#define TARGET_SPARC 1" >> $config_h
1662 echo "#define TARGET_SPARC64 1" >> $config_h
1663 echo "#define TARGET_ABI32 1" >> $config_h
1664 ;;
1665 *)
1666 echo "Unsupported target CPU"
1667 exit 1
1668 ;;
1669esac
bellardde83cd02003-06-15 20:25:43 +00001670if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001671 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1672 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1673fi
1674if test "$target_softmmu" = "yes" ; then
1675 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1676 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00001677fi
bellard997344f2003-10-27 21:10:39 +00001678if test "$target_user_only" = "yes" ; then
1679 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1680 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1681fi
ths831b7822007-01-18 20:06:33 +00001682if test "$target_linux_user" = "yes" ; then
1683 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1684 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1685fi
1686if test "$target_darwin_user" = "yes" ; then
1687 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1688 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1689fi
pbrook56aebc82008-10-11 17:55:29 +00001690list=""
1691if test ! -z "$gdb_xml_files" ; then
1692 for x in $gdb_xml_files; do
1693 list="$list $source_path/gdb-xml/$x"
1694 done
1695fi
1696echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00001697
aurel320938cda2008-04-11 21:36:06 +00001698if test "$target_cpu" = "arm" \
1699 -o "$target_cpu" = "armeb" \
1700 -o "$target_cpu" = "m68k" \
1701 -o "$target_cpu" = "mips" \
1702 -o "$target_cpu" = "mipsel" \
1703 -o "$target_cpu" = "mipsn32" \
1704 -o "$target_cpu" = "mipsn32el" \
1705 -o "$target_cpu" = "mips64" \
1706 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00001707 -o "$target_cpu" = "ppc" \
1708 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00001709 -o "$target_cpu" = "ppc64abi32" \
1710 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00001711 -o "$target_cpu" = "sparc" \
1712 -o "$target_cpu" = "sparc64" \
1713 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00001714 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1715 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1716fi
pbrooke5fe0c52006-06-11 13:32:59 +00001717if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1718 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1719 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1720fi
pbrookbd0c5662008-05-29 14:34:11 +00001721if test "$target_user_only" = "yes" \
1722 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1723 echo "#define USE_NPTL 1" >> $config_h
1724fi
blueswir1cb33da52007-10-09 16:34:29 +00001725# 32 bit ELF loader in addition to native 64 bit loader?
1726if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1727 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1728 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1729fi
blueswir184778502008-10-26 20:33:16 +00001730if test "$target_bsd_user" = "yes" ; then
1731 echo "CONFIG_BSD_USER=yes" >> $config_mak
1732 echo "#define CONFIG_BSD_USER 1" >> $config_h
1733fi
bellard5b0753e2005-03-01 21:37:28 +00001734
ths15d9ca02007-07-31 23:07:32 +00001735test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1736
bellard97a847b2003-08-10 21:36:04 +00001737done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00001738
1739# build tree in object directory if source path is different from current one
1740if test "$source_path_used" = "yes" ; then
bellard49ecc3f2007-11-07 19:25:15 +00001741 DIRS="tests tests/cris slirp audio"
bellard7d132992003-03-06 23:23:54 +00001742 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00001743 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00001744 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00001745 for dir in $DIRS ; do
1746 mkdir -p $dir
1747 done
bellardec530c82006-04-25 22:36:06 +00001748 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00001749 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00001750 rm -f $f
1751 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00001752 done
1753fi