]> git.proxmox.com Git - qemu.git/blame - configure
cpu-all.h: Remove unnecessary target-specific ifdef for CPU_QuadU
[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"
a91b857c 16TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
7d13299d 17
0ba8681e
LM
18# NB: do not call "exit" in the trap handler; this is buggy with some shells;
19# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
20trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
da1d85e3 21rm -f config.log
9ac81bbb 22
52166aa0 23compile_object() {
da1d85e3
GH
24 echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log
25 $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
52166aa0
JQ
26}
27
28compile_prog() {
29 local_cflags="$1"
30 local_ldflags="$2"
da1d85e3
GH
31 echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log
32 $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1
52166aa0
JQ
33}
34
11568d6d
PB
35# symbolically link $1 to $2. Portable version of "ln -sf".
36symlink() {
37 rm -f $2
38 ln -s $1 $2
39}
40
0dba6195
LM
41# check whether a command is available to this shell (may be either an
42# executable or a builtin)
43has() {
44 type "$1" >/dev/null 2>&1
45}
46
47# search for an executable in PATH
48path_of() {
49 local_command="$1"
50 local_ifs="$IFS"
51 local_dir=""
52
53 # pathname has a dir component?
54 if [ "${local_command#*/}" != "$local_command" ]; then
55 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
56 echo "$local_command"
57 return 0
58 fi
59 fi
60 if [ -z "$local_command" ]; then
61 return 1
62 fi
63
64 IFS=:
65 for local_dir in $PATH; do
66 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
67 echo "$local_dir/$local_command"
68 IFS="${local_ifs:-$(printf ' \t\n')}"
69 return 0
70 fi
71 done
72 # not found
73 IFS="${local_ifs:-$(printf ' \t\n')}"
74 return 1
75}
76
7d13299d 77# default parameters
ca4deeb1 78source_path=`dirname "$0"`
2ff6b91e 79cpu=""
1e43adfc 80interp_prefix="/usr/gnemul/qemu-%M"
43ce4dfe 81static="no"
ed968ff1 82sparc_cpu=""
7d13299d 83cross_prefix=""
0c58ac1c 84audio_drv_list=""
d61a4ce8
GH
85audio_card_list="ac97 es1370 sb16 hda"
86audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
eb852011 87block_drv_whitelist=""
7d13299d 88host_cc="gcc"
c81da56e 89helper_cflags=""
73da375e 90libs_softmmu=""
3e2e0e6b 91libs_tools=""
67f86e8e 92audio_pt_int=""
d5631638 93audio_win_int=""
2b2e59e6 94cc_i386=i386-pc-linux-gnu-gcc
ac0df51d 95
377529c0
PB
96target_list=""
97
98# Default value for a variable defining feature "foo".
99# * foo="no" feature will only be used if --enable-foo arg is given
100# * foo="" feature will be searched for, and if found, will be used
101# unless --disable-foo is given
102# * foo="yes" this value will only be set by --enable-foo flag.
103# feature will searched for,
104# if not found, configure exits with error
105#
106# Always add --enable-foo and --disable-foo command line args.
107# Distributions want to ensure that several features are compiled in, and it
108# is impossible without a --enable-foo that exits if a feature is not found.
109
110bluez=""
111brlapi=""
112curl=""
113curses=""
114docs=""
115fdt=""
116kvm=""
117kvm_para=""
118nptl=""
119sdl=""
821601ea 120vnc="yes"
377529c0
PB
121sparse="no"
122uuid=""
123vde=""
124vnc_tls=""
125vnc_sasl=""
126vnc_jpeg=""
127vnc_png=""
128vnc_thread="no"
129xen=""
130linux_aio=""
131attr=""
132vhost_net=""
133xfs=""
134
135gprof="no"
136debug_tcg="no"
137debug_mon="no"
138debug="no"
139strip_opt="yes"
140bigendian="no"
141mingw32="no"
142EXESUF=""
143prefix="/usr/local"
144mandir="\${prefix}/share/man"
145datadir="\${prefix}/share/qemu"
146docdir="\${prefix}/share/doc/qemu"
147bindir="\${prefix}/bin"
148sysconfdir="\${prefix}/etc"
149confsuffix="/qemu"
150slirp="yes"
151fmod_lib=""
152fmod_inc=""
153oss_lib=""
154bsd="no"
155linux="no"
156solaris="no"
157profiler="no"
158cocoa="no"
159softmmu="yes"
160linux_user="no"
161darwin_user="no"
162bsd_user="no"
163guest_base=""
164uname_release=""
165io_thread="no"
166mixemu="no"
167kerneldir=""
168aix="no"
169blobs="yes"
170pkgversion=""
171check_utests="no"
172user_pie="no"
173zero_malloc=""
174trace_backend="nop"
175trace_file="trace"
176spice=""
177rbd=""
36707144 178smartcard=""
111a38b0 179smartcard_nss=""
377529c0 180
ac0df51d
AL
181# parse CC options first
182for opt do
183 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
184 case "$opt" in
185 --cross-prefix=*) cross_prefix="$optarg"
186 ;;
3d8df640 187 --cc=*) CC="$optarg"
ac0df51d 188 ;;
ca4deeb1
PB
189 --source-path=*) source_path="$optarg"
190 ;;
2ff6b91e
JQ
191 --cpu=*) cpu="$optarg"
192 ;;
a558ee17 193 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
e2a2ed06
JQ
194 ;;
195 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
196 ;;
50e7b1a0
JQ
197 --sparc_cpu=*)
198 sparc_cpu="$optarg"
199 case $sparc_cpu in
ed968ff1 200 v7|v8|v8plus|v8plusa)
50e7b1a0
JQ
201 cpu="sparc"
202 ;;
203 v9)
50e7b1a0
JQ
204 cpu="sparc64"
205 ;;
206 *)
207 echo "undefined SPARC architecture. Exiting";
208 exit 1
209 ;;
210 esac
211 ;;
ac0df51d
AL
212 esac
213done
ac0df51d
AL
214# OS specific
215# Using uname is really, really broken. Once we have the right set of checks
216# we can eliminate it's usage altogether
217
3d8df640
PB
218cc="${cross_prefix}${CC-gcc}"
219ar="${cross_prefix}${AR-ar}"
220objcopy="${cross_prefix}${OBJCOPY-objcopy}"
221ld="${cross_prefix}${LD-ld}"
222strip="${cross_prefix}${STRIP-strip}"
223windres="${cross_prefix}${WINDRES-windres}"
a8bd70ad 224pkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}"
3ec87ffe 225sdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}"
ac0df51d 226
be17dc90
MT
227# default flags for all hosts
228QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
229CFLAGS="-g $CFLAGS"
230QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
231QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
232QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
84958305 233QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
f9728943 234QEMU_INCLUDES="-I. -I\$(SRC_PATH)"
be17dc90
MT
235LDFLAGS="-g $LDFLAGS"
236
ca4deeb1
PB
237# make source path absolute
238source_path=`cd "$source_path"; pwd`
239
ac0df51d
AL
240check_define() {
241cat > $TMPC <<EOF
242#if !defined($1)
243#error Not defined
244#endif
245int main(void) { return 0; }
246EOF
52166aa0 247 compile_object
ac0df51d
AL
248}
249
2ff6b91e
JQ
250if test ! -z "$cpu" ; then
251 # command line argument
252 :
253elif check_define __i386__ ; then
ac0df51d
AL
254 cpu="i386"
255elif check_define __x86_64__ ; then
256 cpu="x86_64"
3aa9bd6c
BS
257elif check_define __sparc__ ; then
258 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
259 # They must be specified using --sparc_cpu
260 if check_define __arch64__ ; then
261 cpu="sparc64"
262 else
263 cpu="sparc"
264 fi
fdf7ed96 265elif check_define _ARCH_PPC ; then
266 if check_define _ARCH_PPC64 ; then
267 cpu="ppc64"
268 else
269 cpu="ppc"
270 fi
afa05235
AJ
271elif check_define __mips__ ; then
272 cpu="mips"
477ba620
AJ
273elif check_define __ia64__ ; then
274 cpu="ia64"
d66ed0ea
AJ
275elif check_define __s390__ ; then
276 if check_define __s390x__ ; then
277 cpu="s390x"
278 else
279 cpu="s390"
280 fi
ac0df51d 281else
fdf7ed96 282 cpu=`uname -m`
ac0df51d
AL
283fi
284
7d13299d 285case "$cpu" in
613a22c9 286 alpha|cris|ia64|lm32|m68k|microblaze|ppc|ppc64|sparc64)
ea8f20f8
JQ
287 cpu="$cpu"
288 ;;
7d13299d 289 i386|i486|i586|i686|i86pc|BePC)
97a847bc 290 cpu="i386"
7d13299d 291 ;;
aaa5fa14
AJ
292 x86_64|amd64)
293 cpu="x86_64"
294 ;;
ba68055e 295 armv*b)
808c4954
FB
296 cpu="armv4b"
297 ;;
ba68055e 298 armv*l)
7d13299d
FB
299 cpu="armv4l"
300 ;;
f54b3f92
AJ
301 parisc|parisc64)
302 cpu="hppa"
303 ;;
afa05235
AJ
304 mips*)
305 cpu="mips"
306 ;;
24e804ec 307 s390)
fb3e5849
FB
308 cpu="s390"
309 ;;
24e804ec
AG
310 s390x)
311 cpu="s390x"
312 ;;
3142255c 313 sparc|sun4[cdmuv])
ae228531
FB
314 cpu="sparc"
315 ;;
7d13299d 316 *)
a447d4dc
PB
317 echo "Unsupported CPU = $cpu"
318 exit 1
7d13299d
FB
319 ;;
320esac
e2d52ad3 321
7d13299d 322# OS specific
ac0df51d
AL
323if check_define __linux__ ; then
324 targetos="Linux"
325elif check_define _WIN32 ; then
326 targetos='MINGW32'
169dc5d3
BS
327elif check_define __OpenBSD__ ; then
328 targetos='OpenBSD'
329elif check_define __sun__ ; then
330 targetos='SunOS'
179cf400
AF
331elif check_define __HAIKU__ ; then
332 targetos='Haiku'
ac0df51d
AL
333else
334 targetos=`uname -s`
335fi
0dbfc675 336
7d13299d 337case $targetos in
c326e0af 338CYGWIN*)
0dbfc675 339 mingw32="yes"
a558ee17 340 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
d5631638 341 audio_possible_drivers="winwave sdl"
342 audio_drv_list="winwave"
c326e0af 343;;
67b915a5 344MINGW32*)
0dbfc675 345 mingw32="yes"
d5631638 346 audio_possible_drivers="winwave dsound sdl fmod"
347 audio_drv_list="winwave"
67b915a5 348;;
5c40d2bd 349GNU/kFreeBSD)
a167ba50 350 bsd="yes"
0dbfc675
JQ
351 audio_drv_list="oss"
352 audio_possible_drivers="oss sdl esd pa"
5c40d2bd 353;;
7d3505c5 354FreeBSD)
0dbfc675 355 bsd="yes"
0db4a067 356 make="${MAKE-gmake}"
0dbfc675
JQ
357 audio_drv_list="oss"
358 audio_possible_drivers="oss sdl esd pa"
f01576f1
JL
359 # needed for kinfo_getvmmap(3) in libutil.h
360 LIBS="-lutil $LIBS"
7d3505c5 361;;
c5e97233 362DragonFly)
0dbfc675 363 bsd="yes"
0db4a067 364 make="${MAKE-gmake}"
0dbfc675
JQ
365 audio_drv_list="oss"
366 audio_possible_drivers="oss sdl esd pa"
c5e97233 367;;
7d3505c5 368NetBSD)
0dbfc675 369 bsd="yes"
0db4a067 370 make="${MAKE-gmake}"
0dbfc675
JQ
371 audio_drv_list="oss"
372 audio_possible_drivers="oss sdl esd"
373 oss_lib="-lossaudio"
7d3505c5
FB
374;;
375OpenBSD)
0dbfc675 376 bsd="yes"
0db4a067 377 make="${MAKE-gmake}"
0dbfc675
JQ
378 audio_drv_list="oss"
379 audio_possible_drivers="oss sdl esd"
380 oss_lib="-lossaudio"
7d3505c5 381;;
83fb7adf 382Darwin)
0dbfc675
JQ
383 bsd="yes"
384 darwin="yes"
385 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
386 # run 64-bit userspace code
387 if [ "$cpu" = "i386" ] ; then
aab8588a 388 is_x86_64=`sysctl -n hw.optional.x86_64`
389 [ "$is_x86_64" = "1" ] && cpu=x86_64
0dbfc675
JQ
390 fi
391 if [ "$cpu" = "x86_64" ] ; then
a558ee17 392 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
0c439cbf 393 LDFLAGS="-arch x86_64 $LDFLAGS"
0dbfc675 394 else
a558ee17 395 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
0dbfc675
JQ
396 fi
397 darwin_user="yes"
398 cocoa="yes"
399 audio_drv_list="coreaudio"
400 audio_possible_drivers="coreaudio sdl fmod"
401 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
7973f21c 402 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
83fb7adf 403;;
ec530c81 404SunOS)
0dbfc675 405 solaris="yes"
0db4a067
PB
406 make="${MAKE-gmake}"
407 install="${INSTALL-ginstall}"
fa58948d 408 ld="gld"
0dbfc675
JQ
409 needs_libsunmath="no"
410 solarisrev=`uname -r | cut -f2 -d.`
411 # have to select again, because `uname -m` returns i86pc
412 # even on an x86_64 box.
413 solariscpu=`isainfo -k`
414 if test "${solariscpu}" = "amd64" ; then
415 cpu="x86_64"
416 fi
417 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
418 if test "$solarisrev" -le 9 ; then
419 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
420 needs_libsunmath="yes"
f14bfdf9
JQ
421 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
422 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
423 LIBS="-lsunmath $LIBS"
0dbfc675
JQ
424 else
425 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
426 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
427 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
428 echo "Studio 11 can be downloaded from www.sun.com."
429 exit 1
430 fi
86b2bd93 431 fi
0dbfc675
JQ
432 fi
433 if test -f /usr/include/sys/soundcard.h ; then
434 audio_drv_list="oss"
435 fi
436 audio_possible_drivers="oss sdl"
d741429a
BS
437# needed for CMSG_ macros in sys/socket.h
438 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
439# needed for TIOCWIN* defines in termios.h
440 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
a558ee17 441 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
e174c0bb 442 LIBS="-lsocket -lnsl -lresolv $LIBS"
86b2bd93 443;;
b29fe3ed 444AIX)
0dbfc675 445 aix="yes"
0db4a067 446 make="${MAKE-gmake}"
b29fe3ed 447;;
179cf400
AF
448Haiku)
449 haiku="yes"
450 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
451 LIBS="-lposix_error_mapper -lnetwork $LIBS"
452;;
1d14ffa9 453*)
0dbfc675
JQ
454 audio_drv_list="oss"
455 audio_possible_drivers="oss alsa sdl esd pa"
456 linux="yes"
457 linux_user="yes"
458 usb="linux"
0dbfc675 459 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
c2de5c91 460 audio_possible_drivers="$audio_possible_drivers fmod"
0dbfc675 461 fi
fb065187 462;;
7d13299d
FB
463esac
464
7d3505c5 465if [ "$bsd" = "yes" ] ; then
b1a550a0 466 if [ "$darwin" != "yes" ] ; then
68063649 467 usb="bsd"
83fb7adf 468 fi
84778508 469 bsd_user="yes"
7d3505c5
FB
470fi
471
0db4a067
PB
472: ${make=${MAKE-make}}
473: ${install=${INSTALL-install}}
474
3457a3f8 475if test "$mingw32" = "yes" ; then
3457a3f8 476 EXESUF=".exe"
a558ee17 477 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
e94a7936
SW
478 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
479 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
08f3896a 480 LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS"
683035de
PB
481 prefix="c:/Program Files/Qemu"
482 mandir="\${prefix}"
483 datadir="\${prefix}"
484 docdir="\${prefix}"
485 bindir="\${prefix}"
486 sysconfdir="\${prefix}"
487 confsuffix=""
3457a3f8
JQ
488fi
489
487fefdb 490werror=""
85aa5189 491
7d13299d 492for opt do
a46e4035 493 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
7d13299d 494 case "$opt" in
2efc3265
FB
495 --help|-h) show_help=yes
496 ;;
b1a550a0 497 --prefix=*) prefix="$optarg"
7d13299d 498 ;;
b1a550a0 499 --interp-prefix=*) interp_prefix="$optarg"
32ce6337 500 ;;
ca4deeb1 501 --source-path=*)
7d13299d 502 ;;
ac0df51d 503 --cross-prefix=*)
7d13299d 504 ;;
ac0df51d 505 --cc=*)
7d13299d 506 ;;
b1a550a0 507 --host-cc=*) host_cc="$optarg"
83469015 508 ;;
b1a550a0 509 --make=*) make="$optarg"
7d13299d 510 ;;
6a882643
PB
511 --install=*) install="$optarg"
512 ;;
e2a2ed06 513 --extra-cflags=*)
7d13299d 514 ;;
e2a2ed06 515 --extra-ldflags=*)
7d13299d 516 ;;
2ff6b91e 517 --cpu=*)
7d13299d 518 ;;
b1a550a0 519 --target-list=*) target_list="$optarg"
de83cd02 520 ;;
74242e0f 521 --enable-trace-backend=*) trace_backend="$optarg"
94a420b1 522 ;;
74242e0f 523 --with-trace-file=*) trace_file="$optarg"
9410b56c 524 ;;
7d13299d
FB
525 --enable-gprof) gprof="yes"
526 ;;
79427693
LM
527 --static)
528 static="yes"
529 LDFLAGS="-static $LDFLAGS"
43ce4dfe 530 ;;
0b24e75f
PB
531 --mandir=*) mandir="$optarg"
532 ;;
533 --bindir=*) bindir="$optarg"
534 ;;
535 --datadir=*) datadir="$optarg"
536 ;;
537 --docdir=*) docdir="$optarg"
538 ;;
ca2fb938 539 --sysconfdir=*) sysconfdir="$optarg"
07381cc1 540 ;;
97a847bc
FB
541 --disable-sdl) sdl="no"
542 ;;
c4198157
JQ
543 --enable-sdl) sdl="yes"
544 ;;
821601ea
JS
545 --disable-vnc) vnc="no"
546 ;;
547 --enable-vnc) vnc="yes"
548 ;;
0c58ac1c 549 --fmod-lib=*) fmod_lib="$optarg"
1d14ffa9 550 ;;
c2de5c91 551 --fmod-inc=*) fmod_inc="$optarg"
552 ;;
2f6a1ab0
BS
553 --oss-lib=*) oss_lib="$optarg"
554 ;;
2fa7d3bf 555 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
102a52e4 556 ;;
0c58ac1c 557 --audio-drv-list=*) audio_drv_list="$optarg"
102a52e4 558 ;;
eb852011
MA
559 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
560 ;;
f8393946
AJ
561 --enable-debug-tcg) debug_tcg="yes"
562 ;;
563 --disable-debug-tcg) debug_tcg="no"
564 ;;
b4475aa2
LC
565 --enable-debug-mon) debug_mon="yes"
566 ;;
567 --disable-debug-mon) debug_mon="no"
568 ;;
f3d08ee6
PB
569 --enable-debug)
570 # Enable debugging options that aren't excessively noisy
571 debug_tcg="yes"
b4475aa2 572 debug_mon="yes"
f3d08ee6
PB
573 debug="yes"
574 strip_opt="no"
575 ;;
03b4fe7d
AL
576 --enable-sparse) sparse="yes"
577 ;;
578 --disable-sparse) sparse="no"
579 ;;
1625af87
AL
580 --disable-strip) strip_opt="no"
581 ;;
8d5d2d4c
TS
582 --disable-vnc-tls) vnc_tls="no"
583 ;;
1be10ad2
JQ
584 --enable-vnc-tls) vnc_tls="yes"
585 ;;
2f9606b3
AL
586 --disable-vnc-sasl) vnc_sasl="no"
587 ;;
ea784e3b
JQ
588 --enable-vnc-sasl) vnc_sasl="yes"
589 ;;
2f6f5c7a
CC
590 --disable-vnc-jpeg) vnc_jpeg="no"
591 ;;
592 --enable-vnc-jpeg) vnc_jpeg="yes"
593 ;;
efe556ad
CC
594 --disable-vnc-png) vnc_png="no"
595 ;;
596 --enable-vnc-png) vnc_png="yes"
597 ;;
bd023f95
CC
598 --disable-vnc-thread) vnc_thread="no"
599 ;;
600 --enable-vnc-thread) vnc_thread="yes"
601 ;;
443f1376 602 --disable-slirp) slirp="no"
1d14ffa9 603 ;;
ee682d27
SW
604 --disable-uuid) uuid="no"
605 ;;
606 --enable-uuid) uuid="yes"
607 ;;
e0e6c8c0 608 --disable-vde) vde="no"
8a16d273 609 ;;
dfb278bd
JQ
610 --enable-vde) vde="yes"
611 ;;
e37630ca
AL
612 --disable-xen) xen="no"
613 ;;
fc321b4b
JQ
614 --enable-xen) xen="yes"
615 ;;
2e4d9fb1
AJ
616 --disable-brlapi) brlapi="no"
617 ;;
4ffcedb6
JQ
618 --enable-brlapi) brlapi="yes"
619 ;;
fb599c9a
AZ
620 --disable-bluez) bluez="no"
621 ;;
a20a6f46
JQ
622 --enable-bluez) bluez="yes"
623 ;;
7ba1e619
AL
624 --disable-kvm) kvm="no"
625 ;;
b31a0277
JQ
626 --enable-kvm) kvm="yes"
627 ;;
cd4ec0b4
GH
628 --disable-spice) spice="no"
629 ;;
630 --enable-spice) spice="yes"
631 ;;
05c2a3e7
FB
632 --enable-profiler) profiler="yes"
633 ;;
c2de5c91 634 --enable-cocoa)
635 cocoa="yes" ;
636 sdl="no" ;
637 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
1d14ffa9 638 ;;
cad25d69 639 --disable-system) softmmu="no"
0a8e90f4 640 ;;
cad25d69 641 --enable-system) softmmu="yes"
0a8e90f4 642 ;;
0953a80f
ZA
643 --disable-user)
644 linux_user="no" ;
645 bsd_user="no" ;
646 darwin_user="no"
647 ;;
648 --enable-user) ;;
831b7825 649 --disable-linux-user) linux_user="no"
0a8e90f4 650 ;;
831b7825
TS
651 --enable-linux-user) linux_user="yes"
652 ;;
653 --disable-darwin-user) darwin_user="no"
654 ;;
655 --enable-darwin-user) darwin_user="yes"
0a8e90f4 656 ;;
84778508
BS
657 --disable-bsd-user) bsd_user="no"
658 ;;
659 --enable-bsd-user) bsd_user="yes"
660 ;;
379f6698
PB
661 --enable-guest-base) guest_base="yes"
662 ;;
663 --disable-guest-base) guest_base="no"
664 ;;
34005a00
KS
665 --enable-user-pie) user_pie="yes"
666 ;;
667 --disable-user-pie) user_pie="no"
668 ;;
c5937220
PB
669 --enable-uname-release=*) uname_release="$optarg"
670 ;;
3142255c 671 --sparc_cpu=*)
3142255c 672 ;;
85aa5189
FB
673 --enable-werror) werror="yes"
674 ;;
675 --disable-werror) werror="no"
676 ;;
4d3b6f6e
AZ
677 --disable-curses) curses="no"
678 ;;
c584a6d0
JQ
679 --enable-curses) curses="yes"
680 ;;
769ce76d
AG
681 --disable-curl) curl="no"
682 ;;
788c8196
JQ
683 --enable-curl) curl="yes"
684 ;;
2df87df7
JQ
685 --disable-fdt) fdt="no"
686 ;;
687 --enable-fdt) fdt="yes"
688 ;;
5495ed11
LC
689 --disable-check-utests) check_utests="no"
690 ;;
691 --enable-check-utests) check_utests="yes"
692 ;;
bd0c5661
PB
693 --disable-nptl) nptl="no"
694 ;;
b0a47e79
JQ
695 --enable-nptl) nptl="yes"
696 ;;
8ff9cbf7 697 --enable-mixemu) mixemu="yes"
698 ;;
5c6c3a6c
CH
699 --disable-linux-aio) linux_aio="no"
700 ;;
701 --enable-linux-aio) linux_aio="yes"
702 ;;
758e8e38
VJJ
703 --disable-attr) attr="no"
704 ;;
705 --enable-attr) attr="yes"
706 ;;
e5d355d1
AL
707 --enable-io-thread) io_thread="yes"
708 ;;
77755340
TS
709 --disable-blobs) blobs="no"
710 ;;
eac30262
AL
711 --kerneldir=*) kerneldir="$optarg"
712 ;;
4a19f1ec
PB
713 --with-pkgversion=*) pkgversion=" ($optarg)"
714 ;;
a25dba17 715 --disable-docs) docs="no"
70ec5dc0 716 ;;
a25dba17 717 --enable-docs) docs="yes"
83a3ab8b 718 ;;
d5970055
MT
719 --disable-vhost-net) vhost_net="no"
720 ;;
721 --enable-vhost-net) vhost_net="yes"
722 ;;
20ff075b
MW
723 --disable-opengl) opengl="no"
724 ;;
725 --enable-opengl) opengl="yes"
726 ;;
6bde81cb
PB
727 --*dir)
728 ;;
f27aaf4b
CB
729 --disable-rbd) rbd="no"
730 ;;
731 --enable-rbd) rbd="yes"
732 ;;
36707144
AL
733 --disable-smartcard) smartcard="no"
734 ;;
735 --enable-smartcard) smartcard="yes"
736 ;;
111a38b0
RR
737 --disable-smartcard-nss) smartcard_nss="no"
738 ;;
739 --enable-smartcard-nss) smartcard_nss="yes"
740 ;;
7f1559c6
AZ
741 *) echo "ERROR: unknown option $opt"; show_help="yes"
742 ;;
7d13299d
FB
743 esac
744done
745
3142255c
BS
746#
747# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
a558ee17 748# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
3142255c 749#
379f6698 750host_guest_base="no"
40293e58 751case "$cpu" in
ed968ff1
JQ
752 sparc) case $sparc_cpu in
753 v7|v8)
a558ee17 754 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
ed968ff1
JQ
755 ;;
756 v8plus|v8plusa)
a558ee17 757 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
ed968ff1
JQ
758 ;;
759 *) # sparc_cpu not defined in the command line
a558ee17 760 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
ed968ff1
JQ
761 esac
762 LDFLAGS="-m32 $LDFLAGS"
a558ee17 763 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
762e8230 764 if test "$solaris" = "no" ; then
a558ee17 765 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
c81da56e 766 helper_cflags="-ffixed-i0"
762e8230 767 fi
3142255c 768 ;;
ed968ff1 769 sparc64)
a558ee17 770 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
ed968ff1 771 LDFLAGS="-m64 $LDFLAGS"
a558ee17 772 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
ed968ff1 773 if test "$solaris" != "no" ; then
a558ee17 774 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
762e8230 775 fi
3142255c 776 ;;
76d83bde 777 s390)
28d7cc49
RH
778 QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
779 LDFLAGS="-m31 $LDFLAGS"
48bb3750 780 host_guest_base="yes"
28d7cc49
RH
781 ;;
782 s390x)
783 QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
784 LDFLAGS="-m64 $LDFLAGS"
48bb3750 785 host_guest_base="yes"
76d83bde 786 ;;
40293e58 787 i386)
a558ee17 788 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
0c439cbf 789 LDFLAGS="-m32 $LDFLAGS"
2b2e59e6 790 cc_i386='$(CC) -m32'
c81da56e 791 helper_cflags="-fomit-frame-pointer"
379f6698 792 host_guest_base="yes"
40293e58
FB
793 ;;
794 x86_64)
a558ee17 795 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
0c439cbf 796 LDFLAGS="-m64 $LDFLAGS"
2b2e59e6 797 cc_i386='$(CC) -m32'
379f6698
PB
798 host_guest_base="yes"
799 ;;
800 arm*)
801 host_guest_base="yes"
40293e58 802 ;;
f6548c0a 803 ppc*)
804 host_guest_base="yes"
805 ;;
cc01cc8e
AJ
806 mips*)
807 host_guest_base="yes"
808 ;;
477ba620
AJ
809 ia64*)
810 host_guest_base="yes"
811 ;;
fd76e73a
RH
812 hppa*)
813 host_guest_base="yes"
814 ;;
3142255c
BS
815esac
816
379f6698
PB
817[ -z "$guest_base" ] && guest_base="$host_guest_base"
818
af5db58e
PB
819if test x"$show_help" = x"yes" ; then
820cat << EOF
821
822Usage: configure [options]
823Options: [defaults in brackets after descriptions]
824
825EOF
826echo "Standard options:"
827echo " --help print this message"
828echo " --prefix=PREFIX install in PREFIX [$prefix]"
829echo " --interp-prefix=PREFIX where to find shared libraries, etc."
830echo " use %M for cpu name [$interp_prefix]"
831echo " --target-list=LIST set target list [$target_list]"
832echo ""
af5db58e
PB
833echo "Advanced options (experts only):"
834echo " --source-path=PATH path of source code [$source_path]"
835echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
836echo " --cc=CC use C compiler CC [$cc]"
0bfe8cc0
PB
837echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
838echo " build time"
a558ee17 839echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
e3fc14c3 840echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
af5db58e 841echo " --make=MAKE use specified make [$make]"
6a882643 842echo " --install=INSTALL use specified install [$install]"
af5db58e 843echo " --static enable static build [$static]"
0b24e75f
PB
844echo " --mandir=PATH install man pages in PATH"
845echo " --datadir=PATH install firmware in PATH"
846echo " --docdir=PATH install documentation in PATH"
847echo " --bindir=PATH install binaries in PATH"
848echo " --sysconfdir=PATH install config in PATH/qemu"
f8393946
AJ
849echo " --enable-debug-tcg enable TCG debugging"
850echo " --disable-debug-tcg disable TCG debugging (default)"
09695a4a 851echo " --enable-debug enable common debug build options"
890b1658
AL
852echo " --enable-sparse enable sparse checker"
853echo " --disable-sparse disable sparse checker (default)"
1625af87 854echo " --disable-strip disable stripping binaries"
85aa5189 855echo " --disable-werror disable compilation abort on warning"
fe8f78e4 856echo " --disable-sdl disable SDL"
c4198157 857echo " --enable-sdl enable SDL"
821601ea
JS
858echo " --disable-vnc disable VNC"
859echo " --enable-vnc enable VNC"
af5db58e 860echo " --enable-cocoa enable COCOA (Mac OS X only)"
c2de5c91 861echo " --audio-drv-list=LIST set audio drivers list:"
862echo " Available drivers: $audio_possible_drivers"
4c9b53e3 863echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
864echo " Available cards: $audio_possible_cards"
eb852011
MA
865echo " --block-drv-whitelist=L set block driver whitelist"
866echo " (affects only QEMU, not qemu-img)"
8ff9cbf7 867echo " --enable-mixemu enable mixer emulation"
e37630ca 868echo " --disable-xen disable xen backend driver support"
fc321b4b 869echo " --enable-xen enable xen backend driver support"
2e4d9fb1 870echo " --disable-brlapi disable BrlAPI"
4ffcedb6 871echo " --enable-brlapi enable BrlAPI"
8d5d2d4c 872echo " --disable-vnc-tls disable TLS encryption for VNC server"
1be10ad2 873echo " --enable-vnc-tls enable TLS encryption for VNC server"
2f9606b3 874echo " --disable-vnc-sasl disable SASL encryption for VNC server"
ea784e3b 875echo " --enable-vnc-sasl enable SASL encryption for VNC server"
2f6f5c7a
CC
876echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
877echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
96763cf9 878echo " --disable-vnc-png disable PNG compression for VNC server (default)"
efe556ad 879echo " --enable-vnc-png enable PNG compression for VNC server"
bd023f95
CC
880echo " --disable-vnc-thread disable threaded VNC server"
881echo " --enable-vnc-thread enable threaded VNC server"
af896aaa 882echo " --disable-curses disable curses output"
c584a6d0 883echo " --enable-curses enable curses output"
769ce76d 884echo " --disable-curl disable curl connectivity"
788c8196 885echo " --enable-curl enable curl connectivity"
2df87df7
JQ
886echo " --disable-fdt disable fdt device tree"
887echo " --enable-fdt enable fdt device tree"
5495ed11
LC
888echo " --disable-check-utests disable check unit-tests"
889echo " --enable-check-utests enable check unit-tests"
fb599c9a 890echo " --disable-bluez disable bluez stack connectivity"
a20a6f46 891echo " --enable-bluez enable bluez stack connectivity"
7ba1e619 892echo " --disable-kvm disable KVM acceleration support"
b31a0277 893echo " --enable-kvm enable KVM acceleration support"
bd0c5661 894echo " --disable-nptl disable usermode NPTL support"
e5934d33 895echo " --enable-nptl enable usermode NPTL support"
af5db58e
PB
896echo " --enable-system enable all system emulation targets"
897echo " --disable-system disable all system emulation targets"
0953a80f
ZA
898echo " --enable-user enable supported user emulation targets"
899echo " --disable-user disable all user emulation targets"
831b7825
TS
900echo " --enable-linux-user enable all linux usermode emulation targets"
901echo " --disable-linux-user disable all linux usermode emulation targets"
902echo " --enable-darwin-user enable all darwin usermode emulation targets"
903echo " --disable-darwin-user disable all darwin usermode emulation targets"
84778508
BS
904echo " --enable-bsd-user enable all BSD usermode emulation targets"
905echo " --disable-bsd-user disable all BSD usermode emulation targets"
379f6698
PB
906echo " --enable-guest-base enable GUEST_BASE support for usermode"
907echo " emulation targets"
908echo " --disable-guest-base disable GUEST_BASE support"
34005a00
KS
909echo " --enable-user-pie build usermode emulation targets as PIE"
910echo " --disable-user-pie do not build usermode emulation targets as PIE"
af5db58e
PB
911echo " --fmod-lib path to FMOD library"
912echo " --fmod-inc path to FMOD includes"
2f6a1ab0 913echo " --oss-lib path to OSS library"
c5937220 914echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
3142255c 915echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
ee682d27
SW
916echo " --disable-uuid disable uuid support"
917echo " --enable-uuid enable uuid support"
e0e6c8c0 918echo " --disable-vde disable support for vde network"
dfb278bd 919echo " --enable-vde enable support for vde network"
5c6c3a6c
CH
920echo " --disable-linux-aio disable Linux AIO support"
921echo " --enable-linux-aio enable Linux AIO support"
758e8e38
VJJ
922echo " --disable-attr disables attr and xattr support"
923echo " --enable-attr enable attr and xattr support"
e5d355d1 924echo " --enable-io-thread enable IO thread"
77755340 925echo " --disable-blobs disable installing provided firmware blobs"
eac30262 926echo " --kerneldir=PATH look for kernel includes in PATH"
d2807bc9
DU
927echo " --enable-docs enable documentation build"
928echo " --disable-docs disable documentation build"
d5970055
MT
929echo " --disable-vhost-net disable vhost-net acceleration support"
930echo " --enable-vhost-net enable vhost-net acceleration support"
320fba2a
FC
931echo " --enable-trace-backend=B Set trace backend"
932echo " Available backends:" $("$source_path"/scripts/tracetool --list-backends)
74242e0f 933echo " --with-trace-file=NAME Full PATH,NAME of file to store traces"
9410b56c 934echo " Default:trace-<pid>"
cd4ec0b4
GH
935echo " --disable-spice disable spice"
936echo " --enable-spice enable spice"
f27aaf4b 937echo " --enable-rbd enable building the rados block device (rbd)"
36707144
AL
938echo " --disable-smartcard disable smartcard support"
939echo " --enable-smartcard enable smartcard support"
111a38b0
RR
940echo " --disable-smartcard-nss disable smartcard nss support"
941echo " --enable-smartcard-nss enable smartcard nss support"
af5db58e 942echo ""
5bf08934 943echo "NOTE: The object files are built at the place where configure is launched"
af5db58e
PB
944exit 1
945fi
946
8d05095c
PB
947# check that the C compiler works.
948cat > $TMPC <<EOF
949int main(void) {}
950EOF
951
952if compile_object ; then
953 : C compiler works ok
954else
955 echo "ERROR: \"$cc\" either does not exist or does not work"
956 exit 1
957fi
958
959gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
960gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
961gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
962gcc_flags="-fstack-protector-all $gcc_flags"
963cat > $TMPC << EOF
964int main(void) { return 0; }
965EOF
966for flag in $gcc_flags; do
967 if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
968 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
969 fi
970done
971
ec530c81
FB
972#
973# Solaris specific configure tool chain decisions
974#
975if test "$solaris" = "yes" ; then
6792aa11
LM
976 if has $install; then
977 :
978 else
ec530c81
FB
979 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
980 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
981 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
982 exit 1
983 fi
6792aa11 984 if test "`path_of $install`" = "/usr/sbin/install" ; then
ec530c81
FB
985 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
986 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
987 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
988 exit 1
989 fi
6792aa11
LM
990 if has ar; then
991 :
992 else
ec530c81
FB
993 echo "Error: No path includes ar"
994 if test -f /usr/ccs/bin/ar ; then
995 echo "Add /usr/ccs/bin to your path and rerun configure"
996 fi
997 exit 1
998 fi
5fafdf24 999fi
ec530c81
FB
1000
1001
5327cf48
FB
1002if test -z "$target_list" ; then
1003# these targets are portable
0a8e90f4 1004 if [ "$softmmu" = "yes" ] ; then
2408a527
AJ
1005 target_list="\
1006i386-softmmu \
1007x86_64-softmmu \
1008arm-softmmu \
1009cris-softmmu \
613a22c9 1010lm32-softmmu \
2408a527 1011m68k-softmmu \
72b675ca 1012microblaze-softmmu \
877fdc12 1013microblazeel-softmmu \
2408a527
AJ
1014mips-softmmu \
1015mipsel-softmmu \
1016mips64-softmmu \
1017mips64el-softmmu \
1018ppc-softmmu \
1019ppcemb-softmmu \
1020ppc64-softmmu \
1021sh4-softmmu \
1022sh4eb-softmmu \
1023sparc-softmmu \
1b64fcae 1024sparc64-softmmu \
2408a527 1025"
0a8e90f4 1026 fi
5327cf48 1027# the following are Linux specific
831b7825 1028 if [ "$linux_user" = "yes" ] ; then
2408a527
AJ
1029 target_list="${target_list}\
1030i386-linux-user \
1031x86_64-linux-user \
1032alpha-linux-user \
1033arm-linux-user \
1034armeb-linux-user \
1035cris-linux-user \
1036m68k-linux-user \
72b675ca 1037microblaze-linux-user \
877fdc12 1038microblazeel-linux-user \
2408a527
AJ
1039mips-linux-user \
1040mipsel-linux-user \
1041ppc-linux-user \
1042ppc64-linux-user \
1043ppc64abi32-linux-user \
1044sh4-linux-user \
1045sh4eb-linux-user \
1046sparc-linux-user \
1047sparc64-linux-user \
1048sparc32plus-linux-user \
1049"
831b7825
TS
1050 fi
1051# the following are Darwin specific
1052 if [ "$darwin_user" = "yes" ] ; then
6cdc7375 1053 target_list="$target_list i386-darwin-user ppc-darwin-user "
5327cf48 1054 fi
84778508
BS
1055# the following are BSD specific
1056 if [ "$bsd_user" = "yes" ] ; then
1057 target_list="${target_list}\
31fc12df
BS
1058i386-bsd-user \
1059x86_64-bsd-user \
1060sparc-bsd-user \
84778508
BS
1061sparc64-bsd-user \
1062"
1063 fi
6e20a45f 1064else
b1a550a0 1065 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
5327cf48 1066fi
0a8e90f4
PB
1067if test -z "$target_list" ; then
1068 echo "No targets enabled"
1069 exit 1
1070fi
f55fe278
PB
1071# see if system emulation was really requested
1072case " $target_list " in
1073 *"-softmmu "*) softmmu=yes
1074 ;;
1075 *) softmmu=no
1076 ;;
1077esac
5327cf48 1078
249247c9
JQ
1079feature_not_found() {
1080 feature=$1
1081
1082 echo "ERROR"
1083 echo "ERROR: User requested feature $feature"
9332f6a2 1084 echo "ERROR: configure was not able to find it"
249247c9
JQ
1085 echo "ERROR"
1086 exit 1;
1087}
1088
7d13299d
FB
1089if test -z "$cross_prefix" ; then
1090
1091# ---
1092# big/little endian test
1093cat > $TMPC << EOF
1094#include <inttypes.h>
1095int main(int argc, char ** argv){
1d14ffa9
FB
1096 volatile uint32_t i=0x01234567;
1097 return (*((uint8_t*)(&i))) == 0x67;
7d13299d
FB
1098}
1099EOF
1100
52166aa0 1101if compile_prog "" "" ; then
7d13299d
FB
1102$TMPE && bigendian="yes"
1103else
1104echo big/little test failed
1105fi
1106
1107else
1108
1109# if cross compiling, cannot launch a program, so make a static guess
ea8f20f8 1110case "$cpu" in
24e804ec 1111 armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
ea8f20f8
JQ
1112 bigendian=yes
1113 ;;
1114esac
7d13299d
FB
1115
1116fi
1117
70be1a2e
PB
1118# host long bits test, actually a pointer size test
1119cat > $TMPC << EOF
1120int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
1121EOF
1122if compile_object; then
1123hostlongbits=64
1124else
1125hostlongbits=32
1126fi
b6853697 1127
b0a47e79
JQ
1128
1129##########################################
1130# NPTL probe
1131
1132if test "$nptl" != "no" ; then
1133 cat > $TMPC <<EOF
bd0c5661 1134#include <sched.h>
30813cea 1135#include <linux/futex.h>
bd0c5661
PB
1136void foo()
1137{
1138#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1139#error bork
1140#endif
1141}
1142EOF
1143
b0a47e79
JQ
1144 if compile_object ; then
1145 nptl=yes
1146 else
1147 if test "$nptl" = "yes" ; then
1148 feature_not_found "nptl"
1149 fi
1150 nptl=no
1151 fi
bd0c5661
PB
1152fi
1153
ac62922e
AZ
1154##########################################
1155# zlib check
1156
1157cat > $TMPC << EOF
1158#include <zlib.h>
1159int main(void) { zlibVersion(); return 0; }
1160EOF
52166aa0 1161if compile_prog "" "-lz" ; then
ac62922e
AZ
1162 :
1163else
1164 echo
1165 echo "Error: zlib check failed"
1166 echo "Make sure to have the zlib libs and headers installed."
1167 echo
1168 exit 1
1169fi
1170
e37630ca
AL
1171##########################################
1172# xen probe
1173
fc321b4b 1174if test "$xen" != "no" ; then
b2266bee
JQ
1175 xen_libs="-lxenstore -lxenctrl -lxenguest"
1176 cat > $TMPC <<EOF
e37630ca
AL
1177#include <xenctrl.h>
1178#include <xs.h>
df7a607b 1179int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
e37630ca 1180EOF
52166aa0 1181 if compile_prog "" "$xen_libs" ; then
fc321b4b 1182 xen=yes
3efd632b 1183 libs_softmmu="$xen_libs $libs_softmmu"
b2266bee 1184 else
fc321b4b
JQ
1185 if test "$xen" = "yes" ; then
1186 feature_not_found "xen"
1187 fi
1188 xen=no
b2266bee 1189 fi
e37630ca
AL
1190fi
1191
f91672e5 1192##########################################
a8bd70ad 1193# pkg-config probe
f91672e5 1194
a8bd70ad 1195if ! has $pkg_config; then
08421541
PB
1196 echo warning: proceeding without "$pkg_config" >&2
1197 pkg_config=/bin/false
f91672e5
PB
1198fi
1199
dfffc653
JQ
1200##########################################
1201# Sparse probe
1202if test "$sparse" != "no" ; then
0dba6195 1203 if has cgcc; then
dfffc653
JQ
1204 sparse=yes
1205 else
1206 if test "$sparse" = "yes" ; then
1207 feature_not_found "sparse"
1208 fi
1209 sparse=no
1210 fi
1211fi
1212
11d9f695
FB
1213##########################################
1214# SDL probe
1215
3ec87ffe
PB
1216# Look for sdl configuration program (pkg-config or sdl-config). Try
1217# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
1218if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
1219 sdl_config=sdl-config
1220fi
1221
1222if $pkg_config sdl --modversion >/dev/null 2>&1; then
a8bd70ad 1223 sdlconfig="$pkg_config sdl"
9316f803 1224 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
3ec87ffe
PB
1225elif has ${sdl_config}; then
1226 sdlconfig="$sdl_config"
9316f803 1227 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
a0dfd8a4
LM
1228else
1229 if test "$sdl" = "yes" ; then
1230 feature_not_found "sdl"
1231 fi
1232 sdl=no
9316f803 1233fi
3ec87ffe
PB
1234if test -n "$cross_prefix" && test "`basename $sdlconfig`" = sdl-config; then
1235 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
1236fi
11d9f695 1237
9316f803 1238sdl_too_old=no
c4198157 1239if test "$sdl" != "no" ; then
ac119f9d 1240 cat > $TMPC << EOF
11d9f695
FB
1241#include <SDL.h>
1242#undef main /* We don't want SDL to override our main() */
1243int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1244EOF
9316f803 1245 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
74f42e18
T
1246 if test "$static" = "yes" ; then
1247 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1248 else
1249 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1250 fi
52166aa0 1251 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
ac119f9d
JQ
1252 if test "$_sdlversion" -lt 121 ; then
1253 sdl_too_old=yes
1254 else
1255 if test "$cocoa" = "no" ; then
1256 sdl=yes
1257 fi
1258 fi
cd01b4a3 1259
67c274d3 1260 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
ac119f9d 1261 if test "$sdl" = "yes" -a "$static" = "yes" ; then
67c274d3 1262 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
f8aa6c7b
SW
1263 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1264 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
ac119f9d 1265 fi
52166aa0 1266 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
ac119f9d
JQ
1267 :
1268 else
1269 sdl=no
1270 fi
1271 fi # static link
c4198157
JQ
1272 else # sdl not found
1273 if test "$sdl" = "yes" ; then
1274 feature_not_found "sdl"
1275 fi
1276 sdl=no
ac119f9d 1277 fi # sdl compile test
a68551bc 1278fi
11d9f695 1279
5368a422 1280if test "$sdl" = "yes" ; then
ac119f9d 1281 cat > $TMPC <<EOF
5368a422
AL
1282#include <SDL.h>
1283#if defined(SDL_VIDEO_DRIVER_X11)
1284#include <X11/XKBlib.h>
1285#else
1286#error No x11 support
1287#endif
1288int main(void) { return 0; }
1289EOF
52166aa0 1290 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
ac119f9d
JQ
1291 sdl_libs="$sdl_libs -lX11"
1292 fi
07d9ac44
JQ
1293 if test "$mingw32" = "yes" ; then
1294 sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1295 fi
0705667e 1296 libs_softmmu="$sdl_libs $libs_softmmu"
5368a422
AL
1297fi
1298
8d5d2d4c
TS
1299##########################################
1300# VNC TLS detection
821601ea 1301if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
1be10ad2 1302 cat > $TMPC <<EOF
ae6b5e5a
AL
1303#include <gnutls/gnutls.h>
1304int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1305EOF
a8bd70ad
PB
1306 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1307 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
1be10ad2
JQ
1308 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1309 vnc_tls=yes
1310 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1311 else
1312 if test "$vnc_tls" = "yes" ; then
1313 feature_not_found "vnc-tls"
ae6b5e5a 1314 fi
1be10ad2
JQ
1315 vnc_tls=no
1316 fi
8d5d2d4c
TS
1317fi
1318
2f9606b3
AL
1319##########################################
1320# VNC SASL detection
821601ea 1321if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
ea784e3b 1322 cat > $TMPC <<EOF
2f9606b3
AL
1323#include <sasl/sasl.h>
1324#include <stdio.h>
1325int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1326EOF
ea784e3b
JQ
1327 # Assuming Cyrus-SASL installed in /usr prefix
1328 vnc_sasl_cflags=""
1329 vnc_sasl_libs="-lsasl2"
1330 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1331 vnc_sasl=yes
1332 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1333 else
1334 if test "$vnc_sasl" = "yes" ; then
1335 feature_not_found "vnc-sasl"
2f9606b3 1336 fi
ea784e3b
JQ
1337 vnc_sasl=no
1338 fi
2f9606b3
AL
1339fi
1340
2f6f5c7a
CC
1341##########################################
1342# VNC JPEG detection
821601ea 1343if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
2f6f5c7a
CC
1344cat > $TMPC <<EOF
1345#include <stdio.h>
1346#include <jpeglib.h>
1347int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
1348EOF
1349 vnc_jpeg_cflags=""
1350 vnc_jpeg_libs="-ljpeg"
1351 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
1352 vnc_jpeg=yes
1353 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1354 else
1355 if test "$vnc_jpeg" = "yes" ; then
1356 feature_not_found "vnc-jpeg"
1357 fi
1358 vnc_jpeg=no
1359 fi
1360fi
1361
efe556ad
CC
1362##########################################
1363# VNC PNG detection
821601ea 1364if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
efe556ad
CC
1365cat > $TMPC <<EOF
1366//#include <stdio.h>
1367#include <png.h>
832ce9c2 1368#include <stddef.h>
efe556ad
CC
1369int main(void) {
1370 png_structp png_ptr;
1371 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1372 return 0;
1373}
1374EOF
1375 vnc_png_cflags=""
1376 vnc_png_libs="-lpng"
1377 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1378 vnc_png=yes
1379 libs_softmmu="$vnc_png_libs $libs_softmmu"
1380 else
1381 if test "$vnc_png" = "yes" ; then
1382 feature_not_found "vnc-png"
1383 fi
1384 vnc_png=no
1385 fi
1386fi
1387
76655d6d
AL
1388##########################################
1389# fnmatch() probe, used for ACL routines
1390fnmatch="no"
1391cat > $TMPC << EOF
1392#include <fnmatch.h>
1393int main(void)
1394{
1395 fnmatch("foo", "foo", 0);
1396 return 0;
1397}
1398EOF
52166aa0 1399if compile_prog "" "" ; then
76655d6d
AL
1400 fnmatch="yes"
1401fi
1402
ee682d27
SW
1403##########################################
1404# uuid_generate() probe, used for vdi block driver
1405if test "$uuid" != "no" ; then
1406 uuid_libs="-luuid"
1407 cat > $TMPC << EOF
1408#include <uuid/uuid.h>
1409int main(void)
1410{
1411 uuid_t my_uuid;
1412 uuid_generate(my_uuid);
1413 return 0;
1414}
1415EOF
1416 if compile_prog "" "$uuid_libs" ; then
1417 uuid="yes"
1418 libs_softmmu="$uuid_libs $libs_softmmu"
1419 libs_tools="$uuid_libs $libs_tools"
1420 else
1421 if test "$uuid" = "yes" ; then
1422 feature_not_found "uuid"
1423 fi
1424 uuid=no
1425 fi
1426fi
1427
dce512de
CH
1428##########################################
1429# xfsctl() probe, used for raw-posix
1430if test "$xfs" != "no" ; then
1431 cat > $TMPC << EOF
1432#include <xfs/xfs.h>
1433int main(void)
1434{
1435 xfsctl(NULL, 0, 0, NULL);
1436 return 0;
1437}
1438EOF
1439 if compile_prog "" "" ; then
1440 xfs="yes"
1441 else
1442 if test "$xfs" = "yes" ; then
1443 feature_not_found "xfs"
1444 fi
1445 xfs=no
1446 fi
1447fi
1448
8a16d273
TS
1449##########################################
1450# vde libraries probe
dfb278bd 1451if test "$vde" != "no" ; then
4baae0ac 1452 vde_libs="-lvdeplug"
8a16d273
TS
1453 cat > $TMPC << EOF
1454#include <libvdeplug.h>
4a7f0e06
PB
1455int main(void)
1456{
1457 struct vde_open_args a = {0, 0, 0};
1458 vde_open("", "", &a);
1459 return 0;
1460}
8a16d273 1461EOF
52166aa0 1462 if compile_prog "" "$vde_libs" ; then
4baae0ac 1463 vde=yes
8e02e54c
JQ
1464 libs_softmmu="$vde_libs $libs_softmmu"
1465 libs_tools="$vde_libs $libs_tools"
dfb278bd
JQ
1466 else
1467 if test "$vde" = "yes" ; then
1468 feature_not_found "vde"
1469 fi
1470 vde=no
4baae0ac 1471 fi
8a16d273
TS
1472fi
1473
8f28f3fb 1474##########################################
c2de5c91 1475# Sound support libraries probe
8f28f3fb 1476
c2de5c91 1477audio_drv_probe()
1478{
1479 drv=$1
1480 hdr=$2
1481 lib=$3
1482 exp=$4
1483 cfl=$5
1484 cat > $TMPC << EOF
1485#include <$hdr>
1486int main(void) { $exp }
8f28f3fb 1487EOF
52166aa0 1488 if compile_prog "$cfl" "$lib" ; then
c2de5c91 1489 :
1490 else
1491 echo
1492 echo "Error: $drv check failed"
1493 echo "Make sure to have the $drv libs and headers installed."
1494 echo
1495 exit 1
1496 fi
1497}
1498
2fa7d3bf 1499audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
c2de5c91 1500for drv in $audio_drv_list; do
1501 case $drv in
1502 alsa)
1503 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1504 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
a4bf6780 1505 libs_softmmu="-lasound $libs_softmmu"
c2de5c91 1506 ;;
1507
1508 fmod)
1509 if test -z $fmod_lib || test -z $fmod_inc; then
1510 echo
1511 echo "Error: You must specify path to FMOD library and headers"
1512 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1513 echo
1514 exit 1
1515 fi
1516 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
a4bf6780 1517 libs_softmmu="$fmod_lib $libs_softmmu"
c2de5c91 1518 ;;
1519
1520 esd)
1521 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
a4bf6780 1522 libs_softmmu="-lesd $libs_softmmu"
67f86e8e 1523 audio_pt_int="yes"
c2de5c91 1524 ;;
b8e59f18 1525
1526 pa)
493abda6 1527 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
b8e59f18 1528 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
493abda6 1529 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
67f86e8e 1530 audio_pt_int="yes"
b8e59f18 1531 ;;
1532
997e690a
JQ
1533 coreaudio)
1534 libs_softmmu="-framework CoreAudio $libs_softmmu"
1535 ;;
1536
a4bf6780
JQ
1537 dsound)
1538 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
d5631638 1539 audio_win_int="yes"
a4bf6780
JQ
1540 ;;
1541
1542 oss)
1543 libs_softmmu="$oss_lib $libs_softmmu"
1544 ;;
1545
1546 sdl|wav)
2f6a1ab0
BS
1547 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1548 ;;
1549
d5631638 1550 winwave)
1551 libs_softmmu="-lwinmm $libs_softmmu"
1552 audio_win_int="yes"
1553 ;;
1554
e4c63a6a 1555 *)
1c9b2a52 1556 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
e4c63a6a 1557 echo
1558 echo "Error: Unknown driver '$drv' selected"
1559 echo "Possible drivers are: $audio_possible_drivers"
1560 echo
1561 exit 1
1562 }
1563 ;;
c2de5c91 1564 esac
1565done
8f28f3fb 1566
2e4d9fb1
AJ
1567##########################################
1568# BrlAPI probe
1569
4ffcedb6 1570if test "$brlapi" != "no" ; then
eb82284f
JQ
1571 brlapi_libs="-lbrlapi"
1572 cat > $TMPC << EOF
2e4d9fb1 1573#include <brlapi.h>
832ce9c2 1574#include <stddef.h>
2e4d9fb1
AJ
1575int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1576EOF
52166aa0 1577 if compile_prog "" "$brlapi_libs" ; then
eb82284f 1578 brlapi=yes
264606b3 1579 libs_softmmu="$brlapi_libs $libs_softmmu"
4ffcedb6
JQ
1580 else
1581 if test "$brlapi" = "yes" ; then
1582 feature_not_found "brlapi"
1583 fi
1584 brlapi=no
eb82284f
JQ
1585 fi
1586fi
2e4d9fb1 1587
4d3b6f6e
AZ
1588##########################################
1589# curses probe
e095e2f3
SW
1590if test "$mingw32" = "yes" ; then
1591 curses_list="-lpdcurses"
1592else
1593 curses_list="-lncurses -lcurses"
1594fi
4d3b6f6e 1595
c584a6d0
JQ
1596if test "$curses" != "no" ; then
1597 curses_found=no
4d3b6f6e
AZ
1598 cat > $TMPC << EOF
1599#include <curses.h>
5a8ff3aa
BS
1600#ifdef __OpenBSD__
1601#define resize_term resizeterm
1602#endif
1603int main(void) { resize_term(0, 0); return curses_version(); }
4d3b6f6e 1604EOF
4f78ef9a
JQ
1605 for curses_lib in $curses_list; do
1606 if compile_prog "" "$curses_lib" ; then
c584a6d0 1607 curses_found=yes
4f78ef9a
JQ
1608 libs_softmmu="$curses_lib $libs_softmmu"
1609 break
1610 fi
1611 done
c584a6d0
JQ
1612 if test "$curses_found" = "yes" ; then
1613 curses=yes
1614 else
1615 if test "$curses" = "yes" ; then
1616 feature_not_found "curses"
1617 fi
1618 curses=no
1619 fi
4f78ef9a 1620fi
4d3b6f6e 1621
769ce76d
AG
1622##########################################
1623# curl probe
1624
a8bd70ad
PB
1625if $pkg_config libcurl --modversion >/dev/null 2>&1; then
1626 curlconfig="$pkg_config libcurl"
4e2b0658
PB
1627else
1628 curlconfig=curl-config
1629fi
1630
788c8196 1631if test "$curl" != "no" ; then
769ce76d
AG
1632 cat > $TMPC << EOF
1633#include <curl/curl.h>
1634int main(void) { return curl_easy_init(); }
1635EOF
4e2b0658
PB
1636 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1637 curl_libs=`$curlconfig --libs 2>/dev/null`
b1d5a277 1638 if compile_prog "$curl_cflags" "$curl_libs" ; then
769ce76d 1639 curl=yes
f0302935
JQ
1640 libs_tools="$curl_libs $libs_tools"
1641 libs_softmmu="$curl_libs $libs_softmmu"
788c8196
JQ
1642 else
1643 if test "$curl" = "yes" ; then
1644 feature_not_found "curl"
1645 fi
1646 curl=no
769ce76d
AG
1647 fi
1648fi # test "$curl"
1649
5495ed11
LC
1650##########################################
1651# check framework probe
1652
1653if test "$check_utests" != "no" ; then
1654 cat > $TMPC << EOF
1655#include <check.h>
1656int main(void) { suite_create("qemu test"); return 0; }
1657EOF
a8bd70ad 1658 check_libs=`$pkg_config --libs check`
5495ed11
LC
1659 if compile_prog "" $check_libs ; then
1660 check_utests=yes
1661 libs_tools="$check_libs $libs_tools"
1662 else
1663 if test "$check_utests" = "yes" ; then
1664 feature_not_found "check"
1665 fi
1666 check_utests=no
1667 fi
1668fi # test "$check_utests"
1669
fb599c9a
AZ
1670##########################################
1671# bluez support probe
a20a6f46 1672if test "$bluez" != "no" ; then
e820e3f4
AZ
1673 cat > $TMPC << EOF
1674#include <bluetooth/bluetooth.h>
1675int main(void) { return bt_error(0); }
1676EOF
a8bd70ad
PB
1677 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
1678 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
52166aa0 1679 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
a20a6f46 1680 bluez=yes
e482d56a 1681 libs_softmmu="$bluez_libs $libs_softmmu"
e820e3f4 1682 else
a20a6f46
JQ
1683 if test "$bluez" = "yes" ; then
1684 feature_not_found "bluez"
1685 fi
e820e3f4
AZ
1686 bluez="no"
1687 fi
fb599c9a
AZ
1688fi
1689
7ba1e619
AL
1690##########################################
1691# kvm probe
b31a0277 1692if test "$kvm" != "no" ; then
7ba1e619
AL
1693 cat > $TMPC <<EOF
1694#include <linux/kvm.h>
9fd8d8d7 1695#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
7ba1e619
AL
1696#error Invalid KVM version
1697#endif
94a8d39a
JK
1698EOF
1699 must_have_caps="KVM_CAP_USER_MEMORY \
1700 KVM_CAP_DESTROY_MEMORY_REGION_WORKS \
1701 KVM_CAP_COALESCED_MMIO \
1702 KVM_CAP_SYNC_MMU \
1703 "
1704 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) ; then
1705 must_have_caps="$caps \
1706 KVM_CAP_SET_TSS_ADDR \
1707 KVM_CAP_EXT_CPUID \
1708 KVM_CAP_CLOCKSOURCE \
1709 KVM_CAP_NOP_IO_DELAY \
1710 KVM_CAP_PV_MMU \
1711 KVM_CAP_MP_STATE \
1712 KVM_CAP_USER_NMI \
1713 "
1714 fi
1715 for c in $must_have_caps ; do
1716 cat >> $TMPC <<EOF
1717#if !defined($c)
1718#error Missing KVM capability $c
9fd8d8d7 1719#endif
94a8d39a
JK
1720EOF
1721 done
1722 cat >> $TMPC <<EOF
7ba1e619
AL
1723int main(void) { return 0; }
1724EOF
eac30262
AL
1725 if test "$kerneldir" != "" ; then
1726 kvm_cflags=-I"$kerneldir"/include
8444eb6e
AL
1727 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1728 -a -d "$kerneldir/arch/x86/include" ; then
1729 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
406b430d
AL
1730 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1731 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
0e60a699
AG
1732 elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
1733 kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
8444eb6e
AL
1734 elif test -d "$kerneldir/arch/$cpu/include" ; then
1735 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1736 fi
eac30262 1737 else
a8bd70ad 1738 kvm_cflags=`$pkg_config --cflags kvm-kmod 2>/dev/null`
eac30262 1739 fi
52166aa0 1740 if compile_prog "$kvm_cflags" "" ; then
b31a0277 1741 kvm=yes
dae5079a
JK
1742 cat > $TMPC <<EOF
1743#include <linux/kvm_para.h>
1744int main(void) { return 0; }
1745EOF
1746 if compile_prog "$kvm_cflags" "" ; then
1747 kvm_para=yes
1748 fi
7ba1e619 1749 else
b31a0277 1750 if test "$kvm" = "yes" ; then
0dba6195 1751 if has awk && has grep; then
b31a0277 1752 kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
9fd8d8d7
AL
1753 | grep "error: " \
1754 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
b31a0277
JQ
1755 if test "$kvmerr" != "" ; then
1756 echo -e "${kvmerr}\n\
94a8d39a
JK
1757NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1758recent kvm-kmod from http://sourceforge.net/projects/kvm."
b31a0277 1759 fi
9fd8d8d7 1760 fi
b31a0277 1761 feature_not_found "kvm"
9fd8d8d7 1762 fi
b31a0277 1763 kvm=no
7ba1e619
AL
1764 fi
1765fi
1766
d5970055
MT
1767##########################################
1768# test for vhost net
1769
1770if test "$vhost_net" != "no"; then
1771 if test "$kvm" != "no"; then
1772 cat > $TMPC <<EOF
1773 #include <linux/vhost.h>
1774 int main(void) { return 0; }
1775EOF
1776 if compile_prog "$kvm_cflags" "" ; then
1777 vhost_net=yes
1778 else
1779 if test "$vhost_net" = "yes" ; then
1780 feature_not_found "vhost-net"
1781 fi
1782 vhost_net=no
1783 fi
1784 else
1785 if test "$vhost_net" = "yes" ; then
4021d247 1786 echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
d5970055
MT
1787 feature_not_found "vhost-net"
1788 fi
1789 vhost_net=no
1790 fi
1791fi
1792
414f0dab 1793##########################################
e5d355d1 1794# pthread probe
de65fe0f 1795PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
3c529d93 1796
4dd75c70 1797pthread=no
e5d355d1 1798cat > $TMPC << EOF
3c529d93 1799#include <pthread.h>
de65fe0f 1800int main(void) { pthread_create(0,0,0,0); return 0; }
414f0dab 1801EOF
bd00d539
AF
1802if compile_prog "" "" ; then
1803 pthread=yes
1804else
1805 for pthread_lib in $PTHREADLIBS_LIST; do
1806 if compile_prog "" "$pthread_lib" ; then
1807 pthread=yes
1808 LIBS="$pthread_lib $LIBS"
1809 break
1810 fi
1811 done
1812fi
414f0dab 1813
4617e593 1814if test "$mingw32" != yes -a "$pthread" = no; then
4dd75c70
CH
1815 echo
1816 echo "Error: pthread check failed"
1817 echo "Make sure to have the pthread libs and headers installed."
1818 echo
1819 exit 1
e5d355d1
AL
1820fi
1821
f27aaf4b
CB
1822##########################################
1823# rbd probe
1824if test "$rbd" != "no" ; then
1825 cat > $TMPC <<EOF
1826#include <stdio.h>
1827#include <rados/librados.h>
1828int main(void) { rados_initialize(0, NULL); return 0; }
1829EOF
cc4e8741 1830 rbd_libs="-lrados"
f27aaf4b
CB
1831 if compile_prog "" "$rbd_libs" ; then
1832 librados_too_old=no
1833 cat > $TMPC <<EOF
1834#include <stdio.h>
1835#include <rados/librados.h>
1836#ifndef CEPH_OSD_TMAP_SET
1837#error missing CEPH_OSD_TMAP_SET
1838#endif
1839int main(void) {
1840 int (*func)(const rados_pool_t pool, uint64_t *snapid) = rados_selfmanaged_snap_create;
1841 rados_initialize(0, NULL);
1842 return 0;
1843}
1844EOF
1845 if compile_prog "" "$rbd_libs" ; then
1846 rbd=yes
1847 libs_tools="$rbd_libs $libs_tools"
1848 libs_softmmu="$rbd_libs $libs_softmmu"
1849 else
1850 rbd=no
1851 librados_too_old=yes
1852 fi
1853 else
1854 if test "$rbd" = "yes" ; then
1855 feature_not_found "rados block device"
1856 fi
1857 rbd=no
1858 fi
1859 if test "$librados_too_old" = "yes" ; then
1860 echo "-> Your librados version is too old - upgrade needed to have rbd support"
1861 fi
1862fi
1863
5c6c3a6c
CH
1864##########################################
1865# linux-aio probe
5c6c3a6c
CH
1866
1867if test "$linux_aio" != "no" ; then
1868 cat > $TMPC <<EOF
1869#include <libaio.h>
1870#include <sys/eventfd.h>
832ce9c2 1871#include <stddef.h>
5c6c3a6c
CH
1872int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
1873EOF
1874 if compile_prog "" "-laio" ; then
1875 linux_aio=yes
048d179f
PB
1876 libs_softmmu="$libs_softmmu -laio"
1877 libs_tools="$libs_tools -laio"
5c6c3a6c
CH
1878 else
1879 if test "$linux_aio" = "yes" ; then
1880 feature_not_found "linux AIO"
1881 fi
3cfcae3c 1882 linux_aio=no
5c6c3a6c
CH
1883 fi
1884fi
1885
758e8e38
VJJ
1886##########################################
1887# attr probe
1888
1889if test "$attr" != "no" ; then
1890 cat > $TMPC <<EOF
1891#include <stdio.h>
1892#include <sys/types.h>
1893#include <attr/xattr.h>
1894int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
1895EOF
1896 if compile_prog "" "-lattr" ; then
1897 attr=yes
1898 LIBS="-lattr $LIBS"
1899 else
1900 if test "$attr" = "yes" ; then
1901 feature_not_found "ATTR"
1902 fi
1903 attr=no
1904 fi
1905fi
1906
bf9298b9
AL
1907##########################################
1908# iovec probe
1909cat > $TMPC <<EOF
db34f0b3 1910#include <sys/types.h>
bf9298b9 1911#include <sys/uio.h>
db34f0b3 1912#include <unistd.h>
bf9298b9
AL
1913int main(void) { struct iovec iov; return 0; }
1914EOF
1915iovec=no
52166aa0 1916if compile_prog "" "" ; then
bf9298b9
AL
1917 iovec=yes
1918fi
1919
ceb42de8
AL
1920##########################################
1921# preadv probe
1922cat > $TMPC <<EOF
1923#include <sys/types.h>
1924#include <sys/uio.h>
1925#include <unistd.h>
1926int main(void) { preadv; }
1927EOF
1928preadv=no
52166aa0 1929if compile_prog "" "" ; then
ceb42de8
AL
1930 preadv=yes
1931fi
1932
f652e6af
AJ
1933##########################################
1934# fdt probe
2df87df7 1935if test "$fdt" != "no" ; then
b41af4ba
JQ
1936 fdt_libs="-lfdt"
1937 cat > $TMPC << EOF
f652e6af
AJ
1938int main(void) { return 0; }
1939EOF
52166aa0 1940 if compile_prog "" "$fdt_libs" ; then
f652e6af 1941 fdt=yes
e4782985 1942 libs_softmmu="$fdt_libs $libs_softmmu"
2df87df7
JQ
1943 else
1944 if test "$fdt" = "yes" ; then
1945 feature_not_found "fdt"
1946 fi
1947 fdt=no
f652e6af
AJ
1948 fi
1949fi
1950
20ff075b
MW
1951##########################################
1952# opengl probe, used by milkymist-tmu2
1953if test "$opengl" != "no" ; then
1954 opengl_libs="-lGL"
1955 cat > $TMPC << EOF
1956#include <X11/Xlib.h>
1957#include <GL/gl.h>
1958#include <GL/glx.h>
1959int main(void) { GL_VERSION; return 0; }
1960EOF
1961 if compile_prog "" "-lGL" ; then
1962 opengl=yes
1963 libs_softmmu="$opengl_libs $libs_softmmu"
1964 else
1965 if test "$opengl" = "yes" ; then
1966 feature_not_found "opengl"
1967 fi
1968 opengl=no
1969 fi
1970fi
1971
3b3f24ad
AJ
1972#
1973# Check for xxxat() functions when we are building linux-user
1974# emulator. This is done because older glibc versions don't
1975# have syscall stubs for these implemented.
1976#
1977atfile=no
67ba57f6 1978cat > $TMPC << EOF
3b3f24ad
AJ
1979#define _ATFILE_SOURCE
1980#include <sys/types.h>
1981#include <fcntl.h>
1982#include <unistd.h>
1983
1984int
1985main(void)
1986{
1987 /* try to unlink nonexisting file */
1988 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1989}
1990EOF
52166aa0 1991if compile_prog "" "" ; then
67ba57f6 1992 atfile=yes
3b3f24ad
AJ
1993fi
1994
39386ac7 1995# Check for inotify functions when we are building linux-user
3b3f24ad
AJ
1996# emulator. This is done because older glibc versions don't
1997# have syscall stubs for these implemented. In that case we
1998# don't provide them even if kernel supports them.
1999#
2000inotify=no
67ba57f6 2001cat > $TMPC << EOF
3b3f24ad
AJ
2002#include <sys/inotify.h>
2003
2004int
2005main(void)
2006{
2007 /* try to start inotify */
8690e420 2008 return inotify_init();
3b3f24ad
AJ
2009}
2010EOF
52166aa0 2011if compile_prog "" "" ; then
67ba57f6 2012 inotify=yes
3b3f24ad
AJ
2013fi
2014
c05c7a73
RV
2015inotify1=no
2016cat > $TMPC << EOF
2017#include <sys/inotify.h>
2018
2019int
2020main(void)
2021{
2022 /* try to start inotify */
2023 return inotify_init1(0);
2024}
2025EOF
2026if compile_prog "" "" ; then
2027 inotify1=yes
2028fi
2029
ebc996f3
RV
2030# check if utimensat and futimens are supported
2031utimens=no
2032cat > $TMPC << EOF
2033#define _ATFILE_SOURCE
ebc996f3
RV
2034#include <stddef.h>
2035#include <fcntl.h>
2036
2037int main(void)
2038{
2039 utimensat(AT_FDCWD, "foo", NULL, 0);
2040 futimens(0, NULL);
2041 return 0;
2042}
2043EOF
52166aa0 2044if compile_prog "" "" ; then
ebc996f3
RV
2045 utimens=yes
2046fi
2047
099d6b0f
RV
2048# check if pipe2 is there
2049pipe2=no
2050cat > $TMPC << EOF
099d6b0f
RV
2051#include <unistd.h>
2052#include <fcntl.h>
2053
2054int main(void)
2055{
2056 int pipefd[2];
2057 pipe2(pipefd, O_CLOEXEC);
2058 return 0;
2059}
2060EOF
52166aa0 2061if compile_prog "" "" ; then
099d6b0f
RV
2062 pipe2=yes
2063fi
2064
40ff6d7e
KW
2065# check if accept4 is there
2066accept4=no
2067cat > $TMPC << EOF
40ff6d7e
KW
2068#include <sys/socket.h>
2069#include <stddef.h>
2070
2071int main(void)
2072{
2073 accept4(0, NULL, NULL, SOCK_CLOEXEC);
2074 return 0;
2075}
2076EOF
2077if compile_prog "" "" ; then
2078 accept4=yes
2079fi
2080
3ce34dfb 2081# check if tee/splice is there. vmsplice was added same time.
2082splice=no
2083cat > $TMPC << EOF
3ce34dfb 2084#include <unistd.h>
2085#include <fcntl.h>
2086#include <limits.h>
2087
2088int main(void)
2089{
2090 int len, fd;
2091 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
2092 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
2093 return 0;
2094}
2095EOF
52166aa0 2096if compile_prog "" "" ; then
3ce34dfb 2097 splice=yes
2098fi
2099
dcc38d1c
MT
2100##########################################
2101# signalfd probe
2102signalfd="no"
2103cat > $TMPC << EOF
2104#define _GNU_SOURCE
2105#include <unistd.h>
2106#include <sys/syscall.h>
2107#include <signal.h>
2108int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2109EOF
2110
2111if compile_prog "" "" ; then
2112 signalfd=yes
de758970
JK
2113elif test "$kvm" = "yes" -a "$io_thread" != "yes"; then
2114 echo
2115 echo "ERROR: Host kernel lacks signalfd() support,"
2116 echo "but KVM depends on it when the IO thread is disabled."
2117 echo
2118 exit 1
dcc38d1c
MT
2119fi
2120
c2882b96
RV
2121# check if eventfd is supported
2122eventfd=no
2123cat > $TMPC << EOF
2124#include <sys/eventfd.h>
2125
2126int main(void)
2127{
2128 int efd = eventfd(0, 0);
2129 return 0;
2130}
2131EOF
2132if compile_prog "" "" ; then
2133 eventfd=yes
2134fi
2135
d0927938
UH
2136# check for fallocate
2137fallocate=no
2138cat > $TMPC << EOF
2139#include <fcntl.h>
2140
2141int main(void)
2142{
2143 fallocate(0, 0, 0, 0);
2144 return 0;
2145}
2146EOF
be17dc90 2147if compile_prog "$ARCH_CFLAGS" "" ; then
d0927938
UH
2148 fallocate=yes
2149fi
2150
c727f47d
PM
2151# check for sync_file_range
2152sync_file_range=no
2153cat > $TMPC << EOF
2154#include <fcntl.h>
2155
2156int main(void)
2157{
2158 sync_file_range(0, 0, 0, 0);
2159 return 0;
2160}
2161EOF
2162if compile_prog "$ARCH_CFLAGS" "" ; then
2163 sync_file_range=yes
2164fi
2165
dace20dc
PM
2166# check for linux/fiemap.h and FS_IOC_FIEMAP
2167fiemap=no
2168cat > $TMPC << EOF
2169#include <sys/ioctl.h>
2170#include <linux/fs.h>
2171#include <linux/fiemap.h>
2172
2173int main(void)
2174{
2175 ioctl(0, FS_IOC_FIEMAP, 0);
2176 return 0;
2177}
2178EOF
2179if compile_prog "$ARCH_CFLAGS" "" ; then
2180 fiemap=yes
2181fi
2182
d0927938
UH
2183# check for dup3
2184dup3=no
2185cat > $TMPC << EOF
2186#include <unistd.h>
2187
2188int main(void)
2189{
2190 dup3(0, 0, 0);
2191 return 0;
2192}
2193EOF
78f5d726 2194if compile_prog "" "" ; then
d0927938
UH
2195 dup3=yes
2196fi
2197
3b6edd16
PM
2198# check for epoll support
2199epoll=no
2200cat > $TMPC << EOF
2201#include <sys/epoll.h>
2202
2203int main(void)
2204{
2205 epoll_create(0);
2206 return 0;
2207}
2208EOF
2209if compile_prog "$ARCH_CFLAGS" "" ; then
2210 epoll=yes
2211fi
2212
2213# epoll_create1 and epoll_pwait are later additions
2214# so we must check separately for their presence
2215epoll_create1=no
2216cat > $TMPC << EOF
2217#include <sys/epoll.h>
2218
2219int main(void)
2220{
2221 epoll_create1(0);
2222 return 0;
2223}
2224EOF
2225if compile_prog "$ARCH_CFLAGS" "" ; then
2226 epoll_create1=yes
2227fi
2228
2229epoll_pwait=no
2230cat > $TMPC << EOF
2231#include <sys/epoll.h>
2232
2233int main(void)
2234{
2235 epoll_pwait(0, 0, 0, 0, 0);
2236 return 0;
2237}
2238EOF
2239if compile_prog "$ARCH_CFLAGS" "" ; then
2240 epoll_pwait=yes
2241fi
2242
cc8ae6de 2243# Check if tools are available to build documentation.
a25dba17 2244if test "$docs" != "no" ; then
01668d98 2245 if has makeinfo && has pod2man; then
a25dba17 2246 docs=yes
83a3ab8b 2247 else
a25dba17
JQ
2248 if test "$docs" = "yes" ; then
2249 feature_not_found "docs"
83a3ab8b 2250 fi
a25dba17 2251 docs=no
83a3ab8b 2252 fi
cc8ae6de
PB
2253fi
2254
f514f41c 2255# Search for bswap_32 function
6ae9a1f4
JQ
2256byteswap_h=no
2257cat > $TMPC << EOF
2258#include <byteswap.h>
2259int main(void) { return bswap_32(0); }
2260EOF
52166aa0 2261if compile_prog "" "" ; then
6ae9a1f4
JQ
2262 byteswap_h=yes
2263fi
2264
f514f41c 2265# Search for bswap_32 function
6ae9a1f4
JQ
2266bswap_h=no
2267cat > $TMPC << EOF
2268#include <sys/endian.h>
2269#include <sys/types.h>
2270#include <machine/bswap.h>
2271int main(void) { return bswap32(0); }
2272EOF
52166aa0 2273if compile_prog "" "" ; then
6ae9a1f4
JQ
2274 bswap_h=yes
2275fi
2276
da93a1fd
AL
2277##########################################
2278# Do we need librt
2279cat > $TMPC <<EOF
2280#include <signal.h>
2281#include <time.h>
2282int main(void) { clockid_t id; return clock_gettime(id, NULL); }
2283EOF
2284
52166aa0 2285if compile_prog "" "" ; then
07ffa4bd 2286 :
52166aa0 2287elif compile_prog "" "-lrt" ; then
07ffa4bd 2288 LIBS="-lrt $LIBS"
da93a1fd
AL
2289fi
2290
31ff504d 2291if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
179cf400 2292 "$aix" != "yes" -a "$haiku" != "yes" ; then
6362a53f
JQ
2293 libs_softmmu="-lutil $libs_softmmu"
2294fi
2295
de5071c5
BS
2296##########################################
2297# check if the compiler defines offsetof
2298
2299need_offsetof=yes
2300cat > $TMPC << EOF
2301#include <stddef.h>
2302int main(void) { struct s { int f; }; return offsetof(struct s, f); }
2303EOF
2304if compile_prog "" "" ; then
2305 need_offsetof=no
2306fi
2307
747bbdf7
BS
2308##########################################
2309# check if the compiler understands attribute warn_unused_result
2310#
2311# This could be smarter, but gcc -Werror does not error out even when warning
2312# about attribute warn_unused_result
2313
2314gcc_attribute_warn_unused_result=no
2315cat > $TMPC << EOF
2316#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
2317#error gcc 3.3 or older
2318#endif
2319int main(void) { return 0;}
2320EOF
2321if compile_prog "" ""; then
2322 gcc_attribute_warn_unused_result=yes
2323fi
2324
cd4ec0b4
GH
2325# spice probe
2326if test "$spice" != "no" ; then
2327 cat > $TMPC << EOF
2328#include <spice.h>
2329int main(void) { spice_server_new(); return 0; }
2330EOF
710fc4f5
JD
2331 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2332 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
2333 if $pkg_config --atleast-version=0.5.3 spice-server >/dev/null 2>&1 && \
cd4ec0b4
GH
2334 compile_prog "$spice_cflags" "$spice_libs" ; then
2335 spice="yes"
2336 libs_softmmu="$libs_softmmu $spice_libs"
2337 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2338 else
2339 if test "$spice" = "yes" ; then
2340 feature_not_found "spice"
2341 fi
2342 spice="no"
2343 fi
2344fi
2345
111a38b0
RR
2346# check for libcacard for smartcard support
2347if test "$smartcard" != "no" ; then
2348 smartcard="yes"
2349 smartcard_cflags=""
2350 # TODO - what's the minimal nss version we support?
2351 if test "$smartcard_nss" != "no"; then
2352 if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 ; then
2353 smartcard_nss="yes"
2354 smartcard_cflags="-I\$(SRC_PATH)/libcacard"
2355 libcacard_libs=$($pkg_config --libs nss 2>/dev/null)
2356 libcacard_cflags=$($pkg_config --cflags nss 2>/dev/null)
2357 QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags"
2358 LIBS="$libcacard_libs $LIBS"
2359 else
2360 if test "$smartcard_nss" = "yes"; then
2361 feature_not_found "nss"
2362 fi
2363 smartcard_nss="no"
2364 fi
2365 fi
2366fi
2367if test "$smartcard" = "no" ; then
2368 smartcard_nss="no"
2369fi
2370
cd4ec0b4
GH
2371##########################################
2372
5f6b9e8f
BS
2373##########################################
2374# check if we have fdatasync
2375
2376fdatasync=no
2377cat > $TMPC << EOF
2378#include <unistd.h>
2379int main(void) { return fdatasync(0); }
2380EOF
2381if compile_prog "" "" ; then
2382 fdatasync=yes
2383fi
2384
e78815a5
AF
2385##########################################
2386# check if we have madvise
2387
2388madvise=no
2389cat > $TMPC << EOF
2390#include <sys/types.h>
2391#include <sys/mman.h>
832ce9c2 2392#include <stddef.h>
e78815a5
AF
2393int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2394EOF
2395if compile_prog "" "" ; then
2396 madvise=yes
2397fi
2398
2399##########################################
2400# check if we have posix_madvise
2401
2402posix_madvise=no
2403cat > $TMPC << EOF
2404#include <sys/mman.h>
832ce9c2 2405#include <stddef.h>
e78815a5
AF
2406int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2407EOF
2408if compile_prog "" "" ; then
2409 posix_madvise=yes
2410fi
2411
94a420b1
SH
2412##########################################
2413# check if trace backend exists
2414
4c3b5a48 2415sh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
94a420b1
SH
2416if test "$?" -ne 0 ; then
2417 echo
2418 echo "Error: invalid trace backend"
2419 echo "Please choose a supported trace backend."
2420 echo
2421 exit 1
2422fi
2423
7e24e92a
SH
2424##########################################
2425# For 'ust' backend, test if ust headers are present
2426if test "$trace_backend" = "ust"; then
2427 cat > $TMPC << EOF
2428#include <ust/tracepoint.h>
2429#include <ust/marker.h>
2430int main(void) { return 0; }
2431EOF
2432 if compile_prog "" "" ; then
2433 LIBS="-lust $LIBS"
2434 else
2435 echo
2436 echo "Error: Trace backend 'ust' missing libust header files"
2437 echo
2438 exit 1
2439 fi
2440fi
b3d08c02
DB
2441
2442##########################################
2443# For 'dtrace' backend, test if 'dtrace' command is present
2444if test "$trace_backend" = "dtrace"; then
2445 if ! has 'dtrace' ; then
2446 echo
2447 echo "Error: dtrace command is not found in PATH $PATH"
2448 echo
2449 exit 1
2450 fi
c276b17d
DB
2451 trace_backend_stap="no"
2452 if has 'stap' ; then
2453 trace_backend_stap="yes"
2454 fi
b3d08c02
DB
2455fi
2456
7e24e92a 2457##########################################
e86ecd4b
JQ
2458# End of CC checks
2459# After here, no more $cc or $ld runs
2460
e86ecd4b 2461if test "$debug" = "no" ; then
1156c669 2462 CFLAGS="-O2 $CFLAGS"
e86ecd4b 2463fi
a316e378 2464
e86ecd4b
JQ
2465# Consult white-list to determine whether to enable werror
2466# by default. Only enable by default for git builds
20ff6c80
AL
2467z_version=`cut -f3 -d. $source_path/VERSION`
2468
e86ecd4b 2469if test -z "$werror" ; then
e86ecd4b
JQ
2470 if test "$z_version" = "50" -a \
2471 "$linux" = "yes" ; then
2472 werror="yes"
2473 else
2474 werror="no"
2475 fi
2476fi
2477
20ff6c80
AL
2478# Disable zero malloc errors for official releases unless explicitly told to
2479# enable/disable
2480if test -z "$zero_malloc" ; then
2481 if test "$z_version" = "50" ; then
2482 zero_malloc="no"
2483 else
2484 zero_malloc="yes"
2485 fi
2486fi
2487
e86ecd4b 2488if test "$werror" = "yes" ; then
a558ee17 2489 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
e86ecd4b
JQ
2490fi
2491
2492if test "$solaris" = "no" ; then
2493 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
1156c669 2494 LDFLAGS="-Wl,--warn-common $LDFLAGS"
e86ecd4b
JQ
2495 fi
2496fi
2497
952afb71
BS
2498# Use ASLR, no-SEH and DEP if available
2499if test "$mingw32" = "yes" ; then
2500 for flag in --dynamicbase --no-seh --nxcompat; do
2501 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2502 LDFLAGS="-Wl,$flag $LDFLAGS"
2503 fi
2504 done
2505fi
2506
190e9c59 2507confdir=$sysconfdir$confsuffix
e7b45cc4 2508
ca35f780
PB
2509tools=
2510if test "$softmmu" = yes ; then
2511 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2512 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2513 tools="qemu-nbd\$(EXESUF) $tools"
2514 if [ "$check_utests" = "yes" ]; then
2515 tools="check-qint check-qstring check-qdict check-qlist $tools"
2516 tools="check-qfloat check-qjson $tools"
2517 fi
2518 fi
2519fi
2520
2521# Mac OS X ships with a broken assembler
2522roms=
2523if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2524 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2525 "$softmmu" = yes ; then
2526 roms="optionrom"
2527fi
39ac8455
DG
2528if test "$cpu" = "ppc64" ; then
2529 roms="$roms spapr-rtas"
2530fi
ca35f780 2531
43ce4dfe 2532echo "Install prefix $prefix"
f2b9e1e3
PB
2533echo "BIOS directory `eval echo $datadir`"
2534echo "binary directory `eval echo $bindir`"
1c0fd160 2535echo "config directory `eval echo $sysconfdir`"
11d9f695 2536if test "$mingw32" = "no" ; then
f2b9e1e3 2537echo "Manual directory `eval echo $mandir`"
43ce4dfe 2538echo "ELF interp prefix $interp_prefix"
11d9f695 2539fi
5a67135a 2540echo "Source path $source_path"
43ce4dfe 2541echo "C compiler $cc"
83469015 2542echo "Host C compiler $host_cc"
0c439cbf 2543echo "CFLAGS $CFLAGS"
a558ee17 2544echo "QEMU_CFLAGS $QEMU_CFLAGS"
0c439cbf 2545echo "LDFLAGS $LDFLAGS"
43ce4dfe 2546echo "make $make"
6a882643 2547echo "install $install"
43ce4dfe 2548echo "host CPU $cpu"
de83cd02 2549echo "host big endian $bigendian"
97a847bc 2550echo "target list $target_list"
ade25b0d 2551echo "tcg debug enabled $debug_tcg"
b4475aa2 2552echo "Mon debug enabled $debug_mon"
43ce4dfe 2553echo "gprof enabled $gprof"
03b4fe7d 2554echo "sparse enabled $sparse"
1625af87 2555echo "strip binaries $strip_opt"
05c2a3e7 2556echo "profiler $profiler"
43ce4dfe 2557echo "static build $static"
85aa5189 2558echo "-Werror enabled $werror"
5b0753e0
FB
2559if test "$darwin" = "yes" ; then
2560 echo "Cocoa support $cocoa"
2561fi
97a847bc 2562echo "SDL support $sdl"
4d3b6f6e 2563echo "curses support $curses"
769ce76d 2564echo "curl support $curl"
5495ed11 2565echo "check support $check_utests"
67b915a5 2566echo "mingw32 support $mingw32"
0c58ac1c 2567echo "Audio drivers $audio_drv_list"
2568echo "Extra audio cards $audio_card_list"
eb852011 2569echo "Block whitelist $block_drv_whitelist"
8ff9cbf7 2570echo "Mixer emulation $mixemu"
821601ea
JS
2571echo "VNC support $vnc"
2572if test "$vnc" = "yes" ; then
2573 echo "VNC TLS support $vnc_tls"
2574 echo "VNC SASL support $vnc_sasl"
2575 echo "VNC JPEG support $vnc_jpeg"
2576 echo "VNC PNG support $vnc_png"
2577 echo "VNC thread $vnc_thread"
2578fi
3142255c
BS
2579if test -n "$sparc_cpu"; then
2580 echo "Target Sparc Arch $sparc_cpu"
2581fi
e37630ca 2582echo "xen support $xen"
2e4d9fb1 2583echo "brlapi support $brlapi"
a20a6f46 2584echo "bluez support $bluez"
a25dba17 2585echo "Documentation $docs"
c5937220
PB
2586[ ! -z "$uname_release" ] && \
2587echo "uname -r $uname_release"
bd0c5661 2588echo "NPTL support $nptl"
379f6698 2589echo "GUEST_BASE $guest_base"
34005a00 2590echo "PIE user targets $user_pie"
8a16d273 2591echo "vde support $vde"
e5d355d1 2592echo "IO thread $io_thread"
5c6c3a6c 2593echo "Linux AIO support $linux_aio"
758e8e38 2594echo "ATTR/XATTR support $attr"
77755340 2595echo "Install blobs $blobs"
b31a0277 2596echo "KVM support $kvm"
f652e6af 2597echo "fdt support $fdt"
ceb42de8 2598echo "preadv support $preadv"
5f6b9e8f 2599echo "fdatasync $fdatasync"
e78815a5
AF
2600echo "madvise $madvise"
2601echo "posix_madvise $posix_madvise"
ee682d27 2602echo "uuid support $uuid"
d5970055 2603echo "vhost-net support $vhost_net"
94a420b1 2604echo "Trace backend $trace_backend"
9410b56c 2605echo "Trace output file $trace_file-<pid>"
cd4ec0b4 2606echo "spice support $spice"
f27aaf4b 2607echo "rbd support $rbd"
dce512de 2608echo "xfsctl support $xfs"
111a38b0 2609echo "nss used $smartcard_nss"
20ff075b 2610echo "OpenGL support $opengl"
67b915a5 2611
97a847bc 2612if test $sdl_too_old = "yes"; then
24b55b96 2613echo "-> Your SDL version is too old - please upgrade to have SDL support"
7c1f25b4 2614fi
7d13299d 2615
98ec69ac 2616config_host_mak="config-host.mak"
4bf6b55b 2617config_host_ld="config-host.ld"
98ec69ac 2618
98ec69ac
JQ
2619echo "# Automatically generated by configure - do not modify" > $config_host_mak
2620printf "# Configured with:" >> $config_host_mak
2621printf " '%s'" "$0" "$@" >> $config_host_mak
2622echo >> $config_host_mak
98ec69ac 2623
e6c3b0f7 2624echo all: >> $config_host_mak
99d7cc75
PB
2625echo "prefix=$prefix" >> $config_host_mak
2626echo "bindir=$bindir" >> $config_host_mak
2627echo "mandir=$mandir" >> $config_host_mak
2628echo "datadir=$datadir" >> $config_host_mak
2629echo "sysconfdir=$sysconfdir" >> $config_host_mak
2630echo "docdir=$docdir" >> $config_host_mak
1dabe05c 2631echo "confdir=$confdir" >> $config_host_mak
804edf29 2632
2408a527 2633case "$cpu" in
613a22c9 2634 i386|x86_64|alpha|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
e0da9dd3 2635 ARCH=$cpu
2408a527 2636 ;;
a302c32d 2637 armv4b|armv4l)
16dbd14f 2638 ARCH=arm
2408a527 2639 ;;
2408a527 2640esac
98ec69ac 2641echo "ARCH=$ARCH" >> $config_host_mak
f8393946 2642if test "$debug_tcg" = "yes" ; then
2358a494 2643 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
f8393946 2644fi
b4475aa2
LC
2645if test "$debug_mon" = "yes" ; then
2646 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2647fi
f3d08ee6 2648if test "$debug" = "yes" ; then
2358a494 2649 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
f3d08ee6 2650fi
1625af87 2651if test "$strip_opt" = "yes" ; then
52ba784d 2652 echo "STRIP=${strip}" >> $config_host_mak
1625af87 2653fi
7d13299d 2654if test "$bigendian" = "yes" ; then
e2542fe2 2655 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
97a847bc 2656fi
2358a494 2657echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
67b915a5 2658if test "$mingw32" = "yes" ; then
98ec69ac 2659 echo "CONFIG_WIN32=y" >> $config_host_mak
9fe6de94
BS
2660 rc_version=`cat $source_path/VERSION`
2661 version_major=${rc_version%%.*}
2662 rc_version=${rc_version#*.}
2663 version_minor=${rc_version%%.*}
2664 rc_version=${rc_version#*.}
2665 version_subminor=${rc_version%%.*}
2666 version_micro=0
2667 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2668 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
210fa556 2669else
35f4df27 2670 echo "CONFIG_POSIX=y" >> $config_host_mak
dffcb71c
MM
2671fi
2672
2673if test "$linux" = "yes" ; then
2674 echo "CONFIG_LINUX=y" >> $config_host_mak
67b915a5 2675fi
128ab2ff 2676
83fb7adf 2677if test "$darwin" = "yes" ; then
98ec69ac 2678 echo "CONFIG_DARWIN=y" >> $config_host_mak
83fb7adf 2679fi
b29fe3ed 2680
2681if test "$aix" = "yes" ; then
98ec69ac 2682 echo "CONFIG_AIX=y" >> $config_host_mak
b29fe3ed 2683fi
2684
ec530c81 2685if test "$solaris" = "yes" ; then
98ec69ac 2686 echo "CONFIG_SOLARIS=y" >> $config_host_mak
2358a494 2687 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
0475a5ca 2688 if test "$needs_libsunmath" = "yes" ; then
75b5a697 2689 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
0475a5ca 2690 fi
ec530c81 2691fi
179cf400
AF
2692if test "$haiku" = "yes" ; then
2693 echo "CONFIG_HAIKU=y" >> $config_host_mak
2694fi
97a847bc 2695if test "$static" = "yes" ; then
98ec69ac 2696 echo "CONFIG_STATIC=y" >> $config_host_mak
7d13299d 2697fi
05c2a3e7 2698if test $profiler = "yes" ; then
2358a494 2699 echo "CONFIG_PROFILER=y" >> $config_host_mak
05c2a3e7 2700fi
c20709aa 2701if test "$slirp" = "yes" ; then
98ec69ac 2702 echo "CONFIG_SLIRP=y" >> $config_host_mak
f9728943 2703 QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
c20709aa 2704fi
8a16d273 2705if test "$vde" = "yes" ; then
98ec69ac 2706 echo "CONFIG_VDE=y" >> $config_host_mak
8a16d273 2707fi
0c58ac1c 2708for card in $audio_card_list; do
f6e5889e 2709 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
98ec69ac 2710 echo "$def=y" >> $config_host_mak
0c58ac1c 2711done
2358a494 2712echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
0c58ac1c 2713for drv in $audio_drv_list; do
f6e5889e 2714 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
98ec69ac 2715 echo "$def=y" >> $config_host_mak
923e4521 2716 if test "$drv" = "fmod"; then
7aac6cb1 2717 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
0c58ac1c 2718 fi
2719done
67f86e8e
JQ
2720if test "$audio_pt_int" = "yes" ; then
2721 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2722fi
d5631638 2723if test "$audio_win_int" = "yes" ; then
2724 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2725fi
eb852011 2726echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
8ff9cbf7 2727if test "$mixemu" = "yes" ; then
98ec69ac 2728 echo "CONFIG_MIXEMU=y" >> $config_host_mak
8ff9cbf7 2729fi
821601ea
JS
2730if test "$vnc" = "yes" ; then
2731 echo "CONFIG_VNC=y" >> $config_host_mak
2732fi
8d5d2d4c 2733if test "$vnc_tls" = "yes" ; then
98ec69ac 2734 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
525061bf 2735 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
8d5d2d4c 2736fi
2f9606b3 2737if test "$vnc_sasl" = "yes" ; then
98ec69ac 2738 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
60ddf533 2739 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
2f9606b3 2740fi
821601ea 2741if test "$vnc_jpeg" = "yes" ; then
2f6f5c7a
CC
2742 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
2743 echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
2744fi
821601ea 2745if test "$vnc_png" = "yes" ; then
efe556ad
CC
2746 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2747 echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2748fi
821601ea 2749if test "$vnc_thread" = "yes" ; then
bd023f95 2750 echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
bd023f95 2751fi
76655d6d 2752if test "$fnmatch" = "yes" ; then
2358a494 2753 echo "CONFIG_FNMATCH=y" >> $config_host_mak
76655d6d 2754fi
ee682d27
SW
2755if test "$uuid" = "yes" ; then
2756 echo "CONFIG_UUID=y" >> $config_host_mak
2757fi
dce512de
CH
2758if test "$xfs" = "yes" ; then
2759 echo "CONFIG_XFS=y" >> $config_host_mak
2760fi
b1a550a0 2761qemu_version=`head $source_path/VERSION`
98ec69ac 2762echo "VERSION=$qemu_version" >>$config_host_mak
2358a494 2763echo "PKGVERSION=$pkgversion" >>$config_host_mak
98ec69ac 2764echo "SRC_PATH=$source_path" >> $config_host_mak
98ec69ac 2765echo "TARGET_DIRS=$target_list" >> $config_host_mak
a25dba17 2766if [ "$docs" = "yes" ] ; then
98ec69ac 2767 echo "BUILD_DOCS=yes" >> $config_host_mak
cc8ae6de 2768fi
1ac88f28 2769if test "$sdl" = "yes" ; then
98ec69ac 2770 echo "CONFIG_SDL=y" >> $config_host_mak
1ac88f28 2771 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
49ecc3fa
FB
2772fi
2773if test "$cocoa" = "yes" ; then
98ec69ac 2774 echo "CONFIG_COCOA=y" >> $config_host_mak
4d3b6f6e
AZ
2775fi
2776if test "$curses" = "yes" ; then
98ec69ac 2777 echo "CONFIG_CURSES=y" >> $config_host_mak
49ecc3fa 2778fi
3b3f24ad 2779if test "$atfile" = "yes" ; then
2358a494 2780 echo "CONFIG_ATFILE=y" >> $config_host_mak
3b3f24ad 2781fi
ebc996f3 2782if test "$utimens" = "yes" ; then
2358a494 2783 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
ebc996f3 2784fi
099d6b0f 2785if test "$pipe2" = "yes" ; then
2358a494 2786 echo "CONFIG_PIPE2=y" >> $config_host_mak
099d6b0f 2787fi
40ff6d7e
KW
2788if test "$accept4" = "yes" ; then
2789 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
2790fi
3ce34dfb 2791if test "$splice" = "yes" ; then
2358a494 2792 echo "CONFIG_SPLICE=y" >> $config_host_mak
3ce34dfb 2793fi
c2882b96
RV
2794if test "$eventfd" = "yes" ; then
2795 echo "CONFIG_EVENTFD=y" >> $config_host_mak
2796fi
d0927938
UH
2797if test "$fallocate" = "yes" ; then
2798 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2799fi
c727f47d
PM
2800if test "$sync_file_range" = "yes" ; then
2801 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
2802fi
dace20dc
PM
2803if test "$fiemap" = "yes" ; then
2804 echo "CONFIG_FIEMAP=y" >> $config_host_mak
2805fi
d0927938
UH
2806if test "$dup3" = "yes" ; then
2807 echo "CONFIG_DUP3=y" >> $config_host_mak
2808fi
3b6edd16
PM
2809if test "$epoll" = "yes" ; then
2810 echo "CONFIG_EPOLL=y" >> $config_host_mak
2811fi
2812if test "$epoll_create1" = "yes" ; then
2813 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
2814fi
2815if test "$epoll_pwait" = "yes" ; then
2816 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
2817fi
3b3f24ad 2818if test "$inotify" = "yes" ; then
2358a494 2819 echo "CONFIG_INOTIFY=y" >> $config_host_mak
3b3f24ad 2820fi
c05c7a73
RV
2821if test "$inotify1" = "yes" ; then
2822 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2823fi
6ae9a1f4
JQ
2824if test "$byteswap_h" = "yes" ; then
2825 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
2826fi
2827if test "$bswap_h" = "yes" ; then
2828 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
2829fi
769ce76d 2830if test "$curl" = "yes" ; then
98ec69ac 2831 echo "CONFIG_CURL=y" >> $config_host_mak
b1d5a277 2832 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
769ce76d 2833fi
2e4d9fb1 2834if test "$brlapi" = "yes" ; then
98ec69ac 2835 echo "CONFIG_BRLAPI=y" >> $config_host_mak
2e4d9fb1 2836fi
fb599c9a 2837if test "$bluez" = "yes" ; then
98ec69ac 2838 echo "CONFIG_BLUEZ=y" >> $config_host_mak
ef7635ec 2839 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
fb599c9a 2840fi
e37630ca 2841if test "$xen" = "yes" ; then
5647eb74 2842 echo "CONFIG_XEN=y" >> $config_host_mak
e37630ca 2843fi
e5d355d1 2844if test "$io_thread" = "yes" ; then
98ec69ac 2845 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
e5d355d1 2846fi
5c6c3a6c
CH
2847if test "$linux_aio" = "yes" ; then
2848 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
2849fi
758e8e38
VJJ
2850if test "$attr" = "yes" ; then
2851 echo "CONFIG_ATTR=y" >> $config_host_mak
2852fi
2853if test "$linux" = "yes" ; then
2854 if test "$attr" = "yes" ; then
2855 echo "CONFIG_VIRTFS=y" >> $config_host_mak
2856 fi
2857fi
77755340 2858if test "$blobs" = "yes" ; then
98ec69ac 2859 echo "INSTALL_BLOBS=yes" >> $config_host_mak
77755340 2860fi
bf9298b9 2861if test "$iovec" = "yes" ; then
2358a494 2862 echo "CONFIG_IOVEC=y" >> $config_host_mak
bf9298b9 2863fi
ceb42de8 2864if test "$preadv" = "yes" ; then
2358a494 2865 echo "CONFIG_PREADV=y" >> $config_host_mak
ceb42de8 2866fi
f652e6af 2867if test "$fdt" = "yes" ; then
3f0855b1 2868 echo "CONFIG_FDT=y" >> $config_host_mak
f652e6af 2869fi
dcc38d1c
MT
2870if test "$signalfd" = "yes" ; then
2871 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
2872fi
de5071c5
BS
2873if test "$need_offsetof" = "yes" ; then
2874 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2875fi
747bbdf7
BS
2876if test "$gcc_attribute_warn_unused_result" = "yes" ; then
2877 echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2878fi
5f6b9e8f
BS
2879if test "$fdatasync" = "yes" ; then
2880 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
2881fi
e78815a5
AF
2882if test "$madvise" = "yes" ; then
2883 echo "CONFIG_MADVISE=y" >> $config_host_mak
2884fi
2885if test "$posix_madvise" = "yes" ; then
2886 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
2887fi
97a847bc 2888
cd4ec0b4
GH
2889if test "$spice" = "yes" ; then
2890 echo "CONFIG_SPICE=y" >> $config_host_mak
2891fi
36707144
AL
2892
2893if test "$smartcard" = "yes" ; then
2894 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
2895fi
cd4ec0b4 2896
111a38b0
RR
2897if test "$smartcard_nss" = "yes" ; then
2898 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
2899fi
2900
20ff075b
MW
2901if test "$opengl" = "yes" ; then
2902 echo "CONFIG_OPENGL=y" >> $config_host_mak
2903fi
2904
83fb7adf 2905# XXX: suppress that
7d3505c5 2906if [ "$bsd" = "yes" ] ; then
2358a494 2907 echo "CONFIG_BSD=y" >> $config_host_mak
7d3505c5
FB
2908fi
2909
2358a494 2910echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
c5937220 2911
20ff6c80
AL
2912if test "$zero_malloc" = "yes" ; then
2913 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
2914fi
f27aaf4b
CB
2915if test "$rbd" = "yes" ; then
2916 echo "CONFIG_RBD=y" >> $config_host_mak
2917fi
20ff6c80 2918
68063649
BS
2919# USB host support
2920case "$usb" in
2921linux)
98ec69ac 2922 echo "HOST_USB=linux" >> $config_host_mak
68063649
BS
2923;;
2924bsd)
98ec69ac 2925 echo "HOST_USB=bsd" >> $config_host_mak
68063649
BS
2926;;
2927*)
98ec69ac 2928 echo "HOST_USB=stub" >> $config_host_mak
68063649
BS
2929;;
2930esac
2931
94a420b1 2932echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
22890ab5
PS
2933if test "$trace_backend" = "simple"; then
2934 echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak
2935fi
9410b56c
PS
2936# Set the appropriate trace file.
2937if test "$trace_backend" = "simple"; then
2938 trace_file="\"$trace_file-%u\""
2939fi
c276b17d
DB
2940if test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then
2941 echo "CONFIG_SYSTEMTAP_TRACE=y" >> $config_host_mak
2942fi
9410b56c
PS
2943echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
2944
98ec69ac 2945echo "TOOLS=$tools" >> $config_host_mak
98ec69ac 2946echo "ROMS=$roms" >> $config_host_mak
804edf29
JQ
2947echo "MAKE=$make" >> $config_host_mak
2948echo "INSTALL=$install" >> $config_host_mak
2949echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2950echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2951echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2952echo "CC=$cc" >> $config_host_mak
2b2e59e6 2953echo "CC_I386=$cc_i386" >> $config_host_mak
804edf29 2954echo "HOST_CC=$host_cc" >> $config_host_mak
804edf29
JQ
2955echo "AR=$ar" >> $config_host_mak
2956echo "OBJCOPY=$objcopy" >> $config_host_mak
2957echo "LD=$ld" >> $config_host_mak
9fe6de94 2958echo "WINDRES=$windres" >> $config_host_mak
e2a2ed06 2959echo "CFLAGS=$CFLAGS" >> $config_host_mak
a558ee17 2960echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
f9728943 2961echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
e39f0062
PB
2962if test "$sparse" = "yes" ; then
2963 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
2964 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
2965 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
2966fi
c81da56e 2967echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
e2a2ed06 2968echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
a36abbbb
JQ
2969echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2970echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
73da375e 2971echo "LIBS+=$LIBS" >> $config_host_mak
3e2e0e6b 2972echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
804edf29 2973echo "EXESUF=$EXESUF" >> $config_host_mak
804edf29 2974
4bf6b55b
JQ
2975# generate list of library paths for linker script
2976
2977$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
2978
2979if test -f ${config_host_ld}~ ; then
2980 if cmp -s $config_host_ld ${config_host_ld}~ ; then
2981 mv ${config_host_ld}~ $config_host_ld
2982 else
2983 rm ${config_host_ld}~
2984 fi
2985fi
2986
4d904533
BS
2987for d in libdis libdis-user; do
2988 mkdir -p $d
11568d6d 2989 symlink $source_path/Makefile.dis $d/Makefile
4d904533
BS
2990 echo > $d/config.mak
2991done
d44cff22
RH
2992if test "$static" = "no" -a "$user_pie" = "yes" ; then
2993 echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
2994fi
4d904533 2995
1d14ffa9 2996for target in $target_list; do
97a847bc 2997target_dir="$target"
25be210f 2998config_target_mak=$target_dir/config-target.mak
600309b6 2999target_arch2=`echo $target | cut -d '-' -f 1`
97a847bc 3000target_bigendian="no"
1f3d3c8f 3001
ea2d6a39 3002case "$target_arch2" in
613a22c9 3003 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
ea2d6a39
JQ
3004 target_bigendian=yes
3005 ;;
3006esac
97a847bc 3007target_softmmu="no"
997344f3 3008target_user_only="no"
831b7825 3009target_linux_user="no"
831b7825 3010target_darwin_user="no"
84778508 3011target_bsd_user="no"
9e407a85 3012case "$target" in
600309b6 3013 ${target_arch2}-softmmu)
9e407a85
PB
3014 target_softmmu="yes"
3015 ;;
600309b6 3016 ${target_arch2}-linux-user)
9c7a4202
BS
3017 if test "$linux" != "yes" ; then
3018 echo "ERROR: Target '$target' is only available on a Linux host"
3019 exit 1
3020 fi
9e407a85
PB
3021 target_user_only="yes"
3022 target_linux_user="yes"
3023 ;;
600309b6 3024 ${target_arch2}-darwin-user)
9c7a4202
BS
3025 if test "$darwin" != "yes" ; then
3026 echo "ERROR: Target '$target' is only available on a Darwin host"
3027 exit 1
3028 fi
9e407a85
PB
3029 target_user_only="yes"
3030 target_darwin_user="yes"
3031 ;;
600309b6 3032 ${target_arch2}-bsd-user)
9cf55765 3033 if test "$bsd" != "yes" ; then
9c7a4202
BS
3034 echo "ERROR: Target '$target' is only available on a BSD host"
3035 exit 1
3036 fi
84778508
BS
3037 target_user_only="yes"
3038 target_bsd_user="yes"
3039 ;;
9e407a85
PB
3040 *)
3041 echo "ERROR: Target '$target' not recognised"
3042 exit 1
3043 ;;
3044esac
831b7825 3045
97a847bc 3046mkdir -p $target_dir
158142c2 3047mkdir -p $target_dir/fpu
57fec1fe 3048mkdir -p $target_dir/tcg
59f2a787 3049mkdir -p $target_dir/ide
84778508 3050if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
69de927c
FB
3051 mkdir -p $target_dir/nwfpe
3052fi
11568d6d 3053symlink $source_path/Makefile.target $target_dir/Makefile
ec530c81 3054
97a847bc 3055
25be210f 3056echo "# Automatically generated by configure - do not modify" > $config_target_mak
de83cd02 3057
e5fe0c52 3058bflt="no"
bd0c5661 3059target_nptl="no"
600309b6 3060interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
7ee2822c 3061echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
56aebc89 3062gdb_xml_files=""
c2e3dee6
LV
3063target_short_alignment=2
3064target_int_alignment=4
3065target_long_alignment=4
3066target_llong_alignment=8
7ba1e619 3067
938b1edd 3068TARGET_ARCH="$target_arch2"
6acff7da 3069TARGET_BASE_ARCH=""
e6e91b9c 3070TARGET_ABI_DIR=""
e73aae67 3071
600309b6 3072case "$target_arch2" in
2408a527 3073 i386)
71deff27 3074 target_phys_bits=64
2408a527
AJ
3075 ;;
3076 x86_64)
6acff7da 3077 TARGET_BASE_ARCH=i386
1ad2134f 3078 target_phys_bits=64
c2e3dee6 3079 target_long_alignment=8
2408a527
AJ
3080 ;;
3081 alpha)
1ad2134f 3082 target_phys_bits=64
c2e3dee6 3083 target_long_alignment=8
a4b388ff 3084 target_nptl="yes"
2408a527
AJ
3085 ;;
3086 arm|armeb)
b498c8a0 3087 TARGET_ARCH=arm
2408a527 3088 bflt="yes"
bd0c5661 3089 target_nptl="yes"
56aebc89 3090 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1ad2134f 3091 target_phys_bits=32
c2e3dee6 3092 target_llong_alignment=4
2408a527
AJ
3093 ;;
3094 cris)
253bd7f8 3095 target_nptl="yes"
1ad2134f 3096 target_phys_bits=32
2408a527 3097 ;;
613a22c9
MW
3098 lm32)
3099 target_phys_bits=32
3100 ;;
2408a527 3101 m68k)
2408a527 3102 bflt="yes"
56aebc89 3103 gdb_xml_files="cf-core.xml cf-fp.xml"
1ad2134f 3104 target_phys_bits=32
c2e3dee6
LV
3105 target_int_alignment=2
3106 target_long_alignment=2
3107 target_llong_alignment=2
2408a527 3108 ;;
877fdc12
EI
3109 microblaze|microblazeel)
3110 TARGET_ARCH=microblaze
72b675ca
EI
3111 bflt="yes"
3112 target_nptl="yes"
3113 target_phys_bits=32
3114 ;;
0adcffb1 3115 mips|mipsel)
b498c8a0 3116 TARGET_ARCH=mips
25be210f 3117 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
f04dc72f 3118 target_nptl="yes"
1ad2134f 3119 target_phys_bits=64
2408a527
AJ
3120 ;;
3121 mipsn32|mipsn32el)
b498c8a0 3122 TARGET_ARCH=mipsn32
6acff7da 3123 TARGET_BASE_ARCH=mips
25be210f 3124 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
1ad2134f 3125 target_phys_bits=64
2408a527
AJ
3126 ;;
3127 mips64|mips64el)
b498c8a0 3128 TARGET_ARCH=mips64
6acff7da 3129 TARGET_BASE_ARCH=mips
25be210f 3130 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
1ad2134f 3131 target_phys_bits=64
c2e3dee6 3132 target_long_alignment=8
2408a527
AJ
3133 ;;
3134 ppc)
c8b3532d 3135 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 3136 target_phys_bits=32
d6630708 3137 target_nptl="yes"
2408a527
AJ
3138 ;;
3139 ppcemb)
6acff7da 3140 TARGET_BASE_ARCH=ppc
e6e91b9c 3141 TARGET_ABI_DIR=ppc
c8b3532d 3142 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 3143 target_phys_bits=64
d6630708 3144 target_nptl="yes"
2408a527
AJ
3145 ;;
3146 ppc64)
6acff7da 3147 TARGET_BASE_ARCH=ppc
e6e91b9c 3148 TARGET_ABI_DIR=ppc
c8b3532d 3149 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 3150 target_phys_bits=64
c2e3dee6 3151 target_long_alignment=8
2408a527
AJ
3152 ;;
3153 ppc64abi32)
b498c8a0 3154 TARGET_ARCH=ppc64
6acff7da 3155 TARGET_BASE_ARCH=ppc
e6e91b9c 3156 TARGET_ABI_DIR=ppc
25be210f 3157 echo "TARGET_ABI32=y" >> $config_target_mak
c8b3532d 3158 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 3159 target_phys_bits=64
2408a527
AJ
3160 ;;
3161 sh4|sh4eb)
b498c8a0 3162 TARGET_ARCH=sh4
2408a527 3163 bflt="yes"
0b6d3ae0 3164 target_nptl="yes"
1ad2134f 3165 target_phys_bits=32
2408a527
AJ
3166 ;;
3167 sparc)
1ad2134f 3168 target_phys_bits=64
2408a527
AJ
3169 ;;
3170 sparc64)
6acff7da 3171 TARGET_BASE_ARCH=sparc
1ad2134f 3172 target_phys_bits=64
c2e3dee6 3173 target_long_alignment=8
2408a527
AJ
3174 ;;
3175 sparc32plus)
b498c8a0 3176 TARGET_ARCH=sparc64
6acff7da 3177 TARGET_BASE_ARCH=sparc
e6e91b9c 3178 TARGET_ABI_DIR=sparc
25be210f 3179 echo "TARGET_ABI32=y" >> $config_target_mak
1ad2134f 3180 target_phys_bits=64
2408a527 3181 ;;
24e804ec 3182 s390x)
bc434676 3183 target_nptl="yes"
24e804ec
AG
3184 target_phys_bits=64
3185 ;;
2408a527
AJ
3186 *)
3187 echo "Unsupported target CPU"
3188 exit 1
3189 ;;
3190esac
c2e3dee6
LV
3191echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3192echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3193echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3194echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
25be210f 3195echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
053dd92e 3196target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
25be210f
JQ
3197echo "TARGET_$target_arch_name=y" >> $config_target_mak
3198echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
42bc608b 3199# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
6acff7da
JQ
3200if [ "$TARGET_BASE_ARCH" = "" ]; then
3201 TARGET_BASE_ARCH=$TARGET_ARCH
6acff7da 3202fi
25be210f 3203echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
e6e91b9c
JQ
3204if [ "$TARGET_ABI_DIR" = "" ]; then
3205 TARGET_ABI_DIR=$TARGET_ARCH
3206fi
25be210f 3207echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
1b0c87fc
JQ
3208case "$target_arch2" in
3209 i386|x86_64)
3210 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
25be210f 3211 echo "CONFIG_XEN=y" >> $config_target_mak
1b0c87fc
JQ
3212 fi
3213esac
c59249f9 3214case "$target_arch2" in
0e60a699 3215 i386|x86_64|ppcemb|ppc|ppc64|s390x)
c59249f9
JQ
3216 # Make sure the target and host cpus are compatible
3217 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3218 \( "$target_arch2" = "$cpu" -o \
3219 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
5f114bc6 3220 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
adf82011
RR
3221 \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \
3222 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
c59249f9
JQ
3223 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
3224 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
25be210f
JQ
3225 echo "CONFIG_KVM=y" >> $config_target_mak
3226 echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
dae5079a
JK
3227 if test "$kvm_para" = "yes"; then
3228 echo "CONFIG_KVM_PARA=y" >> $config_target_mak
3229 fi
d5970055
MT
3230 if test $vhost_net = "yes" ; then
3231 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3232 fi
c59249f9
JQ
3233 fi
3234esac
de83cd02 3235if test "$target_bigendian" = "yes" ; then
25be210f 3236 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
de83cd02 3237fi
97a847bc 3238if test "$target_softmmu" = "yes" ; then
b1aa27c4 3239 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
25be210f
JQ
3240 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
3241 echo "LIBS+=$libs_softmmu" >> $config_target_mak
0e8c9214 3242 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
5791f45b 3243 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
43ce4dfe 3244fi
997344f3 3245if test "$target_user_only" = "yes" ; then
25be210f 3246 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
997344f3 3247fi
831b7825 3248if test "$target_linux_user" = "yes" ; then
25be210f 3249 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
831b7825
TS
3250fi
3251if test "$target_darwin_user" = "yes" ; then
25be210f 3252 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
831b7825 3253fi
111a38b0
RR
3254if test "$smartcard_nss" = "yes" ; then
3255 echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3256 echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3257 echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3258fi
56aebc89
PB
3259list=""
3260if test ! -z "$gdb_xml_files" ; then
3261 for x in $gdb_xml_files; do
3262 list="$list $source_path/gdb-xml/$x"
3263 done
3d0f1517 3264 echo "TARGET_XML_FILES=$list" >> $config_target_mak
56aebc89 3265fi
97a847bc 3266
f57975fb 3267case "$target_arch2" in
eb8f7776
AJ
3268 i386|x86_64)
3269 echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
f57975fb 3270 ;;
d6b38939 3271 *)
eb8f7776 3272 echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
d6b38939 3273 ;;
f57975fb
JQ
3274esac
3275
e5fe0c52 3276if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
25be210f 3277 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
e5fe0c52 3278fi
bd0c5661
PB
3279if test "$target_user_only" = "yes" \
3280 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
25be210f 3281 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
bd0c5661 3282fi
379f6698 3283if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
25be210f 3284 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
379f6698 3285fi
84778508 3286if test "$target_bsd_user" = "yes" ; then
25be210f 3287 echo "CONFIG_BSD_USER=y" >> $config_target_mak
84778508 3288fi
5b0753e0 3289
4afddb55 3290# generate QEMU_CFLAGS/LDFLAGS for targets
fa282484 3291
4afddb55 3292cflags=""
f9728943 3293includes=""
fa282484 3294ldflags=""
9b8e111f 3295
57ddfbf7 3296if test "$ARCH" = "sparc64" ; then
f9728943 3297 includes="-I\$(SRC_PATH)/tcg/sparc $includes"
24e804ec 3298elif test "$ARCH" = "s390x" ; then
f9728943 3299 includes="-I\$(SRC_PATH)/tcg/s390 $includes"
5d8a4f8f 3300elif test "$ARCH" = "x86_64" ; then
f9728943 3301 includes="-I\$(SRC_PATH)/tcg/i386 $includes"
57ddfbf7 3302else
f9728943 3303 includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
57ddfbf7 3304fi
f9728943
PB
3305includes="-I\$(SRC_PATH)/tcg $includes"
3306includes="-I\$(SRC_PATH)/fpu $includes"
57ddfbf7 3307
4d904533
BS
3308if test "$target_user_only" = "yes" ; then
3309 libdis_config_mak=libdis-user/config.mak
3310else
3311 libdis_config_mak=libdis/config.mak
3312fi
3313
64656024
JQ
3314for i in $ARCH $TARGET_BASE_ARCH ; do
3315 case "$i" in
3316 alpha)
25be210f 3317 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
4d904533 3318 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
64656024
JQ
3319 ;;
3320 arm)
25be210f 3321 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
4d904533 3322 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
64656024
JQ
3323 ;;
3324 cris)
25be210f 3325 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
4d904533 3326 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
64656024
JQ
3327 ;;
3328 hppa)
25be210f 3329 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
4d904533 3330 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
64656024
JQ
3331 ;;
3332 i386|x86_64)
25be210f 3333 echo "CONFIG_I386_DIS=y" >> $config_target_mak
4d904533 3334 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
64656024 3335 ;;
903ec55c
AJ
3336 ia64*)
3337 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
3338 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
3339 ;;
64656024 3340 m68k)
25be210f 3341 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
4d904533 3342 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
64656024 3343 ;;
877fdc12 3344 microblaze*)
25be210f 3345 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
4d904533 3346 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
64656024
JQ
3347 ;;
3348 mips*)
25be210f 3349 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
4d904533 3350 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
64656024
JQ
3351 ;;
3352 ppc*)
25be210f 3353 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
4d904533 3354 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
64656024 3355 ;;
24e804ec 3356 s390*)
25be210f 3357 echo "CONFIG_S390_DIS=y" >> $config_target_mak
4d904533 3358 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
64656024
JQ
3359 ;;
3360 sh4)
25be210f 3361 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
4d904533 3362 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
64656024
JQ
3363 ;;
3364 sparc*)
25be210f 3365 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
4d904533 3366 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
64656024
JQ
3367 ;;
3368 esac
3369done
3370
6ee7126f
JQ
3371case "$ARCH" in
3372alpha)
3373 # Ensure there's only a single GP
3374 cflags="-msmall-data $cflags"
3375;;
3376esac
3377
55d9c04b
JQ
3378if test "$target_softmmu" = "yes" ; then
3379 case "$TARGET_BASE_ARCH" in
3380 arm)
3381 cflags="-DHAS_AUDIO $cflags"
25a8bb96
MW
3382 ;;
3383 lm32)
3384 cflags="-DHAS_AUDIO $cflags"
55d9c04b
JQ
3385 ;;
3386 i386|mips|ppc)
3387 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
3388 ;;
3389 esac
3390fi
3391
34005a00 3392if test "$target_user_only" = "yes" -a "$static" = "no" -a \
50108930 3393 "$user_pie" = "yes" ; then
34005a00
KS
3394 cflags="-fpie $cflags"
3395 ldflags="-pie $ldflags"
3396fi
3397
471857dd
JQ
3398if test "$target_softmmu" = "yes" -a \( \
3399 "$TARGET_ARCH" = "microblaze" -o \
3400 "$TARGET_ARCH" = "cris" \) ; then
25be210f 3401 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
471857dd
JQ
3402fi
3403
d02c1db3 3404if test "$gprof" = "yes" ; then
25be210f 3405 echo "TARGET_GPROF=yes" >> $config_target_mak
d02c1db3
JQ
3406 if test "$target_linux_user" = "yes" ; then
3407 cflags="-p $cflags"
3408 ldflags="-p $ldflags"
3409 fi
3410 if test "$target_softmmu" = "yes" ; then
3411 ldflags="-p $ldflags"
25be210f 3412 echo "GPROF_CFLAGS=-p" >> $config_target_mak
d02c1db3
JQ
3413 fi
3414fi
3415
6ee7126f 3416linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
9b8e111f 3417if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
fa282484 3418 case "$ARCH" in
fa282484
JQ
3419 sparc)
3420 # -static is used to avoid g1/g3 usage by the dynamic linker
322e5878 3421 ldflags="$linker_script -static $ldflags"
fa282484 3422 ;;
4d58be06
RH
3423 alpha | s390x)
3424 # The default placement of the application is fine.
3425 ;;
fd76e73a 3426 *)
322e5878 3427 ldflags="$linker_script $ldflags"
fa282484
JQ
3428 ;;
3429 esac
3430fi
fa282484 3431
25be210f
JQ
3432echo "LDFLAGS+=$ldflags" >> $config_target_mak
3433echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
f9728943 3434echo "QEMU_INCLUDES+=$includes" >> $config_target_mak
fa282484 3435
97a847bc 3436done # for target in $targets
7d13299d 3437
d1807a4f
PB
3438# build tree in object directory in case the source is not in the current directory
3439DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
3440DIRS="$DIRS roms/seabios roms/vgabios"
3441DIRS="$DIRS fsdev ui"
3442FILES="Makefile tests/Makefile"
3443FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
3444FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
3445FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
3446for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
3447 FILES="$FILES pc-bios/`basename $bios_file`"
3448done
3449mkdir -p $DIRS
3450for f in $FILES ; do
eae30c8f 3451 test -e $f || symlink $source_path/$f $f
d1807a4f 3452done
1ad2134f 3453
c34ebfdc 3454# temporary config to build submodules
2d9f27d2 3455for rom in seabios vgabios ; do
c34ebfdc 3456 config_mak=roms/$rom/config.mak
37116c89 3457 echo "# Automatically generated by configure - do not modify" > $config_mak
c34ebfdc
AL
3458 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3459 echo "CC=$cc" >> $config_mak
3460 echo "BCC=bcc" >> $config_mak
3461 echo "CPP=${cross_prefix}cpp" >> $config_mak
3462 echo "OBJCOPY=objcopy" >> $config_mak
3463 echo "IASL=iasl" >> $config_mak
c34ebfdc
AL
3464 echo "LD=$ld" >> $config_mak
3465done
3466
1ad2134f
PB
3467for hwlib in 32 64; do
3468 d=libhw$hwlib
3469 mkdir -p $d
9953b2fc 3470 mkdir -p $d/ide
11568d6d 3471 symlink $source_path/Makefile.hw $d/Makefile
37116c89 3472 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
1ad2134f 3473done
add16157 3474
111a38b0
RR
3475if [ "$source_path" != `pwd` ]; then
3476 # out of tree build
3477 mkdir -p libcacard
3478 rm -f libcacard/Makefile
3479 ln -s "$source_path/libcacard/Makefile" libcacard/Makefile
3480fi
3481
add16157
BS
3482d=libuser
3483mkdir -p $d
11568d6d 3484symlink $source_path/Makefile.user $d/Makefile
299060a0
KS
3485if test "$static" = "no" -a "$user_pie" = "yes" ; then
3486 echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3487fi
b40292e7
JK
3488
3489if test "$docs" = "yes" ; then
3490 mkdir -p QMP
3491fi