]> git.proxmox.com Git - qemu.git/blame - configure
Cancel IDE outstanding IO on device reset (Gleb Natapov)
[qemu.git] / configure
CommitLineData
7d13299d
FB
1#!/bin/sh
2#
3ef693a0 3# qemu configure script (c) 2003 Fabrice Bellard
7d13299d
FB
4#
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
3ef693a0
FB
14TMPC="${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"
7d13299d
FB
18
19# default parameters
11d9f695 20prefix=""
1e43adfc 21interp_prefix="/usr/gnemul/qemu-%M"
43ce4dfe 22static="no"
7d13299d
FB
23cross_prefix=""
24cc="gcc"
328a4240 25gcc3_search="yes"
fe8f78e4 26gcc3_list="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
0c58ac1c 27audio_drv_list=""
28audio_card_list=""
7d13299d
FB
29host_cc="gcc"
30ar="ar"
31make="make"
6a882643 32install="install"
7d13299d
FB
33strip="strip"
34cpu=`uname -m`
5327cf48 35target_list=""
7d13299d
FB
36case "$cpu" in
37 i386|i486|i586|i686|i86pc|BePC)
97a847bc 38 cpu="i386"
7d13299d 39 ;;
aaa5fa14
AJ
40 x86_64|amd64)
41 cpu="x86_64"
42 ;;
43 alpha)
44 cpu="alpha"
45 ;;
ba68055e 46 armv*b)
808c4954
FB
47 cpu="armv4b"
48 ;;
ba68055e 49 armv*l)
7d13299d
FB
50 cpu="armv4l"
51 ;;
aaa5fa14
AJ
52 cris)
53 cpu="cris"
7d13299d 54 ;;
f54b3f92
AJ
55 parisc|parisc64)
56 cpu="hppa"
57 ;;
aaa5fa14
AJ
58 ia64)
59 cpu="ia64"
60 ;;
61 m68k)
62 cpu="m68k"
7d13299d
FB
63 ;;
64 mips)
65 cpu="mips"
66 ;;
fbe4f65b
TS
67 mips64)
68 cpu="mips64"
69 ;;
aaa5fa14
AJ
70 "Power Macintosh"|ppc|ppc64)
71 cpu="powerpc"
e7daa605 72 ;;
0e7b8a9f 73 s390*)
fb3e5849
FB
74 cpu="s390"
75 ;;
3142255c 76 sparc|sun4[cdmuv])
ae228531
FB
77 cpu="sparc"
78 ;;
79 sparc64)
80 cpu="sparc64"
81 ;;
7d13299d
FB
82 *)
83 cpu="unknown"
84 ;;
85esac
86gprof="no"
87bigendian="no"
67b915a5
FB
88mingw32="no"
89EXESUF=""
90gdbstub="yes"
443f1376 91slirp="yes"
e0e6c8c0 92vde="yes"
102a52e4
FB
93fmod_lib=""
94fmod_inc=""
8d5d2d4c 95vnc_tls="yes"
b1a550a0 96bsd="no"
5327cf48 97linux="no"
c9ec1fe4 98kqemu="no"
05c2a3e7 99profiler="no"
5b0753e0 100cocoa="no"
97ccc689 101check_gfx="yes"
1aff381f 102check_gcc="yes"
0a8e90f4 103softmmu="yes"
831b7825
TS
104linux_user="no"
105darwin_user="no"
cc8ae6de 106build_docs="no"
c5937220 107uname_release=""
4d3b6f6e 108curses="yes"
414f0dab 109aio="yes"
bd0c5661 110nptl="yes"
8ff9cbf7 111mixemu="no"
7d13299d
FB
112
113# OS specific
114targetos=`uname -s`
115case $targetos in
c326e0af
FB
116CYGWIN*)
117mingw32="yes"
6f30fa85 118OS_CFLAGS="-mno-cygwin"
db8d7dd1
TS
119if [ "$cpu" = "i386" ] ; then
120 kqemu="yes"
121fi
c2de5c91 122audio_possible_drivers="sdl"
c326e0af 123;;
67b915a5
FB
124MINGW32*)
125mingw32="yes"
db8d7dd1
TS
126if [ "$cpu" = "i386" ] ; then
127 kqemu="yes"
128fi
c2de5c91 129audio_possible_drivers="dsound sdl fmod"
67b915a5 130;;
5c40d2bd 131GNU/kFreeBSD)
0c58ac1c 132audio_drv_list="oss"
c2de5c91 133audio_possible_drivers="oss sdl esd"
5c40d2bd
TS
134if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
135 kqemu="yes"
136fi
137;;
7d3505c5
FB
138FreeBSD)
139bsd="yes"
0c58ac1c 140audio_drv_list="oss"
c2de5c91 141audio_possible_drivers="oss sdl esd"
e99f9060 142if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
07f4ddbf
FB
143 kqemu="yes"
144fi
7d3505c5
FB
145;;
146NetBSD)
147bsd="yes"
0c58ac1c 148audio_drv_list="oss"
c2de5c91 149audio_possible_drivers="oss sdl esd"
7d3505c5
FB
150;;
151OpenBSD)
152bsd="yes"
0c58ac1c 153audio_drv_list="oss"
c2de5c91 154audio_possible_drivers="oss sdl esd"
7d3505c5 155;;
83fb7adf
FB
156Darwin)
157bsd="yes"
158darwin="yes"
831b7825 159darwin_user="yes"
fd677642 160cocoa="yes"
0c58ac1c 161audio_drv_list="coreaudio"
c2de5c91 162audio_possible_drivers="coreaudio sdl fmod"
6f30fa85 163OS_CFLAGS="-mdynamic-no-pic"
c2c59c3e 164OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
83fb7adf 165;;
ec530c81 166SunOS)
c2b84fab
TS
167 solaris="yes"
168 make="gmake"
169 install="ginstall"
0475a5ca 170 needs_libsunmath="no"
c2b84fab 171 solarisrev=`uname -r | cut -f2 -d.`
ef18c883
TS
172 # have to select again, because `uname -m` returns i86pc
173 # even on an x86_64 box.
174 solariscpu=`isainfo -k`
175 if test "${solariscpu}" = "amd64" ; then
176 cpu="x86_64"
177 fi
c2b84fab 178 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
0475a5ca
TS
179 if test "$solarisrev" -le 9 ; then
180 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
181 needs_libsunmath="yes"
182 else
183 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
184 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
185 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
186 echo "Studio 11 can be downloaded from www.sun.com."
187 exit 1
188 fi
189 fi
190 if test "$solarisrev" -ge 9 ; then
c2b84fab
TS
191 kqemu="yes"
192 fi
86b2bd93 193 fi
6b4d2ba1 194 if test -f /usr/include/sys/soundcard.h ; then
0c58ac1c 195 audio_drv_list="oss"
6b4d2ba1 196 fi
c2de5c91 197 audio_possible_drivers="oss sdl"
86b2bd93 198;;
1d14ffa9 199*)
0c58ac1c 200audio_drv_list="oss"
b8e59f18 201audio_possible_drivers="oss alsa sdl esd pa"
5327cf48 202linux="yes"
831b7825 203linux_user="yes"
07f4ddbf 204if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
c9ec1fe4 205 kqemu="yes"
c2de5c91 206 audio_possible_drivers="$audio_possible_drivers fmod"
c9ec1fe4 207fi
fb065187 208;;
7d13299d
FB
209esac
210
7d3505c5 211if [ "$bsd" = "yes" ] ; then
b1a550a0 212 if [ "$darwin" != "yes" ] ; then
83fb7adf
FB
213 make="gmake"
214 fi
7d3505c5
FB
215fi
216
7d13299d 217# find source path
ad064840 218source_path=`dirname "$0"`
59faef3a
AZ
219source_path_used="no"
220workdir=`pwd`
ad064840 221if [ -z "$source_path" ]; then
59faef3a 222 source_path=$workdir
ad064840
PB
223else
224 source_path=`cd "$source_path"; pwd`
7d13299d 225fi
724db118 226[ -f "$workdir/vl.c" ] || source_path_used="yes"
7d13299d 227
85aa5189 228werror="no"
0d1e2394
FB
229# generate compile errors on warnings for development builds
230#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
231#werror="yes";
232#fi
85aa5189 233
7d13299d 234for opt do
a46e4035 235 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
7d13299d 236 case "$opt" in
2efc3265
FB
237 --help|-h) show_help=yes
238 ;;
b1a550a0 239 --prefix=*) prefix="$optarg"
7d13299d 240 ;;
b1a550a0 241 --interp-prefix=*) interp_prefix="$optarg"
32ce6337 242 ;;
b1a550a0 243 --source-path=*) source_path="$optarg"
ad064840 244 source_path_used="yes"
7d13299d 245 ;;
b1a550a0 246 --cross-prefix=*) cross_prefix="$optarg"
7d13299d 247 ;;
b1a550a0 248 --cc=*) cc="$optarg"
328a4240 249 gcc3_search="no"
7d13299d 250 ;;
b1a550a0 251 --host-cc=*) host_cc="$optarg"
83469015 252 ;;
b1a550a0 253 --make=*) make="$optarg"
7d13299d 254 ;;
6a882643
PB
255 --install=*) install="$optarg"
256 ;;
b1a550a0 257 --extra-cflags=*) CFLAGS="$optarg"
7d13299d 258 ;;
b1a550a0 259 --extra-ldflags=*) LDFLAGS="$optarg"
7d13299d 260 ;;
b1a550a0 261 --cpu=*) cpu="$optarg"
7d13299d 262 ;;
b1a550a0 263 --target-list=*) target_list="$optarg"
de83cd02 264 ;;
7d13299d
FB
265 --enable-gprof) gprof="yes"
266 ;;
43ce4dfe
FB
267 --static) static="yes"
268 ;;
97a847bc
FB
269 --disable-sdl) sdl="no"
270 ;;
0c58ac1c 271 --fmod-lib=*) fmod_lib="$optarg"
1d14ffa9 272 ;;
c2de5c91 273 --fmod-inc=*) fmod_inc="$optarg"
274 ;;
2fa7d3bf 275 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
102a52e4 276 ;;
0c58ac1c 277 --audio-drv-list=*) audio_drv_list="$optarg"
102a52e4 278 ;;
8d5d2d4c
TS
279 --disable-vnc-tls) vnc_tls="no"
280 ;;
b93aebec 281 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
1d14ffa9 282 ;;
443f1376 283 --disable-slirp) slirp="no"
1d14ffa9 284 ;;
e0e6c8c0 285 --disable-vde) vde="no"
8a16d273 286 ;;
c9ec1fe4 287 --disable-kqemu) kqemu="no"
1d14ffa9 288 ;;
2e4d9fb1
AJ
289 --disable-brlapi) brlapi="no"
290 ;;
05c2a3e7
FB
291 --enable-profiler) profiler="yes"
292 ;;
c2de5c91 293 --enable-cocoa)
294 cocoa="yes" ;
295 sdl="no" ;
296 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
1d14ffa9 297 ;;
97ccc689
FB
298 --disable-gfx-check) check_gfx="no"
299 ;;
1aff381f
FB
300 --disable-gcc-check) check_gcc="no"
301 ;;
cad25d69 302 --disable-system) softmmu="no"
0a8e90f4 303 ;;
cad25d69 304 --enable-system) softmmu="yes"
0a8e90f4 305 ;;
831b7825 306 --disable-linux-user) linux_user="no"
0a8e90f4 307 ;;
831b7825
TS
308 --enable-linux-user) linux_user="yes"
309 ;;
310 --disable-darwin-user) darwin_user="no"
311 ;;
312 --enable-darwin-user) darwin_user="yes"
0a8e90f4 313 ;;
c5937220
PB
314 --enable-uname-release=*) uname_release="$optarg"
315 ;;
3142255c
BS
316 --sparc_cpu=*)
317 sparc_cpu="$optarg"
318 case $sparc_cpu in
319 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
320 target_cpu="sparc"; cpu="sparc" ;;
321 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
322 target_cpu="sparc"; cpu="sparc" ;;
323 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
324 target_cpu="sparc64"; cpu="sparc64" ;;
325 *) echo "undefined SPARC architecture. Exiting";exit 1;;
326 esac
327 ;;
85aa5189
FB
328 --enable-werror) werror="yes"
329 ;;
330 --disable-werror) werror="no"
331 ;;
4d3b6f6e
AZ
332 --disable-curses) curses="no"
333 ;;
bd0c5661
PB
334 --disable-nptl) nptl="no"
335 ;;
8ff9cbf7 336 --enable-mixemu) mixemu="yes"
337 ;;
414f0dab
BS
338 --disable-aio) aio="no"
339 ;;
7f1559c6
AZ
340 *) echo "ERROR: unknown option $opt"; show_help="yes"
341 ;;
7d13299d
FB
342 esac
343done
344
209afb9e
TS
345if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
346 AIOLIBS=
347else
4259e1a5
TS
348 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
349 AIOLIBS="-lrt -lpthread"
209afb9e
TS
350fi
351
6f30fa85
TS
352# default flags for all hosts
353CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
354LDFLAGS="$LDFLAGS -g"
85aa5189
FB
355if test "$werror" = "yes" ; then
356CFLAGS="$CFLAGS -Werror"
357fi
6f30fa85 358
3142255c
BS
359#
360# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
361# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
362#
40293e58 363case "$cpu" in
3142255c
BS
364 sparc) if test -z "$sparc_cpu" ; then
365 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
366 ARCH_LDFLAGS="-m32"
367 else
368 ARCH_CFLAGS="${SP_CFLAGS}"
369 ARCH_LDFLAGS="${SP_LDFLAGS}"
370 fi
371 ;;
372 sparc64) if test -z "$sparc_cpu" ; then
373 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
374 ARCH_LDFLAGS="-m64"
375 else
376 ARCH_CFLAGS="${SP_CFLAGS}"
377 ARCH_LDFLAGS="${SP_LDFLAGS}"
378 fi
379 ;;
76d83bde
TS
380 s390)
381 ARCH_CFLAGS="-march=z900"
382 ;;
40293e58
FB
383 i386)
384 ARCH_CFLAGS="-m32"
385 ARCH_LDFLAGS="-m32"
386 ;;
387 x86_64)
388 ARCH_CFLAGS="-m64"
389 ARCH_LDFLAGS="-m64"
390 ;;
3142255c
BS
391esac
392
af5db58e
PB
393if test x"$show_help" = x"yes" ; then
394cat << EOF
395
396Usage: configure [options]
397Options: [defaults in brackets after descriptions]
398
399EOF
400echo "Standard options:"
401echo " --help print this message"
402echo " --prefix=PREFIX install in PREFIX [$prefix]"
403echo " --interp-prefix=PREFIX where to find shared libraries, etc."
404echo " use %M for cpu name [$interp_prefix]"
405echo " --target-list=LIST set target list [$target_list]"
406echo ""
407echo "kqemu kernel acceleration support:"
408echo " --disable-kqemu disable kqemu support"
af5db58e
PB
409echo ""
410echo "Advanced options (experts only):"
411echo " --source-path=PATH path of source code [$source_path]"
412echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
413echo " --cc=CC use C compiler CC [$cc]"
414echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
415echo " --make=MAKE use specified make [$make]"
6a882643 416echo " --install=INSTALL use specified install [$install]"
af5db58e 417echo " --static enable static build [$static]"
85aa5189 418echo " --disable-werror disable compilation abort on warning"
fe8f78e4 419echo " --disable-sdl disable SDL"
af5db58e
PB
420echo " --enable-cocoa enable COCOA (Mac OS X only)"
421echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
c2de5c91 422echo " --audio-drv-list=LIST set audio drivers list:"
423echo " Available drivers: $audio_possible_drivers"
424echo " --audio-card-list=LIST set list of additional emulated audio cards"
425echo " Available cards: ac97 adlib cs4231a gus"
8ff9cbf7 426echo " --enable-mixemu enable mixer emulation"
2e4d9fb1 427echo " --disable-brlapi disable BrlAPI"
8d5d2d4c 428echo " --disable-vnc-tls disable TLS encryption for VNC server"
af896aaa 429echo " --disable-curses disable curses output"
bd0c5661 430echo " --disable-nptl disable usermode NPTL support"
af5db58e
PB
431echo " --enable-system enable all system emulation targets"
432echo " --disable-system disable all system emulation targets"
831b7825
TS
433echo " --enable-linux-user enable all linux usermode emulation targets"
434echo " --disable-linux-user disable all linux usermode emulation targets"
435echo " --enable-darwin-user enable all darwin usermode emulation targets"
436echo " --disable-darwin-user disable all darwin usermode emulation targets"
af5db58e
PB
437echo " --fmod-lib path to FMOD library"
438echo " --fmod-inc path to FMOD includes"
c5937220 439echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
3142255c 440echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
e0e6c8c0 441echo " --disable-vde disable support for vde network"
414f0dab 442echo " --disable-aio disable AIO support"
af5db58e 443echo ""
5bf08934 444echo "NOTE: The object files are built at the place where configure is launched"
af5db58e
PB
445exit 1
446fi
447
7d13299d
FB
448cc="${cross_prefix}${cc}"
449ar="${cross_prefix}${ar}"
450strip="${cross_prefix}${strip}"
451
064aae13
PB
452# check that the C compiler works.
453cat > $TMPC <<EOF
454int main(void) {}
455EOF
456
db7287ed 457if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
064aae13
PB
458 : C compiler works ok
459else
460 echo "ERROR: \"$cc\" either does not exist or does not work"
461 exit 1
a7350fa1
FB
462fi
463
67b915a5 464if test "$mingw32" = "yes" ; then
5327cf48 465 linux="no"
67b915a5 466 EXESUF=".exe"
9f059eca 467 oss="no"
67b915a5
FB
468fi
469
5fafdf24 470# Check for gcc4, error if pre-gcc4
328a4240
PB
471if test "$check_gcc" = "yes" ; then
472 cat > $TMPC <<EOF
473#if __GNUC__ < 4
474#error gcc3
475#endif
476int main(){return 0;}
477EOF
db7287ed 478 if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
328a4240
PB
479 echo "WARNING: \"$cc\" looks like gcc 4.x"
480 found_compat_cc="no"
481 if test "$gcc3_search" = "yes" ; then
482 echo "Looking for gcc 3.x"
483 for compat_cc in $gcc3_list ; do
d4af3de2 484 if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
328a4240 485 echo "Found \"$compat_cc\""
1124426a 486 cc="$cross_prefix$compat_cc"
328a4240
PB
487 found_compat_cc="yes"
488 break
489 fi
490 done
491 if test "$found_compat_cc" = "no" ; then
492 echo "gcc 3.x not found!"
493 fi
494 fi
495 if test "$found_compat_cc" = "no" ; then
496 echo "QEMU is known to have problems when compiled with gcc 4.x"
497 echo "It is recommended that you use gcc 3.x to build QEMU"
498 echo "To use this compiler anyway, configure with --disable-gcc-check"
499 exit 1;
500 fi
501 fi
502fi
503
ec530c81
FB
504#
505# Solaris specific configure tool chain decisions
506#
507if test "$solaris" = "yes" ; then
508 #
509 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
510 # override the check with --disable-gcc-check
5fafdf24 511 #
ec530c81
FB
512 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
513 solgcc=`which $cc`
514 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
515 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
516 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
517 echo "or get the latest patch from SunSolve for gcc"
518 exit 1
519 fi
520 fi
521 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
522 if test -z "$solinst" ; then
523 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
524 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
525 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
526 exit 1
527 fi
528 if test "$solinst" = "/usr/sbin/install" ; then
529 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
530 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
531 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
532 exit 1
533 fi
ec530c81
FB
534 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
535 if test -z "$sol_ar" ; then
536 echo "Error: No path includes ar"
537 if test -f /usr/ccs/bin/ar ; then
538 echo "Add /usr/ccs/bin to your path and rerun configure"
539 fi
540 exit 1
541 fi
5fafdf24 542fi
ec530c81
FB
543
544
5327cf48
FB
545if test -z "$target_list" ; then
546# these targets are portable
0a8e90f4 547 if [ "$softmmu" = "yes" ] ; then
2408a527
AJ
548 target_list="\
549i386-softmmu \
550x86_64-softmmu \
551arm-softmmu \
552cris-softmmu \
553m68k-softmmu \
554mips-softmmu \
555mipsel-softmmu \
556mips64-softmmu \
557mips64el-softmmu \
558ppc-softmmu \
559ppcemb-softmmu \
560ppc64-softmmu \
561sh4-softmmu \
562sh4eb-softmmu \
563sparc-softmmu \
564"
0a8e90f4 565 fi
5327cf48 566# the following are Linux specific
831b7825 567 if [ "$linux_user" = "yes" ] ; then
2408a527
AJ
568 target_list="${target_list}\
569i386-linux-user \
570x86_64-linux-user \
571alpha-linux-user \
572arm-linux-user \
573armeb-linux-user \
574cris-linux-user \
575m68k-linux-user \
576mips-linux-user \
577mipsel-linux-user \
578ppc-linux-user \
579ppc64-linux-user \
580ppc64abi32-linux-user \
581sh4-linux-user \
582sh4eb-linux-user \
583sparc-linux-user \
584sparc64-linux-user \
585sparc32plus-linux-user \
586"
831b7825
TS
587 fi
588# the following are Darwin specific
589 if [ "$darwin_user" = "yes" ] ; then
2408a527 590 target_list="$target_list i386-darwin-user ppc-darwin-user"
5327cf48 591 fi
6e20a45f 592else
b1a550a0 593 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
5327cf48 594fi
0a8e90f4
PB
595if test -z "$target_list" ; then
596 echo "No targets enabled"
597 exit 1
598fi
5327cf48 599
7d13299d
FB
600if test -z "$cross_prefix" ; then
601
602# ---
603# big/little endian test
604cat > $TMPC << EOF
605#include <inttypes.h>
606int main(int argc, char ** argv){
1d14ffa9
FB
607 volatile uint32_t i=0x01234567;
608 return (*((uint8_t*)(&i))) == 0x67;
7d13299d
FB
609}
610EOF
611
db7287ed 612if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
7d13299d
FB
613$TMPE && bigendian="yes"
614else
615echo big/little test failed
616fi
617
618else
619
620# if cross compiling, cannot launch a program, so make a static guess
0938cda5 621if test "$cpu" = "armv4b" \
f54b3f92 622 -o "$cpu" = "hppa" \
0938cda5
AJ
623 -o "$cpu" = "m68k" \
624 -o "$cpu" = "mips" \
625 -o "$cpu" = "mips64" \
626 -o "$cpu" = "powerpc" \
627 -o "$cpu" = "s390" \
628 -o "$cpu" = "sparc" \
629 -o "$cpu" = "sparc64"; then
7d13299d
FB
630 bigendian="yes"
631fi
632
633fi
634
b6853697
FB
635# host long bits test
636hostlongbits="32"
0938cda5
AJ
637if test "$cpu" = "x86_64" \
638 -o "$cpu" = "alpha" \
639 -o "$cpu" = "ia64" \
640 -o "$cpu" = "sparc64"; then
b6853697
FB
641 hostlongbits="64"
642fi
643
810260a8 644# ppc specific hostlongbits selection
645if test "$cpu" = "powerpc" ; then
646 cat > $TMPC <<EOF
647int main(void){return sizeof(long);}
648EOF
649
650 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null; then
651 $TMPE
652 case $? in
653 4) hostlongbits="32";;
654 8) hostlongbits="64";;
ba69a08a 655 *) echo "Couldn't determine bits per long value"; exit 1;;
810260a8 656 esac
657 else
658 echo hostlongbits test failed
ba69a08a 659 exit 1
810260a8 660 fi
661fi
662
e8cd23de 663# check gcc options support
04369ff2
FB
664cat > $TMPC <<EOF
665int main(void) {
04369ff2
FB
666}
667EOF
668
bd0c5661
PB
669# Check host NPTL support
670cat > $TMPC <<EOF
671#include <sched.h>
30813cea 672#include <linux/futex.h>
bd0c5661
PB
673void foo()
674{
675#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
676#error bork
677#endif
678}
679EOF
680
681if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
682 :
683else
684 nptl="no"
685fi
686
11d9f695
FB
687##########################################
688# SDL probe
689
690sdl_too_old=no
691
692if test -z "$sdl" ; then
069b0bda
TS
693 sdl_config="sdl-config"
694 sdl=no
695 sdl_static=no
696
697 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
698 # win32 cross compilation case
699 sdl_config="i386-mingw32msvc-sdl-config"
700 sdl=yes
701 else
702 # normal SDL probe
11d9f695
FB
703cat > $TMPC << EOF
704#include <SDL.h>
705#undef main /* We don't want SDL to override our main() */
706int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
707EOF
db7287ed 708 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
069b0bda
TS
709 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
710 if test "$_sdlversion" -lt 121 ; then
711 sdl_too_old=yes
712 else
713 if test "$cocoa" = "no" ; then
714 sdl=yes
715 fi
716 fi
11d9f695 717
069b0bda
TS
718 # static link with sdl ?
719 if test "$sdl" = "yes" ; then
720 aa="no"
721 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
722 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
723 if [ "$aa" = "yes" ] ; then
724 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
725 fi
726
8281db4d 727 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
069b0bda
TS
728 sdl_static=yes
729 fi
730 fi # static link
731 fi # sdl compile test
732 fi # cross compilation
fd677642 733else
069b0bda
TS
734 # Make sure to disable cocoa if sdl was set
735 if test "$sdl" = "yes" ; then
736 cocoa="no"
c2de5c91 737 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
069b0bda 738 fi
a6e022ad 739fi # -z $sdl
11d9f695 740
8d5d2d4c
TS
741##########################################
742# VNC TLS detection
743if test "$vnc_tls" = "yes" ; then
ae6b5e5a
AL
744cat > $TMPC <<EOF
745#include <gnutls/gnutls.h>
746int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
747EOF
748 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
749 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
750 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
751 $vnc_tls_libs 2> /dev/null ; then
752 :
753 else
754 vnc_tls="no"
755 fi
8d5d2d4c
TS
756fi
757
8a16d273
TS
758##########################################
759# vde libraries probe
760if test "$vde" = "yes" ; then
761 cat > $TMPC << EOF
762#include <libvdeplug.h>
763int main(void) { struct vde_open_args a = {0, 0, 0} ; return 0;}
764EOF
765 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
766 :
767 else
e0e6c8c0 768 vde="no"
8a16d273
TS
769 fi
770fi
771
8f28f3fb 772##########################################
c2de5c91 773# Sound support libraries probe
8f28f3fb 774
c2de5c91 775audio_drv_probe()
776{
777 drv=$1
778 hdr=$2
779 lib=$3
780 exp=$4
781 cfl=$5
782 cat > $TMPC << EOF
783#include <$hdr>
784int main(void) { $exp }
8f28f3fb 785EOF
c2de5c91 786 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib 2> /dev/null ; then
787 :
788 else
789 echo
790 echo "Error: $drv check failed"
791 echo "Make sure to have the $drv libs and headers installed."
792 echo
793 exit 1
794 fi
795}
796
2fa7d3bf 797audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
c2de5c91 798for drv in $audio_drv_list; do
799 case $drv in
800 alsa)
801 audio_drv_probe $drv alsa/asoundlib.h -lasound \
802 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
803 ;;
804
805 fmod)
806 if test -z $fmod_lib || test -z $fmod_inc; then
807 echo
808 echo "Error: You must specify path to FMOD library and headers"
809 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
810 echo
811 exit 1
812 fi
813 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
814 ;;
815
816 esd)
817 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
818 ;;
b8e59f18 819
820 pa)
821 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
822 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
823 ;;
824
e4c63a6a 825 *)
1c9b2a52 826 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
e4c63a6a 827 echo
828 echo "Error: Unknown driver '$drv' selected"
829 echo "Possible drivers are: $audio_possible_drivers"
830 echo
831 exit 1
832 }
833 ;;
834
16b98a97 835 oss|sdl|core|wav|dsound)
836 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
837 ;;
838
c2de5c91 839 esac
840done
8f28f3fb 841
2e4d9fb1
AJ
842##########################################
843# BrlAPI probe
844
845if test -z "$brlapi" ; then
846 brlapi=no
847cat > $TMPC << EOF
848#include <brlapi.h>
849int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
850EOF
a40e56d5 851 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev/null ; then
2e4d9fb1
AJ
852 brlapi=yes
853 fi # brlapi compile test
854fi # -z $brlapi
855
4d3b6f6e
AZ
856##########################################
857# curses probe
858
859if test "$curses" = "yes" ; then
860 curses=no
861 cat > $TMPC << EOF
862#include <curses.h>
863int main(void) { return curses_version(); }
864EOF
af896aaa 865 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then
4d3b6f6e
AZ
866 curses=yes
867 fi
868fi # test "$curses"
869
414f0dab
BS
870##########################################
871# AIO probe
872if test "$aio" = "yes" ; then
873 aio=no
874 cat > $TMPC << EOF
875#include <aio.h>
876int main(void) { return aio_write(NULL); }
877EOF
878 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
879 aio=yes
880 fi
881fi
882
cc8ae6de 883# Check if tools are available to build documentation.
6c591867
TS
884if [ -x "`which texi2html 2>/dev/null`" ] && \
885 [ -x "`which pod2man 2>/dev/null`" ]; then
cc8ae6de
PB
886 build_docs="yes"
887fi
888
11d9f695 889if test "$mingw32" = "yes" ; then
308c3593
PB
890 if test -z "$prefix" ; then
891 prefix="/c/Program Files/Qemu"
892 fi
893 mansuffix=""
894 datasuffix=""
895 docsuffix=""
896 binsuffix=""
11d9f695 897else
308c3593
PB
898 if test -z "$prefix" ; then
899 prefix="/usr/local"
900 fi
901 mansuffix="/share/man"
902 datasuffix="/share/qemu"
903 docsuffix="/share/doc/qemu"
904 binsuffix="/bin"
11d9f695 905fi
5a67135a 906
43ce4dfe 907echo "Install prefix $prefix"
308c3593
PB
908echo "BIOS directory $prefix$datasuffix"
909echo "binary directory $prefix$binsuffix"
11d9f695 910if test "$mingw32" = "no" ; then
308c3593 911echo "Manual directory $prefix$mansuffix"
43ce4dfe 912echo "ELF interp prefix $interp_prefix"
11d9f695 913fi
5a67135a 914echo "Source path $source_path"
43ce4dfe 915echo "C compiler $cc"
83469015 916echo "Host C compiler $host_cc"
db7287ed 917echo "ARCH_CFLAGS $ARCH_CFLAGS"
43ce4dfe 918echo "make $make"
6a882643 919echo "install $install"
43ce4dfe 920echo "host CPU $cpu"
de83cd02 921echo "host big endian $bigendian"
97a847bc 922echo "target list $target_list"
43ce4dfe 923echo "gprof enabled $gprof"
05c2a3e7 924echo "profiler $profiler"
43ce4dfe 925echo "static build $static"
85aa5189 926echo "-Werror enabled $werror"
5b0753e0
FB
927if test "$darwin" = "yes" ; then
928 echo "Cocoa support $cocoa"
929fi
97a847bc 930echo "SDL support $sdl"
e4afee97
FB
931if test "$sdl" != "no" ; then
932 echo "SDL static link $sdl_static"
933fi
4d3b6f6e 934echo "curses support $curses"
67b915a5 935echo "mingw32 support $mingw32"
0c58ac1c 936echo "Audio drivers $audio_drv_list"
937echo "Extra audio cards $audio_card_list"
8ff9cbf7 938echo "Mixer emulation $mixemu"
8d5d2d4c
TS
939echo "VNC TLS support $vnc_tls"
940if test "$vnc_tls" = "yes" ; then
941 echo " TLS CFLAGS $vnc_tls_cflags"
942 echo " TLS LIBS $vnc_tls_libs"
943fi
3142255c
BS
944if test -n "$sparc_cpu"; then
945 echo "Target Sparc Arch $sparc_cpu"
946fi
07f4ddbf 947echo "kqemu support $kqemu"
2e4d9fb1 948echo "brlapi support $brlapi"
cc8ae6de 949echo "Documentation $build_docs"
c5937220
PB
950[ ! -z "$uname_release" ] && \
951echo "uname -r $uname_release"
bd0c5661 952echo "NPTL support $nptl"
8a16d273 953echo "vde support $vde"
414f0dab 954echo "AIO support $aio"
67b915a5 955
97a847bc 956if test $sdl_too_old = "yes"; then
24b55b96 957echo "-> Your SDL version is too old - please upgrade to have SDL support"
7c1f25b4 958fi
20b40c6a
TS
959if [ -s /tmp/qemu-$$-sdl-config.log ]; then
960 echo "The error log from compiling the libSDL test is: "
961 cat /tmp/qemu-$$-sdl-config.log
962fi
963rm -f /tmp/qemu-$$-sdl-config.log
24b55b96
FB
964#if test "$sdl_static" = "no"; then
965# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
966#fi
97a847bc
FB
967config_mak="config-host.mak"
968config_h="config-host.h"
7d13299d 969
7c1f25b4 970#echo "Creating $config_mak and $config_h"
7d13299d 971
15d9ca0f
TS
972test -f $config_h && mv $config_h ${config_h}~
973
97a847bc 974echo "# Automatically generated by configure - do not modify" > $config_mak
29517134 975echo "# Configured with: $0 $@" >> $config_mak
97a847bc 976echo "/* Automatically generated by configure - do not modify */" > $config_h
7d13299d 977
97a847bc 978echo "prefix=$prefix" >> $config_mak
308c3593
PB
979echo "bindir=\${prefix}$binsuffix" >> $config_mak
980echo "mandir=\${prefix}$mansuffix" >> $config_mak
981echo "datadir=\${prefix}$datasuffix" >> $config_mak
4ad5b06d 982echo "docdir=\${prefix}$docsuffix" >> $config_mak
308c3593 983echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
97a847bc 984echo "MAKE=$make" >> $config_mak
6a882643 985echo "INSTALL=$install" >> $config_mak
97a847bc 986echo "CC=$cc" >> $config_mak
97a847bc
FB
987echo "HOST_CC=$host_cc" >> $config_mak
988echo "AR=$ar" >> $config_mak
989echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
40293e58
FB
990# XXX: only use CFLAGS and LDFLAGS ?
991# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
992# compilation of dyngen tool (useful for win32 build on Linux host)
6f30fa85 993echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
3142255c
BS
994echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
995echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
996echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
97a847bc
FB
997echo "CFLAGS=$CFLAGS" >> $config_mak
998echo "LDFLAGS=$LDFLAGS" >> $config_mak
67b915a5 999echo "EXESUF=$EXESUF" >> $config_mak
70956b77 1000echo "AIOLIBS=$AIOLIBS" >> $config_mak
2408a527
AJ
1001case "$cpu" in
1002 i386)
1003 echo "ARCH=i386" >> $config_mak
1004 echo "#define HOST_I386 1" >> $config_h
1005 ;;
1006 x86_64)
1007 echo "ARCH=x86_64" >> $config_mak
1008 echo "#define HOST_X86_64 1" >> $config_h
1009 ;;
1010 alpha)
1011 echo "ARCH=alpha" >> $config_mak
1012 echo "#define HOST_ALPHA 1" >> $config_h
1013 ;;
1014 armv4b)
1015 echo "ARCH=arm" >> $config_mak
1016 echo "#define HOST_ARM 1" >> $config_h
1017 ;;
1018 armv4l)
1019 echo "ARCH=arm" >> $config_mak
1020 echo "#define HOST_ARM 1" >> $config_h
1021 ;;
1022 cris)
1023 echo "ARCH=cris" >> $config_mak
1024 echo "#define HOST_CRIS 1" >> $config_h
1025 ;;
1026 hppa)
1027 echo "ARCH=hppa" >> $config_mak
1028 echo "#define HOST_HPPA 1" >> $config_h
1029 ;;
1030 ia64)
1031 echo "ARCH=ia64" >> $config_mak
1032 echo "#define HOST_IA64 1" >> $config_h
1033 ;;
1034 m68k)
1035 echo "ARCH=m68k" >> $config_mak
1036 echo "#define HOST_M68K 1" >> $config_h
1037 ;;
1038 mips)
1039 echo "ARCH=mips" >> $config_mak
1040 echo "#define HOST_MIPS 1" >> $config_h
1041 ;;
1042 mips64)
1043 echo "ARCH=mips64" >> $config_mak
1044 echo "#define HOST_MIPS64 1" >> $config_h
1045 ;;
1046 powerpc)
810260a8 1047 if test "$hostlongbits" = "32"; then
1048 echo "ARCH=ppc" >> $config_mak
1049 echo "#define HOST_PPC 1" >> $config_h
1050 else
1051 echo "ARCH=ppc64" >> $config_mak
1052 echo "#define HOST_PPC64 1" >> $config_h
1053 fi
2408a527
AJ
1054 ;;
1055 s390)
1056 echo "ARCH=s390" >> $config_mak
1057 echo "#define HOST_S390 1" >> $config_h
1058 ;;
1059 sparc)
1060 echo "ARCH=sparc" >> $config_mak
1061 echo "#define HOST_SPARC 1" >> $config_h
1062 ;;
1063 sparc64)
1064 echo "ARCH=sparc64" >> $config_mak
1065 echo "#define HOST_SPARC64 1" >> $config_h
1066 ;;
1067 *)
1068 echo "Unsupported CPU = $cpu"
1069 exit 1
1070 ;;
1071esac
7d13299d 1072if test "$bigendian" = "yes" ; then
97a847bc
FB
1073 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1074 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1075fi
b6853697 1076echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
67b915a5
FB
1077if test "$mingw32" = "yes" ; then
1078 echo "CONFIG_WIN32=yes" >> $config_mak
11d9f695 1079 echo "#define CONFIG_WIN32 1" >> $config_h
210fa556
PB
1080else
1081 cat > $TMPC << EOF
1082#include <byteswap.h>
1083int main(void) { return bswap_32(0); }
1084EOF
db7287ed 1085 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
210fa556
PB
1086 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1087 fi
67b915a5 1088fi
83fb7adf
FB
1089if test "$darwin" = "yes" ; then
1090 echo "CONFIG_DARWIN=yes" >> $config_mak
1091 echo "#define CONFIG_DARWIN 1" >> $config_h
1092fi
ec530c81
FB
1093if test "$solaris" = "yes" ; then
1094 echo "CONFIG_SOLARIS=yes" >> $config_mak
38cfa06c 1095 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
0475a5ca
TS
1096 if test "$needs_libsunmath" = "yes" ; then
1097 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1098 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1099 fi
ec530c81 1100fi
3142255c
BS
1101if test -n "$sparc_cpu"; then
1102 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1103 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1104fi
67b915a5
FB
1105if test "$gdbstub" = "yes" ; then
1106 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1107 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1108fi
97a847bc
FB
1109if test "$gprof" = "yes" ; then
1110 echo "TARGET_GPROF=yes" >> $config_mak
1111 echo "#define HAVE_GPROF 1" >> $config_h
1112fi
1113if test "$static" = "yes" ; then
1114 echo "CONFIG_STATIC=yes" >> $config_mak
50863472 1115 echo "#define CONFIG_STATIC 1" >> $config_h
7d13299d 1116fi
05c2a3e7
FB
1117if test $profiler = "yes" ; then
1118 echo "#define CONFIG_PROFILER 1" >> $config_h
1119fi
c20709aa
FB
1120if test "$slirp" = "yes" ; then
1121 echo "CONFIG_SLIRP=yes" >> $config_mak
1122 echo "#define CONFIG_SLIRP 1" >> $config_h
1123fi
8a16d273
TS
1124if test "$vde" = "yes" ; then
1125 echo "CONFIG_VDE=yes" >> $config_mak
1126 echo "#define CONFIG_VDE 1" >> $config_h
1127 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1128fi
0c58ac1c 1129for card in $audio_card_list; do
f6e5889e 1130 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
0c58ac1c 1131 echo "$def=yes" >> $config_mak
1132 echo "#define $def 1" >> $config_h
1133done
1134echo "#define AUDIO_DRIVERS \\" >> $config_h
1135for drv in $audio_drv_list; do
1136 echo " &${drv}_audio_driver, \\" >>$config_h
f6e5889e 1137 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
0c58ac1c 1138 echo "$def=yes" >> $config_mak
923e4521 1139 if test "$drv" = "fmod"; then
0c58ac1c 1140 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1141 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1142 fi
1143done
1144echo "" >>$config_h
8ff9cbf7 1145if test "$mixemu" = "yes" ; then
1146 echo "CONFIG_MIXEMU=yes" >> $config_mak
1147 echo "#define CONFIG_MIXEMU 1" >> $config_h
1148fi
8d5d2d4c
TS
1149if test "$vnc_tls" = "yes" ; then
1150 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1151 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1152 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1153 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1154fi
b1a550a0
PB
1155qemu_version=`head $source_path/VERSION`
1156echo "VERSION=$qemu_version" >>$config_mak
d4b8f039 1157echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
97a847bc
FB
1158
1159echo "SRC_PATH=$source_path" >> $config_mak
ad064840
PB
1160if [ "$source_path_used" = "yes" ]; then
1161 echo "VPATH=$source_path" >> $config_mak
1162fi
97a847bc 1163echo "TARGET_DIRS=$target_list" >> $config_mak
cc8ae6de
PB
1164if [ "$build_docs" = "yes" ] ; then
1165 echo "BUILD_DOCS=yes" >> $config_mak
1166fi
49ecc3fa
FB
1167if test "$static" = "yes"; then
1168 sdl1=$sdl_static
1169else
1170 sdl1=$sdl
1171fi
1172if test "$sdl1" = "yes" ; then
1173 echo "#define CONFIG_SDL 1" >> $config_h
1174 echo "CONFIG_SDL=yes" >> $config_mak
1175 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1176 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1177 else
1178 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1179 fi
1180 if [ "${aa}" = "yes" ] ; then
1181 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1182 else
1183 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1184 fi
1185fi
1186if test "$cocoa" = "yes" ; then
4d3b6f6e
AZ
1187 echo "#define CONFIG_COCOA 1" >> $config_h
1188 echo "CONFIG_COCOA=yes" >> $config_mak
1189fi
1190if test "$curses" = "yes" ; then
1191 echo "#define CONFIG_CURSES 1" >> $config_h
1192 echo "CONFIG_CURSES=yes" >> $config_mak
1193 echo "CURSES_LIBS=-lcurses" >> $config_mak
49ecc3fa 1194fi
2e4d9fb1
AJ
1195if test "$brlapi" = "yes" ; then
1196 echo "CONFIG_BRLAPI=yes" >> $config_mak
1197 echo "#define CONFIG_BRLAPI 1" >> $config_h
1198 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1199fi
414f0dab
BS
1200if test "$aio" = "yes" ; then
1201 echo "#define CONFIG_AIO 1" >> $config_h
1202fi
97a847bc 1203
83fb7adf 1204# XXX: suppress that
7d3505c5 1205if [ "$bsd" = "yes" ] ; then
43003046 1206 echo "#define O_LARGEFILE 0" >> $config_h
43003046 1207 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
7d3505c5
FB
1208 echo "#define _BSD 1" >> $config_h
1209fi
1210
c5937220
PB
1211echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1212
c39e3338
PB
1213tools=
1214if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1215 tools="qemu-img\$(EXESUF) $tools"
7a5ca864
FB
1216 if [ "$linux" = "yes" ] ; then
1217 tools="qemu-nbd\$(EXESUF) $tools"
1218 fi
c39e3338
PB
1219fi
1220echo "TOOLS=$tools" >> $config_mak
1221
15d9ca0f
TS
1222test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1223
1d14ffa9 1224for target in $target_list; do
97a847bc
FB
1225target_dir="$target"
1226config_mak=$target_dir/config.mak
1227config_h=$target_dir/config.h
1228target_cpu=`echo $target | cut -d '-' -f 1`
1229target_bigendian="no"
808c4954 1230[ "$target_cpu" = "armeb" ] && target_bigendian=yes
0938cda5
AJ
1231[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1232[ "$target_cpu" = "mips" ] && target_bigendian=yes
1233[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1234[ "$target_cpu" = "mips64" ] && target_bigendian=yes
67867308 1235[ "$target_cpu" = "ppc" ] && target_bigendian=yes
d4082e95 1236[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
22f8a8b3 1237[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
e85e7c6e 1238[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
908f52b0 1239[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
0938cda5
AJ
1240[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1241[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1242[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
97a847bc 1243target_softmmu="no"
997344f3 1244target_user_only="no"
831b7825 1245target_linux_user="no"
831b7825 1246target_darwin_user="no"
9e407a85
PB
1247case "$target" in
1248 ${target_cpu}-softmmu)
1249 target_softmmu="yes"
1250 ;;
1251 ${target_cpu}-linux-user)
1252 target_user_only="yes"
1253 target_linux_user="yes"
1254 ;;
1255 ${target_cpu}-darwin-user)
1256 target_user_only="yes"
1257 target_darwin_user="yes"
1258 ;;
1259 *)
1260 echo "ERROR: Target '$target' not recognised"
1261 exit 1
1262 ;;
1263esac
831b7825 1264
97ccc689 1265if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1d14ffa9 1266 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
97ccc689 1267 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
9c038506 1268 echo "To build QEMU without graphical output configure with --disable-gfx-check"
4d3b6f6e
AZ
1269 echo "Note that this will disable all output from the virtual graphics card"
1270 echo "except through VNC or curses."
97ccc689
FB
1271 exit 1;
1272fi
1273
7c1f25b4 1274#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
97a847bc 1275
15d9ca0f
TS
1276test -f $config_h && mv $config_h ${config_h}~
1277
97a847bc 1278mkdir -p $target_dir
158142c2 1279mkdir -p $target_dir/fpu
57fec1fe 1280mkdir -p $target_dir/tcg
831b7825 1281if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
69de927c
FB
1282 mkdir -p $target_dir/nwfpe
1283fi
1284
ec530c81
FB
1285#
1286# don't use ln -sf as not all "ln -sf" over write the file/link
1287#
1288rm -f $target_dir/Makefile
1289ln -s $source_path/Makefile.target $target_dir/Makefile
1290
97a847bc
FB
1291
1292echo "# Automatically generated by configure - do not modify" > $config_mak
1293echo "/* Automatically generated by configure - do not modify */" > $config_h
1294
de83cd02 1295
97a847bc
FB
1296echo "include ../config-host.mak" >> $config_mak
1297echo "#include \"../config-host.h\"" >> $config_h
1e43adfc 1298
e5fe0c52 1299bflt="no"
cb33da57 1300elfload32="no"
bd0c5661 1301target_nptl="no"
1e43adfc
FB
1302interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1303echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
97a847bc 1304
2408a527
AJ
1305case "$target_cpu" in
1306 i386)
1307 echo "TARGET_ARCH=i386" >> $config_mak
1308 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1309 echo "#define TARGET_I386 1" >> $config_h
da260249 1310 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
2408a527
AJ
1311 then
1312 echo "#define USE_KQEMU 1" >> $config_h
1313 fi
f2bf094e 1314 gcc3minver=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
11d1fdb0 1315 if test -n "$gcc3minver" && test $gcc3minver -gt 3
f2bf094e
AJ
1316 then
1317 echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1318 else
1319 echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1320 fi
2408a527
AJ
1321 ;;
1322 x86_64)
1323 echo "TARGET_ARCH=x86_64" >> $config_mak
1324 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1325 echo "#define TARGET_I386 1" >> $config_h
1326 echo "#define TARGET_X86_64 1" >> $config_h
1327 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1328 then
1329 echo "#define USE_KQEMU 1" >> $config_h
1330 fi
1331 ;;
1332 alpha)
1333 echo "TARGET_ARCH=alpha" >> $config_mak
bf6247fb 1334 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1335 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1336 echo "#define TARGET_ALPHA 1" >> $config_h
bf6247fb 1337 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1338 ;;
1339 arm|armeb)
1340 echo "TARGET_ARCH=arm" >> $config_mak
2408a527
AJ
1341 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1342 echo "#define TARGET_ARM 1" >> $config_h
2408a527 1343 bflt="yes"
bd0c5661 1344 target_nptl="yes"
2408a527
AJ
1345 ;;
1346 cris)
1347 echo "TARGET_ARCH=cris" >> $config_mak
1348 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1349 echo "#define TARGET_CRIS 1" >> $config_h
2408a527
AJ
1350 ;;
1351 m68k)
1352 echo "TARGET_ARCH=m68k" >> $config_mak
1353 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1354 echo "#define TARGET_M68K 1" >> $config_h
1355 bflt="yes"
1356 ;;
1357 mips|mipsel)
1358 echo "TARGET_ARCH=mips" >> $config_mak
1359 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1360 echo "#define TARGET_MIPS 1" >> $config_h
1361 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1362 ;;
1363 mipsn32|mipsn32el)
1364 echo "TARGET_ARCH=mipsn32" >> $config_mak
1365 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1366 echo "#define TARGET_MIPS 1" >> $config_h
1367 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1368 ;;
1369 mips64|mips64el)
1370 echo "TARGET_ARCH=mips64" >> $config_mak
1371 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1372 echo "#define TARGET_MIPS 1" >> $config_h
1373 echo "#define TARGET_MIPS64 1" >> $config_h
1374 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1375 ;;
1376 ppc)
1377 echo "TARGET_ARCH=ppc" >> $config_mak
bf6247fb 1378 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1379 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1380 echo "#define TARGET_PPC 1" >> $config_h
bf6247fb 1381 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1382 ;;
1383 ppcemb)
1384 echo "TARGET_ARCH=ppcemb" >> $config_mak
1385 echo "TARGET_ABI_DIR=ppc" >> $config_mak
bf6247fb 1386 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1387 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1388 echo "#define TARGET_PPC 1" >> $config_h
1389 echo "#define TARGET_PPCEMB 1" >> $config_h
ec5b78cd 1390 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1391 ;;
1392 ppc64)
1393 echo "TARGET_ARCH=ppc64" >> $config_mak
1394 echo "TARGET_ABI_DIR=ppc" >> $config_mak
bf6247fb 1395 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1396 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1397 echo "#define TARGET_PPC 1" >> $config_h
1398 echo "#define TARGET_PPC64 1" >> $config_h
bf6247fb 1399 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1400 ;;
1401 ppc64abi32)
1402 echo "TARGET_ARCH=ppc64" >> $config_mak
1403 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1404 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
bf6247fb 1405 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1406 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1407 echo "#define TARGET_PPC 1" >> $config_h
1408 echo "#define TARGET_PPC64 1" >> $config_h
1409 echo "#define TARGET_ABI32 1" >> $config_h
bf6247fb 1410 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1411 ;;
1412 sh4|sh4eb)
1413 echo "TARGET_ARCH=sh4" >> $config_mak
bf6247fb 1414 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1415 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1416 echo "#define TARGET_SH4 1" >> $config_h
bf6247fb 1417 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1418 bflt="yes"
1419 ;;
1420 sparc)
1421 echo "TARGET_ARCH=sparc" >> $config_mak
1422 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1423 echo "#define TARGET_SPARC 1" >> $config_h
1424 ;;
1425 sparc64)
1426 echo "TARGET_ARCH=sparc64" >> $config_mak
1427 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1428 echo "#define TARGET_SPARC 1" >> $config_h
1429 echo "#define TARGET_SPARC64 1" >> $config_h
1430 elfload32="yes"
1431 ;;
1432 sparc32plus)
1433 echo "TARGET_ARCH=sparc64" >> $config_mak
1434 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1435 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1436 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1437 echo "#define TARGET_SPARC 1" >> $config_h
1438 echo "#define TARGET_SPARC64 1" >> $config_h
1439 echo "#define TARGET_ABI32 1" >> $config_h
1440 ;;
1441 *)
1442 echo "Unsupported target CPU"
1443 exit 1
1444 ;;
1445esac
de83cd02 1446if test "$target_bigendian" = "yes" ; then
97a847bc
FB
1447 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1448 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
de83cd02 1449fi
97a847bc
FB
1450if test "$target_softmmu" = "yes" ; then
1451 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1452 echo "#define CONFIG_SOFTMMU 1" >> $config_h
43ce4dfe 1453fi
997344f3
FB
1454if test "$target_user_only" = "yes" ; then
1455 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1456 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1457fi
831b7825
TS
1458if test "$target_linux_user" = "yes" ; then
1459 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1460 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1461fi
1462if test "$target_darwin_user" = "yes" ; then
1463 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1464 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1465fi
97a847bc 1466
0938cda5
AJ
1467if test "$target_cpu" = "arm" \
1468 -o "$target_cpu" = "armeb" \
1469 -o "$target_cpu" = "m68k" \
1470 -o "$target_cpu" = "mips" \
1471 -o "$target_cpu" = "mipsel" \
1472 -o "$target_cpu" = "mipsn32" \
1473 -o "$target_cpu" = "mipsn32el" \
1474 -o "$target_cpu" = "mips64" \
1475 -o "$target_cpu" = "mips64el" \
1476 -o "$target_cpu" = "sparc" \
1477 -o "$target_cpu" = "sparc64" \
1478 -o "$target_cpu" = "sparc32plus"; then
158142c2
FB
1479 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1480 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1481fi
e5fe0c52
PB
1482if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1483 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1484 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1485fi
bd0c5661
PB
1486if test "$target_user_only" = "yes" \
1487 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1488 echo "#define USE_NPTL 1" >> $config_h
1489fi
cb33da57
BS
1490# 32 bit ELF loader in addition to native 64 bit loader?
1491if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1492 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1493 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1494fi
5b0753e0 1495
15d9ca0f
TS
1496test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1497
97a847bc 1498done # for target in $targets
7d13299d
FB
1499
1500# build tree in object directory if source path is different from current one
1501if test "$source_path_used" = "yes" ; then
49ecc3fa 1502 DIRS="tests tests/cris slirp audio"
7d13299d 1503 FILES="Makefile tests/Makefile"
e7daa605 1504 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
e1ffb0f1 1505 FILES="$FILES tests/test-mmap.c"
7d13299d
FB
1506 for dir in $DIRS ; do
1507 mkdir -p $dir
1508 done
ec530c81 1509 # remove the link and recreate it, as not all "ln -sf" overwrite the link
7d13299d 1510 for f in $FILES ; do
ec530c81
FB
1511 rm -f $f
1512 ln -s $source_path/$f $f
7d13299d
FB
1513 done
1514fi
7d13299d 1515
97a847bc 1516rm -f $TMPO $TMPC $TMPE $TMPS