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