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