]>
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" | |
16 | TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}" | |
17 | TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S" | |
9d56d2dc | 18 | TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i" |
d4742de8 | 19 | TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log" |
7d13299d | 20 | |
d4742de8 | 21 | trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15 |
9ac81bbb | 22 | |
7d13299d | 23 | # default parameters |
11d9f695 | 24 | prefix="" |
1e43adfc | 25 | interp_prefix="/usr/gnemul/qemu-%M" |
43ce4dfe | 26 | static="no" |
7d13299d FB |
27 | cross_prefix="" |
28 | cc="gcc" | |
0c58ac1c | 29 | audio_drv_list="" |
4c9b53e3 | 30 | audio_card_list="ac97 es1370 sb16" |
31 | audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus" | |
7d13299d FB |
32 | host_cc="gcc" |
33 | ar="ar" | |
34 | make="make" | |
6a882643 | 35 | install="install" |
7aa486fe AL |
36 | objcopy="objcopy" |
37 | ld="ld" | |
ac0df51d AL |
38 | |
39 | # parse CC options first | |
40 | for opt do | |
41 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` | |
42 | case "$opt" in | |
43 | --cross-prefix=*) cross_prefix="$optarg" | |
44 | ;; | |
45 | --cc=*) cc="$optarg" | |
46 | ;; | |
47 | esac | |
48 | done | |
49 | ||
50 | # OS specific | |
51 | # Using uname is really, really broken. Once we have the right set of checks | |
52 | # we can eliminate it's usage altogether | |
53 | ||
54 | cc="${cross_prefix}${cc}" | |
55 | ar="${cross_prefix}${ar}" | |
7aa486fe AL |
56 | objcopy="${cross_prefix}${objcopy}" |
57 | ld="${cross_prefix}${ld}" | |
ac0df51d AL |
58 | |
59 | # check that the C compiler works. | |
60 | cat > $TMPC <<EOF | |
61 | int main(void) {} | |
62 | EOF | |
63 | ||
64 | if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then | |
65 | : C compiler works ok | |
66 | else | |
67 | echo "ERROR: \"$cc\" either does not exist or does not work" | |
68 | exit 1 | |
69 | fi | |
70 | ||
71 | check_define() { | |
72 | cat > $TMPC <<EOF | |
73 | #if !defined($1) | |
74 | #error Not defined | |
75 | #endif | |
76 | int main(void) { return 0; } | |
77 | EOF | |
78 | $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null | |
79 | } | |
80 | ||
81 | if check_define __i386__ ; then | |
82 | cpu="i386" | |
83 | elif check_define __x86_64__ ; then | |
84 | cpu="x86_64" | |
3aa9bd6c BS |
85 | elif check_define __sparc__ ; then |
86 | # We can't check for 64 bit (when gcc is biarch) or V8PLUSA | |
87 | # They must be specified using --sparc_cpu | |
88 | if check_define __arch64__ ; then | |
89 | cpu="sparc64" | |
90 | else | |
91 | cpu="sparc" | |
92 | fi | |
fdf7ed96 | 93 | elif check_define _ARCH_PPC ; then |
94 | if check_define _ARCH_PPC64 ; then | |
95 | cpu="ppc64" | |
96 | else | |
97 | cpu="ppc" | |
98 | fi | |
ac0df51d | 99 | else |
fdf7ed96 | 100 | cpu=`uname -m` |
ac0df51d AL |
101 | fi |
102 | ||
5327cf48 | 103 | target_list="" |
7d13299d FB |
104 | case "$cpu" in |
105 | i386|i486|i586|i686|i86pc|BePC) | |
97a847bc | 106 | cpu="i386" |
7d13299d | 107 | ;; |
aaa5fa14 AJ |
108 | x86_64|amd64) |
109 | cpu="x86_64" | |
110 | ;; | |
111 | alpha) | |
112 | cpu="alpha" | |
113 | ;; | |
ba68055e | 114 | armv*b) |
808c4954 FB |
115 | cpu="armv4b" |
116 | ;; | |
ba68055e | 117 | armv*l) |
7d13299d FB |
118 | cpu="armv4l" |
119 | ;; | |
aaa5fa14 AJ |
120 | cris) |
121 | cpu="cris" | |
7d13299d | 122 | ;; |
f54b3f92 AJ |
123 | parisc|parisc64) |
124 | cpu="hppa" | |
125 | ;; | |
aaa5fa14 AJ |
126 | ia64) |
127 | cpu="ia64" | |
128 | ;; | |
129 | m68k) | |
130 | cpu="m68k" | |
7d13299d | 131 | ;; |
72b675ca EI |
132 | microblaze) |
133 | cpu="microblaze" | |
134 | ;; | |
7d13299d FB |
135 | mips) |
136 | cpu="mips" | |
137 | ;; | |
fbe4f65b TS |
138 | mips64) |
139 | cpu="mips64" | |
140 | ;; | |
fdf7ed96 | 141 | ppc) |
142 | cpu="ppc" | |
143 | ;; | |
144 | ppc64) | |
145 | cpu="ppc64" | |
e7daa605 | 146 | ;; |
0e7b8a9f | 147 | s390*) |
fb3e5849 FB |
148 | cpu="s390" |
149 | ;; | |
3142255c | 150 | sparc|sun4[cdmuv]) |
ae228531 FB |
151 | cpu="sparc" |
152 | ;; | |
153 | sparc64) | |
154 | cpu="sparc64" | |
155 | ;; | |
7d13299d FB |
156 | *) |
157 | cpu="unknown" | |
158 | ;; | |
159 | esac | |
eb82284f | 160 | brlapi="yes" |
7d13299d | 161 | gprof="no" |
f8393946 | 162 | debug_tcg="no" |
f3d08ee6 | 163 | debug="no" |
03b4fe7d | 164 | sparse="no" |
1625af87 | 165 | strip_opt="yes" |
7d13299d | 166 | bigendian="no" |
67b915a5 FB |
167 | mingw32="no" |
168 | EXESUF="" | |
443f1376 | 169 | slirp="yes" |
e0e6c8c0 | 170 | vde="yes" |
102a52e4 FB |
171 | fmod_lib="" |
172 | fmod_inc="" | |
2f6a1ab0 | 173 | oss_lib="" |
8d5d2d4c | 174 | vnc_tls="yes" |
2f9606b3 | 175 | vnc_sasl="yes" |
b1a550a0 | 176 | bsd="no" |
5327cf48 | 177 | linux="no" |
d2c7c9b8 | 178 | solaris="no" |
c9ec1fe4 | 179 | kqemu="no" |
05c2a3e7 | 180 | profiler="no" |
5b0753e0 | 181 | cocoa="no" |
0a8e90f4 | 182 | softmmu="yes" |
831b7825 TS |
183 | linux_user="no" |
184 | darwin_user="no" | |
84778508 | 185 | bsd_user="no" |
379f6698 | 186 | guest_base="" |
70ec5dc0 | 187 | build_docs="yes" |
c5937220 | 188 | uname_release="" |
4d3b6f6e | 189 | curses="yes" |
769ce76d | 190 | curl="yes" |
e5d355d1 | 191 | pthread="yes" |
414f0dab | 192 | aio="yes" |
e5d355d1 | 193 | io_thread="no" |
bd0c5661 | 194 | nptl="yes" |
8ff9cbf7 | 195 | mixemu="no" |
fb599c9a | 196 | bluez="yes" |
dff84034 | 197 | kvm="no" |
eac30262 | 198 | kerneldir="" |
b29fe3ed | 199 | aix="no" |
77755340 | 200 | blobs="yes" |
f652e6af | 201 | fdt="yes" |
f92f8afe | 202 | sdl="yes" |
e37630ca | 203 | xen="yes" |
4a19f1ec | 204 | pkgversion="" |
7d13299d FB |
205 | |
206 | # OS specific | |
ac0df51d AL |
207 | if check_define __linux__ ; then |
208 | targetos="Linux" | |
209 | elif check_define _WIN32 ; then | |
210 | targetos='MINGW32' | |
169dc5d3 BS |
211 | elif check_define __OpenBSD__ ; then |
212 | targetos='OpenBSD' | |
213 | elif check_define __sun__ ; then | |
214 | targetos='SunOS' | |
ac0df51d AL |
215 | else |
216 | targetos=`uname -s` | |
217 | fi | |
7d13299d | 218 | case $targetos in |
c326e0af FB |
219 | CYGWIN*) |
220 | mingw32="yes" | |
6f30fa85 | 221 | OS_CFLAGS="-mno-cygwin" |
db8d7dd1 TS |
222 | if [ "$cpu" = "i386" ] ; then |
223 | kqemu="yes" | |
224 | fi | |
c2de5c91 | 225 | audio_possible_drivers="sdl" |
c326e0af | 226 | ;; |
67b915a5 FB |
227 | MINGW32*) |
228 | mingw32="yes" | |
db8d7dd1 TS |
229 | if [ "$cpu" = "i386" ] ; then |
230 | kqemu="yes" | |
231 | fi | |
c2de5c91 | 232 | audio_possible_drivers="dsound sdl fmod" |
67b915a5 | 233 | ;; |
5c40d2bd | 234 | GNU/kFreeBSD) |
0c58ac1c | 235 | audio_drv_list="oss" |
f34af52c | 236 | audio_possible_drivers="oss sdl esd pa" |
5c40d2bd TS |
237 | if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then |
238 | kqemu="yes" | |
239 | fi | |
240 | ;; | |
7d3505c5 FB |
241 | FreeBSD) |
242 | bsd="yes" | |
0c58ac1c | 243 | audio_drv_list="oss" |
f34af52c | 244 | audio_possible_drivers="oss sdl esd pa" |
e99f9060 | 245 | if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then |
07f4ddbf FB |
246 | kqemu="yes" |
247 | fi | |
7d3505c5 | 248 | ;; |
c5e97233 BS |
249 | DragonFly) |
250 | bsd="yes" | |
251 | audio_drv_list="oss" | |
252 | audio_possible_drivers="oss sdl esd pa" | |
253 | if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then | |
254 | kqemu="yes" | |
255 | fi | |
256 | aio="no" | |
257 | ;; | |
7d3505c5 FB |
258 | NetBSD) |
259 | bsd="yes" | |
0c58ac1c | 260 | audio_drv_list="oss" |
c2de5c91 | 261 | audio_possible_drivers="oss sdl esd" |
8ef92a88 | 262 | oss_lib="-lossaudio" |
7d3505c5 FB |
263 | ;; |
264 | OpenBSD) | |
265 | bsd="yes" | |
0c58ac1c | 266 | audio_drv_list="oss" |
c2de5c91 | 267 | audio_possible_drivers="oss sdl esd" |
2f6a1ab0 | 268 | oss_lib="-lossaudio" |
7d3505c5 | 269 | ;; |
83fb7adf FB |
270 | Darwin) |
271 | bsd="yes" | |
272 | darwin="yes" | |
1b0f9cc2 | 273 | # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code |
aab8588a | 274 | if [ "$cpu" = "i386" ] ; then |
275 | is_x86_64=`sysctl -n hw.optional.x86_64` | |
276 | [ "$is_x86_64" = "1" ] && cpu=x86_64 | |
1b0f9cc2 AL |
277 | fi |
278 | if [ "$cpu" = "x86_64" ] ; then | |
279 | OS_CFLAGS="-arch x86_64" | |
280 | LDFLAGS="-arch x86_64" | |
281 | else | |
282 | OS_CFLAGS="-mdynamic-no-pic" | |
283 | fi | |
831b7825 | 284 | darwin_user="yes" |
fd677642 | 285 | cocoa="yes" |
0c58ac1c | 286 | audio_drv_list="coreaudio" |
c2de5c91 | 287 | audio_possible_drivers="coreaudio sdl fmod" |
c2c59c3e | 288 | OS_LDFLAGS="-framework CoreFoundation -framework IOKit" |
83fb7adf | 289 | ;; |
ec530c81 | 290 | SunOS) |
c2b84fab TS |
291 | solaris="yes" |
292 | make="gmake" | |
293 | install="ginstall" | |
0475a5ca | 294 | needs_libsunmath="no" |
c2b84fab | 295 | solarisrev=`uname -r | cut -f2 -d.` |
ef18c883 TS |
296 | # have to select again, because `uname -m` returns i86pc |
297 | # even on an x86_64 box. | |
298 | solariscpu=`isainfo -k` | |
299 | if test "${solariscpu}" = "amd64" ; then | |
300 | cpu="x86_64" | |
301 | fi | |
c2b84fab | 302 | if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then |
0475a5ca TS |
303 | if test "$solarisrev" -le 9 ; then |
304 | if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then | |
305 | needs_libsunmath="yes" | |
306 | else | |
307 | echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" | |
308 | echo "libsunmath from the Sun Studio compilers tools, due to a lack of" | |
309 | echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" | |
310 | echo "Studio 11 can be downloaded from www.sun.com." | |
311 | exit 1 | |
312 | fi | |
313 | fi | |
314 | if test "$solarisrev" -ge 9 ; then | |
c2b84fab TS |
315 | kqemu="yes" |
316 | fi | |
86b2bd93 | 317 | fi |
6b4d2ba1 | 318 | if test -f /usr/include/sys/soundcard.h ; then |
0c58ac1c | 319 | audio_drv_list="oss" |
6b4d2ba1 | 320 | fi |
c2de5c91 | 321 | audio_possible_drivers="oss sdl" |
14d483ec | 322 | OS_CFLAGS=-std=gnu99 |
86b2bd93 | 323 | ;; |
b29fe3ed | 324 | AIX) |
325 | aix="yes" | |
326 | make="gmake" | |
327 | ;; | |
1d14ffa9 | 328 | *) |
0c58ac1c | 329 | audio_drv_list="oss" |
b8e59f18 | 330 | audio_possible_drivers="oss alsa sdl esd pa" |
5327cf48 | 331 | linux="yes" |
831b7825 | 332 | linux_user="yes" |
68063649 | 333 | usb="linux" |
dff84034 | 334 | kvm="yes" |
07f4ddbf | 335 | if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then |
c9ec1fe4 | 336 | kqemu="yes" |
c2de5c91 | 337 | audio_possible_drivers="$audio_possible_drivers fmod" |
c9ec1fe4 | 338 | fi |
fb065187 | 339 | ;; |
7d13299d FB |
340 | esac |
341 | ||
7d3505c5 | 342 | if [ "$bsd" = "yes" ] ; then |
b1a550a0 | 343 | if [ "$darwin" != "yes" ] ; then |
83fb7adf | 344 | make="gmake" |
68063649 | 345 | usb="bsd" |
83fb7adf | 346 | fi |
84778508 | 347 | bsd_user="yes" |
7d3505c5 FB |
348 | fi |
349 | ||
7d13299d | 350 | # find source path |
ad064840 | 351 | source_path=`dirname "$0"` |
59faef3a AZ |
352 | source_path_used="no" |
353 | workdir=`pwd` | |
ad064840 | 354 | if [ -z "$source_path" ]; then |
59faef3a | 355 | source_path=$workdir |
ad064840 PB |
356 | else |
357 | source_path=`cd "$source_path"; pwd` | |
7d13299d | 358 | fi |
724db118 | 359 | [ -f "$workdir/vl.c" ] || source_path_used="yes" |
7d13299d | 360 | |
487fefdb | 361 | werror="" |
85aa5189 | 362 | |
7d13299d | 363 | for opt do |
a46e4035 | 364 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` |
7d13299d | 365 | case "$opt" in |
2efc3265 FB |
366 | --help|-h) show_help=yes |
367 | ;; | |
b1a550a0 | 368 | --prefix=*) prefix="$optarg" |
7d13299d | 369 | ;; |
b1a550a0 | 370 | --interp-prefix=*) interp_prefix="$optarg" |
32ce6337 | 371 | ;; |
b1a550a0 | 372 | --source-path=*) source_path="$optarg" |
ad064840 | 373 | source_path_used="yes" |
7d13299d | 374 | ;; |
ac0df51d | 375 | --cross-prefix=*) |
7d13299d | 376 | ;; |
ac0df51d | 377 | --cc=*) |
7d13299d | 378 | ;; |
b1a550a0 | 379 | --host-cc=*) host_cc="$optarg" |
83469015 | 380 | ;; |
b1a550a0 | 381 | --make=*) make="$optarg" |
7d13299d | 382 | ;; |
6a882643 PB |
383 | --install=*) install="$optarg" |
384 | ;; | |
e3fc14c3 | 385 | --extra-cflags=*) EXTRA_CFLAGS="$optarg" |
7d13299d | 386 | ;; |
e3fc14c3 | 387 | --extra-ldflags=*) EXTRA_LDFLAGS="$optarg" |
7d13299d | 388 | ;; |
b1a550a0 | 389 | --cpu=*) cpu="$optarg" |
7d13299d | 390 | ;; |
b1a550a0 | 391 | --target-list=*) target_list="$optarg" |
de83cd02 | 392 | ;; |
7d13299d FB |
393 | --enable-gprof) gprof="yes" |
394 | ;; | |
43ce4dfe FB |
395 | --static) static="yes" |
396 | ;; | |
97a847bc FB |
397 | --disable-sdl) sdl="no" |
398 | ;; | |
0c58ac1c | 399 | --fmod-lib=*) fmod_lib="$optarg" |
1d14ffa9 | 400 | ;; |
c2de5c91 | 401 | --fmod-inc=*) fmod_inc="$optarg" |
402 | ;; | |
2f6a1ab0 BS |
403 | --oss-lib=*) oss_lib="$optarg" |
404 | ;; | |
2fa7d3bf | 405 | --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` |
102a52e4 | 406 | ;; |
0c58ac1c | 407 | --audio-drv-list=*) audio_drv_list="$optarg" |
102a52e4 | 408 | ;; |
f8393946 AJ |
409 | --enable-debug-tcg) debug_tcg="yes" |
410 | ;; | |
411 | --disable-debug-tcg) debug_tcg="no" | |
412 | ;; | |
f3d08ee6 PB |
413 | --enable-debug) |
414 | # Enable debugging options that aren't excessively noisy | |
415 | debug_tcg="yes" | |
416 | debug="yes" | |
417 | strip_opt="no" | |
418 | ;; | |
03b4fe7d AL |
419 | --enable-sparse) sparse="yes" |
420 | ;; | |
421 | --disable-sparse) sparse="no" | |
422 | ;; | |
1625af87 AL |
423 | --disable-strip) strip_opt="no" |
424 | ;; | |
8d5d2d4c TS |
425 | --disable-vnc-tls) vnc_tls="no" |
426 | ;; | |
2f9606b3 AL |
427 | --disable-vnc-sasl) vnc_sasl="no" |
428 | ;; | |
443f1376 | 429 | --disable-slirp) slirp="no" |
1d14ffa9 | 430 | ;; |
e0e6c8c0 | 431 | --disable-vde) vde="no" |
8a16d273 | 432 | ;; |
c9ec1fe4 | 433 | --disable-kqemu) kqemu="no" |
1d14ffa9 | 434 | ;; |
e37630ca AL |
435 | --disable-xen) xen="no" |
436 | ;; | |
2e4d9fb1 AJ |
437 | --disable-brlapi) brlapi="no" |
438 | ;; | |
fb599c9a AZ |
439 | --disable-bluez) bluez="no" |
440 | ;; | |
7ba1e619 AL |
441 | --disable-kvm) kvm="no" |
442 | ;; | |
05c2a3e7 FB |
443 | --enable-profiler) profiler="yes" |
444 | ;; | |
c2de5c91 | 445 | --enable-cocoa) |
446 | cocoa="yes" ; | |
447 | sdl="no" ; | |
448 | audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" | |
1d14ffa9 | 449 | ;; |
cad25d69 | 450 | --disable-system) softmmu="no" |
0a8e90f4 | 451 | ;; |
cad25d69 | 452 | --enable-system) softmmu="yes" |
0a8e90f4 | 453 | ;; |
831b7825 | 454 | --disable-linux-user) linux_user="no" |
0a8e90f4 | 455 | ;; |
831b7825 TS |
456 | --enable-linux-user) linux_user="yes" |
457 | ;; | |
458 | --disable-darwin-user) darwin_user="no" | |
459 | ;; | |
460 | --enable-darwin-user) darwin_user="yes" | |
0a8e90f4 | 461 | ;; |
84778508 BS |
462 | --disable-bsd-user) bsd_user="no" |
463 | ;; | |
464 | --enable-bsd-user) bsd_user="yes" | |
465 | ;; | |
379f6698 PB |
466 | --enable-guest-base) guest_base="yes" |
467 | ;; | |
468 | --disable-guest-base) guest_base="no" | |
469 | ;; | |
c5937220 PB |
470 | --enable-uname-release=*) uname_release="$optarg" |
471 | ;; | |
3142255c BS |
472 | --sparc_cpu=*) |
473 | sparc_cpu="$optarg" | |
474 | case $sparc_cpu in | |
b274051d JQ |
475 | v7|v8) |
476 | ARCH_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__" | |
477 | ARCH_LDFLAGS="-m32" | |
b274051d JQ |
478 | cpu="sparc" |
479 | ;; | |
480 | v8plus|v8plusa) | |
481 | ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__" | |
482 | ARCH_LDFLAGS="-m32" | |
b274051d JQ |
483 | cpu="sparc" |
484 | ;; | |
485 | v9) | |
486 | ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__" | |
487 | ARCH_LDFLAGS="-m64" | |
b274051d JQ |
488 | cpu="sparc64" |
489 | ;; | |
490 | *) | |
491 | echo "undefined SPARC architecture. Exiting"; | |
492 | exit 1 | |
493 | ;; | |
3142255c BS |
494 | esac |
495 | ;; | |
85aa5189 FB |
496 | --enable-werror) werror="yes" |
497 | ;; | |
498 | --disable-werror) werror="no" | |
499 | ;; | |
4d3b6f6e AZ |
500 | --disable-curses) curses="no" |
501 | ;; | |
769ce76d AG |
502 | --disable-curl) curl="no" |
503 | ;; | |
bd0c5661 PB |
504 | --disable-nptl) nptl="no" |
505 | ;; | |
8ff9cbf7 | 506 | --enable-mixemu) mixemu="yes" |
507 | ;; | |
e5d355d1 AL |
508 | --disable-pthread) pthread="no" |
509 | ;; | |
414f0dab BS |
510 | --disable-aio) aio="no" |
511 | ;; | |
e5d355d1 AL |
512 | --enable-io-thread) io_thread="yes" |
513 | ;; | |
77755340 TS |
514 | --disable-blobs) blobs="no" |
515 | ;; | |
eac30262 AL |
516 | --kerneldir=*) kerneldir="$optarg" |
517 | ;; | |
4a19f1ec PB |
518 | --with-pkgversion=*) pkgversion=" ($optarg)" |
519 | ;; | |
70ec5dc0 AL |
520 | --disable-docs) build_docs="no" |
521 | ;; | |
7f1559c6 AZ |
522 | *) echo "ERROR: unknown option $opt"; show_help="yes" |
523 | ;; | |
7d13299d FB |
524 | esac |
525 | done | |
526 | ||
6f30fa85 | 527 | # default flags for all hosts |
f3d08ee6 PB |
528 | CFLAGS="$CFLAGS -g -fno-strict-aliasing" |
529 | if test "$debug" = "no" ; then | |
530 | CFLAGS="$CFLAGS -O2" | |
531 | fi | |
e0e36fe9 | 532 | CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls" |
6f30fa85 | 533 | LDFLAGS="$LDFLAGS -g" |
1172f653 BS |
534 | |
535 | # Consult white-list to determine whether to enable werror | |
536 | # by default. Only enable by default for git builds | |
537 | if test -z "$werror" ; then | |
538 | z_version=`cut -f3 -d. $source_path/VERSION` | |
539 | if test "$z_version" = "50" -a \ | |
540 | "$linux" = "yes" ; then | |
541 | werror="yes" | |
542 | else | |
543 | werror="no" | |
544 | fi | |
545 | fi | |
546 | ||
85aa5189 | 547 | if test "$werror" = "yes" ; then |
1172f653 | 548 | CFLAGS="$CFLAGS -Werror" |
85aa5189 | 549 | fi |
6f30fa85 | 550 | |
d2c7c9b8 BS |
551 | if test "$solaris" = "no" ; then |
552 | if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then | |
553 | LDFLAGS="$LDFLAGS -Wl,--warn-common" | |
554 | fi | |
49237acd BS |
555 | fi |
556 | ||
3142255c BS |
557 | # |
558 | # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right | |
559 | # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) | |
560 | # | |
379f6698 | 561 | host_guest_base="no" |
40293e58 | 562 | case "$cpu" in |
3142255c BS |
563 | sparc) if test -z "$sparc_cpu" ; then |
564 | ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__" | |
565 | ARCH_LDFLAGS="-m32" | |
3142255c | 566 | fi |
762e8230 BS |
567 | ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3" |
568 | if test "$solaris" = "no" ; then | |
569 | ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6" | |
570 | fi | |
3142255c BS |
571 | ;; |
572 | sparc64) if test -z "$sparc_cpu" ; then | |
573 | ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__" | |
574 | ARCH_LDFLAGS="-m64" | |
3142255c | 575 | fi |
762e8230 BS |
576 | if test "$solaris" = "no" ; then |
577 | ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7" | |
578 | else | |
579 | ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7" | |
580 | fi | |
3142255c | 581 | ;; |
76d83bde TS |
582 | s390) |
583 | ARCH_CFLAGS="-march=z900" | |
584 | ;; | |
40293e58 FB |
585 | i386) |
586 | ARCH_CFLAGS="-m32" | |
587 | ARCH_LDFLAGS="-m32" | |
379f6698 | 588 | host_guest_base="yes" |
40293e58 FB |
589 | ;; |
590 | x86_64) | |
591 | ARCH_CFLAGS="-m64" | |
592 | ARCH_LDFLAGS="-m64" | |
379f6698 PB |
593 | host_guest_base="yes" |
594 | ;; | |
595 | arm*) | |
596 | host_guest_base="yes" | |
40293e58 | 597 | ;; |
f6548c0a | 598 | ppc*) |
599 | host_guest_base="yes" | |
600 | ;; | |
3142255c BS |
601 | esac |
602 | ||
379f6698 PB |
603 | [ -z "$guest_base" ] && guest_base="$host_guest_base" |
604 | ||
af5db58e PB |
605 | if test x"$show_help" = x"yes" ; then |
606 | cat << EOF | |
607 | ||
608 | Usage: configure [options] | |
609 | Options: [defaults in brackets after descriptions] | |
610 | ||
611 | EOF | |
612 | echo "Standard options:" | |
613 | echo " --help print this message" | |
614 | echo " --prefix=PREFIX install in PREFIX [$prefix]" | |
615 | echo " --interp-prefix=PREFIX where to find shared libraries, etc." | |
616 | echo " use %M for cpu name [$interp_prefix]" | |
617 | echo " --target-list=LIST set target list [$target_list]" | |
618 | echo "" | |
619 | echo "kqemu kernel acceleration support:" | |
620 | echo " --disable-kqemu disable kqemu support" | |
af5db58e PB |
621 | echo "" |
622 | echo "Advanced options (experts only):" | |
623 | echo " --source-path=PATH path of source code [$source_path]" | |
624 | echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" | |
625 | echo " --cc=CC use C compiler CC [$cc]" | |
626 | echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc." | |
e3fc14c3 JK |
627 | echo " --extra-cflags=CFLAGS append extra C compiler flags CFLAGS" |
628 | echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" | |
af5db58e | 629 | echo " --make=MAKE use specified make [$make]" |
6a882643 | 630 | echo " --install=INSTALL use specified install [$install]" |
af5db58e | 631 | echo " --static enable static build [$static]" |
f8393946 AJ |
632 | echo " --enable-debug-tcg enable TCG debugging" |
633 | echo " --disable-debug-tcg disable TCG debugging (default)" | |
09695a4a | 634 | echo " --enable-debug enable common debug build options" |
890b1658 AL |
635 | echo " --enable-sparse enable sparse checker" |
636 | echo " --disable-sparse disable sparse checker (default)" | |
1625af87 | 637 | echo " --disable-strip disable stripping binaries" |
85aa5189 | 638 | echo " --disable-werror disable compilation abort on warning" |
fe8f78e4 | 639 | echo " --disable-sdl disable SDL" |
af5db58e | 640 | echo " --enable-cocoa enable COCOA (Mac OS X only)" |
c2de5c91 | 641 | echo " --audio-drv-list=LIST set audio drivers list:" |
642 | echo " Available drivers: $audio_possible_drivers" | |
4c9b53e3 | 643 | echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" |
644 | echo " Available cards: $audio_possible_cards" | |
8ff9cbf7 | 645 | echo " --enable-mixemu enable mixer emulation" |
e37630ca | 646 | echo " --disable-xen disable xen backend driver support" |
2e4d9fb1 | 647 | echo " --disable-brlapi disable BrlAPI" |
8d5d2d4c | 648 | echo " --disable-vnc-tls disable TLS encryption for VNC server" |
2f9606b3 | 649 | echo " --disable-vnc-sasl disable SASL encryption for VNC server" |
af896aaa | 650 | echo " --disable-curses disable curses output" |
769ce76d | 651 | echo " --disable-curl disable curl connectivity" |
fb599c9a | 652 | echo " --disable-bluez disable bluez stack connectivity" |
7ba1e619 | 653 | echo " --disable-kvm disable KVM acceleration support" |
bd0c5661 | 654 | echo " --disable-nptl disable usermode NPTL support" |
af5db58e PB |
655 | echo " --enable-system enable all system emulation targets" |
656 | echo " --disable-system disable all system emulation targets" | |
831b7825 TS |
657 | echo " --enable-linux-user enable all linux usermode emulation targets" |
658 | echo " --disable-linux-user disable all linux usermode emulation targets" | |
659 | echo " --enable-darwin-user enable all darwin usermode emulation targets" | |
660 | echo " --disable-darwin-user disable all darwin usermode emulation targets" | |
84778508 BS |
661 | echo " --enable-bsd-user enable all BSD usermode emulation targets" |
662 | echo " --disable-bsd-user disable all BSD usermode emulation targets" | |
379f6698 PB |
663 | echo " --enable-guest-base enable GUEST_BASE support for usermode" |
664 | echo " emulation targets" | |
665 | echo " --disable-guest-base disable GUEST_BASE support" | |
af5db58e PB |
666 | echo " --fmod-lib path to FMOD library" |
667 | echo " --fmod-inc path to FMOD includes" | |
2f6a1ab0 | 668 | echo " --oss-lib path to OSS library" |
c5937220 | 669 | echo " --enable-uname-release=R Return R for uname -r in usermode emulation" |
3142255c | 670 | echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" |
e0e6c8c0 | 671 | echo " --disable-vde disable support for vde network" |
e5d355d1 | 672 | echo " --disable-pthread disable pthread support" |
414f0dab | 673 | echo " --disable-aio disable AIO support" |
e5d355d1 | 674 | echo " --enable-io-thread enable IO thread" |
77755340 | 675 | echo " --disable-blobs disable installing provided firmware blobs" |
eac30262 | 676 | echo " --kerneldir=PATH look for kernel includes in PATH" |
af5db58e | 677 | echo "" |
5bf08934 | 678 | echo "NOTE: The object files are built at the place where configure is launched" |
af5db58e PB |
679 | exit 1 |
680 | fi | |
681 | ||
67b915a5 | 682 | if test "$mingw32" = "yes" ; then |
5327cf48 | 683 | linux="no" |
67b915a5 | 684 | EXESUF=".exe" |
cd01b4a3 | 685 | linux_user="no" |
84778508 | 686 | bsd_user="no" |
49dc768d | 687 | OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501" |
cd01b4a3 AL |
688 | fi |
689 | ||
03b4fe7d AL |
690 | if test ! -x "$(which cgcc 2>/dev/null)"; then |
691 | sparse="no" | |
692 | fi | |
693 | ||
ec530c81 FB |
694 | # |
695 | # Solaris specific configure tool chain decisions | |
696 | # | |
697 | if test "$solaris" = "yes" ; then | |
ec530c81 FB |
698 | solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"` |
699 | if test -z "$solinst" ; then | |
700 | echo "Solaris install program not found. Use --install=/usr/ucb/install or" | |
701 | echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" | |
702 | echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" | |
703 | exit 1 | |
704 | fi | |
705 | if test "$solinst" = "/usr/sbin/install" ; then | |
706 | echo "Error: Solaris /usr/sbin/install is not an appropriate install program." | |
707 | echo "try ginstall from the GNU fileutils available from www.blastwave.org" | |
708 | echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" | |
709 | exit 1 | |
710 | fi | |
ec530c81 FB |
711 | sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"` |
712 | if test -z "$sol_ar" ; then | |
713 | echo "Error: No path includes ar" | |
714 | if test -f /usr/ccs/bin/ar ; then | |
715 | echo "Add /usr/ccs/bin to your path and rerun configure" | |
716 | fi | |
717 | exit 1 | |
718 | fi | |
5fafdf24 | 719 | fi |
ec530c81 FB |
720 | |
721 | ||
5327cf48 FB |
722 | if test -z "$target_list" ; then |
723 | # these targets are portable | |
0a8e90f4 | 724 | if [ "$softmmu" = "yes" ] ; then |
2408a527 AJ |
725 | target_list="\ |
726 | i386-softmmu \ | |
727 | x86_64-softmmu \ | |
728 | arm-softmmu \ | |
729 | cris-softmmu \ | |
730 | m68k-softmmu \ | |
72b675ca | 731 | microblaze-softmmu \ |
2408a527 AJ |
732 | mips-softmmu \ |
733 | mipsel-softmmu \ | |
734 | mips64-softmmu \ | |
735 | mips64el-softmmu \ | |
736 | ppc-softmmu \ | |
737 | ppcemb-softmmu \ | |
738 | ppc64-softmmu \ | |
739 | sh4-softmmu \ | |
740 | sh4eb-softmmu \ | |
741 | sparc-softmmu \ | |
1b64fcae | 742 | sparc64-softmmu \ |
2408a527 | 743 | " |
0a8e90f4 | 744 | fi |
5327cf48 | 745 | # the following are Linux specific |
831b7825 | 746 | if [ "$linux_user" = "yes" ] ; then |
2408a527 AJ |
747 | target_list="${target_list}\ |
748 | i386-linux-user \ | |
749 | x86_64-linux-user \ | |
750 | alpha-linux-user \ | |
751 | arm-linux-user \ | |
752 | armeb-linux-user \ | |
753 | cris-linux-user \ | |
754 | m68k-linux-user \ | |
72b675ca | 755 | microblaze-linux-user \ |
2408a527 AJ |
756 | mips-linux-user \ |
757 | mipsel-linux-user \ | |
758 | ppc-linux-user \ | |
759 | ppc64-linux-user \ | |
760 | ppc64abi32-linux-user \ | |
761 | sh4-linux-user \ | |
762 | sh4eb-linux-user \ | |
763 | sparc-linux-user \ | |
764 | sparc64-linux-user \ | |
765 | sparc32plus-linux-user \ | |
766 | " | |
831b7825 TS |
767 | fi |
768 | # the following are Darwin specific | |
769 | if [ "$darwin_user" = "yes" ] ; then | |
6cdc7375 | 770 | target_list="$target_list i386-darwin-user ppc-darwin-user " |
5327cf48 | 771 | fi |
84778508 BS |
772 | # the following are BSD specific |
773 | if [ "$bsd_user" = "yes" ] ; then | |
774 | target_list="${target_list}\ | |
31fc12df BS |
775 | i386-bsd-user \ |
776 | x86_64-bsd-user \ | |
777 | sparc-bsd-user \ | |
84778508 BS |
778 | sparc64-bsd-user \ |
779 | " | |
780 | fi | |
6e20a45f | 781 | else |
b1a550a0 | 782 | target_list=`echo "$target_list" | sed -e 's/,/ /g'` |
5327cf48 | 783 | fi |
0a8e90f4 PB |
784 | if test -z "$target_list" ; then |
785 | echo "No targets enabled" | |
786 | exit 1 | |
787 | fi | |
5327cf48 | 788 | |
7d13299d FB |
789 | if test -z "$cross_prefix" ; then |
790 | ||
791 | # --- | |
792 | # big/little endian test | |
793 | cat > $TMPC << EOF | |
794 | #include <inttypes.h> | |
795 | int main(int argc, char ** argv){ | |
1d14ffa9 FB |
796 | volatile uint32_t i=0x01234567; |
797 | return (*((uint8_t*)(&i))) == 0x67; | |
7d13299d FB |
798 | } |
799 | EOF | |
800 | ||
178baee6 | 801 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then |
7d13299d FB |
802 | $TMPE && bigendian="yes" |
803 | else | |
804 | echo big/little test failed | |
805 | fi | |
806 | ||
807 | else | |
808 | ||
809 | # if cross compiling, cannot launch a program, so make a static guess | |
0938cda5 | 810 | if test "$cpu" = "armv4b" \ |
f54b3f92 | 811 | -o "$cpu" = "hppa" \ |
0938cda5 AJ |
812 | -o "$cpu" = "m68k" \ |
813 | -o "$cpu" = "mips" \ | |
814 | -o "$cpu" = "mips64" \ | |
fdf7ed96 | 815 | -o "$cpu" = "ppc" \ |
816 | -o "$cpu" = "ppc64" \ | |
0938cda5 AJ |
817 | -o "$cpu" = "s390" \ |
818 | -o "$cpu" = "sparc" \ | |
819 | -o "$cpu" = "sparc64"; then | |
7d13299d FB |
820 | bigendian="yes" |
821 | fi | |
822 | ||
823 | fi | |
824 | ||
b6853697 FB |
825 | # host long bits test |
826 | hostlongbits="32" | |
0938cda5 AJ |
827 | if test "$cpu" = "x86_64" \ |
828 | -o "$cpu" = "alpha" \ | |
829 | -o "$cpu" = "ia64" \ | |
fdf7ed96 | 830 | -o "$cpu" = "sparc64" \ |
831 | -o "$cpu" = "ppc64"; then | |
b6853697 FB |
832 | hostlongbits="64" |
833 | fi | |
834 | ||
bd0c5661 PB |
835 | # Check host NPTL support |
836 | cat > $TMPC <<EOF | |
837 | #include <sched.h> | |
30813cea | 838 | #include <linux/futex.h> |
bd0c5661 PB |
839 | void foo() |
840 | { | |
841 | #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) | |
842 | #error bork | |
843 | #endif | |
844 | } | |
845 | EOF | |
846 | ||
8c7f7574 | 847 | if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then |
bd0c5661 PB |
848 | : |
849 | else | |
850 | nptl="no" | |
851 | fi | |
852 | ||
ac62922e AZ |
853 | ########################################## |
854 | # zlib check | |
855 | ||
856 | cat > $TMPC << EOF | |
857 | #include <zlib.h> | |
858 | int main(void) { zlibVersion(); return 0; } | |
859 | EOF | |
8c7f7574 | 860 | if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then |
ac62922e AZ |
861 | : |
862 | else | |
863 | echo | |
864 | echo "Error: zlib check failed" | |
865 | echo "Make sure to have the zlib libs and headers installed." | |
866 | echo | |
867 | exit 1 | |
868 | fi | |
869 | ||
e37630ca AL |
870 | ########################################## |
871 | # xen probe | |
872 | ||
873 | if test "$xen" = "yes" ; then | |
b2266bee JQ |
874 | xen_libs="-lxenstore -lxenctrl -lxenguest" |
875 | cat > $TMPC <<EOF | |
e37630ca AL |
876 | #include <xenctrl.h> |
877 | #include <xs.h> | |
df7a607b | 878 | int main(void) { xs_daemon_open(); xc_interface_open(); return 0; } |
e37630ca | 879 | EOF |
ac8ab73a | 880 | if $cc $CFLAGS $ARCH_CFLAGS $EXTRA_CFLAGS -c -o $TMPO $TMPC $LDFLAGS $EXTRA_LDFLAGS $xen_libs 2> /dev/null > /dev/null ; then |
b2266bee JQ |
881 | : |
882 | else | |
883 | xen="no" | |
884 | fi | |
e37630ca AL |
885 | fi |
886 | ||
11d9f695 FB |
887 | ########################################## |
888 | # SDL probe | |
889 | ||
890 | sdl_too_old=no | |
891 | ||
f92f8afe | 892 | if test "$sdl" = "yes" ; then |
ac119f9d JQ |
893 | sdl=no |
894 | cat > $TMPC << EOF | |
11d9f695 FB |
895 | #include <SDL.h> |
896 | #undef main /* We don't want SDL to override our main() */ | |
897 | int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } | |
898 | EOF | |
ac119f9d JQ |
899 | sdl_cflags=`sdl-config --cflags 2> /dev/null` |
900 | sdl_libs=`sdl-config --libs 2> /dev/null` | |
901 | if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > $TMPSDLLOG 2>&1 ; then | |
902 | _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'` | |
903 | if test "$_sdlversion" -lt 121 ; then | |
904 | sdl_too_old=yes | |
905 | else | |
906 | if test "$cocoa" = "no" ; then | |
907 | sdl=yes | |
908 | fi | |
909 | fi | |
cd01b4a3 | 910 | |
ac119f9d JQ |
911 | # static link with sdl ? |
912 | if test "$sdl" = "yes" -a "$static" = "yes" ; then | |
913 | sdl_libs=`sdl-config --static-libs 2>/dev/null` | |
914 | if test `sdl-config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` ; then | |
915 | sdl_libs="$sdl_libs `aalib-config --static-libs >2 /dev/null`" | |
916 | sdl_cflags="$sd_cflags `aalib-config --cflags >2 /dev/null`" | |
917 | fi | |
918 | if $cc -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > /dev/null 2> /dev/null; then | |
919 | : | |
920 | else | |
921 | sdl=no | |
922 | fi | |
923 | fi # static link | |
924 | fi # sdl compile test | |
a68551bc | 925 | fi |
11d9f695 | 926 | |
5368a422 | 927 | if test "$sdl" = "yes" ; then |
ac119f9d | 928 | cat > $TMPC <<EOF |
5368a422 AL |
929 | #include <SDL.h> |
930 | #if defined(SDL_VIDEO_DRIVER_X11) | |
931 | #include <X11/XKBlib.h> | |
932 | #else | |
933 | #error No x11 support | |
934 | #endif | |
935 | int main(void) { return 0; } | |
936 | EOF | |
ac119f9d JQ |
937 | if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > /dev/null 2>&1 ; then |
938 | sdl_libs="$sdl_libs -lX11" | |
939 | fi | |
5368a422 AL |
940 | fi |
941 | ||
8d5d2d4c TS |
942 | ########################################## |
943 | # VNC TLS detection | |
944 | if test "$vnc_tls" = "yes" ; then | |
ae6b5e5a AL |
945 | cat > $TMPC <<EOF |
946 | #include <gnutls/gnutls.h> | |
947 | int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } | |
948 | EOF | |
949 | vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null` | |
950 | vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null` | |
951 | if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \ | |
8c7f7574 | 952 | $vnc_tls_libs > /dev/null 2> /dev/null ; then |
ae6b5e5a AL |
953 | : |
954 | else | |
955 | vnc_tls="no" | |
956 | fi | |
8d5d2d4c TS |
957 | fi |
958 | ||
2f9606b3 AL |
959 | ########################################## |
960 | # VNC SASL detection | |
961 | if test "$vnc_sasl" = "yes" ; then | |
962 | cat > $TMPC <<EOF | |
963 | #include <sasl/sasl.h> | |
964 | #include <stdio.h> | |
965 | int main(void) { sasl_server_init(NULL, "qemu"); return 0; } | |
966 | EOF | |
967 | # Assuming Cyrus-SASL installed in /usr prefix | |
968 | vnc_sasl_cflags="" | |
969 | vnc_sasl_libs="-lsasl2" | |
970 | if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \ | |
918a608b | 971 | $vnc_sasl_libs 2> /dev/null > /dev/null ; then |
2f9606b3 AL |
972 | : |
973 | else | |
974 | vnc_sasl="no" | |
975 | fi | |
976 | fi | |
977 | ||
76655d6d AL |
978 | ########################################## |
979 | # fnmatch() probe, used for ACL routines | |
980 | fnmatch="no" | |
981 | cat > $TMPC << EOF | |
982 | #include <fnmatch.h> | |
983 | int main(void) | |
984 | { | |
985 | fnmatch("foo", "foo", 0); | |
986 | return 0; | |
987 | } | |
988 | EOF | |
989 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then | |
990 | fnmatch="yes" | |
991 | fi | |
992 | ||
8a16d273 TS |
993 | ########################################## |
994 | # vde libraries probe | |
995 | if test "$vde" = "yes" ; then | |
4baae0ac JQ |
996 | vde=no |
997 | vde_libs="-lvdeplug" | |
8a16d273 TS |
998 | cat > $TMPC << EOF |
999 | #include <libvdeplug.h> | |
4a7f0e06 PB |
1000 | int main(void) |
1001 | { | |
1002 | struct vde_open_args a = {0, 0, 0}; | |
1003 | vde_open("", "", &a); | |
1004 | return 0; | |
1005 | } | |
8a16d273 | 1006 | EOF |
4baae0ac JQ |
1007 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC $vde_libs > /dev/null 2> /dev/null ; then |
1008 | vde=yes | |
1009 | fi | |
8a16d273 TS |
1010 | fi |
1011 | ||
8f28f3fb | 1012 | ########################################## |
c2de5c91 | 1013 | # Sound support libraries probe |
8f28f3fb | 1014 | |
c2de5c91 | 1015 | audio_drv_probe() |
1016 | { | |
1017 | drv=$1 | |
1018 | hdr=$2 | |
1019 | lib=$3 | |
1020 | exp=$4 | |
1021 | cfl=$5 | |
1022 | cat > $TMPC << EOF | |
1023 | #include <$hdr> | |
1024 | int main(void) { $exp } | |
8f28f3fb | 1025 | EOF |
8c7f7574 | 1026 | if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then |
c2de5c91 | 1027 | : |
1028 | else | |
1029 | echo | |
1030 | echo "Error: $drv check failed" | |
1031 | echo "Make sure to have the $drv libs and headers installed." | |
1032 | echo | |
1033 | exit 1 | |
1034 | fi | |
1035 | } | |
1036 | ||
2fa7d3bf | 1037 | audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` |
c2de5c91 | 1038 | for drv in $audio_drv_list; do |
1039 | case $drv in | |
1040 | alsa) | |
1041 | audio_drv_probe $drv alsa/asoundlib.h -lasound \ | |
1042 | "snd_pcm_t **handle; return snd_pcm_close(*handle);" | |
1043 | ;; | |
1044 | ||
1045 | fmod) | |
1046 | if test -z $fmod_lib || test -z $fmod_inc; then | |
1047 | echo | |
1048 | echo "Error: You must specify path to FMOD library and headers" | |
1049 | echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" | |
1050 | echo | |
1051 | exit 1 | |
1052 | fi | |
1053 | audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" | |
1054 | ;; | |
1055 | ||
1056 | esd) | |
1057 | audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' | |
1058 | ;; | |
b8e59f18 | 1059 | |
1060 | pa) | |
1061 | audio_drv_probe $drv pulse/simple.h -lpulse-simple \ | |
1062 | "pa_simple *s = NULL; pa_simple_free(s); return 0;" | |
1063 | ;; | |
1064 | ||
2f6a1ab0 BS |
1065 | oss|sdl|core|wav|dsound) |
1066 | # XXX: Probes for CoreAudio, DirectSound, SDL(?) | |
1067 | ;; | |
1068 | ||
e4c63a6a | 1069 | *) |
1c9b2a52 | 1070 | echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { |
e4c63a6a | 1071 | echo |
1072 | echo "Error: Unknown driver '$drv' selected" | |
1073 | echo "Possible drivers are: $audio_possible_drivers" | |
1074 | echo | |
1075 | exit 1 | |
1076 | } | |
1077 | ;; | |
c2de5c91 | 1078 | esac |
1079 | done | |
8f28f3fb | 1080 | |
2e4d9fb1 AJ |
1081 | ########################################## |
1082 | # BrlAPI probe | |
1083 | ||
eb82284f JQ |
1084 | if test "$brlapi" = "yes" ; then |
1085 | brlapi=no | |
1086 | brlapi_libs="-lbrlapi" | |
1087 | cat > $TMPC << EOF | |
2e4d9fb1 AJ |
1088 | #include <brlapi.h> |
1089 | int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } | |
1090 | EOF | |
eb82284f JQ |
1091 | if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC $brlapi_libs > /dev/null 2> /dev/null ; then |
1092 | brlapi=yes | |
1093 | fi | |
1094 | fi | |
2e4d9fb1 | 1095 | |
4d3b6f6e AZ |
1096 | ########################################## |
1097 | # curses probe | |
1098 | ||
1099 | if test "$curses" = "yes" ; then | |
4d3b6f6e AZ |
1100 | cat > $TMPC << EOF |
1101 | #include <curses.h> | |
5a8ff3aa BS |
1102 | #ifdef __OpenBSD__ |
1103 | #define resize_term resizeterm | |
1104 | #endif | |
1105 | int main(void) { resize_term(0, 0); return curses_version(); } | |
4d3b6f6e | 1106 | EOF |
ab4e5602 | 1107 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lncurses > /dev/null 2> /dev/null ; then |
e0b7a42b | 1108 | curses_libs="-lncurses" |
ab4e5602 | 1109 | elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then |
e0b7a42b JQ |
1110 | curses_libs="-lcurses" |
1111 | else | |
1112 | curses=no | |
4d3b6f6e AZ |
1113 | fi |
1114 | fi # test "$curses" | |
1115 | ||
769ce76d AG |
1116 | ########################################## |
1117 | # curl probe | |
1118 | ||
1119 | if test "$curl" = "yes" ; then | |
1120 | curl=no | |
1121 | cat > $TMPC << EOF | |
1122 | #include <curl/curl.h> | |
1123 | int main(void) { return curl_easy_init(); } | |
1124 | EOF | |
52368552 | 1125 | curl_libs=`curl-config --libs 2>/dev/null` |
769ce76d AG |
1126 | if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then |
1127 | curl=yes | |
1128 | fi | |
1129 | fi # test "$curl" | |
1130 | ||
fb599c9a AZ |
1131 | ########################################## |
1132 | # bluez support probe | |
1133 | if test "$bluez" = "yes" ; then | |
efcfd0c5 | 1134 | `pkg-config bluez 2> /dev/null` || bluez="no" |
fb599c9a AZ |
1135 | fi |
1136 | if test "$bluez" = "yes" ; then | |
e820e3f4 AZ |
1137 | cat > $TMPC << EOF |
1138 | #include <bluetooth/bluetooth.h> | |
1139 | int main(void) { return bt_error(0); } | |
1140 | EOF | |
efcfd0c5 BS |
1141 | bluez_cflags=`pkg-config --cflags bluez 2> /dev/null` |
1142 | bluez_libs=`pkg-config --libs bluez 2> /dev/null` | |
17e1592d | 1143 | if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \ |
8c7f7574 | 1144 | $bluez_libs > /dev/null 2> /dev/null ; then |
e820e3f4 AZ |
1145 | : |
1146 | else | |
1147 | bluez="no" | |
1148 | fi | |
fb599c9a AZ |
1149 | fi |
1150 | ||
7ba1e619 AL |
1151 | ########################################## |
1152 | # kvm probe | |
1153 | if test "$kvm" = "yes" ; then | |
1154 | cat > $TMPC <<EOF | |
1155 | #include <linux/kvm.h> | |
9fd8d8d7 | 1156 | #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12 |
7ba1e619 AL |
1157 | #error Invalid KVM version |
1158 | #endif | |
9fd8d8d7 AL |
1159 | #if !defined(KVM_CAP_USER_MEMORY) |
1160 | #error Missing KVM capability KVM_CAP_USER_MEMORY | |
1161 | #endif | |
1162 | #if !defined(KVM_CAP_SET_TSS_ADDR) | |
1163 | #error Missing KVM capability KVM_CAP_SET_TSS_ADDR | |
1164 | #endif | |
1165 | #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS) | |
1166 | #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS | |
1167 | #endif | |
7ba1e619 AL |
1168 | int main(void) { return 0; } |
1169 | EOF | |
eac30262 AL |
1170 | if test "$kerneldir" != "" ; then |
1171 | kvm_cflags=-I"$kerneldir"/include | |
8444eb6e AL |
1172 | if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \ |
1173 | -a -d "$kerneldir/arch/x86/include" ; then | |
1174 | kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include" | |
406b430d AL |
1175 | elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then |
1176 | kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include" | |
8444eb6e AL |
1177 | elif test -d "$kerneldir/arch/$cpu/include" ; then |
1178 | kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include" | |
1179 | fi | |
eac30262 AL |
1180 | else |
1181 | kvm_cflags="" | |
1182 | fi | |
7ba1e619 | 1183 | if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \ |
8c7f7574 | 1184 | > /dev/null 2>/dev/null ; then |
7ba1e619 AL |
1185 | : |
1186 | else | |
9fd8d8d7 AL |
1187 | kvm="no"; |
1188 | if [ -x "`which awk 2>/dev/null`" ] && \ | |
1189 | [ -x "`which grep 2>/dev/null`" ]; then | |
e4f5100c | 1190 | kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \ |
9fd8d8d7 AL |
1191 | | grep "error: " \ |
1192 | | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'` | |
1193 | if test "$kvmerr" != "" ; then | |
168ccc11 JK |
1194 | kvm="no - (${kvmerr})\n\ |
1195 | NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \ | |
1196 | recent kvm-kmod from http://sourceforge.net/projects/kvm." | |
9fd8d8d7 AL |
1197 | fi |
1198 | fi | |
7ba1e619 AL |
1199 | fi |
1200 | fi | |
1201 | ||
414f0dab | 1202 | ########################################## |
e5d355d1 | 1203 | # pthread probe |
de65fe0f | 1204 | PTHREADLIBS_LIST="-lpthread -lpthreadGC2" |
e5d355d1 | 1205 | PTHREADLIBS="" |
3c529d93 | 1206 | |
e5d355d1 AL |
1207 | if test "$pthread" = yes; then |
1208 | pthread=no | |
1209 | cat > $TMPC << EOF | |
3c529d93 | 1210 | #include <pthread.h> |
de65fe0f | 1211 | int main(void) { pthread_create(0,0,0,0); return 0; } |
414f0dab | 1212 | EOF |
de65fe0f SH |
1213 | for pthread_lib in $PTHREADLIBS_LIST; do |
1214 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC $pthread_lib 2> /dev/null > /dev/null ; then | |
1215 | pthread=yes | |
1216 | PTHREADLIBS="$pthread_lib" | |
1217 | break | |
1218 | fi | |
1219 | done | |
414f0dab BS |
1220 | fi |
1221 | ||
e5d355d1 AL |
1222 | if test "$pthread" = no; then |
1223 | aio=no | |
1224 | io_thread=no | |
1225 | fi | |
1226 | ||
bf9298b9 AL |
1227 | ########################################## |
1228 | # iovec probe | |
1229 | cat > $TMPC <<EOF | |
db34f0b3 | 1230 | #include <sys/types.h> |
bf9298b9 | 1231 | #include <sys/uio.h> |
db34f0b3 | 1232 | #include <unistd.h> |
bf9298b9 AL |
1233 | int main(void) { struct iovec iov; return 0; } |
1234 | EOF | |
1235 | iovec=no | |
8c7f7574 | 1236 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then |
bf9298b9 AL |
1237 | iovec=yes |
1238 | fi | |
1239 | ||
ceb42de8 AL |
1240 | ########################################## |
1241 | # preadv probe | |
1242 | cat > $TMPC <<EOF | |
1243 | #include <sys/types.h> | |
1244 | #include <sys/uio.h> | |
1245 | #include <unistd.h> | |
1246 | int main(void) { preadv; } | |
1247 | EOF | |
1248 | preadv=no | |
1249 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then | |
1250 | preadv=yes | |
1251 | fi | |
1252 | ||
f652e6af AJ |
1253 | ########################################## |
1254 | # fdt probe | |
1255 | if test "$fdt" = "yes" ; then | |
b41af4ba JQ |
1256 | fdt=no |
1257 | fdt_libs="-lfdt" | |
1258 | cat > $TMPC << EOF | |
f652e6af AJ |
1259 | int main(void) { return 0; } |
1260 | EOF | |
b41af4ba | 1261 | if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC $fdt_libs 2> /dev/null > /dev/null ; then |
f652e6af AJ |
1262 | fdt=yes |
1263 | fi | |
1264 | fi | |
1265 | ||
3b3f24ad AJ |
1266 | # |
1267 | # Check for xxxat() functions when we are building linux-user | |
1268 | # emulator. This is done because older glibc versions don't | |
1269 | # have syscall stubs for these implemented. | |
1270 | # | |
1271 | atfile=no | |
67ba57f6 | 1272 | cat > $TMPC << EOF |
3b3f24ad AJ |
1273 | #define _ATFILE_SOURCE |
1274 | #include <sys/types.h> | |
1275 | #include <fcntl.h> | |
1276 | #include <unistd.h> | |
1277 | ||
1278 | int | |
1279 | main(void) | |
1280 | { | |
1281 | /* try to unlink nonexisting file */ | |
1282 | return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); | |
1283 | } | |
1284 | EOF | |
67ba57f6 RV |
1285 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then |
1286 | atfile=yes | |
3b3f24ad AJ |
1287 | fi |
1288 | ||
39386ac7 | 1289 | # Check for inotify functions when we are building linux-user |
3b3f24ad AJ |
1290 | # emulator. This is done because older glibc versions don't |
1291 | # have syscall stubs for these implemented. In that case we | |
1292 | # don't provide them even if kernel supports them. | |
1293 | # | |
1294 | inotify=no | |
67ba57f6 | 1295 | cat > $TMPC << EOF |
3b3f24ad AJ |
1296 | #include <sys/inotify.h> |
1297 | ||
1298 | int | |
1299 | main(void) | |
1300 | { | |
1301 | /* try to start inotify */ | |
8690e420 | 1302 | return inotify_init(); |
3b3f24ad AJ |
1303 | } |
1304 | EOF | |
67ba57f6 RV |
1305 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then |
1306 | inotify=yes | |
3b3f24ad AJ |
1307 | fi |
1308 | ||
ebc996f3 RV |
1309 | # check if utimensat and futimens are supported |
1310 | utimens=no | |
1311 | cat > $TMPC << EOF | |
1312 | #define _ATFILE_SOURCE | |
1313 | #define _GNU_SOURCE | |
1314 | #include <stddef.h> | |
1315 | #include <fcntl.h> | |
1316 | ||
1317 | int main(void) | |
1318 | { | |
1319 | utimensat(AT_FDCWD, "foo", NULL, 0); | |
1320 | futimens(0, NULL); | |
1321 | return 0; | |
1322 | } | |
1323 | EOF | |
1324 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then | |
1325 | utimens=yes | |
1326 | fi | |
1327 | ||
099d6b0f RV |
1328 | # check if pipe2 is there |
1329 | pipe2=no | |
1330 | cat > $TMPC << EOF | |
1331 | #define _GNU_SOURCE | |
1332 | #include <unistd.h> | |
1333 | #include <fcntl.h> | |
1334 | ||
1335 | int main(void) | |
1336 | { | |
1337 | int pipefd[2]; | |
1338 | pipe2(pipefd, O_CLOEXEC); | |
1339 | return 0; | |
1340 | } | |
1341 | EOF | |
1342 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then | |
1343 | pipe2=yes | |
1344 | fi | |
1345 | ||
3ce34dfb VS |
1346 | # check if tee/splice is there. vmsplice was added same time. |
1347 | splice=no | |
1348 | cat > $TMPC << EOF | |
1349 | #define _GNU_SOURCE | |
1350 | #include <unistd.h> | |
1351 | #include <fcntl.h> | |
1352 | #include <limits.h> | |
1353 | ||
1354 | int main(void) | |
1355 | { | |
1356 | int len, fd; | |
1357 | len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); | |
1358 | splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); | |
1359 | return 0; | |
1360 | } | |
1361 | EOF | |
1362 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then | |
1363 | splice=yes | |
1364 | fi | |
1365 | ||
cc8ae6de | 1366 | # Check if tools are available to build documentation. |
70ec5dc0 AL |
1367 | if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then |
1368 | build_docs="no" | |
cc8ae6de PB |
1369 | fi |
1370 | ||
da93a1fd AL |
1371 | ########################################## |
1372 | # Do we need librt | |
e5d355d1 | 1373 | CLOCKLIBS="" |
da93a1fd AL |
1374 | cat > $TMPC <<EOF |
1375 | #include <signal.h> | |
1376 | #include <time.h> | |
1377 | int main(void) { clockid_t id; return clock_gettime(id, NULL); } | |
1378 | EOF | |
1379 | ||
1380 | rt=no | |
8c7f7574 | 1381 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then |
da93a1fd | 1382 | : |
8c7f7574 | 1383 | elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then |
da93a1fd AL |
1384 | rt=yes |
1385 | fi | |
1386 | ||
1387 | if test "$rt" = "yes" ; then | |
e5d355d1 | 1388 | CLOCKLIBS="-lrt" |
da93a1fd AL |
1389 | fi |
1390 | ||
11d9f695 | 1391 | if test "$mingw32" = "yes" ; then |
308c3593 | 1392 | if test -z "$prefix" ; then |
55418b96 | 1393 | prefix="c:/Program Files/Qemu" |
308c3593 PB |
1394 | fi |
1395 | mansuffix="" | |
1396 | datasuffix="" | |
1397 | docsuffix="" | |
1398 | binsuffix="" | |
11d9f695 | 1399 | else |
308c3593 PB |
1400 | if test -z "$prefix" ; then |
1401 | prefix="/usr/local" | |
1402 | fi | |
1403 | mansuffix="/share/man" | |
1404 | datasuffix="/share/qemu" | |
1405 | docsuffix="/share/doc/qemu" | |
1406 | binsuffix="/bin" | |
11d9f695 | 1407 | fi |
5a67135a | 1408 | |
43ce4dfe | 1409 | echo "Install prefix $prefix" |
308c3593 PB |
1410 | echo "BIOS directory $prefix$datasuffix" |
1411 | echo "binary directory $prefix$binsuffix" | |
11d9f695 | 1412 | if test "$mingw32" = "no" ; then |
308c3593 | 1413 | echo "Manual directory $prefix$mansuffix" |
43ce4dfe | 1414 | echo "ELF interp prefix $interp_prefix" |
11d9f695 | 1415 | fi |
5a67135a | 1416 | echo "Source path $source_path" |
43ce4dfe | 1417 | echo "C compiler $cc" |
83469015 | 1418 | echo "Host C compiler $host_cc" |
db7287ed | 1419 | echo "ARCH_CFLAGS $ARCH_CFLAGS" |
43ce4dfe | 1420 | echo "make $make" |
6a882643 | 1421 | echo "install $install" |
43ce4dfe | 1422 | echo "host CPU $cpu" |
de83cd02 | 1423 | echo "host big endian $bigendian" |
97a847bc | 1424 | echo "target list $target_list" |
ade25b0d | 1425 | echo "tcg debug enabled $debug_tcg" |
43ce4dfe | 1426 | echo "gprof enabled $gprof" |
03b4fe7d | 1427 | echo "sparse enabled $sparse" |
1625af87 | 1428 | echo "strip binaries $strip_opt" |
05c2a3e7 | 1429 | echo "profiler $profiler" |
43ce4dfe | 1430 | echo "static build $static" |
85aa5189 | 1431 | echo "-Werror enabled $werror" |
5b0753e0 FB |
1432 | if test "$darwin" = "yes" ; then |
1433 | echo "Cocoa support $cocoa" | |
1434 | fi | |
97a847bc | 1435 | echo "SDL support $sdl" |
4d3b6f6e | 1436 | echo "curses support $curses" |
769ce76d | 1437 | echo "curl support $curl" |
67b915a5 | 1438 | echo "mingw32 support $mingw32" |
0c58ac1c | 1439 | echo "Audio drivers $audio_drv_list" |
1440 | echo "Extra audio cards $audio_card_list" | |
8ff9cbf7 | 1441 | echo "Mixer emulation $mixemu" |
8d5d2d4c TS |
1442 | echo "VNC TLS support $vnc_tls" |
1443 | if test "$vnc_tls" = "yes" ; then | |
1444 | echo " TLS CFLAGS $vnc_tls_cflags" | |
1445 | echo " TLS LIBS $vnc_tls_libs" | |
1446 | fi | |
2f9606b3 AL |
1447 | echo "VNC SASL support $vnc_sasl" |
1448 | if test "$vnc_sasl" = "yes" ; then | |
1449 | echo " SASL CFLAGS $vnc_sasl_cflags" | |
1450 | echo " SASL LIBS $vnc_sasl_libs" | |
1451 | fi | |
3142255c BS |
1452 | if test -n "$sparc_cpu"; then |
1453 | echo "Target Sparc Arch $sparc_cpu" | |
1454 | fi | |
07f4ddbf | 1455 | echo "kqemu support $kqemu" |
e37630ca | 1456 | echo "xen support $xen" |
2e4d9fb1 | 1457 | echo "brlapi support $brlapi" |
cc8ae6de | 1458 | echo "Documentation $build_docs" |
c5937220 PB |
1459 | [ ! -z "$uname_release" ] && \ |
1460 | echo "uname -r $uname_release" | |
bd0c5661 | 1461 | echo "NPTL support $nptl" |
379f6698 | 1462 | echo "GUEST_BASE $guest_base" |
8a16d273 | 1463 | echo "vde support $vde" |
414f0dab | 1464 | echo "AIO support $aio" |
e5d355d1 | 1465 | echo "IO thread $io_thread" |
77755340 | 1466 | echo "Install blobs $blobs" |
168ccc11 | 1467 | echo -e "KVM support $kvm" |
f652e6af | 1468 | echo "fdt support $fdt" |
ceb42de8 | 1469 | echo "preadv support $preadv" |
67b915a5 | 1470 | |
97a847bc | 1471 | if test $sdl_too_old = "yes"; then |
24b55b96 | 1472 | echo "-> Your SDL version is too old - please upgrade to have SDL support" |
7c1f25b4 | 1473 | fi |
7d13299d | 1474 | |
98ec69ac JQ |
1475 | config_host_mak="config-host.mak" |
1476 | config_host_h="config-host.h" | |
4bf6b55b | 1477 | config_host_ld="config-host.ld" |
98ec69ac JQ |
1478 | |
1479 | #echo "Creating $config_host_mak and $config_host_h" | |
1480 | ||
1481 | test -f $config_host_h && mv $config_host_h ${config_host_h}~ | |
1482 | ||
1483 | echo "# Automatically generated by configure - do not modify" > $config_host_mak | |
1484 | printf "# Configured with:" >> $config_host_mak | |
1485 | printf " '%s'" "$0" "$@" >> $config_host_mak | |
1486 | echo >> $config_host_mak | |
98ec69ac | 1487 | |
2358a494 | 1488 | echo "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak |
804edf29 | 1489 | |
2408a527 | 1490 | case "$cpu" in |
c62bbcd3 | 1491 | i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|sparc|sparc64) |
e0da9dd3 | 1492 | ARCH=$cpu |
2408a527 | 1493 | ;; |
a302c32d | 1494 | armv4b|armv4l) |
16dbd14f | 1495 | ARCH=arm |
2408a527 | 1496 | ;; |
2408a527 AJ |
1497 | *) |
1498 | echo "Unsupported CPU = $cpu" | |
1499 | exit 1 | |
1500 | ;; | |
1501 | esac | |
98ec69ac | 1502 | echo "ARCH=$ARCH" >> $config_host_mak |
f8393946 | 1503 | if test "$debug_tcg" = "yes" ; then |
2358a494 | 1504 | echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak |
f8393946 | 1505 | fi |
f3d08ee6 | 1506 | if test "$debug" = "yes" ; then |
2358a494 | 1507 | echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak |
f3d08ee6 | 1508 | fi |
1625af87 | 1509 | if test "$strip_opt" = "yes" ; then |
98ec69ac | 1510 | echo "STRIP_OPT=-s" >> $config_host_mak |
1625af87 | 1511 | fi |
7d13299d | 1512 | if test "$bigendian" = "yes" ; then |
e2542fe2 | 1513 | echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak |
97a847bc | 1514 | fi |
2358a494 | 1515 | echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak |
67b915a5 | 1516 | if test "$mingw32" = "yes" ; then |
98ec69ac | 1517 | echo "CONFIG_WIN32=y" >> $config_host_mak |
210fa556 | 1518 | else |
35f4df27 | 1519 | echo "CONFIG_POSIX=y" >> $config_host_mak |
210fa556 PB |
1520 | cat > $TMPC << EOF |
1521 | #include <byteswap.h> | |
1522 | int main(void) { return bswap_32(0); } | |
1523 | EOF | |
178baee6 | 1524 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then |
2358a494 | 1525 | echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak |
210fa556 | 1526 | fi |
1360677c BS |
1527 | cat > $TMPC << EOF |
1528 | #include <sys/endian.h> | |
1529 | #include <sys/types.h> | |
1530 | #include <machine/bswap.h> | |
1531 | int main(void) { return bswap32(0); } | |
1532 | EOF | |
178baee6 | 1533 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then |
2358a494 | 1534 | echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak |
1360677c | 1535 | fi |
67b915a5 | 1536 | fi |
128ab2ff | 1537 | |
83fb7adf | 1538 | if test "$darwin" = "yes" ; then |
98ec69ac | 1539 | echo "CONFIG_DARWIN=y" >> $config_host_mak |
83fb7adf | 1540 | fi |
b29fe3ed | 1541 | |
1542 | if test "$aix" = "yes" ; then | |
98ec69ac | 1543 | echo "CONFIG_AIX=y" >> $config_host_mak |
b29fe3ed | 1544 | fi |
1545 | ||
ec530c81 | 1546 | if test "$solaris" = "yes" ; then |
98ec69ac | 1547 | echo "CONFIG_SOLARIS=y" >> $config_host_mak |
2358a494 | 1548 | echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak |
0475a5ca | 1549 | if test "$needs_libsunmath" = "yes" ; then |
75b5a697 | 1550 | echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak |
0475a5ca | 1551 | fi |
ec530c81 | 1552 | fi |
3142255c | 1553 | if test -n "$sparc_cpu"; then |
98ec69ac | 1554 | echo "CONFIG__sparc_${sparc_cpu}__=y" >> $config_host_mak |
3142255c | 1555 | fi |
97a847bc | 1556 | if test "$gprof" = "yes" ; then |
98ec69ac | 1557 | echo "TARGET_GPROF=yes" >> $config_host_mak |
97a847bc FB |
1558 | fi |
1559 | if test "$static" = "yes" ; then | |
98ec69ac | 1560 | echo "CONFIG_STATIC=y" >> $config_host_mak |
67c0f08d | 1561 | LDFLAGS="$LDFLAGS -static" |
7d13299d | 1562 | fi |
05c2a3e7 | 1563 | if test $profiler = "yes" ; then |
2358a494 | 1564 | echo "CONFIG_PROFILER=y" >> $config_host_mak |
05c2a3e7 | 1565 | fi |
c20709aa | 1566 | if test "$slirp" = "yes" ; then |
98ec69ac | 1567 | echo "CONFIG_SLIRP=y" >> $config_host_mak |
c20709aa | 1568 | fi |
8a16d273 | 1569 | if test "$vde" = "yes" ; then |
98ec69ac | 1570 | echo "CONFIG_VDE=y" >> $config_host_mak |
4baae0ac | 1571 | echo "VDE_LIBS=$vde_libs" >> $config_host_mak |
8a16d273 | 1572 | fi |
0c58ac1c | 1573 | for card in $audio_card_list; do |
f6e5889e | 1574 | def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'` |
98ec69ac | 1575 | echo "$def=y" >> $config_host_mak |
0c58ac1c | 1576 | done |
2358a494 | 1577 | echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak |
0c58ac1c | 1578 | for drv in $audio_drv_list; do |
f6e5889e | 1579 | def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'` |
98ec69ac | 1580 | echo "$def=y" >> $config_host_mak |
923e4521 | 1581 | if test "$drv" = "fmod"; then |
7aac6cb1 JQ |
1582 | echo "FMOD_LIBS=$fmod_lib" >> $config_host_mak |
1583 | echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak | |
2f6a1ab0 | 1584 | elif test "$drv" = "oss"; then |
6881964c | 1585 | echo "OSS_LIBS=$oss_lib" >> $config_host_mak |
0c58ac1c | 1586 | fi |
1587 | done | |
8ff9cbf7 | 1588 | if test "$mixemu" = "yes" ; then |
98ec69ac | 1589 | echo "CONFIG_MIXEMU=y" >> $config_host_mak |
8ff9cbf7 | 1590 | fi |
8d5d2d4c | 1591 | if test "$vnc_tls" = "yes" ; then |
98ec69ac | 1592 | echo "CONFIG_VNC_TLS=y" >> $config_host_mak |
525061bf JQ |
1593 | echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak |
1594 | echo "VNC_TLS_LIBS=$vnc_tls_libs" >> $config_host_mak | |
8d5d2d4c | 1595 | fi |
2f9606b3 | 1596 | if test "$vnc_sasl" = "yes" ; then |
98ec69ac | 1597 | echo "CONFIG_VNC_SASL=y" >> $config_host_mak |
60ddf533 JQ |
1598 | echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak |
1599 | echo "VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_host_mak | |
2f9606b3 | 1600 | fi |
76655d6d | 1601 | if test "$fnmatch" = "yes" ; then |
2358a494 | 1602 | echo "CONFIG_FNMATCH=y" >> $config_host_mak |
76655d6d | 1603 | fi |
b1a550a0 | 1604 | qemu_version=`head $source_path/VERSION` |
98ec69ac | 1605 | echo "VERSION=$qemu_version" >>$config_host_mak |
2358a494 | 1606 | echo "PKGVERSION=$pkgversion" >>$config_host_mak |
98ec69ac | 1607 | echo "SRC_PATH=$source_path" >> $config_host_mak |
ad064840 | 1608 | if [ "$source_path_used" = "yes" ]; then |
98ec69ac | 1609 | echo "VPATH=$source_path" >> $config_host_mak |
ad064840 | 1610 | fi |
98ec69ac | 1611 | echo "TARGET_DIRS=$target_list" >> $config_host_mak |
cc8ae6de | 1612 | if [ "$build_docs" = "yes" ] ; then |
98ec69ac | 1613 | echo "BUILD_DOCS=yes" >> $config_host_mak |
cc8ae6de | 1614 | fi |
1ac88f28 | 1615 | if test "$sdl" = "yes" ; then |
98ec69ac | 1616 | echo "CONFIG_SDL=y" >> $config_host_mak |
1ac88f28 JQ |
1617 | echo "SDL_LIBS=$sdl_libs" >> $config_host_mak |
1618 | echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak | |
49ecc3fa FB |
1619 | fi |
1620 | if test "$cocoa" = "yes" ; then | |
98ec69ac | 1621 | echo "CONFIG_COCOA=y" >> $config_host_mak |
4d3b6f6e AZ |
1622 | fi |
1623 | if test "$curses" = "yes" ; then | |
98ec69ac | 1624 | echo "CONFIG_CURSES=y" >> $config_host_mak |
e0b7a42b | 1625 | echo "CURSES_LIBS=$curses_libs" >> $config_host_mak |
49ecc3fa | 1626 | fi |
3b3f24ad | 1627 | if test "$atfile" = "yes" ; then |
2358a494 | 1628 | echo "CONFIG_ATFILE=y" >> $config_host_mak |
3b3f24ad | 1629 | fi |
ebc996f3 | 1630 | if test "$utimens" = "yes" ; then |
2358a494 | 1631 | echo "CONFIG_UTIMENSAT=y" >> $config_host_mak |
ebc996f3 | 1632 | fi |
099d6b0f | 1633 | if test "$pipe2" = "yes" ; then |
2358a494 | 1634 | echo "CONFIG_PIPE2=y" >> $config_host_mak |
099d6b0f | 1635 | fi |
3ce34dfb | 1636 | if test "$splice" = "yes" ; then |
2358a494 | 1637 | echo "CONFIG_SPLICE=y" >> $config_host_mak |
3ce34dfb | 1638 | fi |
3b3f24ad | 1639 | if test "$inotify" = "yes" ; then |
2358a494 | 1640 | echo "CONFIG_INOTIFY=y" >> $config_host_mak |
3b3f24ad | 1641 | fi |
769ce76d | 1642 | if test "$curl" = "yes" ; then |
98ec69ac JQ |
1643 | echo "CONFIG_CURL=y" >> $config_host_mak |
1644 | echo "CURL_LIBS=$curl_libs" >> $config_host_mak | |
769ce76d | 1645 | fi |
2e4d9fb1 | 1646 | if test "$brlapi" = "yes" ; then |
98ec69ac | 1647 | echo "CONFIG_BRLAPI=y" >> $config_host_mak |
eb82284f | 1648 | echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak |
2e4d9fb1 | 1649 | fi |
fb599c9a | 1650 | if test "$bluez" = "yes" ; then |
98ec69ac | 1651 | echo "CONFIG_BLUEZ=y" >> $config_host_mak |
ef7635ec JQ |
1652 | echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak |
1653 | echo "BLUEZ_LIBS=$bluez_libs" >> $config_host_mak | |
fb599c9a | 1654 | fi |
e37630ca | 1655 | if test "$xen" = "yes" ; then |
5647eb74 | 1656 | echo "CONFIG_XEN=y" >> $config_host_mak |
b2266bee | 1657 | echo "XEN_LIBS=$xen_libs" >> $config_host_mak |
e37630ca | 1658 | fi |
414f0dab | 1659 | if test "$aio" = "yes" ; then |
98ec69ac | 1660 | echo "CONFIG_AIO=y" >> $config_host_mak |
414f0dab | 1661 | fi |
e5d355d1 | 1662 | if test "$io_thread" = "yes" ; then |
98ec69ac | 1663 | echo "CONFIG_IOTHREAD=y" >> $config_host_mak |
e5d355d1 | 1664 | fi |
77755340 | 1665 | if test "$blobs" = "yes" ; then |
98ec69ac | 1666 | echo "INSTALL_BLOBS=yes" >> $config_host_mak |
77755340 | 1667 | fi |
bf9298b9 | 1668 | if test "$iovec" = "yes" ; then |
2358a494 | 1669 | echo "CONFIG_IOVEC=y" >> $config_host_mak |
bf9298b9 | 1670 | fi |
ceb42de8 | 1671 | if test "$preadv" = "yes" ; then |
2358a494 | 1672 | echo "CONFIG_PREADV=y" >> $config_host_mak |
ceb42de8 | 1673 | fi |
f652e6af | 1674 | if test "$fdt" = "yes" ; then |
3f0855b1 | 1675 | echo "CONFIG_FDT=y" >> $config_host_mak |
b41af4ba | 1676 | echo "FDT_LIBS=$fdt_libs" >> $config_host_mak |
f652e6af | 1677 | fi |
97a847bc | 1678 | |
83fb7adf | 1679 | # XXX: suppress that |
7d3505c5 | 1680 | if [ "$bsd" = "yes" ] ; then |
2358a494 | 1681 | echo "CONFIG_BSD=y" >> $config_host_mak |
7d3505c5 FB |
1682 | fi |
1683 | ||
2358a494 | 1684 | echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak |
c5937220 | 1685 | |
68063649 BS |
1686 | # USB host support |
1687 | case "$usb" in | |
1688 | linux) | |
98ec69ac | 1689 | echo "HOST_USB=linux" >> $config_host_mak |
68063649 BS |
1690 | ;; |
1691 | bsd) | |
98ec69ac | 1692 | echo "HOST_USB=bsd" >> $config_host_mak |
68063649 BS |
1693 | ;; |
1694 | *) | |
98ec69ac | 1695 | echo "HOST_USB=stub" >> $config_host_mak |
68063649 BS |
1696 | ;; |
1697 | esac | |
1698 | ||
9abbdbfe AL |
1699 | # Determine what linker flags to use to force archive inclusion |
1700 | check_linker_flags() | |
1701 | { | |
08b9d66b AL |
1702 | w2= |
1703 | if test "$2" ; then | |
1704 | w2=-Wl,$2 | |
1705 | fi | |
1706 | $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 ${w2} >/dev/null 2>/dev/null | |
9abbdbfe AL |
1707 | } |
1708 | ||
1709 | cat > $TMPC << EOF | |
1710 | int main(void) { } | |
1711 | EOF | |
1712 | if check_linker_flags --whole-archive --no-whole-archive ; then | |
1713 | # GNU ld | |
98ec69ac JQ |
1714 | echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_host_mak |
1715 | echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_host_mak | |
9abbdbfe AL |
1716 | elif check_linker_flags -z,allextract -z,defaultextract ; then |
1717 | # Solaris ld | |
98ec69ac JQ |
1718 | echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_host_mak |
1719 | echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_host_mak | |
08b9d66b AL |
1720 | elif check_linker_flags -all_load ; then |
1721 | # Mac OS X | |
98ec69ac JQ |
1722 | echo "ARLIBS_BEGIN=-all_load" >> $config_host_mak |
1723 | echo "ARLIBS_END=" >> $config_host_mak | |
9abbdbfe AL |
1724 | else |
1725 | echo "Error: your linker does not support --whole-archive or -z." | |
1726 | echo "Please report to [email protected]" | |
1727 | exit 1 | |
1728 | fi | |
1729 | ||
c39e3338 PB |
1730 | tools= |
1731 | if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then | |
3dd1f8ef | 1732 | tools="qemu-img\$(EXESUF) $tools" |
7a5ca864 | 1733 | if [ "$linux" = "yes" ] ; then |
3dd1f8ef | 1734 | tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools" |
7a5ca864 | 1735 | fi |
c39e3338 | 1736 | fi |
98ec69ac | 1737 | echo "TOOLS=$tools" >> $config_host_mak |
c39e3338 | 1738 | |
161294d8 | 1739 | # Mac OS X ships with a broken assembler |
253d0942 | 1740 | roms= |
161294d8 JQ |
1741 | if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ |
1742 | "$targetos" != "Darwin" ; then | |
c05ac895 | 1743 | roms="optionrom" |
253d0942 | 1744 | fi |
98ec69ac | 1745 | echo "ROMS=$roms" >> $config_host_mak |
253d0942 | 1746 | |
804edf29 JQ |
1747 | echo "prefix=$prefix" >> $config_host_mak |
1748 | echo "bindir=\${prefix}$binsuffix" >> $config_host_mak | |
1749 | echo "mandir=\${prefix}$mansuffix" >> $config_host_mak | |
1750 | echo "datadir=\${prefix}$datasuffix" >> $config_host_mak | |
1751 | echo "docdir=\${prefix}$docsuffix" >> $config_host_mak | |
1752 | echo "MAKE=$make" >> $config_host_mak | |
1753 | echo "INSTALL=$install" >> $config_host_mak | |
1754 | echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak | |
1755 | echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak | |
1756 | echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak | |
1757 | echo "CC=$cc" >> $config_host_mak | |
1758 | echo "HOST_CC=$host_cc" >> $config_host_mak | |
1759 | if test "$sparse" = "yes" ; then | |
1760 | echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak | |
1761 | echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak | |
1762 | echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak | |
1763 | fi | |
1764 | echo "AR=$ar" >> $config_host_mak | |
1765 | echo "OBJCOPY=$objcopy" >> $config_host_mak | |
1766 | echo "LD=$ld" >> $config_host_mak | |
1767 | echo "CFLAGS=$CFLAGS $OS_CFLAGS $ARCH_CFLAGS $EXTRA_CFLAGS" >> $config_host_mak | |
1768 | echo "LDFLAGS=$LDFLAGS $OS_LDFLAGS $ARCH_LDFLAGS $EXTRA_LDFLAGS" >> $config_host_mak | |
1769 | echo "EXESUF=$EXESUF" >> $config_host_mak | |
1770 | echo "PTHREADLIBS=$PTHREADLIBS" >> $config_host_mak | |
1771 | echo "CLOCKLIBS=$CLOCKLIBS" >> $config_host_mak | |
1772 | ||
2358a494 JQ |
1773 | echo "/* Automatically generated by configure - do not modify */" > $config_host_h |
1774 | ||
0ff6697d | 1775 | $SHELL $source_path/create_config < $config_host_mak >> $config_host_h |
2358a494 | 1776 | |
98ec69ac JQ |
1777 | if test -f ${config_host_h}~ ; then |
1778 | if cmp -s $config_host_h ${config_host_h}~ ; then | |
1779 | mv ${config_host_h}~ $config_host_h | |
370ab986 | 1780 | else |
98ec69ac | 1781 | rm ${config_host_h}~ |
370ab986 PB |
1782 | fi |
1783 | fi | |
1784 | ||
4bf6b55b JQ |
1785 | # generate list of library paths for linker script |
1786 | ||
1787 | $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} | |
1788 | ||
1789 | if test -f ${config_host_ld}~ ; then | |
1790 | if cmp -s $config_host_ld ${config_host_ld}~ ; then | |
1791 | mv ${config_host_ld}~ $config_host_ld | |
1792 | else | |
1793 | rm ${config_host_ld}~ | |
1794 | fi | |
1795 | fi | |
1796 | ||
1d14ffa9 | 1797 | for target in $target_list; do |
97a847bc FB |
1798 | target_dir="$target" |
1799 | config_mak=$target_dir/config.mak | |
1800 | config_h=$target_dir/config.h | |
600309b6 | 1801 | target_arch2=`echo $target | cut -d '-' -f 1` |
97a847bc | 1802 | target_bigendian="no" |
ea2d6a39 JQ |
1803 | case "$target_arch2" in |
1804 | armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|sh4eb|sparc|sparc64|sparc32plus) | |
1805 | target_bigendian=yes | |
1806 | ;; | |
1807 | esac | |
97a847bc | 1808 | target_softmmu="no" |
997344f3 | 1809 | target_user_only="no" |
831b7825 | 1810 | target_linux_user="no" |
831b7825 | 1811 | target_darwin_user="no" |
84778508 | 1812 | target_bsd_user="no" |
9e407a85 | 1813 | case "$target" in |
600309b6 | 1814 | ${target_arch2}-softmmu) |
9e407a85 PB |
1815 | target_softmmu="yes" |
1816 | ;; | |
600309b6 | 1817 | ${target_arch2}-linux-user) |
9e407a85 PB |
1818 | target_user_only="yes" |
1819 | target_linux_user="yes" | |
1820 | ;; | |
600309b6 | 1821 | ${target_arch2}-darwin-user) |
9e407a85 PB |
1822 | target_user_only="yes" |
1823 | target_darwin_user="yes" | |
1824 | ;; | |
600309b6 | 1825 | ${target_arch2}-bsd-user) |
84778508 BS |
1826 | target_user_only="yes" |
1827 | target_bsd_user="yes" | |
1828 | ;; | |
9e407a85 PB |
1829 | *) |
1830 | echo "ERROR: Target '$target' not recognised" | |
1831 | exit 1 | |
1832 | ;; | |
1833 | esac | |
831b7825 | 1834 | |
7c1f25b4 | 1835 | #echo "Creating $config_mak, $config_h and $target_dir/Makefile" |
97a847bc | 1836 | |
15d9ca0f TS |
1837 | test -f $config_h && mv $config_h ${config_h}~ |
1838 | ||
97a847bc | 1839 | mkdir -p $target_dir |
158142c2 | 1840 | mkdir -p $target_dir/fpu |
57fec1fe | 1841 | mkdir -p $target_dir/tcg |
84778508 | 1842 | if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then |
69de927c FB |
1843 | mkdir -p $target_dir/nwfpe |
1844 | fi | |
1845 | ||
ec530c81 FB |
1846 | # |
1847 | # don't use ln -sf as not all "ln -sf" over write the file/link | |
1848 | # | |
1849 | rm -f $target_dir/Makefile | |
1850 | ln -s $source_path/Makefile.target $target_dir/Makefile | |
1851 | ||
97a847bc FB |
1852 | |
1853 | echo "# Automatically generated by configure - do not modify" > $config_mak | |
de83cd02 | 1854 | |
97a847bc | 1855 | echo "include ../config-host.mak" >> $config_mak |
1e43adfc | 1856 | |
e5fe0c52 | 1857 | bflt="no" |
cb33da57 | 1858 | elfload32="no" |
bd0c5661 | 1859 | target_nptl="no" |
600309b6 | 1860 | interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` |
42bc608b | 1861 | echo "CONFIG_QEMU_PREFIX=\"$interp_prefix1\"" >> $config_mak |
56aebc89 | 1862 | gdb_xml_files="" |
7ba1e619 | 1863 | |
938b1edd | 1864 | TARGET_ARCH="$target_arch2" |
6acff7da | 1865 | TARGET_BASE_ARCH="" |
e6e91b9c | 1866 | TARGET_ABI_DIR="" |
e73aae67 | 1867 | |
600309b6 | 1868 | case "$target_arch2" in |
2408a527 | 1869 | i386) |
1ad2134f | 1870 | target_phys_bits=32 |
2408a527 AJ |
1871 | ;; |
1872 | x86_64) | |
6acff7da | 1873 | TARGET_BASE_ARCH=i386 |
1ad2134f | 1874 | target_phys_bits=64 |
2408a527 AJ |
1875 | ;; |
1876 | alpha) | |
1ad2134f | 1877 | target_phys_bits=64 |
2408a527 AJ |
1878 | ;; |
1879 | arm|armeb) | |
b498c8a0 | 1880 | TARGET_ARCH=arm |
2408a527 | 1881 | bflt="yes" |
bd0c5661 | 1882 | target_nptl="yes" |
56aebc89 | 1883 | gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" |
1ad2134f | 1884 | target_phys_bits=32 |
2408a527 AJ |
1885 | ;; |
1886 | cris) | |
253bd7f8 | 1887 | target_nptl="yes" |
1ad2134f | 1888 | target_phys_bits=32 |
2408a527 AJ |
1889 | ;; |
1890 | m68k) | |
2408a527 | 1891 | bflt="yes" |
56aebc89 | 1892 | gdb_xml_files="cf-core.xml cf-fp.xml" |
1ad2134f | 1893 | target_phys_bits=32 |
2408a527 | 1894 | ;; |
72b675ca | 1895 | microblaze) |
72b675ca EI |
1896 | bflt="yes" |
1897 | target_nptl="yes" | |
1898 | target_phys_bits=32 | |
1899 | ;; | |
0adcffb1 | 1900 | mips|mipsel) |
b498c8a0 | 1901 | TARGET_ARCH=mips |
42bc608b | 1902 | echo "TARGET_ABI_MIPSO32=y" >> $config_mak |
f04dc72f | 1903 | target_nptl="yes" |
1ad2134f | 1904 | target_phys_bits=64 |
2408a527 AJ |
1905 | ;; |
1906 | mipsn32|mipsn32el) | |
b498c8a0 | 1907 | TARGET_ARCH=mipsn32 |
6acff7da | 1908 | TARGET_BASE_ARCH=mips |
42bc608b | 1909 | echo "TARGET_ABI_MIPSN32=y" >> $config_mak |
1ad2134f | 1910 | target_phys_bits=64 |
2408a527 AJ |
1911 | ;; |
1912 | mips64|mips64el) | |
b498c8a0 | 1913 | TARGET_ARCH=mips64 |
6acff7da | 1914 | TARGET_BASE_ARCH=mips |
42bc608b | 1915 | echo "TARGET_ABI_MIPSN64=y" >> $config_mak |
1ad2134f | 1916 | target_phys_bits=64 |
2408a527 AJ |
1917 | ;; |
1918 | ppc) | |
c8b3532d | 1919 | gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" |
1ad2134f | 1920 | target_phys_bits=32 |
d6630708 | 1921 | target_nptl="yes" |
2408a527 AJ |
1922 | ;; |
1923 | ppcemb) | |
6acff7da | 1924 | TARGET_BASE_ARCH=ppc |
e6e91b9c | 1925 | TARGET_ABI_DIR=ppc |
c8b3532d | 1926 | gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" |
1ad2134f | 1927 | target_phys_bits=64 |
d6630708 | 1928 | target_nptl="yes" |
2408a527 AJ |
1929 | ;; |
1930 | ppc64) | |
6acff7da | 1931 | TARGET_BASE_ARCH=ppc |
e6e91b9c | 1932 | TARGET_ABI_DIR=ppc |
c8b3532d | 1933 | gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" |
1ad2134f | 1934 | target_phys_bits=64 |
2408a527 AJ |
1935 | ;; |
1936 | ppc64abi32) | |
b498c8a0 | 1937 | TARGET_ARCH=ppc64 |
6acff7da | 1938 | TARGET_BASE_ARCH=ppc |
e6e91b9c | 1939 | TARGET_ABI_DIR=ppc |
42bc608b | 1940 | echo "TARGET_ABI32=y" >> $config_mak |
c8b3532d | 1941 | gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" |
1ad2134f | 1942 | target_phys_bits=64 |
2408a527 AJ |
1943 | ;; |
1944 | sh4|sh4eb) | |
b498c8a0 | 1945 | TARGET_ARCH=sh4 |
2408a527 | 1946 | bflt="yes" |
0b6d3ae0 | 1947 | target_nptl="yes" |
1ad2134f | 1948 | target_phys_bits=32 |
2408a527 AJ |
1949 | ;; |
1950 | sparc) | |
1ad2134f | 1951 | target_phys_bits=64 |
2408a527 AJ |
1952 | ;; |
1953 | sparc64) | |
6acff7da | 1954 | TARGET_BASE_ARCH=sparc |
2408a527 | 1955 | elfload32="yes" |
1ad2134f | 1956 | target_phys_bits=64 |
2408a527 AJ |
1957 | ;; |
1958 | sparc32plus) | |
b498c8a0 | 1959 | TARGET_ARCH=sparc64 |
6acff7da | 1960 | TARGET_BASE_ARCH=sparc |
e6e91b9c | 1961 | TARGET_ABI_DIR=sparc |
42bc608b | 1962 | echo "TARGET_ABI32=y" >> $config_mak |
1ad2134f | 1963 | target_phys_bits=64 |
2408a527 AJ |
1964 | ;; |
1965 | *) | |
1966 | echo "Unsupported target CPU" | |
1967 | exit 1 | |
1968 | ;; | |
1969 | esac | |
b498c8a0 | 1970 | echo "TARGET_ARCH=$TARGET_ARCH" >> $config_mak |
0adcffb1 | 1971 | echo "TARGET_ARCH2=$target_arch2" >> $config_mak |
42bc608b | 1972 | # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH |
6acff7da JQ |
1973 | if [ "$TARGET_BASE_ARCH" = "" ]; then |
1974 | TARGET_BASE_ARCH=$TARGET_ARCH | |
6acff7da JQ |
1975 | fi |
1976 | echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_mak | |
e6e91b9c JQ |
1977 | if [ "$TARGET_ABI_DIR" = "" ]; then |
1978 | TARGET_ABI_DIR=$TARGET_ARCH | |
1979 | fi | |
1980 | echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_mak | |
1ad2134f PB |
1981 | if [ $target_phys_bits -lt $hostlongbits ] ; then |
1982 | target_phys_bits=$hostlongbits | |
1983 | fi | |
1b0c87fc JQ |
1984 | case "$target_arch2" in |
1985 | i386|x86_64) | |
1986 | if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then | |
1987 | echo "CONFIG_XEN=y" >> $config_mak | |
1b0c87fc | 1988 | fi |
0d46b7ed JQ |
1989 | if test $kqemu = "yes" -a "$target_softmmu" = "yes" |
1990 | then | |
1991 | echo "CONFIG_KQEMU=y" >> $config_mak | |
0d46b7ed | 1992 | fi |
1b0c87fc | 1993 | esac |
c59249f9 | 1994 | case "$target_arch2" in |
5f114bc6 | 1995 | i386|x86_64|ppcemb|ppc|ppc64) |
c59249f9 JQ |
1996 | # Make sure the target and host cpus are compatible |
1997 | if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ | |
1998 | \( "$target_arch2" = "$cpu" -o \ | |
1999 | \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ | |
5f114bc6 | 2000 | \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ |
c59249f9 JQ |
2001 | \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ |
2002 | \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then | |
2003 | echo "CONFIG_KVM=y" >> $config_mak | |
2004 | echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak | |
c59249f9 JQ |
2005 | fi |
2006 | esac | |
1ad2134f | 2007 | echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak |
42bc608b | 2008 | echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_mak |
1ad2134f | 2009 | echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak |
de83cd02 | 2010 | if test "$target_bigendian" = "yes" ; then |
42bc608b | 2011 | echo "TARGET_WORDS_BIGENDIAN=y" >> $config_mak |
de83cd02 | 2012 | fi |
97a847bc | 2013 | if test "$target_softmmu" = "yes" ; then |
e34af2ce | 2014 | echo "CONFIG_SOFTMMU=y" >> $config_mak |
43ce4dfe | 2015 | fi |
997344f3 | 2016 | if test "$target_user_only" = "yes" ; then |
e34af2ce | 2017 | echo "CONFIG_USER_ONLY=y" >> $config_mak |
997344f3 | 2018 | fi |
831b7825 | 2019 | if test "$target_linux_user" = "yes" ; then |
e34af2ce | 2020 | echo "CONFIG_LINUX_USER=y" >> $config_mak |
831b7825 TS |
2021 | fi |
2022 | if test "$target_darwin_user" = "yes" ; then | |
e34af2ce | 2023 | echo "CONFIG_DARWIN_USER=y" >> $config_mak |
831b7825 | 2024 | fi |
56aebc89 PB |
2025 | list="" |
2026 | if test ! -z "$gdb_xml_files" ; then | |
2027 | for x in $gdb_xml_files; do | |
2028 | list="$list $source_path/gdb-xml/$x" | |
2029 | done | |
2030 | fi | |
2031 | echo "TARGET_XML_FILES=$list" >> $config_mak | |
97a847bc | 2032 | |
f57975fb JQ |
2033 | case "$target_arch2" in |
2034 | arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|sparc|sparc64|sparc32plus) | |
2035 | echo "CONFIG_SOFTFLOAT=y" >> $config_mak | |
f57975fb JQ |
2036 | ;; |
2037 | esac | |
2038 | ||
e5fe0c52 | 2039 | if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then |
e34af2ce | 2040 | echo "TARGET_HAS_BFLT=y" >> $config_mak |
e5fe0c52 | 2041 | fi |
bd0c5661 PB |
2042 | if test "$target_user_only" = "yes" \ |
2043 | -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then | |
2f7bb878 | 2044 | echo "CONFIG_USE_NPTL=y" >> $config_mak |
bd0c5661 | 2045 | fi |
cb33da57 BS |
2046 | # 32 bit ELF loader in addition to native 64 bit loader? |
2047 | if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then | |
e34af2ce | 2048 | echo "TARGET_HAS_ELFLOAD32=y" >> $config_mak |
cb33da57 | 2049 | fi |
379f6698 PB |
2050 | if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then |
2051 | echo "CONFIG_USE_GUEST_BASE=y" >> $config_mak | |
2052 | fi | |
84778508 | 2053 | if test "$target_bsd_user" = "yes" ; then |
e34af2ce | 2054 | echo "CONFIG_BSD_USER=y" >> $config_mak |
84778508 | 2055 | fi |
5b0753e0 | 2056 | |
fa282484 JQ |
2057 | # generate LDFLAGS for targets |
2058 | ||
2059 | ldflags="" | |
2060 | if test "$target_linux_user" = "yes" -o "$target_linux_user" = "yes" ; then | |
2061 | case "$ARCH" in | |
2062 | i386) | |
2063 | if test "$gprof" = "yes" -o "$static" = "yes" ; then | |
4bf6b55b | 2064 | ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld' |
fa282484 JQ |
2065 | else |
2066 | # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object | |
2067 | # that the kernel ELF loader considers as an executable. I think this | |
2068 | # is the simplest way to make it self virtualizable! | |
2069 | ldflags='-Wl,-shared' | |
2070 | fi | |
2071 | ;; | |
2072 | sparc) | |
2073 | # -static is used to avoid g1/g3 usage by the dynamic linker | |
4bf6b55b | 2074 | ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static' |
fa282484 JQ |
2075 | ;; |
2076 | ia64) | |
4bf6b55b | 2077 | ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static' |
fa282484 JQ |
2078 | ;; |
2079 | x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64) | |
4bf6b55b | 2080 | ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld' |
fa282484 JQ |
2081 | ;; |
2082 | esac | |
2083 | fi | |
2084 | if test "$target_softmmu" = "yes" ; then | |
2085 | case "$ARCH" in | |
2086 | ia64) | |
4bf6b55b | 2087 | ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static' |
fa282484 JQ |
2088 | ;; |
2089 | esac | |
2090 | fi | |
2091 | ||
2092 | if test "$ldflags" != "" ; then | |
2093 | echo "LDFLAGS+=$ldflags" >> $config_mak | |
2094 | fi | |
2095 | ||
2358a494 JQ |
2096 | echo "/* Automatically generated by configure - do not modify */" > $config_h |
2097 | echo "#include \"../config-host.h\"" >> $config_h | |
2098 | ||
0ff6697d | 2099 | $SHELL $source_path/create_config < $config_mak >> $config_h |
42bc608b | 2100 | |
a900c002 JQ |
2101 | if test -f ${config_h}~ ; then |
2102 | if cmp -s $config_h ${config_h}~ ; then | |
2103 | mv ${config_h}~ $config_h | |
2104 | else | |
2105 | rm ${config_h}~ | |
2106 | fi | |
2107 | fi | |
15d9ca0f | 2108 | |
97a847bc | 2109 | done # for target in $targets |
7d13299d FB |
2110 | |
2111 | # build tree in object directory if source path is different from current one | |
2112 | if test "$source_path_used" = "yes" ; then | |
253d0942 | 2113 | DIRS="tests tests/cris slirp audio block pc-bios/optionrom" |
7d13299d | 2114 | FILES="Makefile tests/Makefile" |
e7daa605 | 2115 | FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit" |
e1ffb0f1 | 2116 | FILES="$FILES tests/test-mmap.c" |
7ea78b74 JK |
2117 | FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x" |
2118 | for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do | |
2119 | FILES="$FILES pc-bios/`basename $bios_file`" | |
2120 | done | |
7d13299d FB |
2121 | for dir in $DIRS ; do |
2122 | mkdir -p $dir | |
2123 | done | |
ec530c81 | 2124 | # remove the link and recreate it, as not all "ln -sf" overwrite the link |
7d13299d | 2125 | for f in $FILES ; do |
ec530c81 FB |
2126 | rm -f $f |
2127 | ln -s $source_path/$f $f | |
7d13299d FB |
2128 | done |
2129 | fi | |
1ad2134f PB |
2130 | |
2131 | for hwlib in 32 64; do | |
2132 | d=libhw$hwlib | |
2133 | mkdir -p $d | |
2134 | rm -f $d/Makefile | |
2135 | ln -s $source_path/Makefile.hw $d/Makefile | |
2136 | echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak | |
2137 | echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak | |
2138 | done |