]>
Commit | Line | Data |
---|---|---|
7d13299d FB |
1 | #!/bin/sh |
2 | # | |
3ef693a0 | 3 | # qemu configure script (c) 2003 Fabrice Bellard |
7d13299d FB |
4 | # |
5 | # set temporary file name | |
6 | if test ! -z "$TMPDIR" ; then | |
7 | TMPDIR1="${TMPDIR}" | |
8 | elif test ! -z "$TEMPDIR" ; then | |
9 | TMPDIR1="${TEMPDIR}" | |
10 | else | |
11 | TMPDIR1="/tmp" | |
12 | fi | |
13 | ||
3ef693a0 FB |
14 | TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c" |
15 | TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o" | |
a91b857c | 16 | TMPE="${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> | |
20 | trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM | |
da1d85e3 | 21 | rm -f config.log |
9ac81bbb | 22 | |
b48e3611 PM |
23 | # Print a helpful header at the top of config.log |
24 | echo "# QEMU configure log $(date)" >> config.log | |
979ae168 PM |
25 | printf "# Configured with:" >> config.log |
26 | printf " '%s'" "$0" "$@" >> config.log | |
27 | echo >> config.log | |
b48e3611 PM |
28 | echo "#" >> config.log |
29 | ||
8dc38a78 PM |
30 | do_cc() { |
31 | # Run the compiler, capturing its output to the log. | |
32 | echo $cc "$@" >> config.log | |
33 | $cc "$@" >> config.log 2>&1 || return $? | |
34 | # Test passed. If this is an --enable-werror build, rerun | |
35 | # the test with -Werror and bail out if it fails. This | |
36 | # makes warning-generating-errors in configure test code | |
37 | # obvious to developers. | |
38 | if test "$werror" != "yes"; then | |
39 | return 0 | |
40 | fi | |
41 | # Don't bother rerunning the compile if we were already using -Werror | |
42 | case "$*" in | |
43 | *-Werror*) | |
44 | return 0 | |
45 | ;; | |
46 | esac | |
47 | echo $cc -Werror "$@" >> config.log | |
48 | $cc -Werror "$@" >> config.log 2>&1 && return $? | |
49 | echo "ERROR: configure test passed without -Werror but failed with -Werror." | |
50 | echo "This is probably a bug in the configure script. The failing command" | |
51 | echo "will be at the bottom of config.log." | |
52 | echo "You can run configure with --disable-werror to bypass this check." | |
53 | exit 1 | |
54 | } | |
55 | ||
52166aa0 | 56 | compile_object() { |
8dc38a78 | 57 | do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC |
52166aa0 JQ |
58 | } |
59 | ||
60 | compile_prog() { | |
61 | local_cflags="$1" | |
62 | local_ldflags="$2" | |
8dc38a78 | 63 | do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags |
52166aa0 JQ |
64 | } |
65 | ||
11568d6d PB |
66 | # symbolically link $1 to $2. Portable version of "ln -sf". |
67 | symlink() { | |
72b8b5a1 | 68 | rm -rf "$2" |
ec5b06d7 | 69 | mkdir -p "$(dirname "$2")" |
72b8b5a1 | 70 | ln -s "$1" "$2" |
11568d6d PB |
71 | } |
72 | ||
0dba6195 LM |
73 | # check whether a command is available to this shell (may be either an |
74 | # executable or a builtin) | |
75 | has() { | |
76 | type "$1" >/dev/null 2>&1 | |
77 | } | |
78 | ||
79 | # search for an executable in PATH | |
80 | path_of() { | |
81 | local_command="$1" | |
82 | local_ifs="$IFS" | |
83 | local_dir="" | |
84 | ||
85 | # pathname has a dir component? | |
86 | if [ "${local_command#*/}" != "$local_command" ]; then | |
87 | if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then | |
88 | echo "$local_command" | |
89 | return 0 | |
90 | fi | |
91 | fi | |
92 | if [ -z "$local_command" ]; then | |
93 | return 1 | |
94 | fi | |
95 | ||
96 | IFS=: | |
97 | for local_dir in $PATH; do | |
98 | if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then | |
99 | echo "$local_dir/$local_command" | |
100 | IFS="${local_ifs:-$(printf ' \t\n')}" | |
101 | return 0 | |
102 | fi | |
103 | done | |
104 | # not found | |
105 | IFS="${local_ifs:-$(printf ' \t\n')}" | |
106 | return 1 | |
107 | } | |
108 | ||
7d13299d | 109 | # default parameters |
ca4deeb1 | 110 | source_path=`dirname "$0"` |
2ff6b91e | 111 | cpu="" |
1e43adfc | 112 | interp_prefix="/usr/gnemul/qemu-%M" |
43ce4dfe | 113 | static="no" |
ed968ff1 | 114 | sparc_cpu="" |
7d13299d | 115 | cross_prefix="" |
0c58ac1c | 116 | audio_drv_list="" |
61dc008f AL |
117 | audio_card_list="ac97 es1370 sb16 hda" |
118 | audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda" | |
eb852011 | 119 | block_drv_whitelist="" |
7d13299d | 120 | host_cc="gcc" |
c81da56e | 121 | helper_cflags="" |
73da375e | 122 | libs_softmmu="" |
3e2e0e6b | 123 | libs_tools="" |
67f86e8e | 124 | audio_pt_int="" |
d5631638 | 125 | audio_win_int="" |
2b2e59e6 | 126 | cc_i386=i386-pc-linux-gnu-gcc |
957f1f99 | 127 | libs_qga="" |
5bc62e01 | 128 | debug_info="yes" |
ac0df51d | 129 | |
377529c0 PB |
130 | target_list="" |
131 | ||
132 | # Default value for a variable defining feature "foo". | |
133 | # * foo="no" feature will only be used if --enable-foo arg is given | |
134 | # * foo="" feature will be searched for, and if found, will be used | |
135 | # unless --disable-foo is given | |
136 | # * foo="yes" this value will only be set by --enable-foo flag. | |
137 | # feature will searched for, | |
138 | # if not found, configure exits with error | |
139 | # | |
140 | # Always add --enable-foo and --disable-foo command line args. | |
141 | # Distributions want to ensure that several features are compiled in, and it | |
142 | # is impossible without a --enable-foo that exits if a feature is not found. | |
143 | ||
144 | bluez="" | |
145 | brlapi="" | |
146 | curl="" | |
147 | curses="" | |
148 | docs="" | |
149 | fdt="" | |
377529c0 PB |
150 | nptl="" |
151 | sdl="" | |
983eef5a | 152 | virtfs="" |
821601ea | 153 | vnc="yes" |
377529c0 PB |
154 | sparse="no" |
155 | uuid="" | |
156 | vde="" | |
157 | vnc_tls="" | |
158 | vnc_sasl="" | |
159 | vnc_jpeg="" | |
160 | vnc_png="" | |
377529c0 | 161 | xen="" |
d5b93ddf | 162 | xen_ctrl_version="" |
eb6fda0f | 163 | xen_pci_passthrough="" |
377529c0 | 164 | linux_aio="" |
47e98658 | 165 | cap_ng="" |
377529c0 | 166 | attr="" |
4f26f2b6 | 167 | libattr="" |
377529c0 PB |
168 | xfs="" |
169 | ||
d41a75a2 BS |
170 | vhost_net="no" |
171 | kvm="no" | |
377529c0 PB |
172 | gprof="no" |
173 | debug_tcg="no" | |
377529c0 PB |
174 | debug="no" |
175 | strip_opt="yes" | |
9195b2c2 | 176 | tcg_interpreter="no" |
377529c0 PB |
177 | bigendian="no" |
178 | mingw32="no" | |
179 | EXESUF="" | |
180 | prefix="/usr/local" | |
181 | mandir="\${prefix}/share/man" | |
528ae5b8 | 182 | datadir="\${prefix}/share" |
850da188 | 183 | qemu_docdir="\${prefix}/share/doc/qemu" |
377529c0 | 184 | bindir="\${prefix}/bin" |
3aa5d2be | 185 | libdir="\${prefix}/lib" |
0f94d6da | 186 | includedir="\${prefix}/include" |
377529c0 PB |
187 | sysconfdir="\${prefix}/etc" |
188 | confsuffix="/qemu" | |
189 | slirp="yes" | |
190 | fmod_lib="" | |
191 | fmod_inc="" | |
192 | oss_lib="" | |
193 | bsd="no" | |
194 | linux="no" | |
195 | solaris="no" | |
196 | profiler="no" | |
197 | cocoa="no" | |
198 | softmmu="yes" | |
199 | linux_user="no" | |
377529c0 PB |
200 | bsd_user="no" |
201 | guest_base="" | |
202 | uname_release="" | |
377529c0 | 203 | mixemu="no" |
377529c0 PB |
204 | aix="no" |
205 | blobs="yes" | |
206 | pkgversion="" | |
40d6444e | 207 | pie="" |
377529c0 PB |
208 | zero_malloc="" |
209 | trace_backend="nop" | |
210 | trace_file="trace" | |
211 | spice="" | |
212 | rbd="" | |
36707144 | 213 | smartcard="" |
111a38b0 | 214 | smartcard_nss="" |
69354a83 | 215 | usb_redir="" |
430a3c18 | 216 | opengl="" |
1ece9905 | 217 | zlib="yes" |
d138cee9 | 218 | guest_agent="yes" |
c589b249 | 219 | libiscsi="" |
519175a2 | 220 | coroutine="" |
377529c0 | 221 | |
ac0df51d AL |
222 | # parse CC options first |
223 | for opt do | |
224 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` | |
225 | case "$opt" in | |
226 | --cross-prefix=*) cross_prefix="$optarg" | |
227 | ;; | |
3d8df640 | 228 | --cc=*) CC="$optarg" |
ac0df51d | 229 | ;; |
ca4deeb1 PB |
230 | --source-path=*) source_path="$optarg" |
231 | ;; | |
2ff6b91e JQ |
232 | --cpu=*) cpu="$optarg" |
233 | ;; | |
a558ee17 | 234 | --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" |
e2a2ed06 JQ |
235 | ;; |
236 | --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" | |
237 | ;; | |
5bc62e01 GH |
238 | --enable-debug-info) debug_info="yes" |
239 | ;; | |
240 | --disable-debug-info) debug_info="no" | |
241 | ;; | |
50e7b1a0 JQ |
242 | --sparc_cpu=*) |
243 | sparc_cpu="$optarg" | |
244 | case $sparc_cpu in | |
ed968ff1 | 245 | v7|v8|v8plus|v8plusa) |
50e7b1a0 JQ |
246 | cpu="sparc" |
247 | ;; | |
248 | v9) | |
50e7b1a0 JQ |
249 | cpu="sparc64" |
250 | ;; | |
251 | *) | |
252 | echo "undefined SPARC architecture. Exiting"; | |
253 | exit 1 | |
254 | ;; | |
255 | esac | |
256 | ;; | |
ac0df51d AL |
257 | esac |
258 | done | |
ac0df51d AL |
259 | # OS specific |
260 | # Using uname is really, really broken. Once we have the right set of checks | |
93148aa5 | 261 | # we can eliminate its usage altogether. |
ac0df51d | 262 | |
b3198cc2 SY |
263 | cc="${CC-${cross_prefix}gcc}" |
264 | ar="${AR-${cross_prefix}ar}" | |
265 | objcopy="${OBJCOPY-${cross_prefix}objcopy}" | |
266 | ld="${LD-${cross_prefix}ld}" | |
3f534581 | 267 | libtool="${LIBTOOL-${cross_prefix}libtool}" |
b3198cc2 SY |
268 | strip="${STRIP-${cross_prefix}strip}" |
269 | windres="${WINDRES-${cross_prefix}windres}" | |
17884d7b ST |
270 | pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" |
271 | query_pkg_config() { | |
272 | "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" | |
273 | } | |
274 | pkg_config=query_pkg_config | |
b3198cc2 | 275 | sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}" |
ac0df51d | 276 | |
be17dc90 MT |
277 | # default flags for all hosts |
278 | QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" | |
f9188227 | 279 | QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" |
be17dc90 MT |
280 | QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" |
281 | QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" | |
cbbab922 | 282 | QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu" |
5bc62e01 GH |
283 | if test "$debug_info" = "yes"; then |
284 | CFLAGS="-g $CFLAGS" | |
285 | LDFLAGS="-g $LDFLAGS" | |
286 | fi | |
be17dc90 | 287 | |
ca4deeb1 PB |
288 | # make source path absolute |
289 | source_path=`cd "$source_path"; pwd` | |
290 | ||
ac0df51d AL |
291 | check_define() { |
292 | cat > $TMPC <<EOF | |
293 | #if !defined($1) | |
fd786e1a | 294 | #error $1 not defined |
ac0df51d AL |
295 | #endif |
296 | int main(void) { return 0; } | |
297 | EOF | |
52166aa0 | 298 | compile_object |
ac0df51d AL |
299 | } |
300 | ||
bbea4050 PM |
301 | if check_define __linux__ ; then |
302 | targetos="Linux" | |
303 | elif check_define _WIN32 ; then | |
304 | targetos='MINGW32' | |
305 | elif check_define __OpenBSD__ ; then | |
306 | targetos='OpenBSD' | |
307 | elif check_define __sun__ ; then | |
308 | targetos='SunOS' | |
309 | elif check_define __HAIKU__ ; then | |
310 | targetos='Haiku' | |
311 | else | |
312 | targetos=`uname -s` | |
313 | fi | |
314 | ||
315 | # Some host OSes need non-standard checks for which CPU to use. | |
316 | # Note that these checks are broken for cross-compilation: if you're | |
317 | # cross-compiling to one of these OSes then you'll need to specify | |
318 | # the correct CPU with the --cpu option. | |
319 | case $targetos in | |
320 | Darwin) | |
321 | # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can | |
322 | # run 64-bit userspace code. | |
323 | # If the user didn't specify a CPU explicitly and the kernel says this is | |
324 | # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. | |
325 | if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then | |
326 | cpu="x86_64" | |
327 | fi | |
328 | ;; | |
329 | SunOS) | |
330 | # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo | |
331 | if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then | |
332 | cpu="x86_64" | |
333 | fi | |
334 | esac | |
335 | ||
2ff6b91e JQ |
336 | if test ! -z "$cpu" ; then |
337 | # command line argument | |
338 | : | |
339 | elif check_define __i386__ ; then | |
ac0df51d AL |
340 | cpu="i386" |
341 | elif check_define __x86_64__ ; then | |
342 | cpu="x86_64" | |
3aa9bd6c BS |
343 | elif check_define __sparc__ ; then |
344 | # We can't check for 64 bit (when gcc is biarch) or V8PLUSA | |
345 | # They must be specified using --sparc_cpu | |
346 | if check_define __arch64__ ; then | |
347 | cpu="sparc64" | |
348 | else | |
349 | cpu="sparc" | |
350 | fi | |
fdf7ed96 | 351 | elif check_define _ARCH_PPC ; then |
352 | if check_define _ARCH_PPC64 ; then | |
353 | cpu="ppc64" | |
354 | else | |
355 | cpu="ppc" | |
356 | fi | |
afa05235 AJ |
357 | elif check_define __mips__ ; then |
358 | cpu="mips" | |
477ba620 AJ |
359 | elif check_define __ia64__ ; then |
360 | cpu="ia64" | |
d66ed0ea AJ |
361 | elif check_define __s390__ ; then |
362 | if check_define __s390x__ ; then | |
363 | cpu="s390x" | |
364 | else | |
365 | cpu="s390" | |
366 | fi | |
21d89f84 PM |
367 | elif check_define __arm__ ; then |
368 | cpu="arm" | |
f28ffed5 BS |
369 | elif check_define __hppa__ ; then |
370 | cpu="hppa" | |
ac0df51d | 371 | else |
fdf7ed96 | 372 | cpu=`uname -m` |
ac0df51d AL |
373 | fi |
374 | ||
359bc95d PM |
375 | ARCH= |
376 | # Normalise host CPU name and set ARCH. | |
377 | # Note that this case should only have supported host CPUs, not guests. | |
7d13299d | 378 | case "$cpu" in |
359bc95d | 379 | ia64|ppc|ppc64|s390|s390x|sparc64) |
ea8f20f8 JQ |
380 | cpu="$cpu" |
381 | ;; | |
7d13299d | 382 | i386|i486|i586|i686|i86pc|BePC) |
97a847bc | 383 | cpu="i386" |
7d13299d | 384 | ;; |
aaa5fa14 AJ |
385 | x86_64|amd64) |
386 | cpu="x86_64" | |
387 | ;; | |
21d89f84 PM |
388 | armv*b|armv*l|arm) |
389 | cpu="arm" | |
7d13299d | 390 | ;; |
f28ffed5 | 391 | hppa|parisc|parisc64) |
f54b3f92 AJ |
392 | cpu="hppa" |
393 | ;; | |
afa05235 AJ |
394 | mips*) |
395 | cpu="mips" | |
396 | ;; | |
3142255c | 397 | sparc|sun4[cdmuv]) |
ae228531 FB |
398 | cpu="sparc" |
399 | ;; | |
7d13299d | 400 | *) |
359bc95d PM |
401 | # This will result in either an error or falling back to TCI later |
402 | ARCH=unknown | |
7d13299d FB |
403 | ;; |
404 | esac | |
359bc95d PM |
405 | if test -z "$ARCH"; then |
406 | ARCH="$cpu" | |
407 | fi | |
e2d52ad3 | 408 | |
7d13299d | 409 | # OS specific |
0dbfc675 | 410 | |
7d13299d | 411 | case $targetos in |
c326e0af | 412 | CYGWIN*) |
0dbfc675 | 413 | mingw32="yes" |
a558ee17 | 414 | QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" |
d5631638 | 415 | audio_possible_drivers="winwave sdl" |
416 | audio_drv_list="winwave" | |
c326e0af | 417 | ;; |
67b915a5 | 418 | MINGW32*) |
0dbfc675 | 419 | mingw32="yes" |
d5631638 | 420 | audio_possible_drivers="winwave dsound sdl fmod" |
421 | audio_drv_list="winwave" | |
67b915a5 | 422 | ;; |
5c40d2bd | 423 | GNU/kFreeBSD) |
a167ba50 | 424 | bsd="yes" |
0dbfc675 JQ |
425 | audio_drv_list="oss" |
426 | audio_possible_drivers="oss sdl esd pa" | |
5c40d2bd | 427 | ;; |
7d3505c5 | 428 | FreeBSD) |
0dbfc675 | 429 | bsd="yes" |
0db4a067 | 430 | make="${MAKE-gmake}" |
0dbfc675 JQ |
431 | audio_drv_list="oss" |
432 | audio_possible_drivers="oss sdl esd pa" | |
f01576f1 JL |
433 | # needed for kinfo_getvmmap(3) in libutil.h |
434 | LIBS="-lutil $LIBS" | |
7d3505c5 | 435 | ;; |
c5e97233 | 436 | DragonFly) |
0dbfc675 | 437 | bsd="yes" |
0db4a067 | 438 | make="${MAKE-gmake}" |
0dbfc675 JQ |
439 | audio_drv_list="oss" |
440 | audio_possible_drivers="oss sdl esd pa" | |
c5e97233 | 441 | ;; |
7d3505c5 | 442 | NetBSD) |
0dbfc675 | 443 | bsd="yes" |
0db4a067 | 444 | make="${MAKE-gmake}" |
0dbfc675 JQ |
445 | audio_drv_list="oss" |
446 | audio_possible_drivers="oss sdl esd" | |
447 | oss_lib="-lossaudio" | |
7d3505c5 FB |
448 | ;; |
449 | OpenBSD) | |
0dbfc675 | 450 | bsd="yes" |
0db4a067 | 451 | make="${MAKE-gmake}" |
0dbfc675 JQ |
452 | audio_drv_list="oss" |
453 | audio_possible_drivers="oss sdl esd" | |
454 | oss_lib="-lossaudio" | |
7d3505c5 | 455 | ;; |
83fb7adf | 456 | Darwin) |
0dbfc675 JQ |
457 | bsd="yes" |
458 | darwin="yes" | |
0dbfc675 | 459 | if [ "$cpu" = "x86_64" ] ; then |
a558ee17 | 460 | QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" |
0c439cbf | 461 | LDFLAGS="-arch x86_64 $LDFLAGS" |
0dbfc675 | 462 | else |
a558ee17 | 463 | QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS" |
0dbfc675 | 464 | fi |
0dbfc675 JQ |
465 | cocoa="yes" |
466 | audio_drv_list="coreaudio" | |
467 | audio_possible_drivers="coreaudio sdl fmod" | |
468 | LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" | |
7973f21c | 469 | libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" |
a0b7cf6b PM |
470 | # Disable attempts to use ObjectiveC features in os/object.h since they |
471 | # won't work when we're compiling with gcc as a C compiler. | |
472 | QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" | |
83fb7adf | 473 | ;; |
ec530c81 | 474 | SunOS) |
0dbfc675 | 475 | solaris="yes" |
0db4a067 PB |
476 | make="${MAKE-gmake}" |
477 | install="${INSTALL-ginstall}" | |
fa58948d | 478 | ld="gld" |
e2d8830e | 479 | smbd="${SMBD-/usr/sfw/sbin/smbd}" |
0dbfc675 JQ |
480 | needs_libsunmath="no" |
481 | solarisrev=`uname -r | cut -f2 -d.` | |
0dbfc675 JQ |
482 | if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then |
483 | if test "$solarisrev" -le 9 ; then | |
484 | if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then | |
485 | needs_libsunmath="yes" | |
f14bfdf9 JQ |
486 | QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" |
487 | LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" | |
488 | LIBS="-lsunmath $LIBS" | |
0dbfc675 JQ |
489 | else |
490 | echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" | |
491 | echo "libsunmath from the Sun Studio compilers tools, due to a lack of" | |
492 | echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" | |
493 | echo "Studio 11 can be downloaded from www.sun.com." | |
494 | exit 1 | |
495 | fi | |
86b2bd93 | 496 | fi |
0dbfc675 JQ |
497 | fi |
498 | if test -f /usr/include/sys/soundcard.h ; then | |
499 | audio_drv_list="oss" | |
500 | fi | |
501 | audio_possible_drivers="oss sdl" | |
d741429a BS |
502 | # needed for CMSG_ macros in sys/socket.h |
503 | QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" | |
504 | # needed for TIOCWIN* defines in termios.h | |
505 | QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" | |
a558ee17 | 506 | QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" |
560d375f AF |
507 | solarisnetlibs="-lsocket -lnsl -lresolv" |
508 | LIBS="$solarisnetlibs $LIBS" | |
509 | libs_qga="$solarisnetlibs $libs_qga" | |
86b2bd93 | 510 | ;; |
b29fe3ed | 511 | AIX) |
0dbfc675 | 512 | aix="yes" |
0db4a067 | 513 | make="${MAKE-gmake}" |
b29fe3ed | 514 | ;; |
179cf400 AF |
515 | Haiku) |
516 | haiku="yes" | |
517 | QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" | |
518 | LIBS="-lposix_error_mapper -lnetwork $LIBS" | |
519 | ;; | |
1d14ffa9 | 520 | *) |
0dbfc675 JQ |
521 | audio_drv_list="oss" |
522 | audio_possible_drivers="oss alsa sdl esd pa" | |
523 | linux="yes" | |
524 | linux_user="yes" | |
525 | usb="linux" | |
af2be207 JK |
526 | kvm="yes" |
527 | vhost_net="yes" | |
0dbfc675 | 528 | if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then |
c2de5c91 | 529 | audio_possible_drivers="$audio_possible_drivers fmod" |
0dbfc675 | 530 | fi |
fb065187 | 531 | ;; |
7d13299d FB |
532 | esac |
533 | ||
7d3505c5 | 534 | if [ "$bsd" = "yes" ] ; then |
b1a550a0 | 535 | if [ "$darwin" != "yes" ] ; then |
68063649 | 536 | usb="bsd" |
08de3949 | 537 | bsd_user="yes" |
83fb7adf | 538 | fi |
7d3505c5 FB |
539 | fi |
540 | ||
0db4a067 PB |
541 | : ${make=${MAKE-make}} |
542 | : ${install=${INSTALL-install}} | |
c886edfb | 543 | : ${python=${PYTHON-python}} |
e2d8830e | 544 | : ${smbd=${SMBD-/usr/sbin/smbd}} |
0db4a067 | 545 | |
3457a3f8 | 546 | if test "$mingw32" = "yes" ; then |
3457a3f8 | 547 | EXESUF=".exe" |
a558ee17 | 548 | QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" |
e94a7936 SW |
549 | # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) |
550 | QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" | |
f7cf5d5b SW |
551 | LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" |
552 | cat > $TMPC << EOF | |
553 | int main(void) { return 0; } | |
554 | EOF | |
555 | if compile_prog "" "-liberty" ; then | |
556 | LIBS="-liberty $LIBS" | |
557 | fi | |
c5ec15ea | 558 | prefix="c:/Program Files/QEMU" |
683035de | 559 | mandir="\${prefix}" |
528ae5b8 | 560 | datadir="\${prefix}" |
850da188 | 561 | qemu_docdir="\${prefix}" |
683035de PB |
562 | bindir="\${prefix}" |
563 | sysconfdir="\${prefix}" | |
564 | confsuffix="" | |
368542b8 | 565 | libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga" |
3457a3f8 JQ |
566 | fi |
567 | ||
487fefdb | 568 | werror="" |
85aa5189 | 569 | |
7d13299d | 570 | for opt do |
a46e4035 | 571 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` |
7d13299d | 572 | case "$opt" in |
2efc3265 FB |
573 | --help|-h) show_help=yes |
574 | ;; | |
99123e13 MF |
575 | --version|-V) exec cat $source_path/VERSION |
576 | ;; | |
b1a550a0 | 577 | --prefix=*) prefix="$optarg" |
7d13299d | 578 | ;; |
b1a550a0 | 579 | --interp-prefix=*) interp_prefix="$optarg" |
32ce6337 | 580 | ;; |
ca4deeb1 | 581 | --source-path=*) |
7d13299d | 582 | ;; |
ac0df51d | 583 | --cross-prefix=*) |
7d13299d | 584 | ;; |
ac0df51d | 585 | --cc=*) |
7d13299d | 586 | ;; |
b1a550a0 | 587 | --host-cc=*) host_cc="$optarg" |
83469015 | 588 | ;; |
b1a550a0 | 589 | --make=*) make="$optarg" |
7d13299d | 590 | ;; |
6a882643 PB |
591 | --install=*) install="$optarg" |
592 | ;; | |
c886edfb BS |
593 | --python=*) python="$optarg" |
594 | ;; | |
e2d8830e BS |
595 | --smbd=*) smbd="$optarg" |
596 | ;; | |
e2a2ed06 | 597 | --extra-cflags=*) |
7d13299d | 598 | ;; |
e2a2ed06 | 599 | --extra-ldflags=*) |
7d13299d | 600 | ;; |
5bc62e01 GH |
601 | --enable-debug-info) |
602 | ;; | |
603 | --disable-debug-info) | |
604 | ;; | |
2ff6b91e | 605 | --cpu=*) |
7d13299d | 606 | ;; |
b1a550a0 | 607 | --target-list=*) target_list="$optarg" |
de83cd02 | 608 | ;; |
74242e0f | 609 | --enable-trace-backend=*) trace_backend="$optarg" |
94a420b1 | 610 | ;; |
74242e0f | 611 | --with-trace-file=*) trace_file="$optarg" |
9410b56c | 612 | ;; |
7d13299d FB |
613 | --enable-gprof) gprof="yes" |
614 | ;; | |
79427693 LM |
615 | --static) |
616 | static="yes" | |
617 | LDFLAGS="-static $LDFLAGS" | |
17884d7b | 618 | QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" |
43ce4dfe | 619 | ;; |
0b24e75f PB |
620 | --mandir=*) mandir="$optarg" |
621 | ;; | |
622 | --bindir=*) bindir="$optarg" | |
623 | ;; | |
3aa5d2be AL |
624 | --libdir=*) libdir="$optarg" |
625 | ;; | |
0f94d6da AL |
626 | --includedir=*) includedir="$optarg" |
627 | ;; | |
528ae5b8 | 628 | --datadir=*) datadir="$optarg" |
0b24e75f | 629 | ;; |
023d3d67 EH |
630 | --with-confsuffix=*) confsuffix="$optarg" |
631 | ;; | |
850da188 | 632 | --docdir=*) qemu_docdir="$optarg" |
0b24e75f | 633 | ;; |
ca2fb938 | 634 | --sysconfdir=*) sysconfdir="$optarg" |
07381cc1 | 635 | ;; |
023ddd74 MF |
636 | --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\ |
637 | --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ | |
638 | --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) | |
639 | # These switches are silently ignored, for compatibility with | |
640 | # autoconf-generated configure scripts. This allows QEMU's | |
641 | # configure to be used by RPM and similar macros that set | |
642 | # lots of directory switches by default. | |
643 | ;; | |
97a847bc FB |
644 | --disable-sdl) sdl="no" |
645 | ;; | |
c4198157 JQ |
646 | --enable-sdl) sdl="yes" |
647 | ;; | |
983eef5a MI |
648 | --disable-virtfs) virtfs="no" |
649 | ;; | |
650 | --enable-virtfs) virtfs="yes" | |
651 | ;; | |
821601ea JS |
652 | --disable-vnc) vnc="no" |
653 | ;; | |
654 | --enable-vnc) vnc="yes" | |
655 | ;; | |
0c58ac1c | 656 | --fmod-lib=*) fmod_lib="$optarg" |
1d14ffa9 | 657 | ;; |
c2de5c91 | 658 | --fmod-inc=*) fmod_inc="$optarg" |
659 | ;; | |
2f6a1ab0 BS |
660 | --oss-lib=*) oss_lib="$optarg" |
661 | ;; | |
2fa7d3bf | 662 | --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` |
102a52e4 | 663 | ;; |
0c58ac1c | 664 | --audio-drv-list=*) audio_drv_list="$optarg" |
102a52e4 | 665 | ;; |
eb852011 MA |
666 | --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` |
667 | ;; | |
f8393946 AJ |
668 | --enable-debug-tcg) debug_tcg="yes" |
669 | ;; | |
670 | --disable-debug-tcg) debug_tcg="no" | |
671 | ;; | |
f3d08ee6 PB |
672 | --enable-debug) |
673 | # Enable debugging options that aren't excessively noisy | |
674 | debug_tcg="yes" | |
675 | debug="yes" | |
676 | strip_opt="no" | |
677 | ;; | |
03b4fe7d AL |
678 | --enable-sparse) sparse="yes" |
679 | ;; | |
680 | --disable-sparse) sparse="no" | |
681 | ;; | |
1625af87 AL |
682 | --disable-strip) strip_opt="no" |
683 | ;; | |
8d5d2d4c TS |
684 | --disable-vnc-tls) vnc_tls="no" |
685 | ;; | |
1be10ad2 JQ |
686 | --enable-vnc-tls) vnc_tls="yes" |
687 | ;; | |
2f9606b3 AL |
688 | --disable-vnc-sasl) vnc_sasl="no" |
689 | ;; | |
ea784e3b JQ |
690 | --enable-vnc-sasl) vnc_sasl="yes" |
691 | ;; | |
2f6f5c7a CC |
692 | --disable-vnc-jpeg) vnc_jpeg="no" |
693 | ;; | |
694 | --enable-vnc-jpeg) vnc_jpeg="yes" | |
695 | ;; | |
efe556ad CC |
696 | --disable-vnc-png) vnc_png="no" |
697 | ;; | |
698 | --enable-vnc-png) vnc_png="yes" | |
699 | ;; | |
443f1376 | 700 | --disable-slirp) slirp="no" |
1d14ffa9 | 701 | ;; |
ee682d27 SW |
702 | --disable-uuid) uuid="no" |
703 | ;; | |
704 | --enable-uuid) uuid="yes" | |
705 | ;; | |
e0e6c8c0 | 706 | --disable-vde) vde="no" |
8a16d273 | 707 | ;; |
dfb278bd JQ |
708 | --enable-vde) vde="yes" |
709 | ;; | |
e37630ca AL |
710 | --disable-xen) xen="no" |
711 | ;; | |
fc321b4b JQ |
712 | --enable-xen) xen="yes" |
713 | ;; | |
eb6fda0f AP |
714 | --disable-xen-pci-passthrough) xen_pci_passthrough="no" |
715 | ;; | |
716 | --enable-xen-pci-passthrough) xen_pci_passthrough="yes" | |
717 | ;; | |
2e4d9fb1 AJ |
718 | --disable-brlapi) brlapi="no" |
719 | ;; | |
4ffcedb6 JQ |
720 | --enable-brlapi) brlapi="yes" |
721 | ;; | |
fb599c9a AZ |
722 | --disable-bluez) bluez="no" |
723 | ;; | |
a20a6f46 JQ |
724 | --enable-bluez) bluez="yes" |
725 | ;; | |
7ba1e619 AL |
726 | --disable-kvm) kvm="no" |
727 | ;; | |
b31a0277 JQ |
728 | --enable-kvm) kvm="yes" |
729 | ;; | |
9195b2c2 SW |
730 | --disable-tcg-interpreter) tcg_interpreter="no" |
731 | ;; | |
732 | --enable-tcg-interpreter) tcg_interpreter="yes" | |
733 | ;; | |
47e98658 CB |
734 | --disable-cap-ng) cap_ng="no" |
735 | ;; | |
736 | --enable-cap-ng) cap_ng="yes" | |
737 | ;; | |
cd4ec0b4 GH |
738 | --disable-spice) spice="no" |
739 | ;; | |
740 | --enable-spice) spice="yes" | |
741 | ;; | |
c589b249 RS |
742 | --disable-libiscsi) libiscsi="no" |
743 | ;; | |
744 | --enable-libiscsi) libiscsi="yes" | |
745 | ;; | |
05c2a3e7 FB |
746 | --enable-profiler) profiler="yes" |
747 | ;; | |
14821030 PB |
748 | --disable-cocoa) cocoa="no" |
749 | ;; | |
c2de5c91 | 750 | --enable-cocoa) |
751 | cocoa="yes" ; | |
752 | sdl="no" ; | |
753 | audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" | |
1d14ffa9 | 754 | ;; |
cad25d69 | 755 | --disable-system) softmmu="no" |
0a8e90f4 | 756 | ;; |
cad25d69 | 757 | --enable-system) softmmu="yes" |
0a8e90f4 | 758 | ;; |
0953a80f ZA |
759 | --disable-user) |
760 | linux_user="no" ; | |
761 | bsd_user="no" ; | |
0953a80f ZA |
762 | ;; |
763 | --enable-user) ;; | |
831b7825 | 764 | --disable-linux-user) linux_user="no" |
0a8e90f4 | 765 | ;; |
831b7825 TS |
766 | --enable-linux-user) linux_user="yes" |
767 | ;; | |
84778508 BS |
768 | --disable-bsd-user) bsd_user="no" |
769 | ;; | |
770 | --enable-bsd-user) bsd_user="yes" | |
771 | ;; | |
379f6698 PB |
772 | --enable-guest-base) guest_base="yes" |
773 | ;; | |
774 | --disable-guest-base) guest_base="no" | |
775 | ;; | |
40d6444e | 776 | --enable-pie) pie="yes" |
34005a00 | 777 | ;; |
40d6444e | 778 | --disable-pie) pie="no" |
34005a00 | 779 | ;; |
c5937220 PB |
780 | --enable-uname-release=*) uname_release="$optarg" |
781 | ;; | |
3142255c | 782 | --sparc_cpu=*) |
3142255c | 783 | ;; |
85aa5189 FB |
784 | --enable-werror) werror="yes" |
785 | ;; | |
786 | --disable-werror) werror="no" | |
787 | ;; | |
4d3b6f6e AZ |
788 | --disable-curses) curses="no" |
789 | ;; | |
c584a6d0 JQ |
790 | --enable-curses) curses="yes" |
791 | ;; | |
769ce76d AG |
792 | --disable-curl) curl="no" |
793 | ;; | |
788c8196 JQ |
794 | --enable-curl) curl="yes" |
795 | ;; | |
2df87df7 JQ |
796 | --disable-fdt) fdt="no" |
797 | ;; | |
798 | --enable-fdt) fdt="yes" | |
799 | ;; | |
bd0c5661 PB |
800 | --disable-nptl) nptl="no" |
801 | ;; | |
b0a47e79 JQ |
802 | --enable-nptl) nptl="yes" |
803 | ;; | |
8ff9cbf7 | 804 | --enable-mixemu) mixemu="yes" |
805 | ;; | |
5c6c3a6c CH |
806 | --disable-linux-aio) linux_aio="no" |
807 | ;; | |
808 | --enable-linux-aio) linux_aio="yes" | |
809 | ;; | |
758e8e38 VJ |
810 | --disable-attr) attr="no" |
811 | ;; | |
812 | --enable-attr) attr="yes" | |
813 | ;; | |
77755340 TS |
814 | --disable-blobs) blobs="no" |
815 | ;; | |
4a19f1ec PB |
816 | --with-pkgversion=*) pkgversion=" ($optarg)" |
817 | ;; | |
519175a2 AB |
818 | --with-coroutine=*) coroutine="$optarg" |
819 | ;; | |
a25dba17 | 820 | --disable-docs) docs="no" |
70ec5dc0 | 821 | ;; |
a25dba17 | 822 | --enable-docs) docs="yes" |
83a3ab8b | 823 | ;; |
d5970055 MT |
824 | --disable-vhost-net) vhost_net="no" |
825 | ;; | |
826 | --enable-vhost-net) vhost_net="yes" | |
827 | ;; | |
20ff075b MW |
828 | --disable-opengl) opengl="no" |
829 | ;; | |
830 | --enable-opengl) opengl="yes" | |
831 | ;; | |
f27aaf4b CB |
832 | --disable-rbd) rbd="no" |
833 | ;; | |
834 | --enable-rbd) rbd="yes" | |
835 | ;; | |
8c84cf11 ST |
836 | --disable-xfsctl) xfs="no" |
837 | ;; | |
838 | --enable-xfsctl) xfs="yes" | |
839 | ;; | |
36707144 AL |
840 | --disable-smartcard) smartcard="no" |
841 | ;; | |
842 | --enable-smartcard) smartcard="yes" | |
843 | ;; | |
111a38b0 RR |
844 | --disable-smartcard-nss) smartcard_nss="no" |
845 | ;; | |
846 | --enable-smartcard-nss) smartcard_nss="yes" | |
847 | ;; | |
69354a83 HG |
848 | --disable-usb-redir) usb_redir="no" |
849 | ;; | |
850 | --enable-usb-redir) usb_redir="yes" | |
851 | ;; | |
1ece9905 AL |
852 | --disable-zlib-test) zlib="no" |
853 | ;; | |
d138cee9 MR |
854 | --enable-guest-agent) guest_agent="yes" |
855 | ;; | |
856 | --disable-guest-agent) guest_agent="no" | |
857 | ;; | |
7f1559c6 AZ |
858 | *) echo "ERROR: unknown option $opt"; show_help="yes" |
859 | ;; | |
7d13299d FB |
860 | esac |
861 | done | |
862 | ||
3142255c BS |
863 | # |
864 | # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right | |
a558ee17 | 865 | # QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) |
3142255c | 866 | # |
379f6698 | 867 | host_guest_base="no" |
40293e58 | 868 | case "$cpu" in |
ed968ff1 JQ |
869 | sparc) case $sparc_cpu in |
870 | v7|v8) | |
a558ee17 | 871 | QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" |
ed968ff1 JQ |
872 | ;; |
873 | v8plus|v8plusa) | |
a558ee17 | 874 | QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" |
ed968ff1 JQ |
875 | ;; |
876 | *) # sparc_cpu not defined in the command line | |
a558ee17 | 877 | QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS" |
ed968ff1 JQ |
878 | esac |
879 | LDFLAGS="-m32 $LDFLAGS" | |
a558ee17 | 880 | QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS" |
762e8230 | 881 | if test "$solaris" = "no" ; then |
a558ee17 | 882 | QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS" |
c81da56e | 883 | helper_cflags="-ffixed-i0" |
762e8230 | 884 | fi |
3142255c | 885 | ;; |
ed968ff1 | 886 | sparc64) |
a558ee17 | 887 | QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS" |
ed968ff1 | 888 | LDFLAGS="-m64 $LDFLAGS" |
a558ee17 | 889 | QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS" |
ed968ff1 | 890 | if test "$solaris" != "no" ; then |
a558ee17 | 891 | QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS" |
762e8230 | 892 | fi |
3142255c | 893 | ;; |
76d83bde | 894 | s390) |
28d7cc49 RH |
895 | QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS" |
896 | LDFLAGS="-m31 $LDFLAGS" | |
48bb3750 | 897 | host_guest_base="yes" |
28d7cc49 RH |
898 | ;; |
899 | s390x) | |
900 | QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS" | |
901 | LDFLAGS="-m64 $LDFLAGS" | |
48bb3750 | 902 | host_guest_base="yes" |
76d83bde | 903 | ;; |
40293e58 | 904 | i386) |
a558ee17 | 905 | QEMU_CFLAGS="-m32 $QEMU_CFLAGS" |
0c439cbf | 906 | LDFLAGS="-m32 $LDFLAGS" |
2b2e59e6 | 907 | cc_i386='$(CC) -m32' |
c81da56e | 908 | helper_cflags="-fomit-frame-pointer" |
379f6698 | 909 | host_guest_base="yes" |
40293e58 FB |
910 | ;; |
911 | x86_64) | |
a558ee17 | 912 | QEMU_CFLAGS="-m64 $QEMU_CFLAGS" |
0c439cbf | 913 | LDFLAGS="-m64 $LDFLAGS" |
2b2e59e6 | 914 | cc_i386='$(CC) -m32' |
379f6698 PB |
915 | host_guest_base="yes" |
916 | ;; | |
917 | arm*) | |
918 | host_guest_base="yes" | |
40293e58 | 919 | ;; |
f6548c0a | 920 | ppc*) |
921 | host_guest_base="yes" | |
922 | ;; | |
cc01cc8e AJ |
923 | mips*) |
924 | host_guest_base="yes" | |
925 | ;; | |
477ba620 AJ |
926 | ia64*) |
927 | host_guest_base="yes" | |
928 | ;; | |
fd76e73a RH |
929 | hppa*) |
930 | host_guest_base="yes" | |
931 | ;; | |
d2fbca94 GX |
932 | unicore32*) |
933 | host_guest_base="yes" | |
934 | ;; | |
3142255c BS |
935 | esac |
936 | ||
379f6698 PB |
937 | [ -z "$guest_base" ] && guest_base="$host_guest_base" |
938 | ||
60e0df25 PM |
939 | |
940 | default_target_list="" | |
941 | ||
942 | # these targets are portable | |
943 | if [ "$softmmu" = "yes" ] ; then | |
944 | default_target_list="\ | |
945 | i386-softmmu \ | |
946 | x86_64-softmmu \ | |
27cdad67 | 947 | alpha-softmmu \ |
60e0df25 PM |
948 | arm-softmmu \ |
949 | cris-softmmu \ | |
950 | lm32-softmmu \ | |
951 | m68k-softmmu \ | |
952 | microblaze-softmmu \ | |
953 | microblazeel-softmmu \ | |
954 | mips-softmmu \ | |
955 | mipsel-softmmu \ | |
956 | mips64-softmmu \ | |
957 | mips64el-softmmu \ | |
e67db06e | 958 | or32-softmmu \ |
60e0df25 PM |
959 | ppc-softmmu \ |
960 | ppcemb-softmmu \ | |
961 | ppc64-softmmu \ | |
962 | sh4-softmmu \ | |
963 | sh4eb-softmmu \ | |
964 | sparc-softmmu \ | |
965 | sparc64-softmmu \ | |
0f3301d4 | 966 | s390x-softmmu \ |
cfa550c6 MF |
967 | xtensa-softmmu \ |
968 | xtensaeb-softmmu \ | |
4f23a1e6 | 969 | unicore32-softmmu \ |
60e0df25 PM |
970 | " |
971 | fi | |
972 | # the following are Linux specific | |
973 | if [ "$linux_user" = "yes" ] ; then | |
974 | default_target_list="${default_target_list}\ | |
975 | i386-linux-user \ | |
976 | x86_64-linux-user \ | |
977 | alpha-linux-user \ | |
978 | arm-linux-user \ | |
979 | armeb-linux-user \ | |
980 | cris-linux-user \ | |
981 | m68k-linux-user \ | |
982 | microblaze-linux-user \ | |
983 | microblazeel-linux-user \ | |
984 | mips-linux-user \ | |
985 | mipsel-linux-user \ | |
d962783e | 986 | or32-linux-user \ |
60e0df25 PM |
987 | ppc-linux-user \ |
988 | ppc64-linux-user \ | |
989 | ppc64abi32-linux-user \ | |
990 | sh4-linux-user \ | |
991 | sh4eb-linux-user \ | |
992 | sparc-linux-user \ | |
993 | sparc64-linux-user \ | |
994 | sparc32plus-linux-user \ | |
995 | unicore32-linux-user \ | |
0f3301d4 | 996 | s390x-linux-user \ |
60e0df25 PM |
997 | " |
998 | fi | |
60e0df25 PM |
999 | # the following are BSD specific |
1000 | if [ "$bsd_user" = "yes" ] ; then | |
1001 | default_target_list="${default_target_list}\ | |
1002 | i386-bsd-user \ | |
1003 | x86_64-bsd-user \ | |
1004 | sparc-bsd-user \ | |
1005 | sparc64-bsd-user \ | |
1006 | " | |
1007 | fi | |
1008 | ||
af5db58e PB |
1009 | if test x"$show_help" = x"yes" ; then |
1010 | cat << EOF | |
1011 | ||
1012 | Usage: configure [options] | |
1013 | Options: [defaults in brackets after descriptions] | |
1014 | ||
1015 | EOF | |
1016 | echo "Standard options:" | |
1017 | echo " --help print this message" | |
1018 | echo " --prefix=PREFIX install in PREFIX [$prefix]" | |
1019 | echo " --interp-prefix=PREFIX where to find shared libraries, etc." | |
1020 | echo " use %M for cpu name [$interp_prefix]" | |
60e0df25 PM |
1021 | echo " --target-list=LIST set target list (default: build everything)" |
1022 | echo "Available targets: $default_target_list" | \ | |
1023 | fold -s -w 53 | sed -e 's/^/ /' | |
af5db58e | 1024 | echo "" |
af5db58e PB |
1025 | echo "Advanced options (experts only):" |
1026 | echo " --source-path=PATH path of source code [$source_path]" | |
1027 | echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" | |
1028 | echo " --cc=CC use C compiler CC [$cc]" | |
0bfe8cc0 PB |
1029 | echo " --host-cc=CC use C compiler CC [$host_cc] for code run at" |
1030 | echo " build time" | |
a558ee17 | 1031 | echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" |
e3fc14c3 | 1032 | echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" |
af5db58e | 1033 | echo " --make=MAKE use specified make [$make]" |
6a882643 | 1034 | echo " --install=INSTALL use specified install [$install]" |
c886edfb | 1035 | echo " --python=PYTHON use specified python [$python]" |
e2d8830e | 1036 | echo " --smbd=SMBD use specified smbd [$smbd]" |
af5db58e | 1037 | echo " --static enable static build [$static]" |
0b24e75f | 1038 | echo " --mandir=PATH install man pages in PATH" |
023d3d67 EH |
1039 | echo " --datadir=PATH install firmware in PATH$confsuffix" |
1040 | echo " --docdir=PATH install documentation in PATH$confsuffix" | |
0b24e75f | 1041 | echo " --bindir=PATH install binaries in PATH" |
023d3d67 | 1042 | echo " --sysconfdir=PATH install config in PATH$confsuffix" |
2ae4748f | 1043 | echo " --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]" |
f8393946 AJ |
1044 | echo " --enable-debug-tcg enable TCG debugging" |
1045 | echo " --disable-debug-tcg disable TCG debugging (default)" | |
09695a4a | 1046 | echo " --enable-debug enable common debug build options" |
890b1658 AL |
1047 | echo " --enable-sparse enable sparse checker" |
1048 | echo " --disable-sparse disable sparse checker (default)" | |
1625af87 | 1049 | echo " --disable-strip disable stripping binaries" |
85aa5189 | 1050 | echo " --disable-werror disable compilation abort on warning" |
fe8f78e4 | 1051 | echo " --disable-sdl disable SDL" |
c4198157 | 1052 | echo " --enable-sdl enable SDL" |
983eef5a MI |
1053 | echo " --disable-virtfs disable VirtFS" |
1054 | echo " --enable-virtfs enable VirtFS" | |
821601ea JS |
1055 | echo " --disable-vnc disable VNC" |
1056 | echo " --enable-vnc enable VNC" | |
14821030 PB |
1057 | echo " --disable-cocoa disable Cocoa (Mac OS X only)" |
1058 | echo " --enable-cocoa enable Cocoa (default on Mac OS X)" | |
c2de5c91 | 1059 | echo " --audio-drv-list=LIST set audio drivers list:" |
1060 | echo " Available drivers: $audio_possible_drivers" | |
4c9b53e3 | 1061 | echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" |
1062 | echo " Available cards: $audio_possible_cards" | |
eb852011 MA |
1063 | echo " --block-drv-whitelist=L set block driver whitelist" |
1064 | echo " (affects only QEMU, not qemu-img)" | |
8ff9cbf7 | 1065 | echo " --enable-mixemu enable mixer emulation" |
e37630ca | 1066 | echo " --disable-xen disable xen backend driver support" |
fc321b4b | 1067 | echo " --enable-xen enable xen backend driver support" |
eb6fda0f AP |
1068 | echo " --disable-xen-pci-passthrough" |
1069 | echo " --enable-xen-pci-passthrough" | |
2e4d9fb1 | 1070 | echo " --disable-brlapi disable BrlAPI" |
4ffcedb6 | 1071 | echo " --enable-brlapi enable BrlAPI" |
8d5d2d4c | 1072 | echo " --disable-vnc-tls disable TLS encryption for VNC server" |
1be10ad2 | 1073 | echo " --enable-vnc-tls enable TLS encryption for VNC server" |
2f9606b3 | 1074 | echo " --disable-vnc-sasl disable SASL encryption for VNC server" |
ea784e3b | 1075 | echo " --enable-vnc-sasl enable SASL encryption for VNC server" |
2f6f5c7a CC |
1076 | echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server" |
1077 | echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server" | |
96763cf9 | 1078 | echo " --disable-vnc-png disable PNG compression for VNC server (default)" |
efe556ad | 1079 | echo " --enable-vnc-png enable PNG compression for VNC server" |
af896aaa | 1080 | echo " --disable-curses disable curses output" |
c584a6d0 | 1081 | echo " --enable-curses enable curses output" |
769ce76d | 1082 | echo " --disable-curl disable curl connectivity" |
788c8196 | 1083 | echo " --enable-curl enable curl connectivity" |
2df87df7 JQ |
1084 | echo " --disable-fdt disable fdt device tree" |
1085 | echo " --enable-fdt enable fdt device tree" | |
fb599c9a | 1086 | echo " --disable-bluez disable bluez stack connectivity" |
a20a6f46 | 1087 | echo " --enable-bluez enable bluez stack connectivity" |
6093d3d4 | 1088 | echo " --disable-slirp disable SLIRP userspace network connectivity" |
7ba1e619 | 1089 | echo " --disable-kvm disable KVM acceleration support" |
b31a0277 | 1090 | echo " --enable-kvm enable KVM acceleration support" |
9195b2c2 | 1091 | echo " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)" |
bd0c5661 | 1092 | echo " --disable-nptl disable usermode NPTL support" |
e5934d33 | 1093 | echo " --enable-nptl enable usermode NPTL support" |
af5db58e PB |
1094 | echo " --enable-system enable all system emulation targets" |
1095 | echo " --disable-system disable all system emulation targets" | |
0953a80f ZA |
1096 | echo " --enable-user enable supported user emulation targets" |
1097 | echo " --disable-user disable all user emulation targets" | |
831b7825 TS |
1098 | echo " --enable-linux-user enable all linux usermode emulation targets" |
1099 | echo " --disable-linux-user disable all linux usermode emulation targets" | |
84778508 BS |
1100 | echo " --enable-bsd-user enable all BSD usermode emulation targets" |
1101 | echo " --disable-bsd-user disable all BSD usermode emulation targets" | |
379f6698 PB |
1102 | echo " --enable-guest-base enable GUEST_BASE support for usermode" |
1103 | echo " emulation targets" | |
1104 | echo " --disable-guest-base disable GUEST_BASE support" | |
40d6444e AK |
1105 | echo " --enable-pie build Position Independent Executables" |
1106 | echo " --disable-pie do not build Position Independent Executables" | |
af5db58e PB |
1107 | echo " --fmod-lib path to FMOD library" |
1108 | echo " --fmod-inc path to FMOD includes" | |
2f6a1ab0 | 1109 | echo " --oss-lib path to OSS library" |
c5937220 | 1110 | echo " --enable-uname-release=R Return R for uname -r in usermode emulation" |
235e510c | 1111 | echo " --cpu=CPU Build for host CPU [$cpu]" |
3142255c | 1112 | echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" |
ee682d27 SW |
1113 | echo " --disable-uuid disable uuid support" |
1114 | echo " --enable-uuid enable uuid support" | |
e0e6c8c0 | 1115 | echo " --disable-vde disable support for vde network" |
dfb278bd | 1116 | echo " --enable-vde enable support for vde network" |
5c6c3a6c CH |
1117 | echo " --disable-linux-aio disable Linux AIO support" |
1118 | echo " --enable-linux-aio enable Linux AIO support" | |
47e98658 CB |
1119 | echo " --disable-cap-ng disable libcap-ng support" |
1120 | echo " --enable-cap-ng enable libcap-ng support" | |
758e8e38 VJ |
1121 | echo " --disable-attr disables attr and xattr support" |
1122 | echo " --enable-attr enable attr and xattr support" | |
77755340 | 1123 | echo " --disable-blobs disable installing provided firmware blobs" |
d2807bc9 DU |
1124 | echo " --enable-docs enable documentation build" |
1125 | echo " --disable-docs disable documentation build" | |
d5970055 MT |
1126 | echo " --disable-vhost-net disable vhost-net acceleration support" |
1127 | echo " --enable-vhost-net enable vhost-net acceleration support" | |
320fba2a | 1128 | echo " --enable-trace-backend=B Set trace backend" |
650ab98d | 1129 | echo " Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends) |
74242e0f | 1130 | echo " --with-trace-file=NAME Full PATH,NAME of file to store traces" |
9410b56c | 1131 | echo " Default:trace-<pid>" |
cd4ec0b4 GH |
1132 | echo " --disable-spice disable spice" |
1133 | echo " --enable-spice enable spice" | |
f27aaf4b | 1134 | echo " --enable-rbd enable building the rados block device (rbd)" |
c589b249 RS |
1135 | echo " --disable-libiscsi disable iscsi support" |
1136 | echo " --enable-libiscsi enable iscsi support" | |
36707144 AL |
1137 | echo " --disable-smartcard disable smartcard support" |
1138 | echo " --enable-smartcard enable smartcard support" | |
111a38b0 RR |
1139 | echo " --disable-smartcard-nss disable smartcard nss support" |
1140 | echo " --enable-smartcard-nss enable smartcard nss support" | |
69354a83 HG |
1141 | echo " --disable-usb-redir disable usb network redirection support" |
1142 | echo " --enable-usb-redir enable usb network redirection support" | |
d138cee9 MR |
1143 | echo " --disable-guest-agent disable building of the QEMU Guest Agent" |
1144 | echo " --enable-guest-agent enable building of the QEMU Guest Agent" | |
519175a2 | 1145 | echo " --with-coroutine=BACKEND coroutine backend. Supported options:" |
fe91bfa8 | 1146 | echo " gthread, ucontext, sigaltstack, windows" |
af5db58e | 1147 | echo "" |
5bf08934 | 1148 | echo "NOTE: The object files are built at the place where configure is launched" |
af5db58e PB |
1149 | exit 1 |
1150 | fi | |
1151 | ||
359bc95d PM |
1152 | # Now we have handled --enable-tcg-interpreter and know we're not just |
1153 | # printing the help message, bail out if the host CPU isn't supported. | |
1154 | if test "$ARCH" = "unknown"; then | |
1155 | if test "$tcg_interpreter" = "yes" ; then | |
1156 | echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" | |
1157 | ARCH=tci | |
1158 | else | |
1159 | echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter" | |
1160 | exit 1 | |
1161 | fi | |
1162 | fi | |
1163 | ||
8d05095c PB |
1164 | # check that the C compiler works. |
1165 | cat > $TMPC <<EOF | |
75cafad7 | 1166 | int main(void) { return 0; } |
8d05095c PB |
1167 | EOF |
1168 | ||
1169 | if compile_object ; then | |
1170 | : C compiler works ok | |
1171 | else | |
1172 | echo "ERROR: \"$cc\" either does not exist or does not work" | |
1173 | exit 1 | |
1174 | fi | |
1175 | ||
417c9d72 AG |
1176 | # Consult white-list to determine whether to enable werror |
1177 | # by default. Only enable by default for git builds | |
1178 | z_version=`cut -f3 -d. $source_path/VERSION` | |
1179 | ||
1180 | if test -z "$werror" ; then | |
1181 | if test "$z_version" = "50" -a \ | |
1182 | "$linux" = "yes" ; then | |
1183 | werror="yes" | |
1184 | else | |
1185 | werror="no" | |
1186 | fi | |
1187 | fi | |
1188 | ||
8d05095c PB |
1189 | gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" |
1190 | gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" | |
1191 | gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" | |
f9188227 | 1192 | gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags" |
6ca026cb PM |
1193 | # Note that we do not add -Werror to gcc_flags here, because that would |
1194 | # enable it for all configure tests. If a configure test failed due | |
1195 | # to -Werror this would just silently disable some features, | |
1196 | # so it's too error prone. | |
8d05095c PB |
1197 | cat > $TMPC << EOF |
1198 | int main(void) { return 0; } | |
1199 | EOF | |
1200 | for flag in $gcc_flags; do | |
bd947d30 | 1201 | if compile_prog "-Werror $flag" "" ; then |
8d05095c PB |
1202 | QEMU_CFLAGS="$QEMU_CFLAGS $flag" |
1203 | fi | |
1204 | done | |
1205 | ||
40d6444e AK |
1206 | if test "$static" = "yes" ; then |
1207 | if test "$pie" = "yes" ; then | |
1208 | echo "static and pie are mutually incompatible" | |
1209 | exit 1 | |
1210 | else | |
1211 | pie="no" | |
1212 | fi | |
1213 | fi | |
1214 | ||
1215 | if test "$pie" = ""; then | |
1216 | case "$cpu-$targetos" in | |
f9db31a2 | 1217 | i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD) |
40d6444e AK |
1218 | ;; |
1219 | *) | |
1220 | pie="no" | |
1221 | ;; | |
1222 | esac | |
1223 | fi | |
1224 | ||
1225 | if test "$pie" != "no" ; then | |
1226 | cat > $TMPC << EOF | |
21d4a791 AK |
1227 | |
1228 | #ifdef __linux__ | |
1229 | # define THREAD __thread | |
1230 | #else | |
1231 | # define THREAD | |
1232 | #endif | |
1233 | ||
1234 | static THREAD int tls_var; | |
1235 | ||
1236 | int main(void) { return tls_var; } | |
1237 | ||
40d6444e AK |
1238 | EOF |
1239 | if compile_prog "-fPIE -DPIE" "-pie"; then | |
1240 | QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" | |
1241 | LDFLAGS="-pie $LDFLAGS" | |
1242 | pie="yes" | |
1243 | if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then | |
1244 | LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" | |
1245 | fi | |
1246 | else | |
1247 | if test "$pie" = "yes"; then | |
1248 | echo "PIE not available due to missing toolchain support" | |
1249 | exit 1 | |
1250 | else | |
1251 | echo "Disabling PIE due to missing toolchain support" | |
1252 | pie="no" | |
1253 | fi | |
1254 | fi | |
1255 | fi | |
1256 | ||
ec530c81 FB |
1257 | # |
1258 | # Solaris specific configure tool chain decisions | |
1259 | # | |
1260 | if test "$solaris" = "yes" ; then | |
6792aa11 LM |
1261 | if has $install; then |
1262 | : | |
1263 | else | |
ec530c81 FB |
1264 | echo "Solaris install program not found. Use --install=/usr/ucb/install or" |
1265 | echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" | |
1266 | echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" | |
1267 | exit 1 | |
1268 | fi | |
6792aa11 | 1269 | if test "`path_of $install`" = "/usr/sbin/install" ; then |
ec530c81 FB |
1270 | echo "Error: Solaris /usr/sbin/install is not an appropriate install program." |
1271 | echo "try ginstall from the GNU fileutils available from www.blastwave.org" | |
1272 | echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" | |
1273 | exit 1 | |
1274 | fi | |
6792aa11 LM |
1275 | if has ar; then |
1276 | : | |
1277 | else | |
ec530c81 FB |
1278 | echo "Error: No path includes ar" |
1279 | if test -f /usr/ccs/bin/ar ; then | |
1280 | echo "Add /usr/ccs/bin to your path and rerun configure" | |
1281 | fi | |
1282 | exit 1 | |
1283 | fi | |
5fafdf24 | 1284 | fi |
ec530c81 | 1285 | |
7a3fc891 SH |
1286 | if ! has $python; then |
1287 | echo "Python not found. Use --python=/path/to/python" | |
1288 | exit 1 | |
c886edfb BS |
1289 | fi |
1290 | ||
6ccea1e4 PM |
1291 | # Note that if the Python conditional here evaluates True we will exit |
1292 | # with status 1 which is a shell 'false' value. | |
e120d449 SH |
1293 | if ! "$python" -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then |
1294 | echo "Cannot use '$python', Python 2.4 or later is required." | |
1295 | echo "Note that Python 3 or later is not yet supported." | |
1296 | echo "Use --python=/path/to/python to specify a supported Python." | |
6ccea1e4 PM |
1297 | exit 1 |
1298 | fi | |
1299 | ||
5327cf48 | 1300 | if test -z "$target_list" ; then |
60e0df25 | 1301 | target_list="$default_target_list" |
6e20a45f | 1302 | else |
b1a550a0 | 1303 | target_list=`echo "$target_list" | sed -e 's/,/ /g'` |
5327cf48 | 1304 | fi |
0a8e90f4 PB |
1305 | if test -z "$target_list" ; then |
1306 | echo "No targets enabled" | |
1307 | exit 1 | |
1308 | fi | |
f55fe278 PB |
1309 | # see if system emulation was really requested |
1310 | case " $target_list " in | |
1311 | *"-softmmu "*) softmmu=yes | |
1312 | ;; | |
1313 | *) softmmu=no | |
1314 | ;; | |
1315 | esac | |
5327cf48 | 1316 | |
249247c9 JQ |
1317 | feature_not_found() { |
1318 | feature=$1 | |
1319 | ||
1320 | echo "ERROR" | |
1321 | echo "ERROR: User requested feature $feature" | |
9332f6a2 | 1322 | echo "ERROR: configure was not able to find it" |
249247c9 JQ |
1323 | echo "ERROR" |
1324 | exit 1; | |
1325 | } | |
1326 | ||
7d13299d FB |
1327 | if test -z "$cross_prefix" ; then |
1328 | ||
1329 | # --- | |
1330 | # big/little endian test | |
1331 | cat > $TMPC << EOF | |
1332 | #include <inttypes.h> | |
1333 | int main(int argc, char ** argv){ | |
1d14ffa9 FB |
1334 | volatile uint32_t i=0x01234567; |
1335 | return (*((uint8_t*)(&i))) == 0x67; | |
7d13299d FB |
1336 | } |
1337 | EOF | |
1338 | ||
52166aa0 | 1339 | if compile_prog "" "" ; then |
7d13299d FB |
1340 | $TMPE && bigendian="yes" |
1341 | else | |
1342 | echo big/little test failed | |
1343 | fi | |
1344 | ||
1345 | else | |
1346 | ||
1347 | # if cross compiling, cannot launch a program, so make a static guess | |
ea8f20f8 | 1348 | case "$cpu" in |
21d89f84 PM |
1349 | arm) |
1350 | # ARM can be either way; ask the compiler which one we are | |
1351 | if check_define __ARMEB__; then | |
1352 | bigendian=yes | |
1353 | fi | |
1354 | ;; | |
1355 | hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) | |
ea8f20f8 JQ |
1356 | bigendian=yes |
1357 | ;; | |
1358 | esac | |
7d13299d FB |
1359 | |
1360 | fi | |
1361 | ||
b0a47e79 JQ |
1362 | ########################################## |
1363 | # NPTL probe | |
1364 | ||
1365 | if test "$nptl" != "no" ; then | |
1366 | cat > $TMPC <<EOF | |
bd0c5661 | 1367 | #include <sched.h> |
30813cea | 1368 | #include <linux/futex.h> |
182eacc0 | 1369 | int main(void) { |
bd0c5661 PB |
1370 | #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) |
1371 | #error bork | |
1372 | #endif | |
182eacc0 | 1373 | return 0; |
bd0c5661 PB |
1374 | } |
1375 | EOF | |
1376 | ||
b0a47e79 JQ |
1377 | if compile_object ; then |
1378 | nptl=yes | |
1379 | else | |
1380 | if test "$nptl" = "yes" ; then | |
1381 | feature_not_found "nptl" | |
1382 | fi | |
1383 | nptl=no | |
1384 | fi | |
bd0c5661 PB |
1385 | fi |
1386 | ||
ac62922e AZ |
1387 | ########################################## |
1388 | # zlib check | |
1389 | ||
1ece9905 AL |
1390 | if test "$zlib" != "no" ; then |
1391 | cat > $TMPC << EOF | |
ac62922e AZ |
1392 | #include <zlib.h> |
1393 | int main(void) { zlibVersion(); return 0; } | |
1394 | EOF | |
1ece9905 AL |
1395 | if compile_prog "" "-lz" ; then |
1396 | : | |
1397 | else | |
1398 | echo | |
1399 | echo "Error: zlib check failed" | |
1400 | echo "Make sure to have the zlib libs and headers installed." | |
1401 | echo | |
1402 | exit 1 | |
1403 | fi | |
ac62922e AZ |
1404 | fi |
1405 | ||
e37630ca AL |
1406 | ########################################## |
1407 | # xen probe | |
1408 | ||
fc321b4b | 1409 | if test "$xen" != "no" ; then |
b2266bee | 1410 | xen_libs="-lxenstore -lxenctrl -lxenguest" |
d5b93ddf | 1411 | |
50ced5b3 SW |
1412 | # First we test whether Xen headers and libraries are available. |
1413 | # If no, we are done and there is no Xen support. | |
1414 | # If yes, more tests are run to detect the Xen version. | |
1415 | ||
1416 | # Xen (any) | |
b2266bee | 1417 | cat > $TMPC <<EOF |
e37630ca | 1418 | #include <xenctrl.h> |
50ced5b3 SW |
1419 | int main(void) { |
1420 | return 0; | |
1421 | } | |
1422 | EOF | |
1423 | if ! compile_prog "" "$xen_libs" ; then | |
1424 | # Xen not found | |
1425 | if test "$xen" = "yes" ; then | |
1426 | feature_not_found "xen" | |
1427 | fi | |
1428 | xen=no | |
1429 | ||
1430 | # Xen unstable | |
69deef08 PM |
1431 | elif |
1432 | cat > $TMPC <<EOF && | |
50ced5b3 | 1433 | #include <xenctrl.h> |
e108a3c1 | 1434 | #include <xenstore.h> |
d5b93ddf AP |
1435 | #include <stdint.h> |
1436 | #include <xen/hvm/hvm_info_table.h> | |
1437 | #if !defined(HVM_MAX_VCPUS) | |
1438 | # error HVM_MAX_VCPUS not defined | |
1439 | #endif | |
8688e065 SS |
1440 | int main(void) { |
1441 | xc_interface *xc; | |
1442 | xs_daemon_open(); | |
1443 | xc = xc_interface_open(0, 0, 0); | |
1444 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
1445 | xc_gnttab_open(NULL, 0); | |
1446 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); | |
1447 | xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); | |
1448 | return 0; | |
1449 | } | |
1450 | EOF | |
1451 | compile_prog "" "$xen_libs" | |
69deef08 | 1452 | then |
8688e065 SS |
1453 | xen_ctrl_version=420 |
1454 | xen=yes | |
1455 | ||
69deef08 PM |
1456 | elif |
1457 | cat > $TMPC <<EOF && | |
8688e065 SS |
1458 | #include <xenctrl.h> |
1459 | #include <xs.h> | |
1460 | #include <stdint.h> | |
1461 | #include <xen/hvm/hvm_info_table.h> | |
1462 | #if !defined(HVM_MAX_VCPUS) | |
1463 | # error HVM_MAX_VCPUS not defined | |
1464 | #endif | |
d5b93ddf | 1465 | int main(void) { |
d5b93ddf | 1466 | xs_daemon_open(); |
9b4c0b56 | 1467 | xc_interface_open(0, 0, 0); |
d5b93ddf AP |
1468 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); |
1469 | xc_gnttab_open(NULL, 0); | |
b87de24e | 1470 | xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); |
d5b93ddf AP |
1471 | return 0; |
1472 | } | |
e37630ca | 1473 | EOF |
50ced5b3 | 1474 | compile_prog "" "$xen_libs" |
69deef08 | 1475 | then |
d5b93ddf | 1476 | xen_ctrl_version=410 |
fc321b4b | 1477 | xen=yes |
d5b93ddf AP |
1478 | |
1479 | # Xen 4.0.0 | |
69deef08 PM |
1480 | elif |
1481 | cat > $TMPC <<EOF && | |
d5b93ddf AP |
1482 | #include <xenctrl.h> |
1483 | #include <xs.h> | |
1484 | #include <stdint.h> | |
1485 | #include <xen/hvm/hvm_info_table.h> | |
1486 | #if !defined(HVM_MAX_VCPUS) | |
1487 | # error HVM_MAX_VCPUS not defined | |
1488 | #endif | |
1489 | int main(void) { | |
b87de24e AP |
1490 | struct xen_add_to_physmap xatp = { |
1491 | .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, | |
1492 | }; | |
d5b93ddf AP |
1493 | xs_daemon_open(); |
1494 | xc_interface_open(); | |
1495 | xc_gnttab_open(); | |
1496 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
b87de24e | 1497 | xc_memory_op(0, XENMEM_add_to_physmap, &xatp); |
d5b93ddf AP |
1498 | return 0; |
1499 | } | |
1500 | EOF | |
1501 | compile_prog "" "$xen_libs" | |
69deef08 | 1502 | then |
d5b93ddf AP |
1503 | xen_ctrl_version=400 |
1504 | xen=yes | |
1505 | ||
b87de24e | 1506 | # Xen 3.4.0 |
69deef08 PM |
1507 | elif |
1508 | cat > $TMPC <<EOF && | |
b87de24e AP |
1509 | #include <xenctrl.h> |
1510 | #include <xs.h> | |
1511 | int main(void) { | |
1512 | struct xen_add_to_physmap xatp = { | |
1513 | .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, | |
1514 | }; | |
1515 | xs_daemon_open(); | |
1516 | xc_interface_open(); | |
1517 | xc_gnttab_open(); | |
1518 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
1519 | xc_memory_op(0, XENMEM_add_to_physmap, &xatp); | |
1520 | return 0; | |
1521 | } | |
1522 | EOF | |
1523 | compile_prog "" "$xen_libs" | |
69deef08 | 1524 | then |
b87de24e AP |
1525 | xen_ctrl_version=340 |
1526 | xen=yes | |
1527 | ||
1528 | # Xen 3.3.0 | |
69deef08 PM |
1529 | elif |
1530 | cat > $TMPC <<EOF && | |
d5b93ddf AP |
1531 | #include <xenctrl.h> |
1532 | #include <xs.h> | |
1533 | int main(void) { | |
1534 | xs_daemon_open(); | |
1535 | xc_interface_open(); | |
1536 | xc_gnttab_open(); | |
1537 | xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); | |
1538 | return 0; | |
1539 | } | |
1540 | EOF | |
1541 | compile_prog "" "$xen_libs" | |
69deef08 | 1542 | then |
d5b93ddf AP |
1543 | xen_ctrl_version=330 |
1544 | xen=yes | |
1545 | ||
50ced5b3 | 1546 | # Xen version unsupported |
b2266bee | 1547 | else |
fc321b4b | 1548 | if test "$xen" = "yes" ; then |
50ced5b3 | 1549 | feature_not_found "xen (unsupported version)" |
fc321b4b JQ |
1550 | fi |
1551 | xen=no | |
b2266bee | 1552 | fi |
d5b93ddf AP |
1553 | |
1554 | if test "$xen" = yes; then | |
1555 | libs_softmmu="$xen_libs $libs_softmmu" | |
1556 | fi | |
e37630ca AL |
1557 | fi |
1558 | ||
eb6fda0f AP |
1559 | if test "$xen_pci_passthrough" != "no"; then |
1560 | if test "$xen" = "yes" && test "$linux" = "yes" && | |
1561 | test "$xen_ctrl_version" -ge 340; then | |
1562 | xen_pci_passthrough=yes | |
1563 | else | |
1564 | if test "$xen_pci_passthrough" = "yes"; then | |
1565 | echo "ERROR" | |
1566 | echo "ERROR: User requested feature Xen PCI Passthrough" | |
1567 | echo "ERROR: but this feature require /sys from Linux" | |
1568 | if test "$xen_ctrl_version" -lt 340; then | |
1569 | echo "ERROR: This feature does not work with Xen 3.3" | |
1570 | fi | |
1571 | echo "ERROR" | |
1572 | exit 1; | |
1573 | fi | |
1574 | xen_pci_passthrough=no | |
1575 | fi | |
1576 | fi | |
1577 | ||
f91672e5 | 1578 | ########################################## |
a8bd70ad | 1579 | # pkg-config probe |
f91672e5 | 1580 | |
17884d7b ST |
1581 | if ! has "$pkg_config_exe"; then |
1582 | echo "Error: pkg-config binary '$pkg_config_exe' not found" | |
a213fcb2 | 1583 | exit 1 |
f91672e5 PB |
1584 | fi |
1585 | ||
44dc0ca3 AL |
1586 | ########################################## |
1587 | # libtool probe | |
1588 | ||
3f534581 | 1589 | if ! has $libtool; then |
44dc0ca3 | 1590 | libtool= |
44dc0ca3 AL |
1591 | fi |
1592 | ||
dfffc653 JQ |
1593 | ########################################## |
1594 | # Sparse probe | |
1595 | if test "$sparse" != "no" ; then | |
0dba6195 | 1596 | if has cgcc; then |
dfffc653 JQ |
1597 | sparse=yes |
1598 | else | |
1599 | if test "$sparse" = "yes" ; then | |
1600 | feature_not_found "sparse" | |
1601 | fi | |
1602 | sparse=no | |
1603 | fi | |
1604 | fi | |
1605 | ||
11d9f695 FB |
1606 | ########################################## |
1607 | # SDL probe | |
1608 | ||
3ec87ffe PB |
1609 | # Look for sdl configuration program (pkg-config or sdl-config). Try |
1610 | # sdl-config even without cross prefix, and favour pkg-config over sdl-config. | |
1611 | if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then | |
1612 | sdl_config=sdl-config | |
1613 | fi | |
1614 | ||
1615 | if $pkg_config sdl --modversion >/dev/null 2>&1; then | |
a8bd70ad | 1616 | sdlconfig="$pkg_config sdl" |
9316f803 | 1617 | _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` |
3ec87ffe PB |
1618 | elif has ${sdl_config}; then |
1619 | sdlconfig="$sdl_config" | |
9316f803 | 1620 | _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` |
a0dfd8a4 LM |
1621 | else |
1622 | if test "$sdl" = "yes" ; then | |
1623 | feature_not_found "sdl" | |
1624 | fi | |
1625 | sdl=no | |
9316f803 | 1626 | fi |
29e5bada | 1627 | if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then |
3ec87ffe PB |
1628 | echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 |
1629 | fi | |
11d9f695 | 1630 | |
9316f803 | 1631 | sdl_too_old=no |
c4198157 | 1632 | if test "$sdl" != "no" ; then |
ac119f9d | 1633 | cat > $TMPC << EOF |
11d9f695 FB |
1634 | #include <SDL.h> |
1635 | #undef main /* We don't want SDL to override our main() */ | |
1636 | int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } | |
1637 | EOF | |
9316f803 | 1638 | sdl_cflags=`$sdlconfig --cflags 2> /dev/null` |
74f42e18 T |
1639 | if test "$static" = "yes" ; then |
1640 | sdl_libs=`$sdlconfig --static-libs 2>/dev/null` | |
1641 | else | |
1642 | sdl_libs=`$sdlconfig --libs 2> /dev/null` | |
1643 | fi | |
52166aa0 | 1644 | if compile_prog "$sdl_cflags" "$sdl_libs" ; then |
ac119f9d JQ |
1645 | if test "$_sdlversion" -lt 121 ; then |
1646 | sdl_too_old=yes | |
1647 | else | |
1648 | if test "$cocoa" = "no" ; then | |
1649 | sdl=yes | |
1650 | fi | |
1651 | fi | |
cd01b4a3 | 1652 | |
67c274d3 | 1653 | # static link with sdl ? (note: sdl.pc's --static --libs is broken) |
ac119f9d | 1654 | if test "$sdl" = "yes" -a "$static" = "yes" ; then |
67c274d3 | 1655 | if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then |
f8aa6c7b SW |
1656 | sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" |
1657 | sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" | |
ac119f9d | 1658 | fi |
52166aa0 | 1659 | if compile_prog "$sdl_cflags" "$sdl_libs" ; then |
ac119f9d JQ |
1660 | : |
1661 | else | |
1662 | sdl=no | |
1663 | fi | |
1664 | fi # static link | |
c4198157 JQ |
1665 | else # sdl not found |
1666 | if test "$sdl" = "yes" ; then | |
1667 | feature_not_found "sdl" | |
1668 | fi | |
1669 | sdl=no | |
ac119f9d | 1670 | fi # sdl compile test |
a68551bc | 1671 | fi |
11d9f695 | 1672 | |
5368a422 | 1673 | if test "$sdl" = "yes" ; then |
ac119f9d | 1674 | cat > $TMPC <<EOF |
5368a422 AL |
1675 | #include <SDL.h> |
1676 | #if defined(SDL_VIDEO_DRIVER_X11) | |
1677 | #include <X11/XKBlib.h> | |
1678 | #else | |
1679 | #error No x11 support | |
1680 | #endif | |
1681 | int main(void) { return 0; } | |
1682 | EOF | |
52166aa0 | 1683 | if compile_prog "$sdl_cflags" "$sdl_libs" ; then |
ac119f9d JQ |
1684 | sdl_libs="$sdl_libs -lX11" |
1685 | fi | |
0705667e | 1686 | libs_softmmu="$sdl_libs $libs_softmmu" |
5368a422 AL |
1687 | fi |
1688 | ||
8d5d2d4c TS |
1689 | ########################################## |
1690 | # VNC TLS detection | |
821601ea | 1691 | if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then |
1be10ad2 | 1692 | cat > $TMPC <<EOF |
ae6b5e5a AL |
1693 | #include <gnutls/gnutls.h> |
1694 | int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } | |
1695 | EOF | |
a8bd70ad PB |
1696 | vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null` |
1697 | vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null` | |
1be10ad2 JQ |
1698 | if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then |
1699 | vnc_tls=yes | |
1700 | libs_softmmu="$vnc_tls_libs $libs_softmmu" | |
1701 | else | |
1702 | if test "$vnc_tls" = "yes" ; then | |
1703 | feature_not_found "vnc-tls" | |
ae6b5e5a | 1704 | fi |
1be10ad2 JQ |
1705 | vnc_tls=no |
1706 | fi | |
8d5d2d4c TS |
1707 | fi |
1708 | ||
2f9606b3 AL |
1709 | ########################################## |
1710 | # VNC SASL detection | |
821601ea | 1711 | if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then |
ea784e3b | 1712 | cat > $TMPC <<EOF |
2f9606b3 AL |
1713 | #include <sasl/sasl.h> |
1714 | #include <stdio.h> | |
1715 | int main(void) { sasl_server_init(NULL, "qemu"); return 0; } | |
1716 | EOF | |
ea784e3b JQ |
1717 | # Assuming Cyrus-SASL installed in /usr prefix |
1718 | vnc_sasl_cflags="" | |
1719 | vnc_sasl_libs="-lsasl2" | |
1720 | if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then | |
1721 | vnc_sasl=yes | |
1722 | libs_softmmu="$vnc_sasl_libs $libs_softmmu" | |
1723 | else | |
1724 | if test "$vnc_sasl" = "yes" ; then | |
1725 | feature_not_found "vnc-sasl" | |
2f9606b3 | 1726 | fi |
ea784e3b JQ |
1727 | vnc_sasl=no |
1728 | fi | |
2f9606b3 AL |
1729 | fi |
1730 | ||
2f6f5c7a CC |
1731 | ########################################## |
1732 | # VNC JPEG detection | |
821601ea | 1733 | if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then |
2f6f5c7a CC |
1734 | cat > $TMPC <<EOF |
1735 | #include <stdio.h> | |
1736 | #include <jpeglib.h> | |
1737 | int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } | |
1738 | EOF | |
1739 | vnc_jpeg_cflags="" | |
1740 | vnc_jpeg_libs="-ljpeg" | |
1741 | if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then | |
1742 | vnc_jpeg=yes | |
1743 | libs_softmmu="$vnc_jpeg_libs $libs_softmmu" | |
1744 | else | |
1745 | if test "$vnc_jpeg" = "yes" ; then | |
1746 | feature_not_found "vnc-jpeg" | |
1747 | fi | |
1748 | vnc_jpeg=no | |
1749 | fi | |
1750 | fi | |
1751 | ||
efe556ad CC |
1752 | ########################################## |
1753 | # VNC PNG detection | |
821601ea | 1754 | if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then |
efe556ad CC |
1755 | cat > $TMPC <<EOF |
1756 | //#include <stdio.h> | |
1757 | #include <png.h> | |
832ce9c2 | 1758 | #include <stddef.h> |
efe556ad CC |
1759 | int main(void) { |
1760 | png_structp png_ptr; | |
1761 | png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); | |
7edc3fed | 1762 | return png_ptr != 0; |
efe556ad CC |
1763 | } |
1764 | EOF | |
9af8025e BS |
1765 | if $pkg_config libpng --modversion >/dev/null 2>&1; then |
1766 | vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null` | |
1767 | vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null` | |
1768 | else | |
efe556ad CC |
1769 | vnc_png_cflags="" |
1770 | vnc_png_libs="-lpng" | |
9af8025e | 1771 | fi |
efe556ad CC |
1772 | if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then |
1773 | vnc_png=yes | |
1774 | libs_softmmu="$vnc_png_libs $libs_softmmu" | |
9af8025e | 1775 | QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" |
efe556ad CC |
1776 | else |
1777 | if test "$vnc_png" = "yes" ; then | |
1778 | feature_not_found "vnc-png" | |
1779 | fi | |
1780 | vnc_png=no | |
1781 | fi | |
1782 | fi | |
1783 | ||
76655d6d AL |
1784 | ########################################## |
1785 | # fnmatch() probe, used for ACL routines | |
1786 | fnmatch="no" | |
1787 | cat > $TMPC << EOF | |
1788 | #include <fnmatch.h> | |
1789 | int main(void) | |
1790 | { | |
1791 | fnmatch("foo", "foo", 0); | |
1792 | return 0; | |
1793 | } | |
1794 | EOF | |
52166aa0 | 1795 | if compile_prog "" "" ; then |
76655d6d AL |
1796 | fnmatch="yes" |
1797 | fi | |
1798 | ||
ee682d27 SW |
1799 | ########################################## |
1800 | # uuid_generate() probe, used for vdi block driver | |
1801 | if test "$uuid" != "no" ; then | |
1802 | uuid_libs="-luuid" | |
1803 | cat > $TMPC << EOF | |
1804 | #include <uuid/uuid.h> | |
1805 | int main(void) | |
1806 | { | |
1807 | uuid_t my_uuid; | |
1808 | uuid_generate(my_uuid); | |
1809 | return 0; | |
1810 | } | |
1811 | EOF | |
1812 | if compile_prog "" "$uuid_libs" ; then | |
1813 | uuid="yes" | |
1814 | libs_softmmu="$uuid_libs $libs_softmmu" | |
1815 | libs_tools="$uuid_libs $libs_tools" | |
1816 | else | |
1817 | if test "$uuid" = "yes" ; then | |
1818 | feature_not_found "uuid" | |
1819 | fi | |
1820 | uuid=no | |
1821 | fi | |
1822 | fi | |
1823 | ||
dce512de CH |
1824 | ########################################## |
1825 | # xfsctl() probe, used for raw-posix | |
1826 | if test "$xfs" != "no" ; then | |
1827 | cat > $TMPC << EOF | |
ffc41d10 | 1828 | #include <stddef.h> /* NULL */ |
dce512de CH |
1829 | #include <xfs/xfs.h> |
1830 | int main(void) | |
1831 | { | |
1832 | xfsctl(NULL, 0, 0, NULL); | |
1833 | return 0; | |
1834 | } | |
1835 | EOF | |
1836 | if compile_prog "" "" ; then | |
1837 | xfs="yes" | |
1838 | else | |
1839 | if test "$xfs" = "yes" ; then | |
1840 | feature_not_found "xfs" | |
1841 | fi | |
1842 | xfs=no | |
1843 | fi | |
1844 | fi | |
1845 | ||
8a16d273 TS |
1846 | ########################################## |
1847 | # vde libraries probe | |
dfb278bd | 1848 | if test "$vde" != "no" ; then |
4baae0ac | 1849 | vde_libs="-lvdeplug" |
8a16d273 TS |
1850 | cat > $TMPC << EOF |
1851 | #include <libvdeplug.h> | |
4a7f0e06 PB |
1852 | int main(void) |
1853 | { | |
1854 | struct vde_open_args a = {0, 0, 0}; | |
fea08e08 PM |
1855 | char s[] = ""; |
1856 | vde_open(s, s, &a); | |
4a7f0e06 PB |
1857 | return 0; |
1858 | } | |
8a16d273 | 1859 | EOF |
52166aa0 | 1860 | if compile_prog "" "$vde_libs" ; then |
4baae0ac | 1861 | vde=yes |
8e02e54c JQ |
1862 | libs_softmmu="$vde_libs $libs_softmmu" |
1863 | libs_tools="$vde_libs $libs_tools" | |
dfb278bd JQ |
1864 | else |
1865 | if test "$vde" = "yes" ; then | |
1866 | feature_not_found "vde" | |
1867 | fi | |
1868 | vde=no | |
4baae0ac | 1869 | fi |
8a16d273 TS |
1870 | fi |
1871 | ||
47e98658 CB |
1872 | ########################################## |
1873 | # libcap-ng library probe | |
1874 | if test "$cap_ng" != "no" ; then | |
1875 | cap_libs="-lcap-ng" | |
1876 | cat > $TMPC << EOF | |
1877 | #include <cap-ng.h> | |
1878 | int main(void) | |
1879 | { | |
1880 | capng_capability_to_name(CAPNG_EFFECTIVE); | |
1881 | return 0; | |
1882 | } | |
1883 | EOF | |
1884 | if compile_prog "" "$cap_libs" ; then | |
1885 | cap_ng=yes | |
1886 | libs_tools="$cap_libs $libs_tools" | |
1887 | else | |
1888 | if test "$cap_ng" = "yes" ; then | |
1889 | feature_not_found "cap_ng" | |
1890 | fi | |
1891 | cap_ng=no | |
1892 | fi | |
1893 | fi | |
1894 | ||
8f28f3fb | 1895 | ########################################## |
c2de5c91 | 1896 | # Sound support libraries probe |
8f28f3fb | 1897 | |
c2de5c91 | 1898 | audio_drv_probe() |
1899 | { | |
1900 | drv=$1 | |
1901 | hdr=$2 | |
1902 | lib=$3 | |
1903 | exp=$4 | |
1904 | cfl=$5 | |
1905 | cat > $TMPC << EOF | |
1906 | #include <$hdr> | |
1907 | int main(void) { $exp } | |
8f28f3fb | 1908 | EOF |
52166aa0 | 1909 | if compile_prog "$cfl" "$lib" ; then |
c2de5c91 | 1910 | : |
1911 | else | |
1912 | echo | |
1913 | echo "Error: $drv check failed" | |
1914 | echo "Make sure to have the $drv libs and headers installed." | |
1915 | echo | |
1916 | exit 1 | |
1917 | fi | |
1918 | } | |
1919 | ||
2fa7d3bf | 1920 | audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` |
c2de5c91 | 1921 | for drv in $audio_drv_list; do |
1922 | case $drv in | |
1923 | alsa) | |
1924 | audio_drv_probe $drv alsa/asoundlib.h -lasound \ | |
e35bcb0c | 1925 | "return snd_pcm_close((snd_pcm_t *)0);" |
a4bf6780 | 1926 | libs_softmmu="-lasound $libs_softmmu" |
c2de5c91 | 1927 | ;; |
1928 | ||
1929 | fmod) | |
1930 | if test -z $fmod_lib || test -z $fmod_inc; then | |
1931 | echo | |
1932 | echo "Error: You must specify path to FMOD library and headers" | |
1933 | echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" | |
1934 | echo | |
1935 | exit 1 | |
1936 | fi | |
1937 | audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" | |
a4bf6780 | 1938 | libs_softmmu="$fmod_lib $libs_softmmu" |
c2de5c91 | 1939 | ;; |
1940 | ||
1941 | esd) | |
1942 | audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' | |
a4bf6780 | 1943 | libs_softmmu="-lesd $libs_softmmu" |
67f86e8e | 1944 | audio_pt_int="yes" |
c2de5c91 | 1945 | ;; |
b8e59f18 | 1946 | |
1947 | pa) | |
a394aed2 MAL |
1948 | audio_drv_probe $drv pulse/mainloop.h "-lpulse" \ |
1949 | "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;" | |
1950 | libs_softmmu="-lpulse $libs_softmmu" | |
67f86e8e | 1951 | audio_pt_int="yes" |
b8e59f18 | 1952 | ;; |
1953 | ||
997e690a JQ |
1954 | coreaudio) |
1955 | libs_softmmu="-framework CoreAudio $libs_softmmu" | |
1956 | ;; | |
1957 | ||
a4bf6780 JQ |
1958 | dsound) |
1959 | libs_softmmu="-lole32 -ldxguid $libs_softmmu" | |
d5631638 | 1960 | audio_win_int="yes" |
a4bf6780 JQ |
1961 | ;; |
1962 | ||
1963 | oss) | |
1964 | libs_softmmu="$oss_lib $libs_softmmu" | |
1965 | ;; | |
1966 | ||
1967 | sdl|wav) | |
2f6a1ab0 BS |
1968 | # XXX: Probes for CoreAudio, DirectSound, SDL(?) |
1969 | ;; | |
1970 | ||
d5631638 | 1971 | winwave) |
1972 | libs_softmmu="-lwinmm $libs_softmmu" | |
1973 | audio_win_int="yes" | |
1974 | ;; | |
1975 | ||
e4c63a6a | 1976 | *) |
1c9b2a52 | 1977 | echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { |
e4c63a6a | 1978 | echo |
1979 | echo "Error: Unknown driver '$drv' selected" | |
1980 | echo "Possible drivers are: $audio_possible_drivers" | |
1981 | echo | |
1982 | exit 1 | |
1983 | } | |
1984 | ;; | |
c2de5c91 | 1985 | esac |
1986 | done | |
8f28f3fb | 1987 | |
2e4d9fb1 AJ |
1988 | ########################################## |
1989 | # BrlAPI probe | |
1990 | ||
4ffcedb6 | 1991 | if test "$brlapi" != "no" ; then |
eb82284f JQ |
1992 | brlapi_libs="-lbrlapi" |
1993 | cat > $TMPC << EOF | |
2e4d9fb1 | 1994 | #include <brlapi.h> |
832ce9c2 | 1995 | #include <stddef.h> |
2e4d9fb1 AJ |
1996 | int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } |
1997 | EOF | |
52166aa0 | 1998 | if compile_prog "" "$brlapi_libs" ; then |
eb82284f | 1999 | brlapi=yes |
264606b3 | 2000 | libs_softmmu="$brlapi_libs $libs_softmmu" |
4ffcedb6 JQ |
2001 | else |
2002 | if test "$brlapi" = "yes" ; then | |
2003 | feature_not_found "brlapi" | |
2004 | fi | |
2005 | brlapi=no | |
eb82284f JQ |
2006 | fi |
2007 | fi | |
2e4d9fb1 | 2008 | |
4d3b6f6e AZ |
2009 | ########################################## |
2010 | # curses probe | |
e095e2f3 SW |
2011 | if test "$mingw32" = "yes" ; then |
2012 | curses_list="-lpdcurses" | |
2013 | else | |
2014 | curses_list="-lncurses -lcurses" | |
2015 | fi | |
4d3b6f6e | 2016 | |
c584a6d0 JQ |
2017 | if test "$curses" != "no" ; then |
2018 | curses_found=no | |
4d3b6f6e AZ |
2019 | cat > $TMPC << EOF |
2020 | #include <curses.h> | |
ef9a2524 SW |
2021 | int main(void) { |
2022 | const char *s = curses_version(); | |
2023 | resize_term(0, 0); | |
2024 | return s != 0; | |
2025 | } | |
4d3b6f6e | 2026 | EOF |
4f78ef9a JQ |
2027 | for curses_lib in $curses_list; do |
2028 | if compile_prog "" "$curses_lib" ; then | |
c584a6d0 | 2029 | curses_found=yes |
4f78ef9a JQ |
2030 | libs_softmmu="$curses_lib $libs_softmmu" |
2031 | break | |
2032 | fi | |
2033 | done | |
c584a6d0 JQ |
2034 | if test "$curses_found" = "yes" ; then |
2035 | curses=yes | |
2036 | else | |
2037 | if test "$curses" = "yes" ; then | |
2038 | feature_not_found "curses" | |
2039 | fi | |
2040 | curses=no | |
2041 | fi | |
4f78ef9a | 2042 | fi |
4d3b6f6e | 2043 | |
769ce76d AG |
2044 | ########################################## |
2045 | # curl probe | |
2046 | ||
a8bd70ad PB |
2047 | if $pkg_config libcurl --modversion >/dev/null 2>&1; then |
2048 | curlconfig="$pkg_config libcurl" | |
4e2b0658 PB |
2049 | else |
2050 | curlconfig=curl-config | |
2051 | fi | |
2052 | ||
788c8196 | 2053 | if test "$curl" != "no" ; then |
769ce76d AG |
2054 | cat > $TMPC << EOF |
2055 | #include <curl/curl.h> | |
0b862ced | 2056 | int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } |
769ce76d | 2057 | EOF |
4e2b0658 PB |
2058 | curl_cflags=`$curlconfig --cflags 2>/dev/null` |
2059 | curl_libs=`$curlconfig --libs 2>/dev/null` | |
b1d5a277 | 2060 | if compile_prog "$curl_cflags" "$curl_libs" ; then |
769ce76d | 2061 | curl=yes |
f0302935 JQ |
2062 | libs_tools="$curl_libs $libs_tools" |
2063 | libs_softmmu="$curl_libs $libs_softmmu" | |
788c8196 JQ |
2064 | else |
2065 | if test "$curl" = "yes" ; then | |
2066 | feature_not_found "curl" | |
2067 | fi | |
2068 | curl=no | |
769ce76d AG |
2069 | fi |
2070 | fi # test "$curl" | |
2071 | ||
fb599c9a AZ |
2072 | ########################################## |
2073 | # bluez support probe | |
a20a6f46 | 2074 | if test "$bluez" != "no" ; then |
e820e3f4 AZ |
2075 | cat > $TMPC << EOF |
2076 | #include <bluetooth/bluetooth.h> | |
2077 | int main(void) { return bt_error(0); } | |
2078 | EOF | |
a8bd70ad PB |
2079 | bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` |
2080 | bluez_libs=`$pkg_config --libs bluez 2> /dev/null` | |
52166aa0 | 2081 | if compile_prog "$bluez_cflags" "$bluez_libs" ; then |
a20a6f46 | 2082 | bluez=yes |
e482d56a | 2083 | libs_softmmu="$bluez_libs $libs_softmmu" |
e820e3f4 | 2084 | else |
a20a6f46 JQ |
2085 | if test "$bluez" = "yes" ; then |
2086 | feature_not_found "bluez" | |
2087 | fi | |
e820e3f4 AZ |
2088 | bluez="no" |
2089 | fi | |
fb599c9a AZ |
2090 | fi |
2091 | ||
e18df141 AL |
2092 | ########################################## |
2093 | # glib support probe | |
a52d28af PB |
2094 | |
2095 | if test "$mingw32" = yes; then | |
2096 | # g_poll is required in order to integrate with the glib main loop. | |
2097 | glib_req_ver=2.20 | |
2098 | else | |
2099 | glib_req_ver=2.12 | |
2100 | fi | |
2101 | if $pkg_config --atleast-version=$glib_req_ver gthread-2.0 > /dev/null 2>&1 | |
2102 | then | |
4b76a481 SH |
2103 | glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null` |
2104 | glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null` | |
14015304 | 2105 | LIBS="$glib_libs $LIBS" |
957f1f99 | 2106 | libs_qga="$glib_libs $libs_qga" |
4b76a481 | 2107 | else |
a52d28af | 2108 | echo "glib-$glib_req_ver required to compile QEMU" |
4b76a481 | 2109 | exit 1 |
e18df141 AL |
2110 | fi |
2111 | ||
17bff52b MK |
2112 | ########################################## |
2113 | # libcap probe | |
2114 | ||
2115 | if test "$cap" != "no" ; then | |
2116 | cat > $TMPC <<EOF | |
2117 | #include <stdio.h> | |
2118 | #include <sys/capability.h> | |
cc939743 | 2119 | int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; } |
17bff52b MK |
2120 | EOF |
2121 | if compile_prog "" "-lcap" ; then | |
2122 | cap=yes | |
2123 | else | |
2124 | cap=no | |
2125 | fi | |
2126 | fi | |
2127 | ||
414f0dab | 2128 | ########################################## |
e5d355d1 | 2129 | # pthread probe |
4b29ec41 | 2130 | PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" |
3c529d93 | 2131 | |
4dd75c70 | 2132 | pthread=no |
e5d355d1 | 2133 | cat > $TMPC << EOF |
3c529d93 | 2134 | #include <pthread.h> |
7a42bbe4 SW |
2135 | static void *f(void *p) { return NULL; } |
2136 | int main(void) { | |
2137 | pthread_t thread; | |
2138 | pthread_create(&thread, 0, f, 0); | |
2139 | return 0; | |
2140 | } | |
414f0dab | 2141 | EOF |
bd00d539 AF |
2142 | if compile_prog "" "" ; then |
2143 | pthread=yes | |
2144 | else | |
2145 | for pthread_lib in $PTHREADLIBS_LIST; do | |
2146 | if compile_prog "" "$pthread_lib" ; then | |
2147 | pthread=yes | |
e3c56761 PP |
2148 | found=no |
2149 | for lib_entry in $LIBS; do | |
2150 | if test "$lib_entry" = "$pthread_lib"; then | |
2151 | found=yes | |
2152 | break | |
2153 | fi | |
2154 | done | |
2155 | if test "$found" = "no"; then | |
2156 | LIBS="$pthread_lib $LIBS" | |
2157 | fi | |
bd00d539 AF |
2158 | break |
2159 | fi | |
2160 | done | |
2161 | fi | |
414f0dab | 2162 | |
4617e593 | 2163 | if test "$mingw32" != yes -a "$pthread" = no; then |
4dd75c70 CH |
2164 | echo |
2165 | echo "Error: pthread check failed" | |
2166 | echo "Make sure to have the pthread libs and headers installed." | |
2167 | echo | |
2168 | exit 1 | |
e5d355d1 AL |
2169 | fi |
2170 | ||
f27aaf4b CB |
2171 | ########################################## |
2172 | # rbd probe | |
2173 | if test "$rbd" != "no" ; then | |
2174 | cat > $TMPC <<EOF | |
2175 | #include <stdio.h> | |
ad32e9c0 | 2176 | #include <rbd/librbd.h> |
f27aaf4b | 2177 | int main(void) { |
ad32e9c0 JD |
2178 | rados_t cluster; |
2179 | rados_create(&cluster, NULL); | |
f27aaf4b CB |
2180 | return 0; |
2181 | } | |
2182 | EOF | |
ad32e9c0 JD |
2183 | rbd_libs="-lrbd -lrados" |
2184 | if compile_prog "" "$rbd_libs" ; then | |
2185 | rbd=yes | |
2186 | libs_tools="$rbd_libs $libs_tools" | |
2187 | libs_softmmu="$rbd_libs $libs_softmmu" | |
f27aaf4b CB |
2188 | else |
2189 | if test "$rbd" = "yes" ; then | |
2190 | feature_not_found "rados block device" | |
2191 | fi | |
2192 | rbd=no | |
2193 | fi | |
f27aaf4b CB |
2194 | fi |
2195 | ||
5c6c3a6c CH |
2196 | ########################################## |
2197 | # linux-aio probe | |
5c6c3a6c CH |
2198 | |
2199 | if test "$linux_aio" != "no" ; then | |
2200 | cat > $TMPC <<EOF | |
2201 | #include <libaio.h> | |
2202 | #include <sys/eventfd.h> | |
832ce9c2 | 2203 | #include <stddef.h> |
5c6c3a6c CH |
2204 | int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } |
2205 | EOF | |
2206 | if compile_prog "" "-laio" ; then | |
2207 | linux_aio=yes | |
048d179f PB |
2208 | libs_softmmu="$libs_softmmu -laio" |
2209 | libs_tools="$libs_tools -laio" | |
5c6c3a6c CH |
2210 | else |
2211 | if test "$linux_aio" = "yes" ; then | |
2212 | feature_not_found "linux AIO" | |
2213 | fi | |
3cfcae3c | 2214 | linux_aio=no |
5c6c3a6c CH |
2215 | fi |
2216 | fi | |
2217 | ||
758e8e38 VJ |
2218 | ########################################## |
2219 | # attr probe | |
2220 | ||
2221 | if test "$attr" != "no" ; then | |
2222 | cat > $TMPC <<EOF | |
2223 | #include <stdio.h> | |
2224 | #include <sys/types.h> | |
f2338fb4 PB |
2225 | #ifdef CONFIG_LIBATTR |
2226 | #include <attr/xattr.h> | |
2227 | #else | |
4f26f2b6 | 2228 | #include <sys/xattr.h> |
f2338fb4 | 2229 | #endif |
758e8e38 VJ |
2230 | int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } |
2231 | EOF | |
4f26f2b6 AK |
2232 | if compile_prog "" "" ; then |
2233 | attr=yes | |
2234 | # Older distros have <attr/xattr.h>, and need -lattr: | |
f2338fb4 | 2235 | elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then |
758e8e38 VJ |
2236 | attr=yes |
2237 | LIBS="-lattr $LIBS" | |
4f26f2b6 | 2238 | libattr=yes |
758e8e38 VJ |
2239 | else |
2240 | if test "$attr" = "yes" ; then | |
2241 | feature_not_found "ATTR" | |
2242 | fi | |
2243 | attr=no | |
2244 | fi | |
2245 | fi | |
2246 | ||
bf9298b9 AL |
2247 | ########################################## |
2248 | # iovec probe | |
2249 | cat > $TMPC <<EOF | |
db34f0b3 | 2250 | #include <sys/types.h> |
bf9298b9 | 2251 | #include <sys/uio.h> |
db34f0b3 | 2252 | #include <unistd.h> |
f91f9bee | 2253 | int main(void) { return sizeof(struct iovec); } |
bf9298b9 AL |
2254 | EOF |
2255 | iovec=no | |
52166aa0 | 2256 | if compile_prog "" "" ; then |
bf9298b9 AL |
2257 | iovec=yes |
2258 | fi | |
2259 | ||
ceb42de8 AL |
2260 | ########################################## |
2261 | # preadv probe | |
2262 | cat > $TMPC <<EOF | |
2263 | #include <sys/types.h> | |
2264 | #include <sys/uio.h> | |
2265 | #include <unistd.h> | |
c075a723 | 2266 | int main(void) { return preadv(0, 0, 0, 0); } |
ceb42de8 AL |
2267 | EOF |
2268 | preadv=no | |
52166aa0 | 2269 | if compile_prog "" "" ; then |
ceb42de8 AL |
2270 | preadv=yes |
2271 | fi | |
2272 | ||
f652e6af AJ |
2273 | ########################################## |
2274 | # fdt probe | |
2df87df7 | 2275 | if test "$fdt" != "no" ; then |
b41af4ba JQ |
2276 | fdt_libs="-lfdt" |
2277 | cat > $TMPC << EOF | |
f652e6af AJ |
2278 | int main(void) { return 0; } |
2279 | EOF | |
52166aa0 | 2280 | if compile_prog "" "$fdt_libs" ; then |
f652e6af | 2281 | fdt=yes |
2df87df7 JQ |
2282 | else |
2283 | if test "$fdt" = "yes" ; then | |
2284 | feature_not_found "fdt" | |
2285 | fi | |
de3a354a | 2286 | fdt_libs= |
2df87df7 | 2287 | fdt=no |
f652e6af AJ |
2288 | fi |
2289 | fi | |
2290 | ||
20ff075b MW |
2291 | ########################################## |
2292 | # opengl probe, used by milkymist-tmu2 | |
2293 | if test "$opengl" != "no" ; then | |
2294 | opengl_libs="-lGL" | |
2295 | cat > $TMPC << EOF | |
2296 | #include <X11/Xlib.h> | |
2297 | #include <GL/gl.h> | |
2298 | #include <GL/glx.h> | |
84972cbb | 2299 | int main(void) { return GL_VERSION != 0; } |
20ff075b MW |
2300 | EOF |
2301 | if compile_prog "" "-lGL" ; then | |
2302 | opengl=yes | |
20ff075b MW |
2303 | else |
2304 | if test "$opengl" = "yes" ; then | |
2305 | feature_not_found "opengl" | |
2306 | fi | |
de3a354a | 2307 | opengl_libs= |
20ff075b MW |
2308 | opengl=no |
2309 | fi | |
2310 | fi | |
2311 | ||
3b3f24ad AJ |
2312 | # |
2313 | # Check for xxxat() functions when we are building linux-user | |
2314 | # emulator. This is done because older glibc versions don't | |
2315 | # have syscall stubs for these implemented. | |
2316 | # | |
2317 | atfile=no | |
67ba57f6 | 2318 | cat > $TMPC << EOF |
3b3f24ad AJ |
2319 | #define _ATFILE_SOURCE |
2320 | #include <sys/types.h> | |
2321 | #include <fcntl.h> | |
2322 | #include <unistd.h> | |
2323 | ||
2324 | int | |
2325 | main(void) | |
2326 | { | |
2327 | /* try to unlink nonexisting file */ | |
2328 | return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); | |
2329 | } | |
2330 | EOF | |
52166aa0 | 2331 | if compile_prog "" "" ; then |
67ba57f6 | 2332 | atfile=yes |
3b3f24ad AJ |
2333 | fi |
2334 | ||
39386ac7 | 2335 | # Check for inotify functions when we are building linux-user |
3b3f24ad AJ |
2336 | # emulator. This is done because older glibc versions don't |
2337 | # have syscall stubs for these implemented. In that case we | |
2338 | # don't provide them even if kernel supports them. | |
2339 | # | |
2340 | inotify=no | |
67ba57f6 | 2341 | cat > $TMPC << EOF |
3b3f24ad AJ |
2342 | #include <sys/inotify.h> |
2343 | ||
2344 | int | |
2345 | main(void) | |
2346 | { | |
2347 | /* try to start inotify */ | |
8690e420 | 2348 | return inotify_init(); |
3b3f24ad AJ |
2349 | } |
2350 | EOF | |
52166aa0 | 2351 | if compile_prog "" "" ; then |
67ba57f6 | 2352 | inotify=yes |
3b3f24ad AJ |
2353 | fi |
2354 | ||
c05c7a73 RV |
2355 | inotify1=no |
2356 | cat > $TMPC << EOF | |
2357 | #include <sys/inotify.h> | |
2358 | ||
2359 | int | |
2360 | main(void) | |
2361 | { | |
2362 | /* try to start inotify */ | |
2363 | return inotify_init1(0); | |
2364 | } | |
2365 | EOF | |
2366 | if compile_prog "" "" ; then | |
2367 | inotify1=yes | |
2368 | fi | |
2369 | ||
ebc996f3 RV |
2370 | # check if utimensat and futimens are supported |
2371 | utimens=no | |
2372 | cat > $TMPC << EOF | |
2373 | #define _ATFILE_SOURCE | |
ebc996f3 RV |
2374 | #include <stddef.h> |
2375 | #include <fcntl.h> | |
3014ee00 | 2376 | #include <sys/stat.h> |
ebc996f3 RV |
2377 | |
2378 | int main(void) | |
2379 | { | |
2380 | utimensat(AT_FDCWD, "foo", NULL, 0); | |
2381 | futimens(0, NULL); | |
2382 | return 0; | |
2383 | } | |
2384 | EOF | |
52166aa0 | 2385 | if compile_prog "" "" ; then |
ebc996f3 RV |
2386 | utimens=yes |
2387 | fi | |
2388 | ||
099d6b0f RV |
2389 | # check if pipe2 is there |
2390 | pipe2=no | |
2391 | cat > $TMPC << EOF | |
099d6b0f RV |
2392 | #include <unistd.h> |
2393 | #include <fcntl.h> | |
2394 | ||
2395 | int main(void) | |
2396 | { | |
2397 | int pipefd[2]; | |
2398 | pipe2(pipefd, O_CLOEXEC); | |
2399 | return 0; | |
2400 | } | |
2401 | EOF | |
52166aa0 | 2402 | if compile_prog "" "" ; then |
099d6b0f RV |
2403 | pipe2=yes |
2404 | fi | |
2405 | ||
40ff6d7e KW |
2406 | # check if accept4 is there |
2407 | accept4=no | |
2408 | cat > $TMPC << EOF | |
40ff6d7e KW |
2409 | #include <sys/socket.h> |
2410 | #include <stddef.h> | |
2411 | ||
2412 | int main(void) | |
2413 | { | |
2414 | accept4(0, NULL, NULL, SOCK_CLOEXEC); | |
2415 | return 0; | |
2416 | } | |
2417 | EOF | |
2418 | if compile_prog "" "" ; then | |
2419 | accept4=yes | |
2420 | fi | |
2421 | ||
3ce34dfb VS |
2422 | # check if tee/splice is there. vmsplice was added same time. |
2423 | splice=no | |
2424 | cat > $TMPC << EOF | |
3ce34dfb VS |
2425 | #include <unistd.h> |
2426 | #include <fcntl.h> | |
2427 | #include <limits.h> | |
2428 | ||
2429 | int main(void) | |
2430 | { | |
66ea0f22 | 2431 | int len, fd = 0; |
3ce34dfb VS |
2432 | len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); |
2433 | splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); | |
2434 | return 0; | |
2435 | } | |
2436 | EOF | |
52166aa0 | 2437 | if compile_prog "" "" ; then |
3ce34dfb VS |
2438 | splice=yes |
2439 | fi | |
2440 | ||
dcc38d1c MT |
2441 | ########################################## |
2442 | # signalfd probe | |
2443 | signalfd="no" | |
2444 | cat > $TMPC << EOF | |
dcc38d1c MT |
2445 | #include <unistd.h> |
2446 | #include <sys/syscall.h> | |
2447 | #include <signal.h> | |
2448 | int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } | |
2449 | EOF | |
2450 | ||
2451 | if compile_prog "" "" ; then | |
2452 | signalfd=yes | |
2453 | fi | |
2454 | ||
c2882b96 RV |
2455 | # check if eventfd is supported |
2456 | eventfd=no | |
2457 | cat > $TMPC << EOF | |
2458 | #include <sys/eventfd.h> | |
2459 | ||
2460 | int main(void) | |
2461 | { | |
55cc7f3e | 2462 | return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); |
c2882b96 RV |
2463 | } |
2464 | EOF | |
2465 | if compile_prog "" "" ; then | |
2466 | eventfd=yes | |
2467 | fi | |
2468 | ||
d0927938 UH |
2469 | # check for fallocate |
2470 | fallocate=no | |
2471 | cat > $TMPC << EOF | |
2472 | #include <fcntl.h> | |
2473 | ||
2474 | int main(void) | |
2475 | { | |
2476 | fallocate(0, 0, 0, 0); | |
2477 | return 0; | |
2478 | } | |
2479 | EOF | |
8fb03151 | 2480 | if compile_prog "" "" ; then |
d0927938 UH |
2481 | fallocate=yes |
2482 | fi | |
2483 | ||
c727f47d PM |
2484 | # check for sync_file_range |
2485 | sync_file_range=no | |
2486 | cat > $TMPC << EOF | |
2487 | #include <fcntl.h> | |
2488 | ||
2489 | int main(void) | |
2490 | { | |
2491 | sync_file_range(0, 0, 0, 0); | |
2492 | return 0; | |
2493 | } | |
2494 | EOF | |
8fb03151 | 2495 | if compile_prog "" "" ; then |
c727f47d PM |
2496 | sync_file_range=yes |
2497 | fi | |
2498 | ||
dace20dc PM |
2499 | # check for linux/fiemap.h and FS_IOC_FIEMAP |
2500 | fiemap=no | |
2501 | cat > $TMPC << EOF | |
2502 | #include <sys/ioctl.h> | |
2503 | #include <linux/fs.h> | |
2504 | #include <linux/fiemap.h> | |
2505 | ||
2506 | int main(void) | |
2507 | { | |
2508 | ioctl(0, FS_IOC_FIEMAP, 0); | |
2509 | return 0; | |
2510 | } | |
2511 | EOF | |
8fb03151 | 2512 | if compile_prog "" "" ; then |
dace20dc PM |
2513 | fiemap=yes |
2514 | fi | |
2515 | ||
d0927938 UH |
2516 | # check for dup3 |
2517 | dup3=no | |
2518 | cat > $TMPC << EOF | |
2519 | #include <unistd.h> | |
2520 | ||
2521 | int main(void) | |
2522 | { | |
2523 | dup3(0, 0, 0); | |
2524 | return 0; | |
2525 | } | |
2526 | EOF | |
78f5d726 | 2527 | if compile_prog "" "" ; then |
d0927938 UH |
2528 | dup3=yes |
2529 | fi | |
2530 | ||
3b6edd16 PM |
2531 | # check for epoll support |
2532 | epoll=no | |
2533 | cat > $TMPC << EOF | |
2534 | #include <sys/epoll.h> | |
2535 | ||
2536 | int main(void) | |
2537 | { | |
2538 | epoll_create(0); | |
2539 | return 0; | |
2540 | } | |
2541 | EOF | |
8fb03151 | 2542 | if compile_prog "" "" ; then |
3b6edd16 PM |
2543 | epoll=yes |
2544 | fi | |
2545 | ||
2546 | # epoll_create1 and epoll_pwait are later additions | |
2547 | # so we must check separately for their presence | |
2548 | epoll_create1=no | |
2549 | cat > $TMPC << EOF | |
2550 | #include <sys/epoll.h> | |
2551 | ||
2552 | int main(void) | |
2553 | { | |
19e83f6b PM |
2554 | /* Note that we use epoll_create1 as a value, not as |
2555 | * a function being called. This is necessary so that on | |
2556 | * old SPARC glibc versions where the function was present in | |
2557 | * the library but not declared in the header file we will | |
2558 | * fail the configure check. (Otherwise we will get a compiler | |
2559 | * warning but not an error, and will proceed to fail the | |
2560 | * qemu compile where we compile with -Werror.) | |
2561 | */ | |
c075a723 | 2562 | return (int)(uintptr_t)&epoll_create1; |
3b6edd16 PM |
2563 | } |
2564 | EOF | |
8fb03151 | 2565 | if compile_prog "" "" ; then |
3b6edd16 PM |
2566 | epoll_create1=yes |
2567 | fi | |
2568 | ||
2569 | epoll_pwait=no | |
2570 | cat > $TMPC << EOF | |
2571 | #include <sys/epoll.h> | |
2572 | ||
2573 | int main(void) | |
2574 | { | |
2575 | epoll_pwait(0, 0, 0, 0, 0); | |
2576 | return 0; | |
2577 | } | |
2578 | EOF | |
8fb03151 | 2579 | if compile_prog "" "" ; then |
3b6edd16 PM |
2580 | epoll_pwait=yes |
2581 | fi | |
2582 | ||
cc8ae6de | 2583 | # Check if tools are available to build documentation. |
a25dba17 | 2584 | if test "$docs" != "no" ; then |
01668d98 | 2585 | if has makeinfo && has pod2man; then |
a25dba17 | 2586 | docs=yes |
83a3ab8b | 2587 | else |
a25dba17 JQ |
2588 | if test "$docs" = "yes" ; then |
2589 | feature_not_found "docs" | |
83a3ab8b | 2590 | fi |
a25dba17 | 2591 | docs=no |
83a3ab8b | 2592 | fi |
cc8ae6de PB |
2593 | fi |
2594 | ||
f514f41c | 2595 | # Search for bswap_32 function |
6ae9a1f4 JQ |
2596 | byteswap_h=no |
2597 | cat > $TMPC << EOF | |
2598 | #include <byteswap.h> | |
2599 | int main(void) { return bswap_32(0); } | |
2600 | EOF | |
52166aa0 | 2601 | if compile_prog "" "" ; then |
6ae9a1f4 JQ |
2602 | byteswap_h=yes |
2603 | fi | |
2604 | ||
f514f41c | 2605 | # Search for bswap_32 function |
6ae9a1f4 JQ |
2606 | bswap_h=no |
2607 | cat > $TMPC << EOF | |
2608 | #include <sys/endian.h> | |
2609 | #include <sys/types.h> | |
2610 | #include <machine/bswap.h> | |
2611 | int main(void) { return bswap32(0); } | |
2612 | EOF | |
52166aa0 | 2613 | if compile_prog "" "" ; then |
6ae9a1f4 JQ |
2614 | bswap_h=yes |
2615 | fi | |
2616 | ||
c589b249 RS |
2617 | ########################################## |
2618 | # Do we have libiscsi | |
fa6acb0c RS |
2619 | # We check for iscsi_unmap_sync() to make sure we have a |
2620 | # recent enough version of libiscsi. | |
c589b249 RS |
2621 | if test "$libiscsi" != "no" ; then |
2622 | cat > $TMPC << EOF | |
fa6acb0c | 2623 | #include <stdio.h> |
c589b249 | 2624 | #include <iscsi/iscsi.h> |
fa6acb0c | 2625 | int main(void) { iscsi_unmap_sync(NULL,0,0,0,NULL,0); return 0; } |
c589b249 | 2626 | EOF |
417c9d72 | 2627 | if compile_prog "" "-liscsi" ; then |
c589b249 RS |
2628 | libiscsi="yes" |
2629 | LIBS="$LIBS -liscsi" | |
2630 | else | |
2631 | if test "$libiscsi" = "yes" ; then | |
2632 | feature_not_found "libiscsi" | |
2633 | fi | |
2634 | libiscsi="no" | |
2635 | fi | |
2636 | fi | |
2637 | ||
2638 | ||
da93a1fd AL |
2639 | ########################################## |
2640 | # Do we need librt | |
2641 | cat > $TMPC <<EOF | |
2642 | #include <signal.h> | |
2643 | #include <time.h> | |
66ea0f22 | 2644 | int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); } |
da93a1fd AL |
2645 | EOF |
2646 | ||
52166aa0 | 2647 | if compile_prog "" "" ; then |
07ffa4bd | 2648 | : |
52166aa0 | 2649 | elif compile_prog "" "-lrt" ; then |
07ffa4bd | 2650 | LIBS="-lrt $LIBS" |
da93a1fd AL |
2651 | fi |
2652 | ||
31ff504d | 2653 | if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ |
179cf400 | 2654 | "$aix" != "yes" -a "$haiku" != "yes" ; then |
6362a53f JQ |
2655 | libs_softmmu="-lutil $libs_softmmu" |
2656 | fi | |
2657 | ||
de5071c5 | 2658 | ########################################## |
cd4ec0b4 GH |
2659 | # spice probe |
2660 | if test "$spice" != "no" ; then | |
2661 | cat > $TMPC << EOF | |
2662 | #include <spice.h> | |
2663 | int main(void) { spice_server_new(); return 0; } | |
2664 | EOF | |
710fc4f5 JD |
2665 | spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) |
2666 | spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) | |
4295e15a | 2667 | if $pkg_config --atleast-version=0.8.2 spice-server >/dev/null 2>&1 && \ |
7e3efdac | 2668 | $pkg_config --atleast-version=0.8.1 spice-protocol > /dev/null 2>&1 && \ |
cd4ec0b4 GH |
2669 | compile_prog "$spice_cflags" "$spice_libs" ; then |
2670 | spice="yes" | |
2671 | libs_softmmu="$libs_softmmu $spice_libs" | |
2672 | QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" | |
2673 | else | |
2674 | if test "$spice" = "yes" ; then | |
2675 | feature_not_found "spice" | |
2676 | fi | |
2677 | spice="no" | |
2678 | fi | |
2679 | fi | |
2680 | ||
111a38b0 RR |
2681 | # check for libcacard for smartcard support |
2682 | if test "$smartcard" != "no" ; then | |
2683 | smartcard="yes" | |
2684 | smartcard_cflags="" | |
2685 | # TODO - what's the minimal nss version we support? | |
2686 | if test "$smartcard_nss" != "no"; then | |
5f01e06f ST |
2687 | cat > $TMPC << EOF |
2688 | #include <pk11pub.h> | |
2689 | int main(void) { PK11_FreeSlot(0); return 0; } | |
2690 | EOF | |
0b22ef0f | 2691 | smartcard_includes="-I\$(SRC_PATH)/libcacard" |
8c741c22 AL |
2692 | libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs" |
2693 | libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags" | |
6ca026cb PM |
2694 | test_cflags="$libcacard_cflags" |
2695 | # The header files in nss < 3.13.3 have a bug which causes them to | |
2696 | # emit a warning. If we're going to compile QEMU with -Werror, then | |
2697 | # test that the headers don't have this bug. Otherwise we would pass | |
2698 | # the configure test but fail to compile QEMU later. | |
2699 | if test "$werror" = "yes"; then | |
2700 | test_cflags="-Werror $test_cflags" | |
2701 | fi | |
5f01e06f | 2702 | if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \ |
6ca026cb | 2703 | compile_prog "$test_cflags" "$libcacard_libs"; then |
111a38b0 | 2704 | smartcard_nss="yes" |
0b22ef0f PM |
2705 | QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags" |
2706 | QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes" | |
ad4cf3f6 | 2707 | libs_softmmu="$libcacard_libs $libs_softmmu" |
111a38b0 RR |
2708 | else |
2709 | if test "$smartcard_nss" = "yes"; then | |
2710 | feature_not_found "nss" | |
2711 | fi | |
2712 | smartcard_nss="no" | |
2713 | fi | |
2714 | fi | |
2715 | fi | |
2716 | if test "$smartcard" = "no" ; then | |
2717 | smartcard_nss="no" | |
2718 | fi | |
2719 | ||
69354a83 HG |
2720 | # check for usbredirparser for usb network redirection support |
2721 | if test "$usb_redir" != "no" ; then | |
097a66ef | 2722 | if $pkg_config --atleast-version=0.3.4 libusbredirparser >/dev/null 2>&1 ; then |
69354a83 HG |
2723 | usb_redir="yes" |
2724 | usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null) | |
2725 | usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null) | |
2726 | QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags" | |
2727 | LIBS="$LIBS $usb_redir_libs" | |
2728 | else | |
2729 | if test "$usb_redir" = "yes"; then | |
2730 | feature_not_found "usb-redir" | |
2731 | fi | |
2732 | usb_redir="no" | |
2733 | fi | |
2734 | fi | |
2735 | ||
cd4ec0b4 GH |
2736 | ########################################## |
2737 | ||
5f6b9e8f BS |
2738 | ########################################## |
2739 | # check if we have fdatasync | |
2740 | ||
2741 | fdatasync=no | |
2742 | cat > $TMPC << EOF | |
2743 | #include <unistd.h> | |
d1722a27 AR |
2744 | int main(void) { |
2745 | #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 | |
2746 | return fdatasync(0); | |
2747 | #else | |
e172fe11 | 2748 | #error Not supported |
d1722a27 AR |
2749 | #endif |
2750 | } | |
5f6b9e8f BS |
2751 | EOF |
2752 | if compile_prog "" "" ; then | |
2753 | fdatasync=yes | |
2754 | fi | |
2755 | ||
e78815a5 AF |
2756 | ########################################## |
2757 | # check if we have madvise | |
2758 | ||
2759 | madvise=no | |
2760 | cat > $TMPC << EOF | |
2761 | #include <sys/types.h> | |
2762 | #include <sys/mman.h> | |
832ce9c2 | 2763 | #include <stddef.h> |
e78815a5 AF |
2764 | int main(void) { return madvise(NULL, 0, MADV_DONTNEED); } |
2765 | EOF | |
2766 | if compile_prog "" "" ; then | |
2767 | madvise=yes | |
2768 | fi | |
2769 | ||
2770 | ########################################## | |
2771 | # check if we have posix_madvise | |
2772 | ||
2773 | posix_madvise=no | |
2774 | cat > $TMPC << EOF | |
2775 | #include <sys/mman.h> | |
832ce9c2 | 2776 | #include <stddef.h> |
e78815a5 AF |
2777 | int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } |
2778 | EOF | |
2779 | if compile_prog "" "" ; then | |
2780 | posix_madvise=yes | |
2781 | fi | |
2782 | ||
94a420b1 SH |
2783 | ########################################## |
2784 | # check if trace backend exists | |
2785 | ||
650ab98d | 2786 | $python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend > /dev/null 2> /dev/null |
94a420b1 SH |
2787 | if test "$?" -ne 0 ; then |
2788 | echo | |
2789 | echo "Error: invalid trace backend" | |
2790 | echo "Please choose a supported trace backend." | |
2791 | echo | |
2792 | exit 1 | |
2793 | fi | |
2794 | ||
7e24e92a SH |
2795 | ########################################## |
2796 | # For 'ust' backend, test if ust headers are present | |
2797 | if test "$trace_backend" = "ust"; then | |
2798 | cat > $TMPC << EOF | |
2799 | #include <ust/tracepoint.h> | |
2800 | #include <ust/marker.h> | |
2801 | int main(void) { return 0; } | |
2802 | EOF | |
2803 | if compile_prog "" "" ; then | |
94b4fefa | 2804 | LIBS="-lust -lurcu-bp $LIBS" |
c9a2e37c | 2805 | libs_qga="-lust -lurcu-bp $libs_qga" |
7e24e92a SH |
2806 | else |
2807 | echo | |
2808 | echo "Error: Trace backend 'ust' missing libust header files" | |
2809 | echo | |
2810 | exit 1 | |
2811 | fi | |
2812 | fi | |
b3d08c02 DB |
2813 | |
2814 | ########################################## | |
2815 | # For 'dtrace' backend, test if 'dtrace' command is present | |
2816 | if test "$trace_backend" = "dtrace"; then | |
2817 | if ! has 'dtrace' ; then | |
2818 | echo | |
2819 | echo "Error: dtrace command is not found in PATH $PATH" | |
2820 | echo | |
2821 | exit 1 | |
2822 | fi | |
c276b17d DB |
2823 | trace_backend_stap="no" |
2824 | if has 'stap' ; then | |
2825 | trace_backend_stap="yes" | |
2826 | fi | |
b3d08c02 DB |
2827 | fi |
2828 | ||
023367e6 WM |
2829 | ########################################## |
2830 | # __sync_fetch_and_and requires at least -march=i486. Many toolchains | |
2831 | # use i686 as default anyway, but for those that don't, an explicit | |
2832 | # specification is necessary | |
1ba16968 | 2833 | if test "$vhost_net" = "yes" && test "$cpu" = "i386"; then |
023367e6 | 2834 | cat > $TMPC << EOF |
7ace252a | 2835 | static int sfaa(int *ptr) |
023367e6 WM |
2836 | { |
2837 | return __sync_fetch_and_and(ptr, 0); | |
2838 | } | |
2839 | ||
2840 | int main(int argc, char **argv) | |
2841 | { | |
2842 | int val = 42; | |
2843 | sfaa(&val); | |
2844 | return val; | |
2845 | } | |
2846 | EOF | |
2847 | if ! compile_prog "" "" ; then | |
caa50971 | 2848 | QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" |
023367e6 WM |
2849 | fi |
2850 | fi | |
2851 | ||
d0e2fce5 | 2852 | ########################################## |
519175a2 | 2853 | # check and set a backend for coroutine |
d0e2fce5 | 2854 | |
519175a2 AB |
2855 | # default is ucontext, but always fallback to gthread |
2856 | # windows autodetected by make | |
2857 | if test "$coroutine" = "" -o "$coroutine" = "ucontext"; then | |
2858 | if test "$darwin" != "yes"; then | |
2859 | cat > $TMPC << EOF | |
d0e2fce5 | 2860 | #include <ucontext.h> |
cdf84806 PM |
2861 | #ifdef __stub_makecontext |
2862 | #error Ignoring glibc stub makecontext which will always fail | |
2863 | #endif | |
75cafad7 | 2864 | int main(void) { makecontext(0, 0, 0); return 0; } |
d0e2fce5 | 2865 | EOF |
519175a2 AB |
2866 | if compile_prog "" "" ; then |
2867 | coroutine_backend=ucontext | |
2868 | else | |
2869 | coroutine_backend=gthread | |
2870 | fi | |
2871 | else | |
2872 | echo "Silently falling back into gthread backend under darwin" | |
d0e2fce5 | 2873 | fi |
519175a2 AB |
2874 | elif test "$coroutine" = "gthread" ; then |
2875 | coroutine_backend=gthread | |
2876 | elif test "$coroutine" = "windows" ; then | |
2877 | coroutine_backend=windows | |
fe91bfa8 AB |
2878 | elif test "$coroutine" = "sigaltstack" ; then |
2879 | coroutine_backend=sigaltstack | |
519175a2 AB |
2880 | else |
2881 | echo | |
2882 | echo "Error: unknown coroutine backend $coroutine" | |
2883 | echo | |
2884 | exit 1 | |
d0e2fce5 AK |
2885 | fi |
2886 | ||
d2042378 AK |
2887 | ########################################## |
2888 | # check if we have open_by_handle_at | |
2889 | ||
4e1797f9 | 2890 | open_by_handle_at=no |
d2042378 AK |
2891 | cat > $TMPC << EOF |
2892 | #include <fcntl.h> | |
acc55ba8 SW |
2893 | #if !defined(AT_EMPTY_PATH) |
2894 | # error missing definition | |
2895 | #else | |
75cafad7 | 2896 | int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } |
acc55ba8 | 2897 | #endif |
d2042378 AK |
2898 | EOF |
2899 | if compile_prog "" "" ; then | |
2900 | open_by_handle_at=yes | |
2901 | fi | |
2902 | ||
e06a765e HPB |
2903 | ######################################## |
2904 | # check if we have linux/magic.h | |
2905 | ||
2906 | linux_magic_h=no | |
2907 | cat > $TMPC << EOF | |
2908 | #include <linux/magic.h> | |
2909 | int main(void) { | |
75cafad7 | 2910 | return 0; |
e06a765e HPB |
2911 | } |
2912 | EOF | |
2913 | if compile_prog "" "" ; then | |
2914 | linux_magic_h=yes | |
2915 | fi | |
2916 | ||
06d71fa1 PM |
2917 | ######################################## |
2918 | # check whether we can disable the -Wunused-but-set-variable | |
2919 | # option with a pragma (this is needed to silence a warning in | |
2920 | # some versions of the valgrind VALGRIND_STACK_DEREGISTER macro.) | |
2921 | # This test has to be compiled with -Werror as otherwise an | |
2922 | # unknown pragma is only a warning. | |
2923 | pragma_disable_unused_but_set=no | |
2924 | cat > $TMPC << EOF | |
2925 | #pragma GCC diagnostic ignored "-Wunused-but-set-variable" | |
2926 | int main(void) { | |
2927 | return 0; | |
2928 | } | |
2929 | EOF | |
2930 | if compile_prog "-Werror" "" ; then | |
2931 | pragma_disable_unused_but_set=yes | |
2932 | fi | |
2933 | ||
3f4349dc KW |
2934 | ######################################## |
2935 | # check if we have valgrind/valgrind.h | |
2936 | ||
2937 | valgrind_h=no | |
2938 | cat > $TMPC << EOF | |
2939 | #include <valgrind/valgrind.h> | |
3f4349dc | 2940 | int main(void) { |
3f4349dc KW |
2941 | return 0; |
2942 | } | |
2943 | EOF | |
2944 | if compile_prog "" "" ; then | |
2945 | valgrind_h=yes | |
2946 | fi | |
2947 | ||
8ab1bf12 LC |
2948 | ######################################## |
2949 | # check if environ is declared | |
2950 | ||
2951 | has_environ=no | |
2952 | cat > $TMPC << EOF | |
2953 | #include <unistd.h> | |
2954 | int main(void) { | |
c075a723 | 2955 | environ = 0; |
8ab1bf12 LC |
2956 | return 0; |
2957 | } | |
2958 | EOF | |
2959 | if compile_prog "" "" ; then | |
2960 | has_environ=yes | |
2961 | fi | |
2962 | ||
7e24e92a | 2963 | ########################################## |
e86ecd4b JQ |
2964 | # End of CC checks |
2965 | # After here, no more $cc or $ld runs | |
2966 | ||
e86ecd4b | 2967 | if test "$debug" = "no" ; then |
8be74dc0 | 2968 | CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS" |
e86ecd4b | 2969 | fi |
a316e378 | 2970 | |
20ff6c80 AL |
2971 | # Disable zero malloc errors for official releases unless explicitly told to |
2972 | # enable/disable | |
2973 | if test -z "$zero_malloc" ; then | |
2974 | if test "$z_version" = "50" ; then | |
2975 | zero_malloc="no" | |
2976 | else | |
2977 | zero_malloc="yes" | |
2978 | fi | |
2979 | fi | |
2980 | ||
6ca026cb PM |
2981 | # Now we've finished running tests it's OK to add -Werror to the compiler flags |
2982 | if test "$werror" = "yes"; then | |
2983 | QEMU_CFLAGS="-Werror $QEMU_CFLAGS" | |
2984 | fi | |
2985 | ||
e86ecd4b JQ |
2986 | if test "$solaris" = "no" ; then |
2987 | if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then | |
1156c669 | 2988 | LDFLAGS="-Wl,--warn-common $LDFLAGS" |
e86ecd4b JQ |
2989 | fi |
2990 | fi | |
2991 | ||
94dd53c5 GH |
2992 | # test if pod2man has --utf8 option |
2993 | if pod2man --help | grep -q utf8; then | |
2994 | POD2MAN="pod2man --utf8" | |
2995 | else | |
2996 | POD2MAN="pod2man" | |
2997 | fi | |
2998 | ||
952afb71 BS |
2999 | # Use ASLR, no-SEH and DEP if available |
3000 | if test "$mingw32" = "yes" ; then | |
3001 | for flag in --dynamicbase --no-seh --nxcompat; do | |
3002 | if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then | |
3003 | LDFLAGS="-Wl,$flag $LDFLAGS" | |
3004 | fi | |
3005 | done | |
3006 | fi | |
3007 | ||
10ea68b3 | 3008 | qemu_confdir=$sysconfdir$confsuffix |
528ae5b8 | 3009 | qemu_datadir=$datadir$confsuffix |
e7b45cc4 | 3010 | |
ca35f780 PB |
3011 | tools= |
3012 | if test "$softmmu" = yes ; then | |
3013 | tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" | |
983eef5a | 3014 | if test "$virtfs" != no ; then |
aabfd88d AF |
3015 | if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then |
3016 | virtfs=yes | |
3017 | tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)" | |
3018 | else | |
3019 | if test "$virtfs" = yes; then | |
263ddcc8 HPB |
3020 | echo "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel" |
3021 | exit 1 | |
983eef5a | 3022 | fi |
17500370 | 3023 | virtfs=no |
aabfd88d | 3024 | fi |
17bff52b | 3025 | fi |
ca35f780 PB |
3026 | if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then |
3027 | tools="qemu-nbd\$(EXESUF) $tools" | |
d138cee9 | 3028 | if [ "$guest_agent" = "yes" ]; then |
48ff7a62 | 3029 | tools="qemu-ga\$(EXESUF) $tools" |
d138cee9 | 3030 | fi |
ca35f780 PB |
3031 | fi |
3032 | fi | |
00c705fb PB |
3033 | if test "$smartcard_nss" = "yes" ; then |
3034 | tools="vscclient\$(EXESUF) $tools" | |
3035 | fi | |
ca35f780 PB |
3036 | |
3037 | # Mac OS X ships with a broken assembler | |
3038 | roms= | |
3039 | if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ | |
3040 | "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ | |
3041 | "$softmmu" = yes ; then | |
3042 | roms="optionrom" | |
3043 | fi | |
d0384d1d | 3044 | if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then |
39ac8455 DG |
3045 | roms="$roms spapr-rtas" |
3046 | fi | |
ca35f780 | 3047 | |
43ce4dfe | 3048 | echo "Install prefix $prefix" |
c00b2808 | 3049 | echo "BIOS directory `eval echo $qemu_datadir`" |
f2b9e1e3 | 3050 | echo "binary directory `eval echo $bindir`" |
3aa5d2be | 3051 | echo "library directory `eval echo $libdir`" |
0f94d6da | 3052 | echo "include directory `eval echo $includedir`" |
1c0fd160 | 3053 | echo "config directory `eval echo $sysconfdir`" |
11d9f695 | 3054 | if test "$mingw32" = "no" ; then |
f2b9e1e3 | 3055 | echo "Manual directory `eval echo $mandir`" |
43ce4dfe | 3056 | echo "ELF interp prefix $interp_prefix" |
11d9f695 | 3057 | fi |
5a67135a | 3058 | echo "Source path $source_path" |
43ce4dfe | 3059 | echo "C compiler $cc" |
83469015 | 3060 | echo "Host C compiler $host_cc" |
0c439cbf | 3061 | echo "CFLAGS $CFLAGS" |
a558ee17 | 3062 | echo "QEMU_CFLAGS $QEMU_CFLAGS" |
0c439cbf | 3063 | echo "LDFLAGS $LDFLAGS" |
43ce4dfe | 3064 | echo "make $make" |
6a882643 | 3065 | echo "install $install" |
c886edfb | 3066 | echo "python $python" |
e2d8830e BS |
3067 | if test "$slirp" = "yes" ; then |
3068 | echo "smbd $smbd" | |
3069 | fi | |
43ce4dfe | 3070 | echo "host CPU $cpu" |
de83cd02 | 3071 | echo "host big endian $bigendian" |
97a847bc | 3072 | echo "target list $target_list" |
ade25b0d | 3073 | echo "tcg debug enabled $debug_tcg" |
43ce4dfe | 3074 | echo "gprof enabled $gprof" |
03b4fe7d | 3075 | echo "sparse enabled $sparse" |
1625af87 | 3076 | echo "strip binaries $strip_opt" |
05c2a3e7 | 3077 | echo "profiler $profiler" |
43ce4dfe | 3078 | echo "static build $static" |
85aa5189 | 3079 | echo "-Werror enabled $werror" |
5b0753e0 FB |
3080 | if test "$darwin" = "yes" ; then |
3081 | echo "Cocoa support $cocoa" | |
3082 | fi | |
97a847bc | 3083 | echo "SDL support $sdl" |
4d3b6f6e | 3084 | echo "curses support $curses" |
769ce76d | 3085 | echo "curl support $curl" |
67b915a5 | 3086 | echo "mingw32 support $mingw32" |
0c58ac1c | 3087 | echo "Audio drivers $audio_drv_list" |
3088 | echo "Extra audio cards $audio_card_list" | |
eb852011 | 3089 | echo "Block whitelist $block_drv_whitelist" |
8ff9cbf7 | 3090 | echo "Mixer emulation $mixemu" |
983eef5a | 3091 | echo "VirtFS support $virtfs" |
821601ea JS |
3092 | echo "VNC support $vnc" |
3093 | if test "$vnc" = "yes" ; then | |
3094 | echo "VNC TLS support $vnc_tls" | |
3095 | echo "VNC SASL support $vnc_sasl" | |
3096 | echo "VNC JPEG support $vnc_jpeg" | |
3097 | echo "VNC PNG support $vnc_png" | |
821601ea | 3098 | fi |
3142255c BS |
3099 | if test -n "$sparc_cpu"; then |
3100 | echo "Target Sparc Arch $sparc_cpu" | |
3101 | fi | |
e37630ca | 3102 | echo "xen support $xen" |
2e4d9fb1 | 3103 | echo "brlapi support $brlapi" |
a20a6f46 | 3104 | echo "bluez support $bluez" |
a25dba17 | 3105 | echo "Documentation $docs" |
c5937220 PB |
3106 | [ ! -z "$uname_release" ] && \ |
3107 | echo "uname -r $uname_release" | |
bd0c5661 | 3108 | echo "NPTL support $nptl" |
379f6698 | 3109 | echo "GUEST_BASE $guest_base" |
40d6444e | 3110 | echo "PIE $pie" |
8a16d273 | 3111 | echo "vde support $vde" |
5c6c3a6c | 3112 | echo "Linux AIO support $linux_aio" |
758e8e38 | 3113 | echo "ATTR/XATTR support $attr" |
77755340 | 3114 | echo "Install blobs $blobs" |
b31a0277 | 3115 | echo "KVM support $kvm" |
9195b2c2 | 3116 | echo "TCG interpreter $tcg_interpreter" |
f652e6af | 3117 | echo "fdt support $fdt" |
ceb42de8 | 3118 | echo "preadv support $preadv" |
5f6b9e8f | 3119 | echo "fdatasync $fdatasync" |
e78815a5 AF |
3120 | echo "madvise $madvise" |
3121 | echo "posix_madvise $posix_madvise" | |
ee682d27 | 3122 | echo "uuid support $uuid" |
47e98658 | 3123 | echo "libcap-ng support $cap_ng" |
d5970055 | 3124 | echo "vhost-net support $vhost_net" |
94a420b1 | 3125 | echo "Trace backend $trace_backend" |
9410b56c | 3126 | echo "Trace output file $trace_file-<pid>" |
cd4ec0b4 | 3127 | echo "spice support $spice" |
f27aaf4b | 3128 | echo "rbd support $rbd" |
dce512de | 3129 | echo "xfsctl support $xfs" |
111a38b0 | 3130 | echo "nss used $smartcard_nss" |
69354a83 | 3131 | echo "usb net redir $usb_redir" |
20ff075b | 3132 | echo "OpenGL support $opengl" |
c589b249 | 3133 | echo "libiscsi support $libiscsi" |
d138cee9 | 3134 | echo "build guest agent $guest_agent" |
519175a2 | 3135 | echo "coroutine backend $coroutine_backend" |
67b915a5 | 3136 | |
1ba16968 | 3137 | if test "$sdl_too_old" = "yes"; then |
24b55b96 | 3138 | echo "-> Your SDL version is too old - please upgrade to have SDL support" |
7c1f25b4 | 3139 | fi |
7d13299d | 3140 | |
98ec69ac | 3141 | config_host_mak="config-host.mak" |
4bf6b55b | 3142 | config_host_ld="config-host.ld" |
98ec69ac | 3143 | |
98ec69ac JQ |
3144 | echo "# Automatically generated by configure - do not modify" > $config_host_mak |
3145 | printf "# Configured with:" >> $config_host_mak | |
3146 | printf " '%s'" "$0" "$@" >> $config_host_mak | |
3147 | echo >> $config_host_mak | |
98ec69ac | 3148 | |
e6c3b0f7 | 3149 | echo all: >> $config_host_mak |
99d7cc75 PB |
3150 | echo "prefix=$prefix" >> $config_host_mak |
3151 | echo "bindir=$bindir" >> $config_host_mak | |
3aa5d2be | 3152 | echo "libdir=$libdir" >> $config_host_mak |
0f94d6da | 3153 | echo "includedir=$includedir" >> $config_host_mak |
99d7cc75 | 3154 | echo "mandir=$mandir" >> $config_host_mak |
99d7cc75 | 3155 | echo "sysconfdir=$sysconfdir" >> $config_host_mak |
22d07038 | 3156 | echo "qemu_confdir=$qemu_confdir" >> $config_host_mak |
9afa52ce EH |
3157 | echo "qemu_datadir=$qemu_datadir" >> $config_host_mak |
3158 | echo "qemu_docdir=$qemu_docdir" >> $config_host_mak | |
7b93fadf | 3159 | echo "libexecdir=\${prefix}/libexec" >> $config_host_mak |
a7c36ee4 | 3160 | echo "CONFIG_QEMU_HELPERDIR=\"$prefix/libexec\"" >> $config_host_mak |
804edf29 | 3161 | |
98ec69ac | 3162 | echo "ARCH=$ARCH" >> $config_host_mak |
f8393946 | 3163 | if test "$debug_tcg" = "yes" ; then |
2358a494 | 3164 | echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak |
f8393946 | 3165 | fi |
f3d08ee6 | 3166 | if test "$debug" = "yes" ; then |
2358a494 | 3167 | echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak |
f3d08ee6 | 3168 | fi |
1625af87 | 3169 | if test "$strip_opt" = "yes" ; then |
52ba784d | 3170 | echo "STRIP=${strip}" >> $config_host_mak |
1625af87 | 3171 | fi |
7d13299d | 3172 | if test "$bigendian" = "yes" ; then |
e2542fe2 | 3173 | echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak |
97a847bc | 3174 | fi |
67b915a5 | 3175 | if test "$mingw32" = "yes" ; then |
98ec69ac | 3176 | echo "CONFIG_WIN32=y" >> $config_host_mak |
9fe6de94 BS |
3177 | rc_version=`cat $source_path/VERSION` |
3178 | version_major=${rc_version%%.*} | |
3179 | rc_version=${rc_version#*.} | |
3180 | version_minor=${rc_version%%.*} | |
3181 | rc_version=${rc_version#*.} | |
3182 | version_subminor=${rc_version%%.*} | |
3183 | version_micro=0 | |
3184 | echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak | |
3185 | echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak | |
210fa556 | 3186 | else |
35f4df27 | 3187 | echo "CONFIG_POSIX=y" >> $config_host_mak |
dffcb71c MM |
3188 | fi |
3189 | ||
3190 | if test "$linux" = "yes" ; then | |
3191 | echo "CONFIG_LINUX=y" >> $config_host_mak | |
67b915a5 | 3192 | fi |
128ab2ff | 3193 | |
83fb7adf | 3194 | if test "$darwin" = "yes" ; then |
98ec69ac | 3195 | echo "CONFIG_DARWIN=y" >> $config_host_mak |
83fb7adf | 3196 | fi |
b29fe3ed | 3197 | |
3198 | if test "$aix" = "yes" ; then | |
98ec69ac | 3199 | echo "CONFIG_AIX=y" >> $config_host_mak |
b29fe3ed | 3200 | fi |
3201 | ||
ec530c81 | 3202 | if test "$solaris" = "yes" ; then |
98ec69ac | 3203 | echo "CONFIG_SOLARIS=y" >> $config_host_mak |
2358a494 | 3204 | echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak |
0475a5ca | 3205 | if test "$needs_libsunmath" = "yes" ; then |
75b5a697 | 3206 | echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak |
0475a5ca | 3207 | fi |
ec530c81 | 3208 | fi |
179cf400 AF |
3209 | if test "$haiku" = "yes" ; then |
3210 | echo "CONFIG_HAIKU=y" >> $config_host_mak | |
3211 | fi | |
97a847bc | 3212 | if test "$static" = "yes" ; then |
98ec69ac | 3213 | echo "CONFIG_STATIC=y" >> $config_host_mak |
7d13299d | 3214 | fi |
1ba16968 | 3215 | if test "$profiler" = "yes" ; then |
2358a494 | 3216 | echo "CONFIG_PROFILER=y" >> $config_host_mak |
05c2a3e7 | 3217 | fi |
c20709aa | 3218 | if test "$slirp" = "yes" ; then |
98ec69ac | 3219 | echo "CONFIG_SLIRP=y" >> $config_host_mak |
e2d8830e | 3220 | echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak |
f9728943 | 3221 | QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES" |
c20709aa | 3222 | fi |
8a16d273 | 3223 | if test "$vde" = "yes" ; then |
98ec69ac | 3224 | echo "CONFIG_VDE=y" >> $config_host_mak |
8a16d273 | 3225 | fi |
47e98658 CB |
3226 | if test "$cap_ng" = "yes" ; then |
3227 | echo "CONFIG_LIBCAP=y" >> $config_host_mak | |
3228 | fi | |
0c58ac1c | 3229 | for card in $audio_card_list; do |
bb55b712 | 3230 | def=CONFIG_`echo $card | LC_ALL=C tr '[a-z]' '[A-Z]'` |
98ec69ac | 3231 | echo "$def=y" >> $config_host_mak |
0c58ac1c | 3232 | done |
2358a494 | 3233 | echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak |
0c58ac1c | 3234 | for drv in $audio_drv_list; do |
bb55b712 | 3235 | def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'` |
98ec69ac | 3236 | echo "$def=y" >> $config_host_mak |
923e4521 | 3237 | if test "$drv" = "fmod"; then |
7aac6cb1 | 3238 | echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak |
0c58ac1c | 3239 | fi |
3240 | done | |
67f86e8e JQ |
3241 | if test "$audio_pt_int" = "yes" ; then |
3242 | echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak | |
3243 | fi | |
d5631638 | 3244 | if test "$audio_win_int" = "yes" ; then |
3245 | echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak | |
3246 | fi | |
eb852011 | 3247 | echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak |
8ff9cbf7 | 3248 | if test "$mixemu" = "yes" ; then |
98ec69ac | 3249 | echo "CONFIG_MIXEMU=y" >> $config_host_mak |
8ff9cbf7 | 3250 | fi |
821601ea JS |
3251 | if test "$vnc" = "yes" ; then |
3252 | echo "CONFIG_VNC=y" >> $config_host_mak | |
3253 | fi | |
8d5d2d4c | 3254 | if test "$vnc_tls" = "yes" ; then |
98ec69ac | 3255 | echo "CONFIG_VNC_TLS=y" >> $config_host_mak |
525061bf | 3256 | echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak |
8d5d2d4c | 3257 | fi |
2f9606b3 | 3258 | if test "$vnc_sasl" = "yes" ; then |
98ec69ac | 3259 | echo "CONFIG_VNC_SASL=y" >> $config_host_mak |
60ddf533 | 3260 | echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak |
2f9606b3 | 3261 | fi |
821601ea | 3262 | if test "$vnc_jpeg" = "yes" ; then |
2f6f5c7a CC |
3263 | echo "CONFIG_VNC_JPEG=y" >> $config_host_mak |
3264 | echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak | |
3265 | fi | |
821601ea | 3266 | if test "$vnc_png" = "yes" ; then |
efe556ad CC |
3267 | echo "CONFIG_VNC_PNG=y" >> $config_host_mak |
3268 | echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak | |
3269 | fi | |
76655d6d | 3270 | if test "$fnmatch" = "yes" ; then |
2358a494 | 3271 | echo "CONFIG_FNMATCH=y" >> $config_host_mak |
76655d6d | 3272 | fi |
ee682d27 SW |
3273 | if test "$uuid" = "yes" ; then |
3274 | echo "CONFIG_UUID=y" >> $config_host_mak | |
3275 | fi | |
dce512de CH |
3276 | if test "$xfs" = "yes" ; then |
3277 | echo "CONFIG_XFS=y" >> $config_host_mak | |
3278 | fi | |
b1a550a0 | 3279 | qemu_version=`head $source_path/VERSION` |
98ec69ac | 3280 | echo "VERSION=$qemu_version" >>$config_host_mak |
2358a494 | 3281 | echo "PKGVERSION=$pkgversion" >>$config_host_mak |
98ec69ac | 3282 | echo "SRC_PATH=$source_path" >> $config_host_mak |
98ec69ac | 3283 | echo "TARGET_DIRS=$target_list" >> $config_host_mak |
a25dba17 | 3284 | if [ "$docs" = "yes" ] ; then |
98ec69ac | 3285 | echo "BUILD_DOCS=yes" >> $config_host_mak |
cc8ae6de | 3286 | fi |
1ac88f28 | 3287 | if test "$sdl" = "yes" ; then |
98ec69ac | 3288 | echo "CONFIG_SDL=y" >> $config_host_mak |
1ac88f28 | 3289 | echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak |
49ecc3fa FB |
3290 | fi |
3291 | if test "$cocoa" = "yes" ; then | |
98ec69ac | 3292 | echo "CONFIG_COCOA=y" >> $config_host_mak |
4d3b6f6e AZ |
3293 | fi |
3294 | if test "$curses" = "yes" ; then | |
98ec69ac | 3295 | echo "CONFIG_CURSES=y" >> $config_host_mak |
49ecc3fa | 3296 | fi |
3b3f24ad | 3297 | if test "$atfile" = "yes" ; then |
2358a494 | 3298 | echo "CONFIG_ATFILE=y" >> $config_host_mak |
3b3f24ad | 3299 | fi |
ebc996f3 | 3300 | if test "$utimens" = "yes" ; then |
2358a494 | 3301 | echo "CONFIG_UTIMENSAT=y" >> $config_host_mak |
ebc996f3 | 3302 | fi |
099d6b0f | 3303 | if test "$pipe2" = "yes" ; then |
2358a494 | 3304 | echo "CONFIG_PIPE2=y" >> $config_host_mak |
099d6b0f | 3305 | fi |
40ff6d7e KW |
3306 | if test "$accept4" = "yes" ; then |
3307 | echo "CONFIG_ACCEPT4=y" >> $config_host_mak | |
3308 | fi | |
3ce34dfb | 3309 | if test "$splice" = "yes" ; then |
2358a494 | 3310 | echo "CONFIG_SPLICE=y" >> $config_host_mak |
3ce34dfb | 3311 | fi |
c2882b96 RV |
3312 | if test "$eventfd" = "yes" ; then |
3313 | echo "CONFIG_EVENTFD=y" >> $config_host_mak | |
3314 | fi | |
d0927938 UH |
3315 | if test "$fallocate" = "yes" ; then |
3316 | echo "CONFIG_FALLOCATE=y" >> $config_host_mak | |
3317 | fi | |
c727f47d PM |
3318 | if test "$sync_file_range" = "yes" ; then |
3319 | echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak | |
3320 | fi | |
dace20dc PM |
3321 | if test "$fiemap" = "yes" ; then |
3322 | echo "CONFIG_FIEMAP=y" >> $config_host_mak | |
3323 | fi | |
d0927938 UH |
3324 | if test "$dup3" = "yes" ; then |
3325 | echo "CONFIG_DUP3=y" >> $config_host_mak | |
3326 | fi | |
3b6edd16 PM |
3327 | if test "$epoll" = "yes" ; then |
3328 | echo "CONFIG_EPOLL=y" >> $config_host_mak | |
3329 | fi | |
3330 | if test "$epoll_create1" = "yes" ; then | |
3331 | echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak | |
3332 | fi | |
3333 | if test "$epoll_pwait" = "yes" ; then | |
3334 | echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak | |
3335 | fi | |
3b3f24ad | 3336 | if test "$inotify" = "yes" ; then |
2358a494 | 3337 | echo "CONFIG_INOTIFY=y" >> $config_host_mak |
3b3f24ad | 3338 | fi |
c05c7a73 RV |
3339 | if test "$inotify1" = "yes" ; then |
3340 | echo "CONFIG_INOTIFY1=y" >> $config_host_mak | |
3341 | fi | |
6ae9a1f4 JQ |
3342 | if test "$byteswap_h" = "yes" ; then |
3343 | echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak | |
3344 | fi | |
3345 | if test "$bswap_h" = "yes" ; then | |
3346 | echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak | |
3347 | fi | |
769ce76d | 3348 | if test "$curl" = "yes" ; then |
98ec69ac | 3349 | echo "CONFIG_CURL=y" >> $config_host_mak |
b1d5a277 | 3350 | echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak |
769ce76d | 3351 | fi |
2e4d9fb1 | 3352 | if test "$brlapi" = "yes" ; then |
98ec69ac | 3353 | echo "CONFIG_BRLAPI=y" >> $config_host_mak |
2e4d9fb1 | 3354 | fi |
fb599c9a | 3355 | if test "$bluez" = "yes" ; then |
98ec69ac | 3356 | echo "CONFIG_BLUEZ=y" >> $config_host_mak |
ef7635ec | 3357 | echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak |
fb599c9a | 3358 | fi |
e18df141 | 3359 | echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak |
e37630ca | 3360 | if test "$xen" = "yes" ; then |
6dbd588a | 3361 | echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak |
d5b93ddf | 3362 | echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak |
e37630ca | 3363 | fi |
5c6c3a6c CH |
3364 | if test "$linux_aio" = "yes" ; then |
3365 | echo "CONFIG_LINUX_AIO=y" >> $config_host_mak | |
3366 | fi | |
758e8e38 VJ |
3367 | if test "$attr" = "yes" ; then |
3368 | echo "CONFIG_ATTR=y" >> $config_host_mak | |
3369 | fi | |
4f26f2b6 AK |
3370 | if test "$libattr" = "yes" ; then |
3371 | echo "CONFIG_LIBATTR=y" >> $config_host_mak | |
3372 | fi | |
983eef5a MI |
3373 | if test "$virtfs" = "yes" ; then |
3374 | echo "CONFIG_VIRTFS=y" >> $config_host_mak | |
758e8e38 | 3375 | fi |
77755340 | 3376 | if test "$blobs" = "yes" ; then |
98ec69ac | 3377 | echo "INSTALL_BLOBS=yes" >> $config_host_mak |
77755340 | 3378 | fi |
bf9298b9 | 3379 | if test "$iovec" = "yes" ; then |
2358a494 | 3380 | echo "CONFIG_IOVEC=y" >> $config_host_mak |
bf9298b9 | 3381 | fi |
ceb42de8 | 3382 | if test "$preadv" = "yes" ; then |
2358a494 | 3383 | echo "CONFIG_PREADV=y" >> $config_host_mak |
ceb42de8 | 3384 | fi |
f652e6af | 3385 | if test "$fdt" = "yes" ; then |
3f0855b1 | 3386 | echo "CONFIG_FDT=y" >> $config_host_mak |
f652e6af | 3387 | fi |
dcc38d1c MT |
3388 | if test "$signalfd" = "yes" ; then |
3389 | echo "CONFIG_SIGNALFD=y" >> $config_host_mak | |
3390 | fi | |
9195b2c2 SW |
3391 | if test "$tcg_interpreter" = "yes" ; then |
3392 | echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak | |
3393 | fi | |
5f6b9e8f BS |
3394 | if test "$fdatasync" = "yes" ; then |
3395 | echo "CONFIG_FDATASYNC=y" >> $config_host_mak | |
3396 | fi | |
e78815a5 AF |
3397 | if test "$madvise" = "yes" ; then |
3398 | echo "CONFIG_MADVISE=y" >> $config_host_mak | |
3399 | fi | |
3400 | if test "$posix_madvise" = "yes" ; then | |
3401 | echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak | |
3402 | fi | |
97a847bc | 3403 | |
cd4ec0b4 GH |
3404 | if test "$spice" = "yes" ; then |
3405 | echo "CONFIG_SPICE=y" >> $config_host_mak | |
3406 | fi | |
36707144 AL |
3407 | |
3408 | if test "$smartcard" = "yes" ; then | |
3409 | echo "CONFIG_SMARTCARD=y" >> $config_host_mak | |
3410 | fi | |
cd4ec0b4 | 3411 | |
111a38b0 RR |
3412 | if test "$smartcard_nss" = "yes" ; then |
3413 | echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak | |
ad4cf3f6 PB |
3414 | echo "libcacard_libs=$libcacard_libs" >> $config_host_mak |
3415 | echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak | |
111a38b0 RR |
3416 | fi |
3417 | ||
69354a83 HG |
3418 | if test "$usb_redir" = "yes" ; then |
3419 | echo "CONFIG_USB_REDIR=y" >> $config_host_mak | |
3420 | fi | |
3421 | ||
20ff075b MW |
3422 | if test "$opengl" = "yes" ; then |
3423 | echo "CONFIG_OPENGL=y" >> $config_host_mak | |
3424 | fi | |
3425 | ||
c589b249 RS |
3426 | if test "$libiscsi" = "yes" ; then |
3427 | echo "CONFIG_LIBISCSI=y" >> $config_host_mak | |
3428 | fi | |
3429 | ||
83fb7adf | 3430 | # XXX: suppress that |
7d3505c5 | 3431 | if [ "$bsd" = "yes" ] ; then |
2358a494 | 3432 | echo "CONFIG_BSD=y" >> $config_host_mak |
7d3505c5 FB |
3433 | fi |
3434 | ||
2358a494 | 3435 | echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak |
c5937220 | 3436 | |
20ff6c80 AL |
3437 | if test "$zero_malloc" = "yes" ; then |
3438 | echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak | |
3439 | fi | |
f27aaf4b CB |
3440 | if test "$rbd" = "yes" ; then |
3441 | echo "CONFIG_RBD=y" >> $config_host_mak | |
d0e2fce5 AK |
3442 | fi |
3443 | ||
519175a2 | 3444 | if test "$coroutine_backend" = "ucontext" ; then |
d0e2fce5 | 3445 | echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak |
fe91bfa8 AB |
3446 | elif test "$coroutine_backend" = "sigaltstack" ; then |
3447 | echo "CONFIG_SIGALTSTACK_COROUTINE=y" >> $config_host_mak | |
f27aaf4b | 3448 | fi |
20ff6c80 | 3449 | |
d2042378 AK |
3450 | if test "$open_by_handle_at" = "yes" ; then |
3451 | echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak | |
3452 | fi | |
3453 | ||
e06a765e HPB |
3454 | if test "$linux_magic_h" = "yes" ; then |
3455 | echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak | |
8ab1bf12 LC |
3456 | fi |
3457 | ||
06d71fa1 PM |
3458 | if test "$pragma_disable_unused_but_set" = "yes" ; then |
3459 | echo "CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET=y" >> $config_host_mak | |
3460 | fi | |
3461 | ||
3f4349dc KW |
3462 | if test "$valgrind_h" = "yes" ; then |
3463 | echo "CONFIG_VALGRIND_H=y" >> $config_host_mak | |
3464 | fi | |
3465 | ||
8ab1bf12 LC |
3466 | if test "$has_environ" = "yes" ; then |
3467 | echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak | |
e06a765e HPB |
3468 | fi |
3469 | ||
68063649 BS |
3470 | # USB host support |
3471 | case "$usb" in | |
3472 | linux) | |
98ec69ac | 3473 | echo "HOST_USB=linux" >> $config_host_mak |
68063649 BS |
3474 | ;; |
3475 | bsd) | |
98ec69ac | 3476 | echo "HOST_USB=bsd" >> $config_host_mak |
68063649 BS |
3477 | ;; |
3478 | *) | |
98ec69ac | 3479 | echo "HOST_USB=stub" >> $config_host_mak |
68063649 BS |
3480 | ;; |
3481 | esac | |
3482 | ||
e4858974 LV |
3483 | # use default implementation for tracing backend-specific routines |
3484 | trace_default=yes | |
94a420b1 | 3485 | echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak |
6d8a764e LV |
3486 | if test "$trace_backend" = "nop"; then |
3487 | echo "CONFIG_TRACE_NOP=y" >> $config_host_mak | |
22890ab5 | 3488 | fi |
9410b56c | 3489 | if test "$trace_backend" = "simple"; then |
6d8a764e | 3490 | echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak |
e4858974 | 3491 | trace_default=no |
6d8a764e | 3492 | # Set the appropriate trace file. |
953ffe0f | 3493 | trace_file="\"$trace_file-\" FMT_pid" |
9410b56c | 3494 | fi |
6d8a764e LV |
3495 | if test "$trace_backend" = "stderr"; then |
3496 | echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak | |
9a82b6a5 | 3497 | trace_default=no |
6d8a764e LV |
3498 | fi |
3499 | if test "$trace_backend" = "ust"; then | |
3500 | echo "CONFIG_TRACE_UST=y" >> $config_host_mak | |
3501 | fi | |
3502 | if test "$trace_backend" = "dtrace"; then | |
3503 | echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak | |
3504 | if test "$trace_backend_stap" = "yes" ; then | |
3505 | echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak | |
3506 | fi | |
c276b17d | 3507 | fi |
9410b56c | 3508 | echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak |
e4858974 LV |
3509 | if test "$trace_default" = "yes"; then |
3510 | echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak | |
3511 | fi | |
9410b56c | 3512 | |
98ec69ac | 3513 | echo "TOOLS=$tools" >> $config_host_mak |
98ec69ac | 3514 | echo "ROMS=$roms" >> $config_host_mak |
804edf29 JQ |
3515 | echo "MAKE=$make" >> $config_host_mak |
3516 | echo "INSTALL=$install" >> $config_host_mak | |
1901cb14 BS |
3517 | echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak |
3518 | echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak | |
3519 | echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak | |
c886edfb | 3520 | echo "PYTHON=$python" >> $config_host_mak |
804edf29 | 3521 | echo "CC=$cc" >> $config_host_mak |
2b2e59e6 | 3522 | echo "CC_I386=$cc_i386" >> $config_host_mak |
804edf29 | 3523 | echo "HOST_CC=$host_cc" >> $config_host_mak |
804edf29 JQ |
3524 | echo "AR=$ar" >> $config_host_mak |
3525 | echo "OBJCOPY=$objcopy" >> $config_host_mak | |
3526 | echo "LD=$ld" >> $config_host_mak | |
9fe6de94 | 3527 | echo "WINDRES=$windres" >> $config_host_mak |
44dc0ca3 | 3528 | echo "LIBTOOL=$libtool" >> $config_host_mak |
e2a2ed06 | 3529 | echo "CFLAGS=$CFLAGS" >> $config_host_mak |
a558ee17 | 3530 | echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak |
f9728943 | 3531 | echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak |
e39f0062 PB |
3532 | if test "$sparse" = "yes" ; then |
3533 | echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak | |
3534 | echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak | |
3535 | echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak | |
3536 | fi | |
c81da56e | 3537 | echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak |
e2a2ed06 | 3538 | echo "LDFLAGS=$LDFLAGS" >> $config_host_mak |
a36abbbb JQ |
3539 | echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak |
3540 | echo "ARLIBS_END=$arlibs_end" >> $config_host_mak | |
73da375e | 3541 | echo "LIBS+=$LIBS" >> $config_host_mak |
3e2e0e6b | 3542 | echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak |
804edf29 | 3543 | echo "EXESUF=$EXESUF" >> $config_host_mak |
957f1f99 | 3544 | echo "LIBS_QGA+=$libs_qga" >> $config_host_mak |
94dd53c5 | 3545 | echo "POD2MAN=$POD2MAN" >> $config_host_mak |
804edf29 | 3546 | |
4bf6b55b JQ |
3547 | # generate list of library paths for linker script |
3548 | ||
3549 | $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} | |
3550 | ||
3551 | if test -f ${config_host_ld}~ ; then | |
3552 | if cmp -s $config_host_ld ${config_host_ld}~ ; then | |
3553 | mv ${config_host_ld}~ $config_host_ld | |
3554 | else | |
3555 | rm ${config_host_ld}~ | |
3556 | fi | |
3557 | fi | |
3558 | ||
4d904533 | 3559 | for d in libdis libdis-user; do |
72b8b5a1 | 3560 | symlink "$source_path/Makefile.dis" "$d/Makefile" |
4d904533 BS |
3561 | echo > $d/config.mak |
3562 | done | |
3563 | ||
6efd7517 PM |
3564 | # use included Linux headers |
3565 | if test "$linux" = "yes" ; then | |
a307beb6 | 3566 | mkdir -p linux-headers |
6efd7517 PM |
3567 | case "$cpu" in |
3568 | i386|x86_64) | |
08312a63 | 3569 | linux_arch=x86 |
6efd7517 PM |
3570 | ;; |
3571 | ppcemb|ppc|ppc64) | |
08312a63 | 3572 | linux_arch=powerpc |
6efd7517 PM |
3573 | ;; |
3574 | s390x) | |
08312a63 PM |
3575 | linux_arch=s390 |
3576 | ;; | |
3577 | *) | |
3578 | # For most CPUs the kernel architecture name and QEMU CPU name match. | |
3579 | linux_arch="$cpu" | |
6efd7517 PM |
3580 | ;; |
3581 | esac | |
08312a63 PM |
3582 | # For non-KVM architectures we will not have asm headers |
3583 | if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then | |
3584 | symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm | |
3585 | fi | |
6efd7517 PM |
3586 | fi |
3587 | ||
1d14ffa9 | 3588 | for target in $target_list; do |
97a847bc | 3589 | target_dir="$target" |
25be210f | 3590 | config_target_mak=$target_dir/config-target.mak |
600309b6 | 3591 | target_arch2=`echo $target | cut -d '-' -f 1` |
97a847bc | 3592 | target_bigendian="no" |
1f3d3c8f | 3593 | |
ea2d6a39 | 3594 | case "$target_arch2" in |
e67db06e | 3595 | armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) |
ea2d6a39 JQ |
3596 | target_bigendian=yes |
3597 | ;; | |
3598 | esac | |
97a847bc | 3599 | target_softmmu="no" |
997344f3 | 3600 | target_user_only="no" |
831b7825 | 3601 | target_linux_user="no" |
84778508 | 3602 | target_bsd_user="no" |
9e407a85 | 3603 | case "$target" in |
600309b6 | 3604 | ${target_arch2}-softmmu) |
9e407a85 PB |
3605 | target_softmmu="yes" |
3606 | ;; | |
600309b6 | 3607 | ${target_arch2}-linux-user) |
9c7a4202 BS |
3608 | if test "$linux" != "yes" ; then |
3609 | echo "ERROR: Target '$target' is only available on a Linux host" | |
3610 | exit 1 | |
3611 | fi | |
9e407a85 PB |
3612 | target_user_only="yes" |
3613 | target_linux_user="yes" | |
3614 | ;; | |
600309b6 | 3615 | ${target_arch2}-bsd-user) |
9cf55765 | 3616 | if test "$bsd" != "yes" ; then |
9c7a4202 BS |
3617 | echo "ERROR: Target '$target' is only available on a BSD host" |
3618 | exit 1 | |
3619 | fi | |
84778508 BS |
3620 | target_user_only="yes" |
3621 | target_bsd_user="yes" | |
3622 | ;; | |
9e407a85 PB |
3623 | *) |
3624 | echo "ERROR: Target '$target' not recognised" | |
3625 | exit 1 | |
3626 | ;; | |
3627 | esac | |
831b7825 | 3628 | |
97a847bc | 3629 | mkdir -p $target_dir |
25be210f | 3630 | echo "# Automatically generated by configure - do not modify" > $config_target_mak |
de83cd02 | 3631 | |
e5fe0c52 | 3632 | bflt="no" |
bd0c5661 | 3633 | target_nptl="no" |
600309b6 | 3634 | interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` |
56aebc89 | 3635 | gdb_xml_files="" |
c2e3dee6 LV |
3636 | target_short_alignment=2 |
3637 | target_int_alignment=4 | |
3638 | target_long_alignment=4 | |
3639 | target_llong_alignment=8 | |
de3a354a | 3640 | target_libs_softmmu= |
7ba1e619 | 3641 | |
938b1edd | 3642 | TARGET_ARCH="$target_arch2" |
6acff7da | 3643 | TARGET_BASE_ARCH="" |
e6e91b9c | 3644 | TARGET_ABI_DIR="" |
e73aae67 | 3645 | |
600309b6 | 3646 | case "$target_arch2" in |
2408a527 | 3647 | i386) |
71deff27 | 3648 | target_phys_bits=64 |
2408a527 AJ |
3649 | ;; |
3650 | x86_64) | |
6acff7da | 3651 | TARGET_BASE_ARCH=i386 |
1ad2134f | 3652 | target_phys_bits=64 |
c2e3dee6 | 3653 | target_long_alignment=8 |
2408a527 AJ |
3654 | ;; |
3655 | alpha) | |
1ad2134f | 3656 | target_phys_bits=64 |
c2e3dee6 | 3657 | target_long_alignment=8 |
a4b388ff | 3658 | target_nptl="yes" |
2408a527 AJ |
3659 | ;; |
3660 | arm|armeb) | |
b498c8a0 | 3661 | TARGET_ARCH=arm |
2408a527 | 3662 | bflt="yes" |
bd0c5661 | 3663 | target_nptl="yes" |
56aebc89 | 3664 | gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" |
3cc0cd61 | 3665 | target_phys_bits=64 |
c2e3dee6 | 3666 | target_llong_alignment=4 |
412beee6 | 3667 | target_libs_softmmu="$fdt_libs" |
2408a527 AJ |
3668 | ;; |
3669 | cris) | |
253bd7f8 | 3670 | target_nptl="yes" |
1ad2134f | 3671 | target_phys_bits=32 |
2408a527 | 3672 | ;; |
613a22c9 MW |
3673 | lm32) |
3674 | target_phys_bits=32 | |
de3a354a | 3675 | target_libs_softmmu="$opengl_libs" |
613a22c9 | 3676 | ;; |
2408a527 | 3677 | m68k) |
2408a527 | 3678 | bflt="yes" |
56aebc89 | 3679 | gdb_xml_files="cf-core.xml cf-fp.xml" |
1ad2134f | 3680 | target_phys_bits=32 |
c2e3dee6 LV |
3681 | target_int_alignment=2 |
3682 | target_long_alignment=2 | |
3683 | target_llong_alignment=2 | |
2408a527 | 3684 | ;; |
877fdc12 EI |
3685 | microblaze|microblazeel) |
3686 | TARGET_ARCH=microblaze | |
72b675ca EI |
3687 | bflt="yes" |
3688 | target_nptl="yes" | |
3689 | target_phys_bits=32 | |
de3a354a | 3690 | target_libs_softmmu="$fdt_libs" |
72b675ca | 3691 | ;; |
0adcffb1 | 3692 | mips|mipsel) |
b498c8a0 | 3693 | TARGET_ARCH=mips |
25be210f | 3694 | echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak |
f04dc72f | 3695 | target_nptl="yes" |
1ad2134f | 3696 | target_phys_bits=64 |
2408a527 AJ |
3697 | ;; |
3698 | mipsn32|mipsn32el) | |
b498c8a0 | 3699 | TARGET_ARCH=mipsn32 |
6acff7da | 3700 | TARGET_BASE_ARCH=mips |
25be210f | 3701 | echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak |
1ad2134f | 3702 | target_phys_bits=64 |
2408a527 AJ |
3703 | ;; |
3704 | mips64|mips64el) | |
b498c8a0 | 3705 | TARGET_ARCH=mips64 |
6acff7da | 3706 | TARGET_BASE_ARCH=mips |
25be210f | 3707 | echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak |
1ad2134f | 3708 | target_phys_bits=64 |
c2e3dee6 | 3709 | target_long_alignment=8 |
2408a527 | 3710 | ;; |
e67db06e JL |
3711 | or32) |
3712 | TARGET_ARCH=openrisc | |
3713 | TARGET_BASE_ARCH=openrisc | |
3714 | target_phys_bits=32 | |
3715 | ;; | |
2408a527 | 3716 | ppc) |
c8b3532d | 3717 | gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" |
8b242eba | 3718 | target_phys_bits=64 |
d6630708 | 3719 | target_nptl="yes" |
de3a354a | 3720 | target_libs_softmmu="$fdt_libs" |
2408a527 AJ |
3721 | ;; |
3722 | ppcemb) | |
6acff7da | 3723 | TARGET_BASE_ARCH=ppc |
e6e91b9c | 3724 | TARGET_ABI_DIR=ppc |
c8b3532d | 3725 | gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" |
1ad2134f | 3726 | target_phys_bits=64 |
d6630708 | 3727 | target_nptl="yes" |
de3a354a | 3728 | target_libs_softmmu="$fdt_libs" |
2408a527 AJ |
3729 | ;; |
3730 | ppc64) | |
6acff7da | 3731 | TARGET_BASE_ARCH=ppc |
e6e91b9c | 3732 | TARGET_ABI_DIR=ppc |
c8b3532d | 3733 | gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" |
1ad2134f | 3734 | target_phys_bits=64 |
c2e3dee6 | 3735 | target_long_alignment=8 |
de3a354a | 3736 | target_libs_softmmu="$fdt_libs" |
2408a527 AJ |
3737 | ;; |
3738 | ppc64abi32) | |
b498c8a0 | 3739 | TARGET_ARCH=ppc64 |
6acff7da | 3740 | TARGET_BASE_ARCH=ppc |
e6e91b9c | 3741 | TARGET_ABI_DIR=ppc |
25be210f | 3742 | echo "TARGET_ABI32=y" >> $config_target_mak |
c8b3532d | 3743 | gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" |
1ad2134f | 3744 | target_phys_bits=64 |
de3a354a | 3745 | target_libs_softmmu="$fdt_libs" |
2408a527 AJ |
3746 | ;; |
3747 | sh4|sh4eb) | |
b498c8a0 | 3748 | TARGET_ARCH=sh4 |
2408a527 | 3749 | bflt="yes" |
0b6d3ae0 | 3750 | target_nptl="yes" |
1ad2134f | 3751 | target_phys_bits=32 |
2408a527 AJ |
3752 | ;; |
3753 | sparc) | |
1ad2134f | 3754 | target_phys_bits=64 |
2408a527 AJ |
3755 | ;; |
3756 | sparc64) | |
6acff7da | 3757 | TARGET_BASE_ARCH=sparc |
1ad2134f | 3758 | target_phys_bits=64 |
c2e3dee6 | 3759 | target_long_alignment=8 |
2408a527 AJ |
3760 | ;; |
3761 | sparc32plus) | |
b498c8a0 | 3762 | TARGET_ARCH=sparc64 |
6acff7da | 3763 | TARGET_BASE_ARCH=sparc |
e6e91b9c | 3764 | TARGET_ABI_DIR=sparc |
25be210f | 3765 | echo "TARGET_ABI32=y" >> $config_target_mak |
1ad2134f | 3766 | target_phys_bits=64 |
2408a527 | 3767 | ;; |
24e804ec | 3768 | s390x) |
bc434676 | 3769 | target_nptl="yes" |
24e804ec | 3770 | target_phys_bits=64 |
7b3da903 | 3771 | target_long_alignment=8 |
24e804ec | 3772 | ;; |
d2fbca94 GX |
3773 | unicore32) |
3774 | target_phys_bits=32 | |
3775 | ;; | |
cfa550c6 MF |
3776 | xtensa|xtensaeb) |
3777 | TARGET_ARCH=xtensa | |
3778 | target_phys_bits=32 | |
3779 | ;; | |
2408a527 AJ |
3780 | *) |
3781 | echo "Unsupported target CPU" | |
3782 | exit 1 | |
3783 | ;; | |
3784 | esac | |
5e8861a0 PB |
3785 | # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH |
3786 | if [ "$TARGET_BASE_ARCH" = "" ]; then | |
3787 | TARGET_BASE_ARCH=$TARGET_ARCH | |
3788 | fi | |
3789 | ||
5e8861a0 PB |
3790 | symlink "$source_path/Makefile.target" "$target_dir/Makefile" |
3791 | ||
0184e266 BS |
3792 | |
3793 | case "$target_arch2" in | |
92fc4b58 | 3794 | alpha | i386 | or32 | sparc* | x86_64 | xtensa* | ppc*) |
0184e266 BS |
3795 | echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak |
3796 | ;; | |
3797 | esac | |
3798 | ||
c2e3dee6 LV |
3799 | echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak |
3800 | echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak | |
3801 | echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak | |
3802 | echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak | |
25be210f | 3803 | echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak |
bb55b712 | 3804 | target_arch_name="`echo $TARGET_ARCH | LC_ALL=C tr '[a-z]' '[A-Z]'`" |
25be210f JQ |
3805 | echo "TARGET_$target_arch_name=y" >> $config_target_mak |
3806 | echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak | |
25be210f | 3807 | echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak |
e6e91b9c JQ |
3808 | if [ "$TARGET_ABI_DIR" = "" ]; then |
3809 | TARGET_ABI_DIR=$TARGET_ARCH | |
3810 | fi | |
25be210f | 3811 | echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak |
1b0c87fc JQ |
3812 | case "$target_arch2" in |
3813 | i386|x86_64) | |
3814 | if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then | |
64b3cfdb | 3815 | target_phys_bits=64 |
25be210f | 3816 | echo "CONFIG_XEN=y" >> $config_target_mak |
eb6fda0f AP |
3817 | if test "$xen_pci_passthrough" = yes; then |
3818 | echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" | |
3819 | fi | |
59d21e53 AG |
3820 | else |
3821 | echo "CONFIG_NO_XEN=y" >> $config_target_mak | |
1b0c87fc | 3822 | fi |
59d21e53 AG |
3823 | ;; |
3824 | *) | |
3825 | echo "CONFIG_NO_XEN=y" >> $config_target_mak | |
1b0c87fc | 3826 | esac |
c59249f9 | 3827 | case "$target_arch2" in |
0e60a699 | 3828 | i386|x86_64|ppcemb|ppc|ppc64|s390x) |
c59249f9 JQ |
3829 | # Make sure the target and host cpus are compatible |
3830 | if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ | |
3831 | \( "$target_arch2" = "$cpu" -o \ | |
3832 | \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ | |
5f114bc6 | 3833 | \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ |
adf82011 RR |
3834 | \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \ |
3835 | \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ | |
c59249f9 JQ |
3836 | \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ |
3837 | \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then | |
25be210f | 3838 | echo "CONFIG_KVM=y" >> $config_target_mak |
1ba16968 | 3839 | if test "$vhost_net" = "yes" ; then |
d5970055 MT |
3840 | echo "CONFIG_VHOST_NET=y" >> $config_target_mak |
3841 | fi | |
c59249f9 JQ |
3842 | fi |
3843 | esac | |
fae001f5 WC |
3844 | case "$target_arch2" in |
3845 | i386|x86_64) | |
3846 | echo "CONFIG_HAVE_GET_MEMORY_MAPPING=y" >> $config_target_mak | |
3847 | esac | |
7f762366 | 3848 | if test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then |
0a6b8dde AG |
3849 | echo "CONFIG_PSERIES=y" >> $config_target_mak |
3850 | fi | |
de83cd02 | 3851 | if test "$target_bigendian" = "yes" ; then |
25be210f | 3852 | echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak |
de83cd02 | 3853 | fi |
97a847bc | 3854 | if test "$target_softmmu" = "yes" ; then |
b1aa27c4 | 3855 | echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak |
25be210f | 3856 | echo "CONFIG_SOFTMMU=y" >> $config_target_mak |
de3a354a | 3857 | echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak |
0e8c9214 | 3858 | echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak |
5791f45b | 3859 | echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak |
ad4cf3f6 PB |
3860 | if test "$smartcard_nss" = "yes" ; then |
3861 | echo "subdir-$target: subdir-libcacard" >> $config_host_mak | |
3862 | fi | |
9fecbed0 WC |
3863 | case "$target_arch2" in |
3864 | i386|x86_64) | |
3865 | echo "CONFIG_HAVE_CORE_DUMP=y" >> $config_target_mak | |
3866 | esac | |
43ce4dfe | 3867 | fi |
997344f3 | 3868 | if test "$target_user_only" = "yes" ; then |
25be210f | 3869 | echo "CONFIG_USER_ONLY=y" >> $config_target_mak |
a2c80be9 | 3870 | echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak |
997344f3 | 3871 | fi |
831b7825 | 3872 | if test "$target_linux_user" = "yes" ; then |
25be210f | 3873 | echo "CONFIG_LINUX_USER=y" >> $config_target_mak |
831b7825 | 3874 | fi |
56aebc89 PB |
3875 | list="" |
3876 | if test ! -z "$gdb_xml_files" ; then | |
3877 | for x in $gdb_xml_files; do | |
3878 | list="$list $source_path/gdb-xml/$x" | |
3879 | done | |
3d0f1517 | 3880 | echo "TARGET_XML_FILES=$list" >> $config_target_mak |
56aebc89 | 3881 | fi |
97a847bc | 3882 | |
e5fe0c52 | 3883 | if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then |
25be210f | 3884 | echo "TARGET_HAS_BFLT=y" >> $config_target_mak |
e5fe0c52 | 3885 | fi |
bd0c5661 PB |
3886 | if test "$target_user_only" = "yes" \ |
3887 | -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then | |
25be210f | 3888 | echo "CONFIG_USE_NPTL=y" >> $config_target_mak |
bd0c5661 | 3889 | fi |
379f6698 | 3890 | if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then |
25be210f | 3891 | echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak |
379f6698 | 3892 | fi |
84778508 | 3893 | if test "$target_bsd_user" = "yes" ; then |
25be210f | 3894 | echo "CONFIG_BSD_USER=y" >> $config_target_mak |
84778508 | 3895 | fi |
5b0753e0 | 3896 | |
5a4d701a JK |
3897 | # the static way of configuring available audio cards requires this workaround |
3898 | if test "$target_user_only" != "yes" && grep -q CONFIG_PCSPK $source_path/default-configs/$target.mak; then | |
3899 | echo "CONFIG_PCSPK=y" >> $config_target_mak | |
3900 | fi | |
3901 | ||
4afddb55 | 3902 | # generate QEMU_CFLAGS/LDFLAGS for targets |
fa282484 | 3903 | |
4afddb55 | 3904 | cflags="" |
f9728943 | 3905 | includes="" |
fa282484 | 3906 | ldflags="" |
9b8e111f | 3907 | |
9195b2c2 SW |
3908 | if test "$tcg_interpreter" = "yes"; then |
3909 | includes="-I\$(SRC_PATH)/tcg/tci $includes" | |
3910 | elif test "$ARCH" = "sparc64" ; then | |
f9728943 | 3911 | includes="-I\$(SRC_PATH)/tcg/sparc $includes" |
24e804ec | 3912 | elif test "$ARCH" = "s390x" ; then |
f9728943 | 3913 | includes="-I\$(SRC_PATH)/tcg/s390 $includes" |
5d8a4f8f | 3914 | elif test "$ARCH" = "x86_64" ; then |
f9728943 | 3915 | includes="-I\$(SRC_PATH)/tcg/i386 $includes" |
57ddfbf7 | 3916 | else |
f9728943 | 3917 | includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes" |
57ddfbf7 | 3918 | fi |
f9728943 | 3919 | includes="-I\$(SRC_PATH)/tcg $includes" |
57ddfbf7 | 3920 | |
6efd7517 PM |
3921 | if test "$linux" = "yes" ; then |
3922 | includes="-I\$(SRC_PATH)/linux-headers $includes" | |
3923 | fi | |
3924 | ||
4d904533 BS |
3925 | if test "$target_user_only" = "yes" ; then |
3926 | libdis_config_mak=libdis-user/config.mak | |
3927 | else | |
3928 | libdis_config_mak=libdis/config.mak | |
3929 | fi | |
3930 | ||
64656024 JQ |
3931 | for i in $ARCH $TARGET_BASE_ARCH ; do |
3932 | case "$i" in | |
3933 | alpha) | |
25be210f | 3934 | echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak |
4d904533 | 3935 | echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak |
64656024 JQ |
3936 | ;; |
3937 | arm) | |
25be210f | 3938 | echo "CONFIG_ARM_DIS=y" >> $config_target_mak |
4d904533 | 3939 | echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak |
64656024 JQ |
3940 | ;; |
3941 | cris) | |
25be210f | 3942 | echo "CONFIG_CRIS_DIS=y" >> $config_target_mak |
4d904533 | 3943 | echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak |
64656024 JQ |
3944 | ;; |
3945 | hppa) | |
25be210f | 3946 | echo "CONFIG_HPPA_DIS=y" >> $config_target_mak |
4d904533 | 3947 | echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak |
64656024 JQ |
3948 | ;; |
3949 | i386|x86_64) | |
25be210f | 3950 | echo "CONFIG_I386_DIS=y" >> $config_target_mak |
4d904533 | 3951 | echo "CONFIG_I386_DIS=y" >> $libdis_config_mak |
64656024 | 3952 | ;; |
903ec55c AJ |
3953 | ia64*) |
3954 | echo "CONFIG_IA64_DIS=y" >> $config_target_mak | |
3955 | echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak | |
3956 | ;; | |
79368f49 MW |
3957 | lm32) |
3958 | echo "CONFIG_LM32_DIS=y" >> $config_target_mak | |
3959 | echo "CONFIG_LM32_DIS=y" >> $libdis_config_mak | |
3960 | ;; | |
64656024 | 3961 | m68k) |
25be210f | 3962 | echo "CONFIG_M68K_DIS=y" >> $config_target_mak |
4d904533 | 3963 | echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak |
64656024 | 3964 | ;; |
877fdc12 | 3965 | microblaze*) |
25be210f | 3966 | echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak |
4d904533 | 3967 | echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak |
64656024 JQ |
3968 | ;; |
3969 | mips*) | |
25be210f | 3970 | echo "CONFIG_MIPS_DIS=y" >> $config_target_mak |
4d904533 | 3971 | echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak |
64656024 | 3972 | ;; |
e67db06e JL |
3973 | or32) |
3974 | echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak | |
3975 | echo "CONFIG_OPENRISC_DIS=y" >> $libdis_config_mak | |
3976 | ;; | |
64656024 | 3977 | ppc*) |
25be210f | 3978 | echo "CONFIG_PPC_DIS=y" >> $config_target_mak |
4d904533 | 3979 | echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak |
64656024 | 3980 | ;; |
24e804ec | 3981 | s390*) |
25be210f | 3982 | echo "CONFIG_S390_DIS=y" >> $config_target_mak |
4d904533 | 3983 | echo "CONFIG_S390_DIS=y" >> $libdis_config_mak |
64656024 JQ |
3984 | ;; |
3985 | sh4) | |
25be210f | 3986 | echo "CONFIG_SH4_DIS=y" >> $config_target_mak |
4d904533 | 3987 | echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak |
64656024 JQ |
3988 | ;; |
3989 | sparc*) | |
25be210f | 3990 | echo "CONFIG_SPARC_DIS=y" >> $config_target_mak |
4d904533 | 3991 | echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak |
64656024 | 3992 | ;; |
cfa550c6 MF |
3993 | xtensa*) |
3994 | echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak | |
3995 | echo "CONFIG_XTENSA_DIS=y" >> $libdis_config_mak | |
3996 | ;; | |
64656024 JQ |
3997 | esac |
3998 | done | |
9195b2c2 SW |
3999 | if test "$tcg_interpreter" = "yes" ; then |
4000 | echo "CONFIG_TCI_DIS=y" >> $config_target_mak | |
4001 | echo "CONFIG_TCI_DIS=y" >> $libdis_config_mak | |
4002 | fi | |
64656024 | 4003 | |
6ee7126f JQ |
4004 | case "$ARCH" in |
4005 | alpha) | |
4006 | # Ensure there's only a single GP | |
4007 | cflags="-msmall-data $cflags" | |
4008 | ;; | |
4009 | esac | |
4010 | ||
55d9c04b JQ |
4011 | if test "$target_softmmu" = "yes" ; then |
4012 | case "$TARGET_BASE_ARCH" in | |
4013 | arm) | |
4014 | cflags="-DHAS_AUDIO $cflags" | |
25a8bb96 MW |
4015 | ;; |
4016 | lm32) | |
4017 | cflags="-DHAS_AUDIO $cflags" | |
55d9c04b JQ |
4018 | ;; |
4019 | i386|mips|ppc) | |
4020 | cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags" | |
4021 | ;; | |
4022 | esac | |
4023 | fi | |
4024 | ||
d02c1db3 | 4025 | if test "$gprof" = "yes" ; then |
25be210f | 4026 | echo "TARGET_GPROF=yes" >> $config_target_mak |
d02c1db3 JQ |
4027 | if test "$target_linux_user" = "yes" ; then |
4028 | cflags="-p $cflags" | |
4029 | ldflags="-p $ldflags" | |
4030 | fi | |
4031 | if test "$target_softmmu" = "yes" ; then | |
4032 | ldflags="-p $ldflags" | |
25be210f | 4033 | echo "GPROF_CFLAGS=-p" >> $config_target_mak |
d02c1db3 JQ |
4034 | fi |
4035 | fi | |
4036 | ||
9195b2c2 SW |
4037 | if test "$ARCH" = "tci"; then |
4038 | linker_script="" | |
4039 | else | |
4040 | linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld" | |
4041 | fi | |
4042 | ||
9b8e111f | 4043 | if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then |
fa282484 | 4044 | case "$ARCH" in |
fa282484 JQ |
4045 | sparc) |
4046 | # -static is used to avoid g1/g3 usage by the dynamic linker | |
322e5878 | 4047 | ldflags="$linker_script -static $ldflags" |
fa282484 | 4048 | ;; |
4d58be06 RH |
4049 | alpha | s390x) |
4050 | # The default placement of the application is fine. | |
4051 | ;; | |
fd76e73a | 4052 | *) |
322e5878 | 4053 | ldflags="$linker_script $ldflags" |
fa282484 JQ |
4054 | ;; |
4055 | esac | |
4056 | fi | |
fa282484 | 4057 | |
25be210f JQ |
4058 | echo "LDFLAGS+=$ldflags" >> $config_target_mak |
4059 | echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak | |
f9728943 | 4060 | echo "QEMU_INCLUDES+=$includes" >> $config_target_mak |
fa282484 | 4061 | |
97a847bc | 4062 | done # for target in $targets |
7d13299d | 4063 | |
d1807a4f | 4064 | # build tree in object directory in case the source is not in the current directory |
927b241d | 4065 | DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32" |
2dee8d54 | 4066 | DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas" |
d1807a4f | 4067 | DIRS="$DIRS roms/seabios roms/vgabios" |
2dee8d54 | 4068 | DIRS="$DIRS qapi-generated" |
00c705fb | 4069 | DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace" |
c09015dd AL |
4070 | FILES="Makefile tests/tcg/Makefile qdict-test-data.txt" |
4071 | FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" | |
00c705fb | 4072 | FILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile" |
d1807a4f | 4073 | FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" |
446b9165 | 4074 | FILES="$FILES pc-bios/spapr-rtas/Makefile" |
d1807a4f | 4075 | FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" |
753d11f2 RH |
4076 | for bios_file in \ |
4077 | $source_path/pc-bios/*.bin \ | |
4078 | $source_path/pc-bios/*.rom \ | |
4079 | $source_path/pc-bios/*.dtb \ | |
4080 | $source_path/pc-bios/openbios-* \ | |
4081 | $source_path/pc-bios/palcode-* | |
4082 | do | |
d1807a4f PB |
4083 | FILES="$FILES pc-bios/`basename $bios_file`" |
4084 | done | |
4085 | mkdir -p $DIRS | |
4086 | for f in $FILES ; do | |
72b8b5a1 | 4087 | if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then |
f9245e10 PM |
4088 | symlink "$source_path/$f" "$f" |
4089 | fi | |
d1807a4f | 4090 | done |
1ad2134f | 4091 | |
c34ebfdc | 4092 | # temporary config to build submodules |
2d9f27d2 | 4093 | for rom in seabios vgabios ; do |
c34ebfdc | 4094 | config_mak=roms/$rom/config.mak |
37116c89 | 4095 | echo "# Automatically generated by configure - do not modify" > $config_mak |
c34ebfdc AL |
4096 | echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak |
4097 | echo "CC=$cc" >> $config_mak | |
4098 | echo "BCC=bcc" >> $config_mak | |
4099 | echo "CPP=${cross_prefix}cpp" >> $config_mak | |
4100 | echo "OBJCOPY=objcopy" >> $config_mak | |
4101 | echo "IASL=iasl" >> $config_mak | |
c34ebfdc AL |
4102 | echo "LD=$ld" >> $config_mak |
4103 | done | |
4104 | ||
1ad2134f PB |
4105 | for hwlib in 32 64; do |
4106 | d=libhw$hwlib | |
72b8b5a1 | 4107 | symlink "$source_path/Makefile.hw" "$d/Makefile" |
37116c89 | 4108 | echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak |
1ad2134f | 4109 | done |
add16157 BS |
4110 | |
4111 | d=libuser | |
72b8b5a1 | 4112 | symlink "$source_path/Makefile.user" "$d/Makefile" |
b40292e7 JK |
4113 | |
4114 | if test "$docs" = "yes" ; then | |
4115 | mkdir -p QMP | |
4116 | fi |