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