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