blob: 1e36cf4d3939a28e30f89d022c4b768440efc15f [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"
blueswir13aa9bd62008-12-31 16:55:26 +000082elif check_define __sparc__ ; then
83 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
84 # They must be specified using --sparc_cpu
85 if check_define __arch64__ ; then
86 cpu="sparc64"
87 else
88 cpu="sparc"
89 fi
aliguoriac0df512008-12-29 17:14:15 +000090else
91 cpu=`test $(uname -s) = AIX && uname -p || uname -m`
92fi
93
bellard5327cf42005-01-10 23:18:50 +000094target_list=""
bellard7d132992003-03-06 23:23:54 +000095case "$cpu" in
96 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +000097 cpu="i386"
bellard7d132992003-03-06 23:23:54 +000098 ;;
aurel32aaa5fa12008-04-11 22:04:22 +000099 x86_64|amd64)
100 cpu="x86_64"
101 ;;
102 alpha)
103 cpu="alpha"
104 ;;
bellardba680552005-03-13 09:49:52 +0000105 armv*b)
bellard808c4952004-12-19 23:33:47 +0000106 cpu="armv4b"
107 ;;
bellardba680552005-03-13 09:49:52 +0000108 armv*l)
bellard7d132992003-03-06 23:23:54 +0000109 cpu="armv4l"
110 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000111 cris)
112 cpu="cris"
bellard7d132992003-03-06 23:23:54 +0000113 ;;
aurel32f54b3f92008-04-12 20:14:54 +0000114 parisc|parisc64)
115 cpu="hppa"
116 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000117 ia64)
118 cpu="ia64"
119 ;;
120 m68k)
121 cpu="m68k"
bellard7d132992003-03-06 23:23:54 +0000122 ;;
123 mips)
124 cpu="mips"
125 ;;
thsfbe4f652007-04-01 11:16:48 +0000126 mips64)
127 cpu="mips64"
128 ;;
malcb29fe3e2008-11-18 01:42:22 +0000129 "Power Macintosh"|ppc|ppc64|powerpc)
aurel32aaa5fa12008-04-11 22:04:22 +0000130 cpu="powerpc"
thse7daa602007-10-08 13:38:27 +0000131 ;;
ths0e7b8a92007-08-01 00:09:31 +0000132 s390*)
bellardfb3e5842003-03-29 17:32:36 +0000133 cpu="s390"
134 ;;
blueswir131422552007-04-16 18:27:06 +0000135 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000136 cpu="sparc"
137 ;;
138 sparc64)
139 cpu="sparc64"
140 ;;
bellard7d132992003-03-06 23:23:54 +0000141 *)
142 cpu="unknown"
143 ;;
144esac
145gprof="no"
aliguori03b4fe72008-10-07 19:16:17 +0000146sparse="no"
bellard7d132992003-03-06 23:23:54 +0000147bigendian="no"
bellard67b915a2004-03-31 23:37:16 +0000148mingw32="no"
149EXESUF=""
150gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +0000151slirp="yes"
aliguorie0e6c8c02008-07-23 18:14:33 +0000152vde="yes"
bellard102a52e2004-11-14 19:57:29 +0000153fmod_lib=""
154fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +0000155oss_lib=""
ths8d5d2d42007-08-25 01:37:51 +0000156vnc_tls="yes"
pbrookb1a550a2006-04-16 13:28:56 +0000157bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000158linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000159solaris="no"
bellardc9ec1fe2005-02-10 21:55:30 +0000160kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +0000161profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000162cocoa="no"
bellard97ccc682005-07-02 13:32:17 +0000163check_gfx="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000164softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000165linux_user="no"
166darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000167bsd_user="no"
pbrookcc8ae6d2006-04-23 17:57:59 +0000168build_docs="no"
pbrookc5937222006-05-14 11:30:38 +0000169uname_release=""
balrog4d3b6f62008-02-10 16:33:14 +0000170curses="yes"
blueswir1414f0da2008-08-15 18:20:52 +0000171aio="yes"
pbrookbd0c5662008-05-29 14:34:11 +0000172nptl="yes"
malc8ff9cbf2008-06-23 18:33:30 +0000173mixemu="no"
balrogfb599c92008-09-28 23:49:55 +0000174bluez="yes"
aliguori7ba1e612008-11-05 16:04:33 +0000175kvm="yes"
aliguorieac30262008-11-05 16:28:56 +0000176kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000177aix="no"
ths77755342008-11-27 15:45:16 +0000178blobs="yes"
aurel32f652e6a2008-12-16 10:43:48 +0000179fdt="yes"
bellard7d132992003-03-06 23:23:54 +0000180
181# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000182if check_define __linux__ ; then
183 targetos="Linux"
184elif check_define _WIN32 ; then
185 targetos='MINGW32'
186else
187 targetos=`uname -s`
188fi
bellard7d132992003-03-06 23:23:54 +0000189case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000190CYGWIN*)
191mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000192OS_CFLAGS="-mno-cygwin"
thsdb8d7dd2007-07-12 09:29:18 +0000193if [ "$cpu" = "i386" ] ; then
194 kqemu="yes"
195fi
malcc2de5c92008-06-28 19:13:06 +0000196audio_possible_drivers="sdl"
bellardc326e0a2005-04-23 18:30:28 +0000197;;
bellard67b915a2004-03-31 23:37:16 +0000198MINGW32*)
199mingw32="yes"
thsdb8d7dd2007-07-12 09:29:18 +0000200if [ "$cpu" = "i386" ] ; then
201 kqemu="yes"
202fi
malcc2de5c92008-06-28 19:13:06 +0000203audio_possible_drivers="dsound sdl fmod"
bellard67b915a2004-03-31 23:37:16 +0000204;;
ths5c40d2b2007-06-23 16:03:36 +0000205GNU/kFreeBSD)
malc0c58ac12008-06-25 21:04:05 +0000206audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000207audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000208if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
209 kqemu="yes"
210fi
211;;
bellard7d3505c2004-05-12 19:32:15 +0000212FreeBSD)
213bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000214audio_drv_list="oss"
aurel32f34af522008-08-21 23:03:15 +0000215audio_possible_drivers="oss sdl esd pa"
bellarde99f9062005-07-28 21:45:38 +0000216if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000217 kqemu="yes"
218fi
bellard7d3505c2004-05-12 19:32:15 +0000219;;
220NetBSD)
221bsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000222audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000223audio_possible_drivers="oss sdl esd"
blueswir18ef92a82008-11-22 20:24:29 +0000224oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000225;;
226OpenBSD)
227bsd="yes"
blueswir1128ab2f2008-08-15 18:33:42 +0000228openbsd="yes"
malc0c58ac12008-06-25 21:04:05 +0000229audio_drv_list="oss"
malcc2de5c92008-06-28 19:13:06 +0000230audio_possible_drivers="oss sdl esd"
blueswir12f6a1ab2008-08-21 18:00:53 +0000231oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000232;;
bellard83fb7ad2004-07-05 21:25:26 +0000233Darwin)
234bsd="yes"
235darwin="yes"
ths831b7822007-01-18 20:06:33 +0000236darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000237cocoa="yes"
malc0c58ac12008-06-25 21:04:05 +0000238audio_drv_list="coreaudio"
malcc2de5c92008-06-28 19:13:06 +0000239audio_possible_drivers="coreaudio sdl fmod"
ths6f30fa82007-01-05 01:00:47 +0000240OS_CFLAGS="-mdynamic-no-pic"
thsc2c59c32008-01-08 00:00:20 +0000241OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
bellard83fb7ad2004-07-05 21:25:26 +0000242;;
bellardec530c82006-04-25 22:36:06 +0000243SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000244 solaris="yes"
245 make="gmake"
246 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000247 needs_libsunmath="no"
thsc2b84fa2007-02-10 23:21:21 +0000248 solarisrev=`uname -r | cut -f2 -d.`
thsef18c882007-09-16 22:12:39 +0000249 # have to select again, because `uname -m` returns i86pc
250 # even on an x86_64 box.
251 solariscpu=`isainfo -k`
252 if test "${solariscpu}" = "amd64" ; then
253 cpu="x86_64"
254 fi
thsc2b84fa2007-02-10 23:21:21 +0000255 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000256 if test "$solarisrev" -le 9 ; then
257 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
258 needs_libsunmath="yes"
259 else
260 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
261 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
262 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
263 echo "Studio 11 can be downloaded from www.sun.com."
264 exit 1
265 fi
266 fi
267 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000268 kqemu="yes"
269 fi
ths86b2bd92007-02-11 00:31:33 +0000270 fi
ths6b4d2ba2007-05-13 18:02:43 +0000271 if test -f /usr/include/sys/soundcard.h ; then
malc0c58ac12008-06-25 21:04:05 +0000272 audio_drv_list="oss"
ths6b4d2ba2007-05-13 18:02:43 +0000273 fi
malcc2de5c92008-06-28 19:13:06 +0000274 audio_possible_drivers="oss sdl"
ths86b2bd92007-02-11 00:31:33 +0000275;;
malcb29fe3e2008-11-18 01:42:22 +0000276AIX)
277aix="yes"
278make="gmake"
279;;
bellard1d14ffa2005-10-30 18:58:22 +0000280*)
malc0c58ac12008-06-25 21:04:05 +0000281audio_drv_list="oss"
malcb8e59f12008-07-02 21:03:08 +0000282audio_possible_drivers="oss alsa sdl esd pa"
bellard5327cf42005-01-10 23:18:50 +0000283linux="yes"
ths831b7822007-01-18 20:06:33 +0000284linux_user="yes"
blueswir168063642008-11-22 21:03:55 +0000285usb="linux"
bellard07f4ddb2005-04-23 17:44:28 +0000286if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000287 kqemu="yes"
malcc2de5c92008-06-28 19:13:06 +0000288 audio_possible_drivers="$audio_possible_drivers fmod"
bellardc9ec1fe2005-02-10 21:55:30 +0000289fi
bellardfb065182004-11-09 23:09:44 +0000290;;
bellard7d132992003-03-06 23:23:54 +0000291esac
292
bellard7d3505c2004-05-12 19:32:15 +0000293if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000294 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000295 make="gmake"
blueswir168063642008-11-22 21:03:55 +0000296 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000297 fi
blueswir184778502008-10-26 20:33:16 +0000298 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000299fi
300
bellard7d132992003-03-06 23:23:54 +0000301# find source path
pbrookad064842006-04-16 12:41:07 +0000302source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000303source_path_used="no"
304workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000305if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000306 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000307else
308 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000309fi
pbrook724db112008-02-03 19:20:13 +0000310[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000311
bellard85aa5182007-11-11 20:17:03 +0000312werror="no"
bellard0d1e2392007-11-11 20:24:30 +0000313# generate compile errors on warnings for development builds
314#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
315#werror="yes";
316#fi
bellard85aa5182007-11-11 20:17:03 +0000317
bellard7d132992003-03-06 23:23:54 +0000318for opt do
pbrooka46e4032006-04-29 23:05:22 +0000319 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000320 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000321 --help|-h) show_help=yes
322 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000323 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000324 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000325 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000326 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000327 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000328 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000329 ;;
aliguoriac0df512008-12-29 17:14:15 +0000330 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000331 ;;
aliguoriac0df512008-12-29 17:14:15 +0000332 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000333 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000334 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000335 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000336 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000337 ;;
pbrook6a882642006-04-17 13:57:12 +0000338 --install=*) install="$optarg"
339 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000340 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000341 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000342 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000343 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000344 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000345 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000346 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000347 ;;
bellard7d132992003-03-06 23:23:54 +0000348 --enable-gprof) gprof="yes"
349 ;;
bellard43ce4df2003-06-09 19:53:12 +0000350 --static) static="yes"
351 ;;
bellard97a847b2003-08-10 21:36:04 +0000352 --disable-sdl) sdl="no"
353 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000354 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000355 ;;
malcc2de5c92008-06-28 19:13:06 +0000356 --fmod-inc=*) fmod_inc="$optarg"
357 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000358 --oss-lib=*) oss_lib="$optarg"
359 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000360 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000361 ;;
362 --audio-drv-list=*) audio_drv_list="$optarg"
363 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000364 --enable-sparse) sparse="yes"
365 ;;
366 --disable-sparse) sparse="no"
367 ;;
ths8d5d2d42007-08-25 01:37:51 +0000368 --disable-vnc-tls) vnc_tls="no"
369 ;;
bellard443f1372004-06-04 11:13:20 +0000370 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000371 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000372 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000373 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000374 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000375 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000376 --disable-brlapi) brlapi="no"
377 ;;
balrogfb599c92008-09-28 23:49:55 +0000378 --disable-bluez) bluez="no"
379 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000380 --disable-kvm) kvm="no"
381 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000382 --enable-profiler) profiler="yes"
383 ;;
malcc2de5c92008-06-28 19:13:06 +0000384 --enable-cocoa)
385 cocoa="yes" ;
386 sdl="no" ;
387 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000388 ;;
bellard97ccc682005-07-02 13:32:17 +0000389 --disable-gfx-check) check_gfx="no"
390 ;;
pbrookcad25d62006-03-19 16:31:11 +0000391 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000392 ;;
pbrookcad25d62006-03-19 16:31:11 +0000393 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000394 ;;
ths831b7822007-01-18 20:06:33 +0000395 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000396 ;;
ths831b7822007-01-18 20:06:33 +0000397 --enable-linux-user) linux_user="yes"
398 ;;
399 --disable-darwin-user) darwin_user="no"
400 ;;
401 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000402 ;;
blueswir184778502008-10-26 20:33:16 +0000403 --disable-bsd-user) bsd_user="no"
404 ;;
405 --enable-bsd-user) bsd_user="yes"
406 ;;
pbrookc5937222006-05-14 11:30:38 +0000407 --enable-uname-release=*) uname_release="$optarg"
408 ;;
blueswir131422552007-04-16 18:27:06 +0000409 --sparc_cpu=*)
410 sparc_cpu="$optarg"
411 case $sparc_cpu in
412 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
413 target_cpu="sparc"; cpu="sparc" ;;
414 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
415 target_cpu="sparc"; cpu="sparc" ;;
416 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
417 target_cpu="sparc64"; cpu="sparc64" ;;
418 *) echo "undefined SPARC architecture. Exiting";exit 1;;
419 esac
420 ;;
bellard85aa5182007-11-11 20:17:03 +0000421 --enable-werror) werror="yes"
422 ;;
423 --disable-werror) werror="no"
424 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000425 --disable-curses) curses="no"
426 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000427 --disable-nptl) nptl="no"
428 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000429 --enable-mixemu) mixemu="yes"
430 ;;
blueswir1414f0da2008-08-15 18:20:52 +0000431 --disable-aio) aio="no"
432 ;;
ths77755342008-11-27 15:45:16 +0000433 --disable-blobs) blobs="no"
434 ;;
aliguorieac30262008-11-05 16:28:56 +0000435 --kerneldir=*) kerneldir="$optarg"
436 ;;
balrog7f1559c2007-11-17 10:24:32 +0000437 *) echo "ERROR: unknown option $opt"; show_help="yes"
438 ;;
bellard7d132992003-03-06 23:23:54 +0000439 esac
440done
441
ths6f30fa82007-01-05 01:00:47 +0000442# default flags for all hosts
blueswir1ac41a622008-09-14 06:46:31 +0000443CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
blueswir1e0e36fe2008-12-07 19:16:27 +0000444CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
ths6f30fa82007-01-05 01:00:47 +0000445LDFLAGS="$LDFLAGS -g"
bellard85aa5182007-11-11 20:17:03 +0000446if test "$werror" = "yes" ; then
447CFLAGS="$CFLAGS -Werror"
448fi
ths6f30fa82007-01-05 01:00:47 +0000449
blueswir1d2c7c9b2008-11-01 14:50:20 +0000450if test "$solaris" = "no" ; then
451 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
452 LDFLAGS="$LDFLAGS -Wl,--warn-common"
453 fi
blueswir149237ac2008-09-17 19:05:19 +0000454fi
455
blueswir131422552007-04-16 18:27:06 +0000456#
457# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
458# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
459#
bellard40293e52008-01-31 11:32:10 +0000460case "$cpu" in
blueswir131422552007-04-16 18:27:06 +0000461 sparc) if test -z "$sparc_cpu" ; then
462 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
463 ARCH_LDFLAGS="-m32"
464 else
465 ARCH_CFLAGS="${SP_CFLAGS}"
466 ARCH_LDFLAGS="${SP_LDFLAGS}"
467 fi
468 ;;
469 sparc64) if test -z "$sparc_cpu" ; then
470 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
471 ARCH_LDFLAGS="-m64"
472 else
473 ARCH_CFLAGS="${SP_CFLAGS}"
474 ARCH_LDFLAGS="${SP_LDFLAGS}"
475 fi
476 ;;
ths76d83bd2007-11-18 21:22:10 +0000477 s390)
478 ARCH_CFLAGS="-march=z900"
479 ;;
bellard40293e52008-01-31 11:32:10 +0000480 i386)
481 ARCH_CFLAGS="-m32"
482 ARCH_LDFLAGS="-m32"
483 ;;
484 x86_64)
485 ARCH_CFLAGS="-m64"
486 ARCH_LDFLAGS="-m64"
487 ;;
blueswir131422552007-04-16 18:27:06 +0000488esac
489
pbrookaf5db582006-04-08 14:26:41 +0000490if test x"$show_help" = x"yes" ; then
491cat << EOF
492
493Usage: configure [options]
494Options: [defaults in brackets after descriptions]
495
496EOF
497echo "Standard options:"
498echo " --help print this message"
499echo " --prefix=PREFIX install in PREFIX [$prefix]"
500echo " --interp-prefix=PREFIX where to find shared libraries, etc."
501echo " use %M for cpu name [$interp_prefix]"
502echo " --target-list=LIST set target list [$target_list]"
503echo ""
504echo "kqemu kernel acceleration support:"
505echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000506echo ""
507echo "Advanced options (experts only):"
508echo " --source-path=PATH path of source code [$source_path]"
509echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
510echo " --cc=CC use C compiler CC [$cc]"
511echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
512echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000513echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000514echo " --static enable static build [$static]"
aliguori890b1652008-10-07 21:22:41 +0000515echo " --enable-sparse enable sparse checker"
516echo " --disable-sparse disable sparse checker (default)"
bellard85aa5182007-11-11 20:17:03 +0000517echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000518echo " --disable-sdl disable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000519echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000520echo " --audio-drv-list=LIST set audio drivers list:"
521echo " Available drivers: $audio_possible_drivers"
522echo " --audio-card-list=LIST set list of additional emulated audio cards"
523echo " Available cards: ac97 adlib cs4231a gus"
malc8ff9cbf2008-06-23 18:33:30 +0000524echo " --enable-mixemu enable mixer emulation"
aurel322e4d9fb2008-04-08 06:01:02 +0000525echo " --disable-brlapi disable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000526echo " --disable-vnc-tls disable TLS encryption for VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000527echo " --disable-curses disable curses output"
balrogfb599c92008-09-28 23:49:55 +0000528echo " --disable-bluez disable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000529echo " --disable-kvm disable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000530echo " --disable-nptl disable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000531echo " --enable-system enable all system emulation targets"
532echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000533echo " --enable-linux-user enable all linux usermode emulation targets"
534echo " --disable-linux-user disable all linux usermode emulation targets"
535echo " --enable-darwin-user enable all darwin usermode emulation targets"
536echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000537echo " --enable-bsd-user enable all BSD usermode emulation targets"
538echo " --disable-bsd-user disable all BSD usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000539echo " --fmod-lib path to FMOD library"
540echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000541echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000542echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000543echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
aliguorie0e6c8c02008-07-23 18:14:33 +0000544echo " --disable-vde disable support for vde network"
blueswir1414f0da2008-08-15 18:20:52 +0000545echo " --disable-aio disable AIO support"
ths77755342008-11-27 15:45:16 +0000546echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000547echo " --kerneldir=PATH look for kernel includes in PATH"
pbrookaf5db582006-04-08 14:26:41 +0000548echo ""
ths5bf08932006-12-23 00:33:26 +0000549echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000550exit 1
551fi
552
bellard67b915a2004-03-31 23:37:16 +0000553if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000554 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000555 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000556 oss="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000557 linux_user="no"
blueswir184778502008-10-26 20:33:16 +0000558 bsd_user="no"
aliguoricd01b4a2008-08-21 19:25:45 +0000559fi
560
aliguori03b4fe72008-10-07 19:16:17 +0000561if test ! -x "$(which cgcc 2>/dev/null)"; then
562 sparse="no"
563fi
564
bellardec530c82006-04-25 22:36:06 +0000565#
566# Solaris specific configure tool chain decisions
567#
568if test "$solaris" = "yes" ; then
bellardec530c82006-04-25 22:36:06 +0000569 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
570 if test -z "$solinst" ; then
571 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
572 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
573 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
574 exit 1
575 fi
576 if test "$solinst" = "/usr/sbin/install" ; then
577 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
578 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
579 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
580 exit 1
581 fi
bellardec530c82006-04-25 22:36:06 +0000582 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
583 if test -z "$sol_ar" ; then
584 echo "Error: No path includes ar"
585 if test -f /usr/ccs/bin/ar ; then
586 echo "Add /usr/ccs/bin to your path and rerun configure"
587 fi
588 exit 1
589 fi
ths5fafdf22007-09-16 21:08:06 +0000590fi
bellardec530c82006-04-25 22:36:06 +0000591
592
bellard5327cf42005-01-10 23:18:50 +0000593if test -z "$target_list" ; then
594# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000595 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000596 target_list="\
597i386-softmmu \
598x86_64-softmmu \
599arm-softmmu \
600cris-softmmu \
601m68k-softmmu \
602mips-softmmu \
603mipsel-softmmu \
604mips64-softmmu \
605mips64el-softmmu \
606ppc-softmmu \
607ppcemb-softmmu \
608ppc64-softmmu \
609sh4-softmmu \
610sh4eb-softmmu \
611sparc-softmmu \
612"
pbrook0a8e90f2006-03-19 14:54:16 +0000613 fi
bellard5327cf42005-01-10 23:18:50 +0000614# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000615 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000616 target_list="${target_list}\
617i386-linux-user \
618x86_64-linux-user \
619alpha-linux-user \
620arm-linux-user \
621armeb-linux-user \
622cris-linux-user \
623m68k-linux-user \
624mips-linux-user \
625mipsel-linux-user \
626ppc-linux-user \
627ppc64-linux-user \
628ppc64abi32-linux-user \
629sh4-linux-user \
630sh4eb-linux-user \
631sparc-linux-user \
632sparc64-linux-user \
633sparc32plus-linux-user \
634"
ths831b7822007-01-18 20:06:33 +0000635 fi
636# the following are Darwin specific
637 if [ "$darwin_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000638 target_list="$target_list i386-darwin-user ppc-darwin-user"
bellard5327cf42005-01-10 23:18:50 +0000639 fi
blueswir184778502008-10-26 20:33:16 +0000640# the following are BSD specific
641 if [ "$bsd_user" = "yes" ] ; then
642 target_list="${target_list}\
643sparc64-bsd-user \
644"
645 fi
bellard6e20a452005-06-05 15:56:02 +0000646else
pbrookb1a550a2006-04-16 13:28:56 +0000647 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000648fi
pbrook0a8e90f2006-03-19 14:54:16 +0000649if test -z "$target_list" ; then
650 echo "No targets enabled"
651 exit 1
652fi
bellard5327cf42005-01-10 23:18:50 +0000653
bellard7d132992003-03-06 23:23:54 +0000654if test -z "$cross_prefix" ; then
655
656# ---
657# big/little endian test
658cat > $TMPC << EOF
659#include <inttypes.h>
660int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000661 volatile uint32_t i=0x01234567;
662 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000663}
664EOF
665
aurel32178baee2008-12-08 18:11:57 +0000666if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000667$TMPE && bigendian="yes"
668else
669echo big/little test failed
670fi
671
672else
673
674# if cross compiling, cannot launch a program, so make a static guess
aurel320938cda2008-04-11 21:36:06 +0000675if test "$cpu" = "armv4b" \
aurel32f54b3f92008-04-12 20:14:54 +0000676 -o "$cpu" = "hppa" \
aurel320938cda2008-04-11 21:36:06 +0000677 -o "$cpu" = "m68k" \
678 -o "$cpu" = "mips" \
679 -o "$cpu" = "mips64" \
680 -o "$cpu" = "powerpc" \
681 -o "$cpu" = "s390" \
682 -o "$cpu" = "sparc" \
683 -o "$cpu" = "sparc64"; then
bellard7d132992003-03-06 23:23:54 +0000684 bigendian="yes"
685fi
686
687fi
688
bellardb6853692005-06-05 17:10:39 +0000689# host long bits test
690hostlongbits="32"
aurel320938cda2008-04-11 21:36:06 +0000691if test "$cpu" = "x86_64" \
692 -o "$cpu" = "alpha" \
693 -o "$cpu" = "ia64" \
694 -o "$cpu" = "sparc64"; then
bellardb6853692005-06-05 17:10:39 +0000695 hostlongbits="64"
696fi
697
malc810260a2008-07-23 19:17:46 +0000698# ppc specific hostlongbits selection
699if test "$cpu" = "powerpc" ; then
malc9d56d2d2008-09-30 19:44:32 +0000700 if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev/null </dev/null; then
701 grep -q __powerpc64__ $TMPI && hostlongbits=64
malc810260a2008-07-23 19:17:46 +0000702 else
703 echo hostlongbits test failed
malcba69a082008-07-24 17:51:36 +0000704 exit 1
malc810260a2008-07-23 19:17:46 +0000705 fi
706fi
707
bellarde8cd23d2003-06-25 16:08:13 +0000708# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000709cat > $TMPC <<EOF
710int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000711}
712EOF
713
pbrookbd0c5662008-05-29 14:34:11 +0000714# Check host NPTL support
715cat > $TMPC <<EOF
716#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +0000717#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +0000718void foo()
719{
720#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
721#error bork
722#endif
723}
724EOF
725
balrog8c7f7572008-12-15 03:15:36 +0000726if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
pbrookbd0c5662008-05-29 14:34:11 +0000727 :
728else
729 nptl="no"
730fi
731
bellard11d9f692004-04-02 20:55:59 +0000732##########################################
balrogac629222008-10-11 09:56:04 +0000733# zlib check
734
735cat > $TMPC << EOF
736#include <zlib.h>
737int main(void) { zlibVersion(); return 0; }
738EOF
balrog8c7f7572008-12-15 03:15:36 +0000739if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
balrogac629222008-10-11 09:56:04 +0000740 :
741else
742 echo
743 echo "Error: zlib check failed"
744 echo "Make sure to have the zlib libs and headers installed."
745 echo
746 exit 1
747fi
748
749##########################################
bellard11d9f692004-04-02 20:55:59 +0000750# SDL probe
751
752sdl_too_old=no
753
754if test -z "$sdl" ; then
ths069b0bd2007-07-12 00:27:15 +0000755 sdl_config="sdl-config"
756 sdl=no
757 sdl_static=no
bellard11d9f692004-04-02 20:55:59 +0000758
759cat > $TMPC << EOF
760#include <SDL.h>
761#undef main /* We don't want SDL to override our main() */
762int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
763EOF
balrog8c7f7572008-12-15 03:15:36 +0000764 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 +0000765 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
766 if test "$_sdlversion" -lt 121 ; then
767 sdl_too_old=yes
768 else
769 if test "$cocoa" = "no" ; then
770 sdl=yes
771 fi
772 fi
773
774 # static link with sdl ?
775 if test "$sdl" = "yes" ; then
776 aa="no"
777 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
778 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
779 if [ "$aa" = "yes" ] ; then
780 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
ths069b0bd2007-07-12 00:27:15 +0000781 fi
bellard11d9f692004-04-02 20:55:59 +0000782
balrog8c7f7572008-12-15 03:15:36 +0000783 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 +0000784 sdl_static=yes
785 fi
786 fi # static link
787 fi # sdl compile test
bellard11d9f692004-04-02 20:55:59 +0000788else
ths069b0bd2007-07-12 00:27:15 +0000789 # Make sure to disable cocoa if sdl was set
790 if test "$sdl" = "yes" ; then
791 cocoa="no"
malcc2de5c92008-06-28 19:13:06 +0000792 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
ths069b0bd2007-07-12 00:27:15 +0000793 fi
bellarda6e022a2004-04-02 21:55:47 +0000794fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000795
ths8f28f3f2007-01-05 21:25:54 +0000796##########################################
ths8d5d2d42007-08-25 01:37:51 +0000797# VNC TLS detection
798if test "$vnc_tls" = "yes" ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000799cat > $TMPC <<EOF
800#include <gnutls/gnutls.h>
801int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
802EOF
803 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
804 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
805 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000806 $vnc_tls_libs > /dev/null 2> /dev/null ; then
aliguoriae6b5e52008-08-06 16:55:50 +0000807 :
808 else
809 vnc_tls="no"
810 fi
ths8d5d2d42007-08-25 01:37:51 +0000811fi
812
813##########################################
ths8a16d272008-07-19 09:56:24 +0000814# vde libraries probe
815if test "$vde" = "yes" ; then
816 cat > $TMPC << EOF
817#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +0000818int main(void)
819{
820 struct vde_open_args a = {0, 0, 0};
821 vde_open("", "", &a);
822 return 0;
823}
ths8a16d272008-07-19 09:56:24 +0000824EOF
balrog8c7f7572008-12-15 03:15:36 +0000825 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
ths8a16d272008-07-19 09:56:24 +0000826 :
827 else
aliguorie0e6c8c02008-07-23 18:14:33 +0000828 vde="no"
ths8a16d272008-07-19 09:56:24 +0000829 fi
830fi
831
832##########################################
malcc2de5c92008-06-28 19:13:06 +0000833# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +0000834
malcc2de5c92008-06-28 19:13:06 +0000835audio_drv_probe()
836{
837 drv=$1
838 hdr=$2
839 lib=$3
840 exp=$4
841 cfl=$5
842 cat > $TMPC << EOF
843#include <$hdr>
844int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +0000845EOF
balrog8c7f7572008-12-15 03:15:36 +0000846 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
malcc2de5c92008-06-28 19:13:06 +0000847 :
848 else
849 echo
850 echo "Error: $drv check failed"
851 echo "Make sure to have the $drv libs and headers installed."
852 echo
853 exit 1
854 fi
855}
856
malc2fa7d3b2008-07-29 12:58:44 +0000857audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +0000858for drv in $audio_drv_list; do
859 case $drv in
860 alsa)
861 audio_drv_probe $drv alsa/asoundlib.h -lasound \
862 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
863 ;;
864
865 fmod)
866 if test -z $fmod_lib || test -z $fmod_inc; then
867 echo
868 echo "Error: You must specify path to FMOD library and headers"
869 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
870 echo
871 exit 1
872 fi
873 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
874 ;;
875
876 esd)
877 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
878 ;;
malcb8e59f12008-07-02 21:03:08 +0000879
880 pa)
881 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
882 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
883 ;;
884
blueswir12f6a1ab2008-08-21 18:00:53 +0000885 oss|sdl|core|wav|dsound)
886 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
887 ;;
888
malce4c63a62008-07-19 16:15:16 +0000889 *)
malc1c9b2a52008-07-19 16:57:30 +0000890 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +0000891 echo
892 echo "Error: Unknown driver '$drv' selected"
893 echo "Possible drivers are: $audio_possible_drivers"
894 echo
895 exit 1
896 }
897 ;;
malcc2de5c92008-06-28 19:13:06 +0000898 esac
899done
ths8f28f3f2007-01-05 21:25:54 +0000900
balrog4d3b6f62008-02-10 16:33:14 +0000901##########################################
aurel322e4d9fb2008-04-08 06:01:02 +0000902# BrlAPI probe
903
904if test -z "$brlapi" ; then
905 brlapi=no
906cat > $TMPC << EOF
907#include <brlapi.h>
908int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
909EOF
aurel32178baee2008-12-08 18:11:57 +0000910 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
aurel322e4d9fb2008-04-08 06:01:02 +0000911 brlapi=yes
912 fi # brlapi compile test
913fi # -z $brlapi
914
915##########################################
balrog4d3b6f62008-02-10 16:33:14 +0000916# curses probe
917
918if test "$curses" = "yes" ; then
919 curses=no
920 cat > $TMPC << EOF
921#include <curses.h>
922int main(void) { return curses_version(); }
923EOF
aurel32178baee2008-12-08 18:11:57 +0000924 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
balrog4d3b6f62008-02-10 16:33:14 +0000925 curses=yes
926 fi
927fi # test "$curses"
928
blueswir1414f0da2008-08-15 18:20:52 +0000929##########################################
balrogfb599c92008-09-28 23:49:55 +0000930# bluez support probe
931if test "$bluez" = "yes" ; then
932 `pkg-config bluez` || bluez="no"
933fi
934if test "$bluez" = "yes" ; then
balroge820e3f2008-09-30 02:27:44 +0000935 cat > $TMPC << EOF
936#include <bluetooth/bluetooth.h>
937int main(void) { return bt_error(0); }
938EOF
balrogfb599c92008-09-28 23:49:55 +0000939 bluez_cflags=`pkg-config --cflags bluez`
940 bluez_libs=`pkg-config --libs bluez`
balrog17e15922008-10-11 12:00:42 +0000941 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000942 $bluez_libs > /dev/null 2> /dev/null ; then
balroge820e3f2008-09-30 02:27:44 +0000943 :
944 else
945 bluez="no"
946 fi
balrogfb599c92008-09-28 23:49:55 +0000947fi
948
949##########################################
aliguori7ba1e612008-11-05 16:04:33 +0000950# kvm probe
951if test "$kvm" = "yes" ; then
952 cat > $TMPC <<EOF
953#include <linux/kvm.h>
954#if !defined(KVM_API_VERSION) || \
955 KVM_API_VERSION < 12 || \
956 KVM_API_VERSION > 12 || \
957 !defined(KVM_CAP_USER_MEMORY) || \
aliguorid85dc282008-12-09 19:59:09 +0000958 !defined(KVM_CAP_SET_TSS_ADDR) || \
959 !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
aliguori7ba1e612008-11-05 16:04:33 +0000960#error Invalid KVM version
961#endif
962int main(void) { return 0; }
963EOF
aliguorieac30262008-11-05 16:28:56 +0000964 if test "$kerneldir" != "" ; then
965 kvm_cflags=-I"$kerneldir"/include
966 else
967 kvm_cflags=""
968 fi
aliguori7ba1e612008-11-05 16:04:33 +0000969 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
balrog8c7f7572008-12-15 03:15:36 +0000970 > /dev/null 2>/dev/null ; then
aliguori7ba1e612008-11-05 16:04:33 +0000971 :
972 else
973 kvm="no"
974 fi
975fi
976
977##########################################
blueswir1414f0da2008-08-15 18:20:52 +0000978# AIO probe
aliguori3c529d92008-12-12 16:41:40 +0000979AIOLIBS=""
980
blueswir1414f0da2008-08-15 18:20:52 +0000981if test "$aio" = "yes" ; then
982 aio=no
983 cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +0000984#include <pthread.h>
985int main(void) { pthread_mutex_t lock; return 0; }
blueswir1414f0da2008-08-15 18:20:52 +0000986EOF
987 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
988 aio=yes
aliguori3c529d92008-12-12 16:41:40 +0000989 AIOLIBS="-lpthread"
blueswir1414f0da2008-08-15 18:20:52 +0000990 fi
991fi
992
aliguoribf9298b2008-12-05 20:05:26 +0000993##########################################
994# iovec probe
995cat > $TMPC <<EOF
996#include <sys/uio.h>
997int main(void) { struct iovec iov; return 0; }
998EOF
999iovec=no
balrog8c7f7572008-12-15 03:15:36 +00001000if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguoribf9298b2008-12-05 20:05:26 +00001001 iovec=yes
1002fi
1003
aurel32f652e6a2008-12-16 10:43:48 +00001004##########################################
1005# fdt probe
1006if test "$fdt" = "yes" ; then
1007 fdt=no
1008 cat > $TMPC << EOF
1009int main(void) { return 0; }
1010EOF
1011 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1012 fdt=yes
1013 fi
1014fi
1015
pbrookcc8ae6d2006-04-23 17:57:59 +00001016# Check if tools are available to build documentation.
ths6c591862007-05-09 13:55:03 +00001017if [ -x "`which texi2html 2>/dev/null`" ] && \
1018 [ -x "`which pod2man 2>/dev/null`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +00001019 build_docs="yes"
1020fi
1021
aliguorida93a1f2008-12-12 20:02:52 +00001022##########################################
1023# Do we need librt
1024cat > $TMPC <<EOF
1025#include <signal.h>
1026#include <time.h>
1027int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1028EOF
1029
1030rt=no
balrog8c7f7572008-12-15 03:15:36 +00001031if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001032 :
balrog8c7f7572008-12-15 03:15:36 +00001033elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
aliguorida93a1f2008-12-12 20:02:52 +00001034 rt=yes
1035fi
1036
1037if test "$rt" = "yes" ; then
1038 # Hack, we should have a general purpose LIBS for this sort of thing
1039 AIOLIBS="$AIOLIBS -lrt"
1040fi
1041
bellard11d9f692004-04-02 20:55:59 +00001042if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +00001043 if test -z "$prefix" ; then
aliguori17e90972008-10-24 14:11:41 +00001044 prefix="c:\\\\Program Files\\\\Qemu"
pbrook308c3592007-02-27 00:52:01 +00001045 fi
1046 mansuffix=""
1047 datasuffix=""
1048 docsuffix=""
1049 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +00001050else
pbrook308c3592007-02-27 00:52:01 +00001051 if test -z "$prefix" ; then
1052 prefix="/usr/local"
1053 fi
1054 mansuffix="/share/man"
1055 datasuffix="/share/qemu"
1056 docsuffix="/share/doc/qemu"
1057 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +00001058fi
bellard5a671352003-10-01 00:13:48 +00001059
bellard43ce4df2003-06-09 19:53:12 +00001060echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +00001061echo "BIOS directory $prefix$datasuffix"
1062echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +00001063if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +00001064echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +00001065echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00001066fi
bellard5a671352003-10-01 00:13:48 +00001067echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00001068echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00001069echo "Host C compiler $host_cc"
pbrookdb7287e2008-02-03 16:27:13 +00001070echo "ARCH_CFLAGS $ARCH_CFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00001071echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00001072echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00001073echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00001074echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00001075echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +00001076echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00001077echo "sparse enabled $sparse"
bellard05c2a3e2006-02-08 22:39:17 +00001078echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00001079echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00001080echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00001081if test "$darwin" = "yes" ; then
1082 echo "Cocoa support $cocoa"
1083fi
bellard97a847b2003-08-10 21:36:04 +00001084echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +00001085if test "$sdl" != "no" ; then
1086 echo "SDL static link $sdl_static"
1087fi
balrog4d3b6f62008-02-10 16:33:14 +00001088echo "curses support $curses"
bellard67b915a2004-03-31 23:37:16 +00001089echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00001090echo "Audio drivers $audio_drv_list"
1091echo "Extra audio cards $audio_card_list"
malc8ff9cbf2008-06-23 18:33:30 +00001092echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00001093echo "VNC TLS support $vnc_tls"
1094if test "$vnc_tls" = "yes" ; then
1095 echo " TLS CFLAGS $vnc_tls_cflags"
1096 echo " TLS LIBS $vnc_tls_libs"
1097fi
blueswir131422552007-04-16 18:27:06 +00001098if test -n "$sparc_cpu"; then
1099 echo "Target Sparc Arch $sparc_cpu"
1100fi
bellard07f4ddb2005-04-23 17:44:28 +00001101echo "kqemu support $kqemu"
aurel322e4d9fb2008-04-08 06:01:02 +00001102echo "brlapi support $brlapi"
pbrookcc8ae6d2006-04-23 17:57:59 +00001103echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +00001104[ ! -z "$uname_release" ] && \
1105echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00001106echo "NPTL support $nptl"
ths8a16d272008-07-19 09:56:24 +00001107echo "vde support $vde"
blueswir1414f0da2008-08-15 18:20:52 +00001108echo "AIO support $aio"
ths77755342008-11-27 15:45:16 +00001109echo "Install blobs $blobs"
aliguori7ba1e612008-11-05 16:04:33 +00001110echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00001111echo "fdt support $fdt"
bellard67b915a2004-03-31 23:37:16 +00001112
bellard97a847b2003-08-10 21:36:04 +00001113if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00001114echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00001115fi
malcd4742de2008-11-29 22:04:31 +00001116if [ -s $TMPSDLLOG ]; then
ths20b40c62007-07-11 23:39:45 +00001117 echo "The error log from compiling the libSDL test is: "
malcd4742de2008-11-29 22:04:31 +00001118 cat $TMPSDLLOG
ths20b40c62007-07-11 23:39:45 +00001119fi
bellard24b55b92005-03-01 22:30:41 +00001120#if test "$sdl_static" = "no"; then
1121# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1122#fi
bellard97a847b2003-08-10 21:36:04 +00001123config_mak="config-host.mak"
1124config_h="config-host.h"
1125
bellard7c1f25b2004-04-22 00:02:08 +00001126#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +00001127
ths15d9ca02007-07-31 23:07:32 +00001128test -f $config_h && mv $config_h ${config_h}~
1129
bellard97a847b2003-08-10 21:36:04 +00001130echo "# Automatically generated by configure - do not modify" > $config_mak
malcfc9902d2008-12-17 19:00:18 +00001131printf "# Configured with:" >> $config_mak
malcfd69fe22008-12-07 22:50:16 +00001132printf " '%s'" "$0" "$@" >> $config_mak
1133echo >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001134echo "/* Automatically generated by configure - do not modify */" > $config_h
1135
1136echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001137echo "bindir=\${prefix}$binsuffix" >> $config_mak
1138echo "mandir=\${prefix}$mansuffix" >> $config_mak
1139echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +00001140echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +00001141echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001142echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +00001143echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001144echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001145echo "HOST_CC=$host_cc" >> $config_mak
1146echo "AR=$ar" >> $config_mak
1147echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
bellard40293e52008-01-31 11:32:10 +00001148# XXX: only use CFLAGS and LDFLAGS ?
1149# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1150# compilation of dyngen tool (useful for win32 build on Linux host)
ths6f30fa82007-01-05 01:00:47 +00001151echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
blueswir131422552007-04-16 18:27:06 +00001152echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1153echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1154echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +00001155echo "CFLAGS=$CFLAGS" >> $config_mak
1156echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +00001157echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +00001158echo "AIOLIBS=$AIOLIBS" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001159case "$cpu" in
1160 i386)
1161 echo "ARCH=i386" >> $config_mak
1162 echo "#define HOST_I386 1" >> $config_h
1163 ;;
1164 x86_64)
1165 echo "ARCH=x86_64" >> $config_mak
1166 echo "#define HOST_X86_64 1" >> $config_h
1167 ;;
1168 alpha)
1169 echo "ARCH=alpha" >> $config_mak
1170 echo "#define HOST_ALPHA 1" >> $config_h
1171 ;;
1172 armv4b)
1173 echo "ARCH=arm" >> $config_mak
1174 echo "#define HOST_ARM 1" >> $config_h
1175 ;;
1176 armv4l)
1177 echo "ARCH=arm" >> $config_mak
1178 echo "#define HOST_ARM 1" >> $config_h
1179 ;;
1180 cris)
1181 echo "ARCH=cris" >> $config_mak
1182 echo "#define HOST_CRIS 1" >> $config_h
1183 ;;
1184 hppa)
1185 echo "ARCH=hppa" >> $config_mak
1186 echo "#define HOST_HPPA 1" >> $config_h
1187 ;;
1188 ia64)
1189 echo "ARCH=ia64" >> $config_mak
1190 echo "#define HOST_IA64 1" >> $config_h
1191 ;;
1192 m68k)
1193 echo "ARCH=m68k" >> $config_mak
1194 echo "#define HOST_M68K 1" >> $config_h
1195 ;;
1196 mips)
1197 echo "ARCH=mips" >> $config_mak
1198 echo "#define HOST_MIPS 1" >> $config_h
1199 ;;
1200 mips64)
1201 echo "ARCH=mips64" >> $config_mak
1202 echo "#define HOST_MIPS64 1" >> $config_h
1203 ;;
1204 powerpc)
malc810260a2008-07-23 19:17:46 +00001205 if test "$hostlongbits" = "32"; then
1206 echo "ARCH=ppc" >> $config_mak
1207 echo "#define HOST_PPC 1" >> $config_h
1208 else
1209 echo "ARCH=ppc64" >> $config_mak
1210 echo "#define HOST_PPC64 1" >> $config_h
1211 fi
aurel322408a522008-04-20 20:19:44 +00001212 ;;
1213 s390)
1214 echo "ARCH=s390" >> $config_mak
1215 echo "#define HOST_S390 1" >> $config_h
1216 ;;
1217 sparc)
1218 echo "ARCH=sparc" >> $config_mak
1219 echo "#define HOST_SPARC 1" >> $config_h
1220 ;;
1221 sparc64)
1222 echo "ARCH=sparc64" >> $config_mak
1223 echo "#define HOST_SPARC64 1" >> $config_h
1224 ;;
1225 *)
1226 echo "Unsupported CPU = $cpu"
1227 exit 1
1228 ;;
1229esac
aliguori03b4fe72008-10-07 19:16:17 +00001230if test "$sparse" = "yes" ; then
1231 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1232 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1233 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1234fi
bellard7d132992003-03-06 23:23:54 +00001235if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001236 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1237 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1238fi
bellardb6853692005-06-05 17:10:39 +00001239echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +00001240if test "$mingw32" = "yes" ; then
1241 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +00001242 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +00001243else
1244 cat > $TMPC << EOF
1245#include <byteswap.h>
1246int main(void) { return bswap_32(0); }
1247EOF
aurel32178baee2008-12-08 18:11:57 +00001248 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
pbrook210fa552007-02-27 21:04:49 +00001249 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1250 fi
blueswir113606772008-12-05 17:54:09 +00001251 cat > $TMPC << EOF
1252#include <sys/endian.h>
1253#include <sys/types.h>
1254#include <machine/bswap.h>
1255int main(void) { return bswap32(0); }
1256EOF
aurel32178baee2008-12-08 18:11:57 +00001257 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
blueswir113606772008-12-05 17:54:09 +00001258 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1259 fi
bellard67b915a2004-03-31 23:37:16 +00001260fi
blueswir1128ab2f2008-08-15 18:33:42 +00001261
1262if [ "$openbsd" = "yes" ] ; then
1263 echo "#define ENOTSUP 4096" >> $config_h
1264fi
1265
bellard83fb7ad2004-07-05 21:25:26 +00001266if test "$darwin" = "yes" ; then
1267 echo "CONFIG_DARWIN=yes" >> $config_mak
1268 echo "#define CONFIG_DARWIN 1" >> $config_h
1269fi
malcb29fe3e2008-11-18 01:42:22 +00001270
1271if test "$aix" = "yes" ; then
1272 echo "CONFIG_AIX=yes" >> $config_mak
1273 echo "#define CONFIG_AIX 1" >> $config_h
1274fi
1275
bellardec530c82006-04-25 22:36:06 +00001276if test "$solaris" = "yes" ; then
1277 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +00001278 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +00001279 if test "$needs_libsunmath" = "yes" ; then
1280 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1281 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1282 fi
bellardec530c82006-04-25 22:36:06 +00001283fi
blueswir131422552007-04-16 18:27:06 +00001284if test -n "$sparc_cpu"; then
1285 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1286 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1287fi
bellard67b915a2004-03-31 23:37:16 +00001288if test "$gdbstub" = "yes" ; then
1289 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1290 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1291fi
bellard97a847b2003-08-10 21:36:04 +00001292if test "$gprof" = "yes" ; then
1293 echo "TARGET_GPROF=yes" >> $config_mak
1294 echo "#define HAVE_GPROF 1" >> $config_h
1295fi
1296if test "$static" = "yes" ; then
1297 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +00001298 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001299fi
bellard05c2a3e2006-02-08 22:39:17 +00001300if test $profiler = "yes" ; then
1301 echo "#define CONFIG_PROFILER 1" >> $config_h
1302fi
bellardc20709a2004-04-21 23:27:19 +00001303if test "$slirp" = "yes" ; then
1304 echo "CONFIG_SLIRP=yes" >> $config_mak
1305 echo "#define CONFIG_SLIRP 1" >> $config_h
1306fi
ths8a16d272008-07-19 09:56:24 +00001307if test "$vde" = "yes" ; then
1308 echo "CONFIG_VDE=yes" >> $config_mak
1309 echo "#define CONFIG_VDE 1" >> $config_h
1310 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1311fi
malc0c58ac12008-06-25 21:04:05 +00001312for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00001313 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001314 echo "$def=yes" >> $config_mak
1315 echo "#define $def 1" >> $config_h
1316done
1317echo "#define AUDIO_DRIVERS \\" >> $config_h
1318for drv in $audio_drv_list; do
1319 echo " &${drv}_audio_driver, \\" >>$config_h
pbrookf6e58892008-06-29 01:00:34 +00001320 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
malc0c58ac12008-06-25 21:04:05 +00001321 echo "$def=yes" >> $config_mak
malc923e4522008-07-02 18:13:46 +00001322 if test "$drv" = "fmod"; then
malc0c58ac12008-06-25 21:04:05 +00001323 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1324 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
blueswir12f6a1ab2008-08-21 18:00:53 +00001325 elif test "$drv" = "oss"; then
1326 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
malc0c58ac12008-06-25 21:04:05 +00001327 fi
1328done
1329echo "" >>$config_h
malc8ff9cbf2008-06-23 18:33:30 +00001330if test "$mixemu" = "yes" ; then
1331 echo "CONFIG_MIXEMU=yes" >> $config_mak
1332 echo "#define CONFIG_MIXEMU 1" >> $config_h
1333fi
ths8d5d2d42007-08-25 01:37:51 +00001334if test "$vnc_tls" = "yes" ; then
1335 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1336 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1337 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1338 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1339fi
pbrookb1a550a2006-04-16 13:28:56 +00001340qemu_version=`head $source_path/VERSION`
1341echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +00001342echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +00001343
1344echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +00001345if [ "$source_path_used" = "yes" ]; then
1346 echo "VPATH=$source_path" >> $config_mak
1347fi
bellard97a847b2003-08-10 21:36:04 +00001348echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00001349if [ "$build_docs" = "yes" ] ; then
1350 echo "BUILD_DOCS=yes" >> $config_mak
1351fi
bellard49ecc3f2007-11-07 19:25:15 +00001352if test "$static" = "yes"; then
1353 sdl1=$sdl_static
1354else
1355 sdl1=$sdl
1356fi
1357if test "$sdl1" = "yes" ; then
1358 echo "#define CONFIG_SDL 1" >> $config_h
1359 echo "CONFIG_SDL=yes" >> $config_mak
1360 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1361 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1362 else
1363 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1364 fi
1365 if [ "${aa}" = "yes" ] ; then
1366 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1367 else
1368 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1369 fi
1370fi
1371if test "$cocoa" = "yes" ; then
balrog4d3b6f62008-02-10 16:33:14 +00001372 echo "#define CONFIG_COCOA 1" >> $config_h
1373 echo "CONFIG_COCOA=yes" >> $config_mak
1374fi
1375if test "$curses" = "yes" ; then
1376 echo "#define CONFIG_CURSES 1" >> $config_h
1377 echo "CONFIG_CURSES=yes" >> $config_mak
1378 echo "CURSES_LIBS=-lcurses" >> $config_mak
bellard49ecc3f2007-11-07 19:25:15 +00001379fi
aurel322e4d9fb2008-04-08 06:01:02 +00001380if test "$brlapi" = "yes" ; then
1381 echo "CONFIG_BRLAPI=yes" >> $config_mak
1382 echo "#define CONFIG_BRLAPI 1" >> $config_h
1383 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1384fi
balrogfb599c92008-09-28 23:49:55 +00001385if test "$bluez" = "yes" ; then
1386 echo "CONFIG_BLUEZ=yes" >> $config_mak
1387 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1388 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1389 echo "#define CONFIG_BLUEZ 1" >> $config_h
1390fi
blueswir1414f0da2008-08-15 18:20:52 +00001391if test "$aio" = "yes" ; then
1392 echo "#define CONFIG_AIO 1" >> $config_h
aliguoria3392f92008-09-11 18:00:19 +00001393 echo "CONFIG_AIO=yes" >> $config_mak
blueswir1414f0da2008-08-15 18:20:52 +00001394fi
ths77755342008-11-27 15:45:16 +00001395if test "$blobs" = "yes" ; then
1396 echo "INSTALL_BLOBS=yes" >> $config_mak
1397fi
aliguoribf9298b2008-12-05 20:05:26 +00001398if test "$iovec" = "yes" ; then
1399 echo "#define HAVE_IOVEC 1" >> $config_h
1400fi
aurel32f652e6a2008-12-16 10:43:48 +00001401if test "$fdt" = "yes" ; then
1402 echo "#define HAVE_FDT 1" >> $config_h
1403 echo "FDT_LIBS=-lfdt" >> $config_mak
1404fi
bellard97a847b2003-08-10 21:36:04 +00001405
bellard83fb7ad2004-07-05 21:25:26 +00001406# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00001407if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +00001408 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +00001409 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +00001410 echo "#define _BSD 1" >> $config_h
1411fi
1412
pbrookc5937222006-05-14 11:30:38 +00001413echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1414
blueswir168063642008-11-22 21:03:55 +00001415# USB host support
1416case "$usb" in
1417linux)
1418 echo "HOST_USB=linux" >> $config_mak
1419;;
1420bsd)
1421 echo "HOST_USB=bsd" >> $config_mak
1422;;
1423*)
1424 echo "HOST_USB=stub" >> $config_mak
1425;;
1426esac
1427
pbrookc39e3332007-09-22 16:49:14 +00001428tools=
1429if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1430 tools="qemu-img\$(EXESUF) $tools"
bellard7a5ca862008-05-27 21:13:40 +00001431 if [ "$linux" = "yes" ] ; then
1432 tools="qemu-nbd\$(EXESUF) $tools"
1433 fi
pbrookc39e3332007-09-22 16:49:14 +00001434fi
1435echo "TOOLS=$tools" >> $config_mak
1436
ths15d9ca02007-07-31 23:07:32 +00001437test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1438
bellard1d14ffa2005-10-30 18:58:22 +00001439for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00001440target_dir="$target"
1441config_mak=$target_dir/config.mak
1442config_h=$target_dir/config.h
1443target_cpu=`echo $target | cut -d '-' -f 1`
1444target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +00001445[ "$target_cpu" = "armeb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001446[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1447[ "$target_cpu" = "mips" ] && target_bigendian=yes
1448[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1449[ "$target_cpu" = "mips64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +00001450[ "$target_cpu" = "ppc" ] && target_bigendian=yes
j_mayerd4082e92007-04-24 07:34:03 +00001451[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
j_mayer22f8a8b2007-10-14 08:38:29 +00001452[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
j_mayere85e7c62007-10-18 19:59:49 +00001453[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +00001454[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
aurel320938cda2008-04-11 21:36:06 +00001455[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1456[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1457[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +00001458target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00001459target_user_only="no"
ths831b7822007-01-18 20:06:33 +00001460target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00001461target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00001462target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00001463case "$target" in
1464 ${target_cpu}-softmmu)
1465 target_softmmu="yes"
1466 ;;
1467 ${target_cpu}-linux-user)
1468 target_user_only="yes"
1469 target_linux_user="yes"
1470 ;;
1471 ${target_cpu}-darwin-user)
1472 target_user_only="yes"
1473 target_darwin_user="yes"
1474 ;;
blueswir184778502008-10-26 20:33:16 +00001475 ${target_cpu}-bsd-user)
1476 target_user_only="yes"
1477 target_bsd_user="yes"
1478 ;;
pbrook9e407a82007-05-26 16:38:53 +00001479 *)
1480 echo "ERROR: Target '$target' not recognised"
1481 exit 1
1482 ;;
1483esac
ths831b7822007-01-18 20:06:33 +00001484
bellard97ccc682005-07-02 13:32:17 +00001485if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +00001486 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +00001487 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +00001488 echo "To build QEMU without graphical output configure with --disable-gfx-check"
balrog4d3b6f62008-02-10 16:33:14 +00001489 echo "Note that this will disable all output from the virtual graphics card"
1490 echo "except through VNC or curses."
bellard97ccc682005-07-02 13:32:17 +00001491 exit 1;
1492fi
1493
bellard7c1f25b2004-04-22 00:02:08 +00001494#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +00001495
ths15d9ca02007-07-31 23:07:32 +00001496test -f $config_h && mv $config_h ${config_h}~
1497
bellard97a847b2003-08-10 21:36:04 +00001498mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00001499mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00001500mkdir -p $target_dir/tcg
blueswir184778502008-10-26 20:33:16 +00001501if 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 +00001502 mkdir -p $target_dir/nwfpe
1503fi
1504
bellardec530c82006-04-25 22:36:06 +00001505#
1506# don't use ln -sf as not all "ln -sf" over write the file/link
1507#
1508rm -f $target_dir/Makefile
1509ln -s $source_path/Makefile.target $target_dir/Makefile
1510
bellard97a847b2003-08-10 21:36:04 +00001511
1512echo "# Automatically generated by configure - do not modify" > $config_mak
1513echo "/* Automatically generated by configure - do not modify */" > $config_h
1514
1515
1516echo "include ../config-host.mak" >> $config_mak
1517echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +00001518
pbrooke5fe0c52006-06-11 13:32:59 +00001519bflt="no"
blueswir1cb33da52007-10-09 16:34:29 +00001520elfload32="no"
pbrookbd0c5662008-05-29 14:34:11 +00001521target_nptl="no"
bellard1e43adf2003-09-30 20:54:24 +00001522interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1523echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
pbrook56aebc82008-10-11 17:55:29 +00001524gdb_xml_files=""
bellard97a847b2003-08-10 21:36:04 +00001525
aliguori5985ece2008-11-05 19:59:25 +00001526# Make sure the target and host cpus are compatible
1527if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
aurel32d76d1652008-12-16 10:43:58 +00001528 \( "$target_cpu" = "ppcemb" -a "$cpu" = "powerpc" \) -o \
aliguori5985ece2008-11-05 19:59:25 +00001529 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1530 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
aliguori7ba1e612008-11-05 16:04:33 +00001531 kvm="no"
1532fi
1533# Disable KVM for linux-user
1534if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1535 kvm="no"
1536fi
1537
aurel322408a522008-04-20 20:19:44 +00001538case "$target_cpu" in
1539 i386)
1540 echo "TARGET_ARCH=i386" >> $config_mak
1541 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1542 echo "#define TARGET_I386 1" >> $config_h
bellardda260242008-05-30 20:48:25 +00001543 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
aurel322408a522008-04-20 20:19:44 +00001544 then
1545 echo "#define USE_KQEMU 1" >> $config_h
1546 fi
aliguori7ba1e612008-11-05 16:04:33 +00001547 if test "$kvm" = "yes" ; then
1548 echo "CONFIG_KVM=yes" >> $config_mak
1549 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
aliguori5985ece2008-11-05 19:59:25 +00001550 echo "#define CONFIG_KVM 1" >> $config_h
aliguori7ba1e612008-11-05 16:04:33 +00001551 fi
aurel322408a522008-04-20 20:19:44 +00001552 ;;
1553 x86_64)
1554 echo "TARGET_ARCH=x86_64" >> $config_mak
1555 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1556 echo "#define TARGET_I386 1" >> $config_h
1557 echo "#define TARGET_X86_64 1" >> $config_h
1558 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1559 then
1560 echo "#define USE_KQEMU 1" >> $config_h
1561 fi
aliguori7ba1e612008-11-05 16:04:33 +00001562 if test "$kvm" = "yes" ; then
1563 echo "CONFIG_KVM=yes" >> $config_mak
1564 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1565 echo "#define CONFIG_KVM 1" >> $config_h
1566 fi
aurel322408a522008-04-20 20:19:44 +00001567 ;;
1568 alpha)
1569 echo "TARGET_ARCH=alpha" >> $config_mak
1570 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1571 echo "#define TARGET_ALPHA 1" >> $config_h
1572 ;;
1573 arm|armeb)
1574 echo "TARGET_ARCH=arm" >> $config_mak
aurel322408a522008-04-20 20:19:44 +00001575 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1576 echo "#define TARGET_ARM 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001577 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00001578 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00001579 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00001580 ;;
1581 cris)
1582 echo "TARGET_ARCH=cris" >> $config_mak
1583 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1584 echo "#define TARGET_CRIS 1" >> $config_h
aurel322408a522008-04-20 20:19:44 +00001585 ;;
1586 m68k)
1587 echo "TARGET_ARCH=m68k" >> $config_mak
1588 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1589 echo "#define TARGET_M68K 1" >> $config_h
1590 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00001591 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00001592 ;;
1593 mips|mipsel)
1594 echo "TARGET_ARCH=mips" >> $config_mak
1595 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1596 echo "#define TARGET_MIPS 1" >> $config_h
1597 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1598 ;;
1599 mipsn32|mipsn32el)
1600 echo "TARGET_ARCH=mipsn32" >> $config_mak
1601 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1602 echo "#define TARGET_MIPS 1" >> $config_h
1603 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1604 ;;
1605 mips64|mips64el)
1606 echo "TARGET_ARCH=mips64" >> $config_mak
1607 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1608 echo "#define TARGET_MIPS 1" >> $config_h
1609 echo "#define TARGET_MIPS64 1" >> $config_h
1610 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1611 ;;
1612 ppc)
1613 echo "TARGET_ARCH=ppc" >> $config_mak
1614 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1615 echo "#define TARGET_PPC 1" >> $config_h
1616 ;;
1617 ppcemb)
1618 echo "TARGET_ARCH=ppcemb" >> $config_mak
1619 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1620 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1621 echo "#define TARGET_PPC 1" >> $config_h
1622 echo "#define TARGET_PPCEMB 1" >> $config_h
aurel32d76d1652008-12-16 10:43:58 +00001623 if test "$kvm" = "yes" ; then
1624 echo "CONFIG_KVM=yes" >> $config_mak
1625 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1626 echo "#define CONFIG_KVM 1" >> $config_h
1627 fi
aurel322408a522008-04-20 20:19:44 +00001628 ;;
1629 ppc64)
1630 echo "TARGET_ARCH=ppc64" >> $config_mak
1631 echo "TARGET_ABI_DIR=ppc" >> $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 ;;
1636 ppc64abi32)
1637 echo "TARGET_ARCH=ppc64" >> $config_mak
1638 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1639 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1640 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1641 echo "#define TARGET_PPC 1" >> $config_h
1642 echo "#define TARGET_PPC64 1" >> $config_h
1643 echo "#define TARGET_ABI32 1" >> $config_h
1644 ;;
1645 sh4|sh4eb)
1646 echo "TARGET_ARCH=sh4" >> $config_mak
1647 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1648 echo "#define TARGET_SH4 1" >> $config_h
1649 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00001650 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00001651 ;;
1652 sparc)
1653 echo "TARGET_ARCH=sparc" >> $config_mak
1654 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1655 echo "#define TARGET_SPARC 1" >> $config_h
1656 ;;
1657 sparc64)
1658 echo "TARGET_ARCH=sparc64" >> $config_mak
1659 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1660 echo "#define TARGET_SPARC 1" >> $config_h
1661 echo "#define TARGET_SPARC64 1" >> $config_h
1662 elfload32="yes"
1663 ;;
1664 sparc32plus)
1665 echo "TARGET_ARCH=sparc64" >> $config_mak
1666 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1667 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1668 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1669 echo "#define TARGET_SPARC 1" >> $config_h
1670 echo "#define TARGET_SPARC64 1" >> $config_h
1671 echo "#define TARGET_ABI32 1" >> $config_h
1672 ;;
1673 *)
1674 echo "Unsupported target CPU"
1675 exit 1
1676 ;;
1677esac
bellardde83cd02003-06-15 20:25:43 +00001678if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +00001679 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1680 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1681fi
1682if test "$target_softmmu" = "yes" ; then
1683 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1684 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +00001685fi
bellard997344f2003-10-27 21:10:39 +00001686if test "$target_user_only" = "yes" ; then
1687 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1688 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1689fi
ths831b7822007-01-18 20:06:33 +00001690if test "$target_linux_user" = "yes" ; then
1691 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1692 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1693fi
1694if test "$target_darwin_user" = "yes" ; then
1695 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1696 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1697fi
pbrook56aebc82008-10-11 17:55:29 +00001698list=""
1699if test ! -z "$gdb_xml_files" ; then
1700 for x in $gdb_xml_files; do
1701 list="$list $source_path/gdb-xml/$x"
1702 done
1703fi
1704echo "TARGET_XML_FILES=$list" >> $config_mak
bellardde83cd02003-06-15 20:25:43 +00001705
aurel320938cda2008-04-11 21:36:06 +00001706if test "$target_cpu" = "arm" \
1707 -o "$target_cpu" = "armeb" \
1708 -o "$target_cpu" = "m68k" \
1709 -o "$target_cpu" = "mips" \
1710 -o "$target_cpu" = "mipsel" \
1711 -o "$target_cpu" = "mipsn32" \
1712 -o "$target_cpu" = "mipsn32el" \
1713 -o "$target_cpu" = "mips64" \
1714 -o "$target_cpu" = "mips64el" \
aurel323147d1e2008-12-15 06:34:37 +00001715 -o "$target_cpu" = "ppc" \
1716 -o "$target_cpu" = "ppc64" \
aurel3271e991f2008-12-15 17:13:19 +00001717 -o "$target_cpu" = "ppc64abi32" \
1718 -o "$target_cpu" = "ppcemb" \
aurel320938cda2008-04-11 21:36:06 +00001719 -o "$target_cpu" = "sparc" \
1720 -o "$target_cpu" = "sparc64" \
1721 -o "$target_cpu" = "sparc32plus"; then
bellard158142c2005-03-13 16:54:06 +00001722 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1723 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1724fi
pbrooke5fe0c52006-06-11 13:32:59 +00001725if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1726 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1727 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1728fi
pbrookbd0c5662008-05-29 14:34:11 +00001729if test "$target_user_only" = "yes" \
1730 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1731 echo "#define USE_NPTL 1" >> $config_h
1732fi
blueswir1cb33da52007-10-09 16:34:29 +00001733# 32 bit ELF loader in addition to native 64 bit loader?
1734if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1735 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1736 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1737fi
blueswir184778502008-10-26 20:33:16 +00001738if test "$target_bsd_user" = "yes" ; then
1739 echo "CONFIG_BSD_USER=yes" >> $config_mak
1740 echo "#define CONFIG_BSD_USER 1" >> $config_h
1741fi
bellard5b0753e2005-03-01 21:37:28 +00001742
ths15d9ca02007-07-31 23:07:32 +00001743test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1744
bellard97a847b2003-08-10 21:36:04 +00001745done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00001746
1747# build tree in object directory if source path is different from current one
1748if test "$source_path_used" = "yes" ; then
bellard49ecc3f2007-11-07 19:25:15 +00001749 DIRS="tests tests/cris slirp audio"
bellard7d132992003-03-06 23:23:54 +00001750 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00001751 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00001752 FILES="$FILES tests/test-mmap.c"
bellard7d132992003-03-06 23:23:54 +00001753 for dir in $DIRS ; do
1754 mkdir -p $dir
1755 done
bellardec530c82006-04-25 22:36:06 +00001756 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00001757 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00001758 rm -f $f
1759 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00001760 done
1761fi