]> git.proxmox.com Git - mirror_qemu.git/blame - configure
Fix build breakage introduced by r6219
[mirror_qemu.git] / configure
CommitLineData
7d13299d
FB
1#!/bin/sh
2#
3ef693a0 3# qemu configure script (c) 2003 Fabrice Bellard
7d13299d
FB
4#
5# set temporary file name
6if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10else
11 TMPDIR1="/tmp"
12fi
13
3ef693a0
FB
14TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
9d56d2dc 18TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
d4742de8 19TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
7d13299d 20
d4742de8 21trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
9ac81bbb 22
7d13299d 23# default parameters
11d9f695 24prefix=""
1e43adfc 25interp_prefix="/usr/gnemul/qemu-%M"
43ce4dfe 26static="no"
7d13299d
FB
27cross_prefix=""
28cc="gcc"
0c58ac1c 29audio_drv_list=""
30audio_card_list=""
7d13299d
FB
31host_cc="gcc"
32ar="ar"
33make="make"
6a882643 34install="install"
7d13299d 35strip="strip"
ac0df51d
AL
36
37# parse CC options first
38for opt do
39 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
40 case "$opt" in
41 --cross-prefix=*) cross_prefix="$optarg"
42 ;;
43 --cc=*) cc="$optarg"
44 ;;
45 esac
46done
47
48# OS specific
49# Using uname is really, really broken. Once we have the right set of checks
50# we can eliminate it's usage altogether
51
52cc="${cross_prefix}${cc}"
53ar="${cross_prefix}${ar}"
54strip="${cross_prefix}${strip}"
55
56# check that the C compiler works.
57cat > $TMPC <<EOF
58int main(void) {}
59EOF
60
61if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
62 : C compiler works ok
63else
64 echo "ERROR: \"$cc\" either does not exist or does not work"
65 exit 1
66fi
67
68check_define() {
69cat > $TMPC <<EOF
70#if !defined($1)
71#error Not defined
72#endif
73int main(void) { return 0; }
74EOF
75 $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
76}
77
78if check_define __i386__ ; then
79 cpu="i386"
80elif check_define __x86_64__ ; then
81 cpu="x86_64"
3aa9bd6c
BS
82elif check_define __sparc__ ; then
83 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
84 # They must be specified using --sparc_cpu
85 if check_define __arch64__ ; then
86 cpu="sparc64"
87 else
88 cpu="sparc"
89 fi
ac0df51d
AL
90else
91 cpu=`test $(uname -s) = AIX && uname -p || uname -m`
92fi
93
5327cf48 94target_list=""
7d13299d
FB
95case "$cpu" in
96 i386|i486|i586|i686|i86pc|BePC)
97a847bc 97 cpu="i386"
7d13299d 98 ;;
aaa5fa14
AJ
99 x86_64|amd64)
100 cpu="x86_64"
101 ;;
102 alpha)
103 cpu="alpha"
104 ;;
ba68055e 105 armv*b)
808c4954
FB
106 cpu="armv4b"
107 ;;
ba68055e 108 armv*l)
7d13299d
FB
109 cpu="armv4l"
110 ;;
aaa5fa14
AJ
111 cris)
112 cpu="cris"
7d13299d 113 ;;
f54b3f92
AJ
114 parisc|parisc64)
115 cpu="hppa"
116 ;;
aaa5fa14
AJ
117 ia64)
118 cpu="ia64"
119 ;;
120 m68k)
121 cpu="m68k"
7d13299d
FB
122 ;;
123 mips)
124 cpu="mips"
125 ;;
fbe4f65b
TS
126 mips64)
127 cpu="mips64"
128 ;;
b29fe3ed 129 "Power Macintosh"|ppc|ppc64|powerpc)
aaa5fa14 130 cpu="powerpc"
e7daa605 131 ;;
0e7b8a9f 132 s390*)
fb3e5849
FB
133 cpu="s390"
134 ;;
3142255c 135 sparc|sun4[cdmuv])
ae228531
FB
136 cpu="sparc"
137 ;;
138 sparc64)
139 cpu="sparc64"
140 ;;
7d13299d
FB
141 *)
142 cpu="unknown"
143 ;;
144esac
145gprof="no"
03b4fe7d 146sparse="no"
7d13299d 147bigendian="no"
67b915a5
FB
148mingw32="no"
149EXESUF=""
150gdbstub="yes"
443f1376 151slirp="yes"
e0e6c8c0 152vde="yes"
102a52e4
FB
153fmod_lib=""
154fmod_inc=""
2f6a1ab0 155oss_lib=""
8d5d2d4c 156vnc_tls="yes"
b1a550a0 157bsd="no"
5327cf48 158linux="no"
d2c7c9b8 159solaris="no"
c9ec1fe4 160kqemu="no"
05c2a3e7 161profiler="no"
5b0753e0 162cocoa="no"
97ccc689 163check_gfx="yes"
0a8e90f4 164softmmu="yes"
831b7825
TS
165linux_user="no"
166darwin_user="no"
84778508 167bsd_user="no"
cc8ae6de 168build_docs="no"
c5937220 169uname_release=""
4d3b6f6e 170curses="yes"
414f0dab 171aio="yes"
bd0c5661 172nptl="yes"
8ff9cbf7 173mixemu="no"
fb599c9a 174bluez="yes"
7ba1e619 175kvm="yes"
eac30262 176kerneldir=""
b29fe3ed 177aix="no"
77755340 178blobs="yes"
f652e6af 179fdt="yes"
7d13299d
FB
180
181# OS specific
ac0df51d
AL
182if check_define __linux__ ; then
183 targetos="Linux"
184elif check_define _WIN32 ; then
185 targetos='MINGW32'
186else
187 targetos=`uname -s`
188fi
7d13299d 189case $targetos in
c326e0af
FB
190CYGWIN*)
191mingw32="yes"
6f30fa85 192OS_CFLAGS="-mno-cygwin"
db8d7dd1
TS
193if [ "$cpu" = "i386" ] ; then
194 kqemu="yes"
195fi
c2de5c91 196audio_possible_drivers="sdl"
c326e0af 197;;
67b915a5
FB
198MINGW32*)
199mingw32="yes"
db8d7dd1
TS
200if [ "$cpu" = "i386" ] ; then
201 kqemu="yes"
202fi
c2de5c91 203audio_possible_drivers="dsound sdl fmod"
67b915a5 204;;
5c40d2bd 205GNU/kFreeBSD)
0c58ac1c 206audio_drv_list="oss"
f34af52c 207audio_possible_drivers="oss sdl esd pa"
5c40d2bd
TS
208if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
209 kqemu="yes"
210fi
211;;
7d3505c5
FB
212FreeBSD)
213bsd="yes"
0c58ac1c 214audio_drv_list="oss"
f34af52c 215audio_possible_drivers="oss sdl esd pa"
e99f9060 216if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
07f4ddbf
FB
217 kqemu="yes"
218fi
7d3505c5
FB
219;;
220NetBSD)
221bsd="yes"
0c58ac1c 222audio_drv_list="oss"
c2de5c91 223audio_possible_drivers="oss sdl esd"
8ef92a88 224oss_lib="-lossaudio"
7d3505c5
FB
225;;
226OpenBSD)
227bsd="yes"
128ab2ff 228openbsd="yes"
0c58ac1c 229audio_drv_list="oss"
c2de5c91 230audio_possible_drivers="oss sdl esd"
2f6a1ab0 231oss_lib="-lossaudio"
7d3505c5 232;;
83fb7adf
FB
233Darwin)
234bsd="yes"
235darwin="yes"
831b7825 236darwin_user="yes"
fd677642 237cocoa="yes"
0c58ac1c 238audio_drv_list="coreaudio"
c2de5c91 239audio_possible_drivers="coreaudio sdl fmod"
6f30fa85 240OS_CFLAGS="-mdynamic-no-pic"
c2c59c3e 241OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
83fb7adf 242;;
ec530c81 243SunOS)
c2b84fab
TS
244 solaris="yes"
245 make="gmake"
246 install="ginstall"
0475a5ca 247 needs_libsunmath="no"
c2b84fab 248 solarisrev=`uname -r | cut -f2 -d.`
ef18c883
TS
249 # have to select again, because `uname -m` returns i86pc
250 # even on an x86_64 box.
251 solariscpu=`isainfo -k`
252 if test "${solariscpu}" = "amd64" ; then
253 cpu="x86_64"
254 fi
c2b84fab 255 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
0475a5ca
TS
256 if test "$solarisrev" -le 9 ; then
257 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
258 needs_libsunmath="yes"
259 else
260 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
261 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
262 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
263 echo "Studio 11 can be downloaded from www.sun.com."
264 exit 1
265 fi
266 fi
267 if test "$solarisrev" -ge 9 ; then
c2b84fab
TS
268 kqemu="yes"
269 fi
86b2bd93 270 fi
6b4d2ba1 271 if test -f /usr/include/sys/soundcard.h ; then
0c58ac1c 272 audio_drv_list="oss"
6b4d2ba1 273 fi
c2de5c91 274 audio_possible_drivers="oss sdl"
86b2bd93 275;;
b29fe3ed 276AIX)
277aix="yes"
278make="gmake"
279;;
1d14ffa9 280*)
0c58ac1c 281audio_drv_list="oss"
b8e59f18 282audio_possible_drivers="oss alsa sdl esd pa"
5327cf48 283linux="yes"
831b7825 284linux_user="yes"
68063649 285usb="linux"
07f4ddbf 286if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
c9ec1fe4 287 kqemu="yes"
c2de5c91 288 audio_possible_drivers="$audio_possible_drivers fmod"
c9ec1fe4 289fi
fb065187 290;;
7d13299d
FB
291esac
292
7d3505c5 293if [ "$bsd" = "yes" ] ; then
b1a550a0 294 if [ "$darwin" != "yes" ] ; then
83fb7adf 295 make="gmake"
68063649 296 usb="bsd"
83fb7adf 297 fi
84778508 298 bsd_user="yes"
7d3505c5
FB
299fi
300
7d13299d 301# find source path
ad064840 302source_path=`dirname "$0"`
59faef3a
AZ
303source_path_used="no"
304workdir=`pwd`
ad064840 305if [ -z "$source_path" ]; then
59faef3a 306 source_path=$workdir
ad064840
PB
307else
308 source_path=`cd "$source_path"; pwd`
7d13299d 309fi
724db118 310[ -f "$workdir/vl.c" ] || source_path_used="yes"
7d13299d 311
85aa5189 312werror="no"
0d1e2394
FB
313# generate compile errors on warnings for development builds
314#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
315#werror="yes";
316#fi
85aa5189 317
7d13299d 318for opt do
a46e4035 319 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
7d13299d 320 case "$opt" in
2efc3265
FB
321 --help|-h) show_help=yes
322 ;;
b1a550a0 323 --prefix=*) prefix="$optarg"
7d13299d 324 ;;
b1a550a0 325 --interp-prefix=*) interp_prefix="$optarg"
32ce6337 326 ;;
b1a550a0 327 --source-path=*) source_path="$optarg"
ad064840 328 source_path_used="yes"
7d13299d 329 ;;
ac0df51d 330 --cross-prefix=*)
7d13299d 331 ;;
ac0df51d 332 --cc=*)
7d13299d 333 ;;
b1a550a0 334 --host-cc=*) host_cc="$optarg"
83469015 335 ;;
b1a550a0 336 --make=*) make="$optarg"
7d13299d 337 ;;
6a882643
PB
338 --install=*) install="$optarg"
339 ;;
b1a550a0 340 --extra-cflags=*) CFLAGS="$optarg"
7d13299d 341 ;;
b1a550a0 342 --extra-ldflags=*) LDFLAGS="$optarg"
7d13299d 343 ;;
b1a550a0 344 --cpu=*) cpu="$optarg"
7d13299d 345 ;;
b1a550a0 346 --target-list=*) target_list="$optarg"
de83cd02 347 ;;
7d13299d
FB
348 --enable-gprof) gprof="yes"
349 ;;
43ce4dfe
FB
350 --static) static="yes"
351 ;;
97a847bc
FB
352 --disable-sdl) sdl="no"
353 ;;
0c58ac1c 354 --fmod-lib=*) fmod_lib="$optarg"
1d14ffa9 355 ;;
c2de5c91 356 --fmod-inc=*) fmod_inc="$optarg"
357 ;;
2f6a1ab0
BS
358 --oss-lib=*) oss_lib="$optarg"
359 ;;
2fa7d3bf 360 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
102a52e4 361 ;;
0c58ac1c 362 --audio-drv-list=*) audio_drv_list="$optarg"
102a52e4 363 ;;
03b4fe7d
AL
364 --enable-sparse) sparse="yes"
365 ;;
366 --disable-sparse) sparse="no"
367 ;;
8d5d2d4c
TS
368 --disable-vnc-tls) vnc_tls="no"
369 ;;
443f1376 370 --disable-slirp) slirp="no"
1d14ffa9 371 ;;
e0e6c8c0 372 --disable-vde) vde="no"
8a16d273 373 ;;
c9ec1fe4 374 --disable-kqemu) kqemu="no"
1d14ffa9 375 ;;
2e4d9fb1
AJ
376 --disable-brlapi) brlapi="no"
377 ;;
fb599c9a
AZ
378 --disable-bluez) bluez="no"
379 ;;
7ba1e619
AL
380 --disable-kvm) kvm="no"
381 ;;
05c2a3e7
FB
382 --enable-profiler) profiler="yes"
383 ;;
c2de5c91 384 --enable-cocoa)
385 cocoa="yes" ;
386 sdl="no" ;
387 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
1d14ffa9 388 ;;
97ccc689
FB
389 --disable-gfx-check) check_gfx="no"
390 ;;
cad25d69 391 --disable-system) softmmu="no"
0a8e90f4 392 ;;
cad25d69 393 --enable-system) softmmu="yes"
0a8e90f4 394 ;;
831b7825 395 --disable-linux-user) linux_user="no"
0a8e90f4 396 ;;
831b7825
TS
397 --enable-linux-user) linux_user="yes"
398 ;;
399 --disable-darwin-user) darwin_user="no"
400 ;;
401 --enable-darwin-user) darwin_user="yes"
0a8e90f4 402 ;;
84778508
BS
403 --disable-bsd-user) bsd_user="no"
404 ;;
405 --enable-bsd-user) bsd_user="yes"
406 ;;
c5937220
PB
407 --enable-uname-release=*) uname_release="$optarg"
408 ;;
3142255c
BS
409 --sparc_cpu=*)
410 sparc_cpu="$optarg"
411 case $sparc_cpu in
412 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
413 target_cpu="sparc"; cpu="sparc" ;;
414 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
415 target_cpu="sparc"; cpu="sparc" ;;
416 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
417 target_cpu="sparc64"; cpu="sparc64" ;;
418 *) echo "undefined SPARC architecture. Exiting";exit 1;;
419 esac
420 ;;
85aa5189
FB
421 --enable-werror) werror="yes"
422 ;;
423 --disable-werror) werror="no"
424 ;;
4d3b6f6e
AZ
425 --disable-curses) curses="no"
426 ;;
bd0c5661
PB
427 --disable-nptl) nptl="no"
428 ;;
8ff9cbf7 429 --enable-mixemu) mixemu="yes"
430 ;;
414f0dab
BS
431 --disable-aio) aio="no"
432 ;;
77755340
TS
433 --disable-blobs) blobs="no"
434 ;;
eac30262
AL
435 --kerneldir=*) kerneldir="$optarg"
436 ;;
7f1559c6
AZ
437 *) echo "ERROR: unknown option $opt"; show_help="yes"
438 ;;
7d13299d
FB
439 esac
440done
441
6f30fa85 442# default flags for all hosts
ac41a620 443CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
e0e36fe9 444CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
6f30fa85 445LDFLAGS="$LDFLAGS -g"
85aa5189
FB
446if test "$werror" = "yes" ; then
447CFLAGS="$CFLAGS -Werror"
448fi
6f30fa85 449
d2c7c9b8
BS
450if test "$solaris" = "no" ; then
451 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
452 LDFLAGS="$LDFLAGS -Wl,--warn-common"
453 fi
49237acd
BS
454fi
455
3142255c
BS
456#
457# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
458# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
459#
40293e58 460case "$cpu" in
3142255c
BS
461 sparc) if test -z "$sparc_cpu" ; then
462 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
463 ARCH_LDFLAGS="-m32"
464 else
465 ARCH_CFLAGS="${SP_CFLAGS}"
466 ARCH_LDFLAGS="${SP_LDFLAGS}"
467 fi
468 ;;
469 sparc64) if test -z "$sparc_cpu" ; then
470 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
471 ARCH_LDFLAGS="-m64"
472 else
473 ARCH_CFLAGS="${SP_CFLAGS}"
474 ARCH_LDFLAGS="${SP_LDFLAGS}"
475 fi
476 ;;
76d83bde
TS
477 s390)
478 ARCH_CFLAGS="-march=z900"
479 ;;
40293e58
FB
480 i386)
481 ARCH_CFLAGS="-m32"
482 ARCH_LDFLAGS="-m32"
483 ;;
484 x86_64)
485 ARCH_CFLAGS="-m64"
486 ARCH_LDFLAGS="-m64"
487 ;;
3142255c
BS
488esac
489
af5db58e
PB
490if test x"$show_help" = x"yes" ; then
491cat << EOF
492
493Usage: configure [options]
494Options: [defaults in brackets after descriptions]
495
496EOF
497echo "Standard options:"
498echo " --help print this message"
499echo " --prefix=PREFIX install in PREFIX [$prefix]"
500echo " --interp-prefix=PREFIX where to find shared libraries, etc."
501echo " use %M for cpu name [$interp_prefix]"
502echo " --target-list=LIST set target list [$target_list]"
503echo ""
504echo "kqemu kernel acceleration support:"
505echo " --disable-kqemu disable kqemu support"
af5db58e
PB
506echo ""
507echo "Advanced options (experts only):"
508echo " --source-path=PATH path of source code [$source_path]"
509echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
510echo " --cc=CC use C compiler CC [$cc]"
511echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
512echo " --make=MAKE use specified make [$make]"
6a882643 513echo " --install=INSTALL use specified install [$install]"
af5db58e 514echo " --static enable static build [$static]"
890b1658
AL
515echo " --enable-sparse enable sparse checker"
516echo " --disable-sparse disable sparse checker (default)"
85aa5189 517echo " --disable-werror disable compilation abort on warning"
fe8f78e4 518echo " --disable-sdl disable SDL"
af5db58e 519echo " --enable-cocoa enable COCOA (Mac OS X only)"
c2de5c91 520echo " --audio-drv-list=LIST set audio drivers list:"
521echo " Available drivers: $audio_possible_drivers"
522echo " --audio-card-list=LIST set list of additional emulated audio cards"
523echo " Available cards: ac97 adlib cs4231a gus"
8ff9cbf7 524echo " --enable-mixemu enable mixer emulation"
2e4d9fb1 525echo " --disable-brlapi disable BrlAPI"
8d5d2d4c 526echo " --disable-vnc-tls disable TLS encryption for VNC server"
af896aaa 527echo " --disable-curses disable curses output"
fb599c9a 528echo " --disable-bluez disable bluez stack connectivity"
7ba1e619 529echo " --disable-kvm disable KVM acceleration support"
bd0c5661 530echo " --disable-nptl disable usermode NPTL support"
af5db58e
PB
531echo " --enable-system enable all system emulation targets"
532echo " --disable-system disable all system emulation targets"
831b7825
TS
533echo " --enable-linux-user enable all linux usermode emulation targets"
534echo " --disable-linux-user disable all linux usermode emulation targets"
535echo " --enable-darwin-user enable all darwin usermode emulation targets"
536echo " --disable-darwin-user disable all darwin usermode emulation targets"
84778508
BS
537echo " --enable-bsd-user enable all BSD usermode emulation targets"
538echo " --disable-bsd-user disable all BSD usermode emulation targets"
af5db58e
PB
539echo " --fmod-lib path to FMOD library"
540echo " --fmod-inc path to FMOD includes"
2f6a1ab0 541echo " --oss-lib path to OSS library"
c5937220 542echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
3142255c 543echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
e0e6c8c0 544echo " --disable-vde disable support for vde network"
414f0dab 545echo " --disable-aio disable AIO support"
77755340 546echo " --disable-blobs disable installing provided firmware blobs"
eac30262 547echo " --kerneldir=PATH look for kernel includes in PATH"
af5db58e 548echo ""
5bf08934 549echo "NOTE: The object files are built at the place where configure is launched"
af5db58e
PB
550exit 1
551fi
552
67b915a5 553if test "$mingw32" = "yes" ; then
5327cf48 554 linux="no"
67b915a5 555 EXESUF=".exe"
9f059eca 556 oss="no"
cd01b4a3 557 linux_user="no"
84778508 558 bsd_user="no"
cd01b4a3
AL
559fi
560
03b4fe7d
AL
561if test ! -x "$(which cgcc 2>/dev/null)"; then
562 sparse="no"
563fi
564
ec530c81
FB
565#
566# Solaris specific configure tool chain decisions
567#
568if test "$solaris" = "yes" ; then
ec530c81
FB
569 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
570 if test -z "$solinst" ; then
571 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
572 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
573 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
574 exit 1
575 fi
576 if test "$solinst" = "/usr/sbin/install" ; then
577 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
578 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
579 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
580 exit 1
581 fi
ec530c81
FB
582 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
583 if test -z "$sol_ar" ; then
584 echo "Error: No path includes ar"
585 if test -f /usr/ccs/bin/ar ; then
586 echo "Add /usr/ccs/bin to your path and rerun configure"
587 fi
588 exit 1
589 fi
5fafdf24 590fi
ec530c81
FB
591
592
5327cf48
FB
593if test -z "$target_list" ; then
594# these targets are portable
0a8e90f4 595 if [ "$softmmu" = "yes" ] ; then
2408a527
AJ
596 target_list="\
597i386-softmmu \
598x86_64-softmmu \
599arm-softmmu \
600cris-softmmu \
601m68k-softmmu \
602mips-softmmu \
603mipsel-softmmu \
604mips64-softmmu \
605mips64el-softmmu \
606ppc-softmmu \
607ppcemb-softmmu \
608ppc64-softmmu \
609sh4-softmmu \
610sh4eb-softmmu \
611sparc-softmmu \
612"
0a8e90f4 613 fi
5327cf48 614# the following are Linux specific
831b7825 615 if [ "$linux_user" = "yes" ] ; then
2408a527
AJ
616 target_list="${target_list}\
617i386-linux-user \
618x86_64-linux-user \
619alpha-linux-user \
620arm-linux-user \
621armeb-linux-user \
622cris-linux-user \
623m68k-linux-user \
624mips-linux-user \
625mipsel-linux-user \
626ppc-linux-user \
627ppc64-linux-user \
628ppc64abi32-linux-user \
629sh4-linux-user \
630sh4eb-linux-user \
631sparc-linux-user \
632sparc64-linux-user \
633sparc32plus-linux-user \
634"
831b7825
TS
635 fi
636# the following are Darwin specific
637 if [ "$darwin_user" = "yes" ] ; then
6cdc7375 638 target_list="$target_list i386-darwin-user ppc-darwin-user "
5327cf48 639 fi
84778508
BS
640# the following are BSD specific
641 if [ "$bsd_user" = "yes" ] ; then
642 target_list="${target_list}\
643sparc64-bsd-user \
644"
645 fi
6e20a45f 646else
b1a550a0 647 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
5327cf48 648fi
0a8e90f4
PB
649if test -z "$target_list" ; then
650 echo "No targets enabled"
651 exit 1
652fi
5327cf48 653
7d13299d
FB
654if test -z "$cross_prefix" ; then
655
656# ---
657# big/little endian test
658cat > $TMPC << EOF
659#include <inttypes.h>
660int main(int argc, char ** argv){
1d14ffa9
FB
661 volatile uint32_t i=0x01234567;
662 return (*((uint8_t*)(&i))) == 0x67;
7d13299d
FB
663}
664EOF
665
178baee6 666if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
7d13299d
FB
667$TMPE && bigendian="yes"
668else
669echo big/little test failed
670fi
671
672else
673
674# if cross compiling, cannot launch a program, so make a static guess
0938cda5 675if test "$cpu" = "armv4b" \
f54b3f92 676 -o "$cpu" = "hppa" \
0938cda5
AJ
677 -o "$cpu" = "m68k" \
678 -o "$cpu" = "mips" \
679 -o "$cpu" = "mips64" \
680 -o "$cpu" = "powerpc" \
681 -o "$cpu" = "s390" \
682 -o "$cpu" = "sparc" \
683 -o "$cpu" = "sparc64"; then
7d13299d
FB
684 bigendian="yes"
685fi
686
687fi
688
b6853697
FB
689# host long bits test
690hostlongbits="32"
0938cda5
AJ
691if test "$cpu" = "x86_64" \
692 -o "$cpu" = "alpha" \
693 -o "$cpu" = "ia64" \
694 -o "$cpu" = "sparc64"; then
b6853697
FB
695 hostlongbits="64"
696fi
697
810260a8 698# ppc specific hostlongbits selection
699if test "$cpu" = "powerpc" ; then
9d56d2dc 700 if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev/null </dev/null; then
701 grep -q __powerpc64__ $TMPI && hostlongbits=64
810260a8 702 else
703 echo hostlongbits test failed
ba69a08a 704 exit 1
810260a8 705 fi
706fi
707
e8cd23de 708# check gcc options support
04369ff2
FB
709cat > $TMPC <<EOF
710int main(void) {
04369ff2
FB
711}
712EOF
713
bd0c5661
PB
714# Check host NPTL support
715cat > $TMPC <<EOF
716#include <sched.h>
30813cea 717#include <linux/futex.h>
bd0c5661
PB
718void foo()
719{
720#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
721#error bork
722#endif
723}
724EOF
725
8c7f7574 726if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
bd0c5661
PB
727 :
728else
729 nptl="no"
730fi
731
ac62922e
AZ
732##########################################
733# zlib check
734
735cat > $TMPC << EOF
736#include <zlib.h>
737int main(void) { zlibVersion(); return 0; }
738EOF
8c7f7574 739if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
ac62922e
AZ
740 :
741else
742 echo
743 echo "Error: zlib check failed"
744 echo "Make sure to have the zlib libs and headers installed."
745 echo
746 exit 1
747fi
748
11d9f695
FB
749##########################################
750# SDL probe
751
752sdl_too_old=no
753
754if test -z "$sdl" ; then
069b0bda
TS
755 sdl_config="sdl-config"
756 sdl=no
757 sdl_static=no
758
11d9f695
FB
759cat > $TMPC << EOF
760#include <SDL.h>
761#undef main /* We don't want SDL to override our main() */
762int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
763EOF
8c7f7574 764 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
cd01b4a3
AL
765 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
766 if test "$_sdlversion" -lt 121 ; then
767 sdl_too_old=yes
768 else
769 if test "$cocoa" = "no" ; then
770 sdl=yes
069b0bda 771 fi
cd01b4a3 772 fi
11d9f695 773
cd01b4a3
AL
774 # static link with sdl ?
775 if test "$sdl" = "yes" ; then
776 aa="no"
777 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
778 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
779 if [ "$aa" = "yes" ] ; then
780 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
781 fi
782
8c7f7574 783 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
cd01b4a3
AL
784 sdl_static=yes
785 fi
786 fi # static link
787 fi # sdl compile test
fd677642 788else
069b0bda
TS
789 # Make sure to disable cocoa if sdl was set
790 if test "$sdl" = "yes" ; then
791 cocoa="no"
c2de5c91 792 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
069b0bda 793 fi
a6e022ad 794fi # -z $sdl
11d9f695 795
8d5d2d4c
TS
796##########################################
797# VNC TLS detection
798if test "$vnc_tls" = "yes" ; then
ae6b5e5a
AL
799cat > $TMPC <<EOF
800#include <gnutls/gnutls.h>
801int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
802EOF
803 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
804 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
805 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
8c7f7574 806 $vnc_tls_libs > /dev/null 2> /dev/null ; then
ae6b5e5a
AL
807 :
808 else
809 vnc_tls="no"
810 fi
8d5d2d4c
TS
811fi
812
8a16d273
TS
813##########################################
814# vde libraries probe
815if test "$vde" = "yes" ; then
816 cat > $TMPC << EOF
817#include <libvdeplug.h>
4a7f0e06
PB
818int main(void)
819{
820 struct vde_open_args a = {0, 0, 0};
821 vde_open("", "", &a);
822 return 0;
823}
8a16d273 824EOF
8c7f7574 825 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
8a16d273
TS
826 :
827 else
e0e6c8c0 828 vde="no"
8a16d273
TS
829 fi
830fi
831
8f28f3fb 832##########################################
c2de5c91 833# Sound support libraries probe
8f28f3fb 834
c2de5c91 835audio_drv_probe()
836{
837 drv=$1
838 hdr=$2
839 lib=$3
840 exp=$4
841 cfl=$5
842 cat > $TMPC << EOF
843#include <$hdr>
844int main(void) { $exp }
8f28f3fb 845EOF
8c7f7574 846 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
c2de5c91 847 :
848 else
849 echo
850 echo "Error: $drv check failed"
851 echo "Make sure to have the $drv libs and headers installed."
852 echo
853 exit 1
854 fi
855}
856
2fa7d3bf 857audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
c2de5c91 858for drv in $audio_drv_list; do
859 case $drv in
860 alsa)
861 audio_drv_probe $drv alsa/asoundlib.h -lasound \
862 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
863 ;;
864
865 fmod)
866 if test -z $fmod_lib || test -z $fmod_inc; then
867 echo
868 echo "Error: You must specify path to FMOD library and headers"
869 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
870 echo
871 exit 1
872 fi
873 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
874 ;;
875
876 esd)
877 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
878 ;;
b8e59f18 879
880 pa)
881 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
882 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
883 ;;
884
2f6a1ab0
BS
885 oss|sdl|core|wav|dsound)
886 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
887 ;;
888
e4c63a6a 889 *)
1c9b2a52 890 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
e4c63a6a 891 echo
892 echo "Error: Unknown driver '$drv' selected"
893 echo "Possible drivers are: $audio_possible_drivers"
894 echo
895 exit 1
896 }
897 ;;
c2de5c91 898 esac
899done
8f28f3fb 900
2e4d9fb1
AJ
901##########################################
902# BrlAPI probe
903
904if test -z "$brlapi" ; then
905 brlapi=no
906cat > $TMPC << EOF
907#include <brlapi.h>
908int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
909EOF
178baee6 910 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
2e4d9fb1
AJ
911 brlapi=yes
912 fi # brlapi compile test
913fi # -z $brlapi
914
4d3b6f6e
AZ
915##########################################
916# curses probe
917
918if test "$curses" = "yes" ; then
919 curses=no
920 cat > $TMPC << EOF
921#include <curses.h>
922int main(void) { return curses_version(); }
923EOF
178baee6 924 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
4d3b6f6e
AZ
925 curses=yes
926 fi
927fi # test "$curses"
928
fb599c9a
AZ
929##########################################
930# bluez support probe
931if test "$bluez" = "yes" ; then
932 `pkg-config bluez` || bluez="no"
933fi
934if test "$bluez" = "yes" ; then
e820e3f4
AZ
935 cat > $TMPC << EOF
936#include <bluetooth/bluetooth.h>
937int main(void) { return bt_error(0); }
938EOF
fb599c9a
AZ
939 bluez_cflags=`pkg-config --cflags bluez`
940 bluez_libs=`pkg-config --libs bluez`
17e1592d 941 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
8c7f7574 942 $bluez_libs > /dev/null 2> /dev/null ; then
e820e3f4
AZ
943 :
944 else
945 bluez="no"
946 fi
fb599c9a
AZ
947fi
948
7ba1e619
AL
949##########################################
950# kvm probe
951if test "$kvm" = "yes" ; then
952 cat > $TMPC <<EOF
953#include <linux/kvm.h>
954#if !defined(KVM_API_VERSION) || \
955 KVM_API_VERSION < 12 || \
956 KVM_API_VERSION > 12 || \
957 !defined(KVM_CAP_USER_MEMORY) || \
d85dc283
AL
958 !defined(KVM_CAP_SET_TSS_ADDR) || \
959 !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
7ba1e619
AL
960#error Invalid KVM version
961#endif
962int main(void) { return 0; }
963EOF
eac30262
AL
964 if test "$kerneldir" != "" ; then
965 kvm_cflags=-I"$kerneldir"/include
966 else
967 kvm_cflags=""
968 fi
7ba1e619 969 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
8c7f7574 970 > /dev/null 2>/dev/null ; then
7ba1e619
AL
971 :
972 else
973 kvm="no"
974 fi
975fi
976
414f0dab
BS
977##########################################
978# AIO probe
3c529d93
AL
979AIOLIBS=""
980
414f0dab
BS
981if test "$aio" = "yes" ; then
982 aio=no
983 cat > $TMPC << EOF
3c529d93
AL
984#include <pthread.h>
985int main(void) { pthread_mutex_t lock; return 0; }
414f0dab
BS
986EOF
987 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
988 aio=yes
3c529d93 989 AIOLIBS="-lpthread"
414f0dab
BS
990 fi
991fi
992
bf9298b9
AL
993##########################################
994# iovec probe
995cat > $TMPC <<EOF
996#include <sys/uio.h>
997int main(void) { struct iovec iov; return 0; }
998EOF
999iovec=no
8c7f7574 1000if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bf9298b9
AL
1001 iovec=yes
1002fi
1003
f652e6af
AJ
1004##########################################
1005# fdt probe
1006if test "$fdt" = "yes" ; then
1007 fdt=no
1008 cat > $TMPC << EOF
1009int main(void) { return 0; }
1010EOF
1011 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1012 fdt=yes
1013 fi
1014fi
1015
cc8ae6de 1016# Check if tools are available to build documentation.
6c591867
TS
1017if [ -x "`which texi2html 2>/dev/null`" ] && \
1018 [ -x "`which pod2man 2>/dev/null`" ]; then
cc8ae6de
PB
1019 build_docs="yes"
1020fi
1021
da93a1fd
AL
1022##########################################
1023# Do we need librt
1024cat > $TMPC <<EOF
1025#include <signal.h>
1026#include <time.h>
1027int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1028EOF
1029
1030rt=no
8c7f7574 1031if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
da93a1fd 1032 :
8c7f7574 1033elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
da93a1fd
AL
1034 rt=yes
1035fi
1036
1037if test "$rt" = "yes" ; then
1038 # Hack, we should have a general purpose LIBS for this sort of thing
1039 AIOLIBS="$AIOLIBS -lrt"
1040fi
1041
11d9f695 1042if test "$mingw32" = "yes" ; then
308c3593 1043 if test -z "$prefix" ; then
17e90973 1044 prefix="c:\\\\Program Files\\\\Qemu"
308c3593
PB
1045 fi
1046 mansuffix=""
1047 datasuffix=""
1048 docsuffix=""
1049 binsuffix=""
11d9f695 1050else
308c3593
PB
1051 if test -z "$prefix" ; then
1052 prefix="/usr/local"
1053 fi
1054 mansuffix="/share/man"
1055 datasuffix="/share/qemu"
1056 docsuffix="/share/doc/qemu"
1057 binsuffix="/bin"
11d9f695 1058fi
5a67135a 1059
43ce4dfe 1060echo "Install prefix $prefix"
308c3593
PB
1061echo "BIOS directory $prefix$datasuffix"
1062echo "binary directory $prefix$binsuffix"
11d9f695 1063if test "$mingw32" = "no" ; then
308c3593 1064echo "Manual directory $prefix$mansuffix"
43ce4dfe 1065echo "ELF interp prefix $interp_prefix"
11d9f695 1066fi
5a67135a 1067echo "Source path $source_path"
43ce4dfe 1068echo "C compiler $cc"
83469015 1069echo "Host C compiler $host_cc"
db7287ed 1070echo "ARCH_CFLAGS $ARCH_CFLAGS"
43ce4dfe 1071echo "make $make"
6a882643 1072echo "install $install"
43ce4dfe 1073echo "host CPU $cpu"
de83cd02 1074echo "host big endian $bigendian"
97a847bc 1075echo "target list $target_list"
43ce4dfe 1076echo "gprof enabled $gprof"
03b4fe7d 1077echo "sparse enabled $sparse"
05c2a3e7 1078echo "profiler $profiler"
43ce4dfe 1079echo "static build $static"
85aa5189 1080echo "-Werror enabled $werror"
5b0753e0
FB
1081if test "$darwin" = "yes" ; then
1082 echo "Cocoa support $cocoa"
1083fi
97a847bc 1084echo "SDL support $sdl"
e4afee97
FB
1085if test "$sdl" != "no" ; then
1086 echo "SDL static link $sdl_static"
1087fi
4d3b6f6e 1088echo "curses support $curses"
67b915a5 1089echo "mingw32 support $mingw32"
0c58ac1c 1090echo "Audio drivers $audio_drv_list"
1091echo "Extra audio cards $audio_card_list"
8ff9cbf7 1092echo "Mixer emulation $mixemu"
8d5d2d4c
TS
1093echo "VNC TLS support $vnc_tls"
1094if test "$vnc_tls" = "yes" ; then
1095 echo " TLS CFLAGS $vnc_tls_cflags"
1096 echo " TLS LIBS $vnc_tls_libs"
1097fi
3142255c
BS
1098if test -n "$sparc_cpu"; then
1099 echo "Target Sparc Arch $sparc_cpu"
1100fi
07f4ddbf 1101echo "kqemu support $kqemu"
2e4d9fb1 1102echo "brlapi support $brlapi"
cc8ae6de 1103echo "Documentation $build_docs"
c5937220
PB
1104[ ! -z "$uname_release" ] && \
1105echo "uname -r $uname_release"
bd0c5661 1106echo "NPTL support $nptl"
8a16d273 1107echo "vde support $vde"
414f0dab 1108echo "AIO support $aio"
77755340 1109echo "Install blobs $blobs"
7ba1e619 1110echo "KVM support $kvm"
f652e6af 1111echo "fdt support $fdt"
67b915a5 1112
97a847bc 1113if test $sdl_too_old = "yes"; then
24b55b96 1114echo "-> Your SDL version is too old - please upgrade to have SDL support"
7c1f25b4 1115fi
d4742de8 1116if [ -s $TMPSDLLOG ]; then
20b40c6a 1117 echo "The error log from compiling the libSDL test is: "
d4742de8 1118 cat $TMPSDLLOG
20b40c6a 1119fi
24b55b96
FB
1120#if test "$sdl_static" = "no"; then
1121# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1122#fi
97a847bc
FB
1123config_mak="config-host.mak"
1124config_h="config-host.h"
7d13299d 1125
7c1f25b4 1126#echo "Creating $config_mak and $config_h"
7d13299d 1127
15d9ca0f
TS
1128test -f $config_h && mv $config_h ${config_h}~
1129
97a847bc 1130echo "# Automatically generated by configure - do not modify" > $config_mak
fc9902d9 1131printf "# Configured with:" >> $config_mak
fd69fe2b 1132printf " '%s'" "$0" "$@" >> $config_mak
1133echo >> $config_mak
97a847bc 1134echo "/* Automatically generated by configure - do not modify */" > $config_h
7d13299d 1135
97a847bc 1136echo "prefix=$prefix" >> $config_mak
308c3593
PB
1137echo "bindir=\${prefix}$binsuffix" >> $config_mak
1138echo "mandir=\${prefix}$mansuffix" >> $config_mak
1139echo "datadir=\${prefix}$datasuffix" >> $config_mak
4ad5b06d 1140echo "docdir=\${prefix}$docsuffix" >> $config_mak
308c3593 1141echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
97a847bc 1142echo "MAKE=$make" >> $config_mak
6a882643 1143echo "INSTALL=$install" >> $config_mak
97a847bc 1144echo "CC=$cc" >> $config_mak
97a847bc
FB
1145echo "HOST_CC=$host_cc" >> $config_mak
1146echo "AR=$ar" >> $config_mak
1147echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
40293e58
FB
1148# XXX: only use CFLAGS and LDFLAGS ?
1149# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1150# compilation of dyngen tool (useful for win32 build on Linux host)
6f30fa85 1151echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
3142255c
BS
1152echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1153echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1154echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
97a847bc
FB
1155echo "CFLAGS=$CFLAGS" >> $config_mak
1156echo "LDFLAGS=$LDFLAGS" >> $config_mak
67b915a5 1157echo "EXESUF=$EXESUF" >> $config_mak
70956b77 1158echo "AIOLIBS=$AIOLIBS" >> $config_mak
2408a527
AJ
1159case "$cpu" in
1160 i386)
1161 echo "ARCH=i386" >> $config_mak
1162 echo "#define HOST_I386 1" >> $config_h
1163 ;;
1164 x86_64)
1165 echo "ARCH=x86_64" >> $config_mak
1166 echo "#define HOST_X86_64 1" >> $config_h
1167 ;;
1168 alpha)
1169 echo "ARCH=alpha" >> $config_mak
1170 echo "#define HOST_ALPHA 1" >> $config_h
1171 ;;
1172 armv4b)
1173 echo "ARCH=arm" >> $config_mak
1174 echo "#define HOST_ARM 1" >> $config_h
1175 ;;
1176 armv4l)
1177 echo "ARCH=arm" >> $config_mak
1178 echo "#define HOST_ARM 1" >> $config_h
1179 ;;
1180 cris)
1181 echo "ARCH=cris" >> $config_mak
1182 echo "#define HOST_CRIS 1" >> $config_h
1183 ;;
1184 hppa)
1185 echo "ARCH=hppa" >> $config_mak
1186 echo "#define HOST_HPPA 1" >> $config_h
1187 ;;
1188 ia64)
1189 echo "ARCH=ia64" >> $config_mak
1190 echo "#define HOST_IA64 1" >> $config_h
1191 ;;
1192 m68k)
1193 echo "ARCH=m68k" >> $config_mak
1194 echo "#define HOST_M68K 1" >> $config_h
1195 ;;
1196 mips)
1197 echo "ARCH=mips" >> $config_mak
1198 echo "#define HOST_MIPS 1" >> $config_h
1199 ;;
1200 mips64)
1201 echo "ARCH=mips64" >> $config_mak
1202 echo "#define HOST_MIPS64 1" >> $config_h
1203 ;;
1204 powerpc)
810260a8 1205 if test "$hostlongbits" = "32"; then
1206 echo "ARCH=ppc" >> $config_mak
1207 echo "#define HOST_PPC 1" >> $config_h
1208 else
1209 echo "ARCH=ppc64" >> $config_mak
1210 echo "#define HOST_PPC64 1" >> $config_h
1211 fi
2408a527
AJ
1212 ;;
1213 s390)
1214 echo "ARCH=s390" >> $config_mak
1215 echo "#define HOST_S390 1" >> $config_h
1216 ;;
1217 sparc)
1218 echo "ARCH=sparc" >> $config_mak
1219 echo "#define HOST_SPARC 1" >> $config_h
1220 ;;
1221 sparc64)
1222 echo "ARCH=sparc64" >> $config_mak
1223 echo "#define HOST_SPARC64 1" >> $config_h
1224 ;;
1225 *)
1226 echo "Unsupported CPU = $cpu"
1227 exit 1
1228 ;;
1229esac
03b4fe7d
AL
1230if test "$sparse" = "yes" ; then
1231 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1232 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1233 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1234fi
7d13299d 1235if test "$bigendian" = "yes" ; then
97a847bc
FB
1236 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1237 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1238fi
b6853697 1239echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
67b915a5
FB
1240if test "$mingw32" = "yes" ; then
1241 echo "CONFIG_WIN32=yes" >> $config_mak
11d9f695 1242 echo "#define CONFIG_WIN32 1" >> $config_h
210fa556
PB
1243else
1244 cat > $TMPC << EOF
1245#include <byteswap.h>
1246int main(void) { return bswap_32(0); }
1247EOF
178baee6 1248 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
210fa556
PB
1249 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1250 fi
1360677c
BS
1251 cat > $TMPC << EOF
1252#include <sys/endian.h>
1253#include <sys/types.h>
1254#include <machine/bswap.h>
1255int main(void) { return bswap32(0); }
1256EOF
178baee6 1257 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1360677c
BS
1258 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1259 fi
67b915a5 1260fi
128ab2ff
BS
1261
1262if [ "$openbsd" = "yes" ] ; then
1263 echo "#define ENOTSUP 4096" >> $config_h
1264fi
1265
83fb7adf
FB
1266if test "$darwin" = "yes" ; then
1267 echo "CONFIG_DARWIN=yes" >> $config_mak
1268 echo "#define CONFIG_DARWIN 1" >> $config_h
1269fi
b29fe3ed 1270
1271if test "$aix" = "yes" ; then
1272 echo "CONFIG_AIX=yes" >> $config_mak
1273 echo "#define CONFIG_AIX 1" >> $config_h
1274fi
1275
ec530c81
FB
1276if test "$solaris" = "yes" ; then
1277 echo "CONFIG_SOLARIS=yes" >> $config_mak
38cfa06c 1278 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
0475a5ca
TS
1279 if test "$needs_libsunmath" = "yes" ; then
1280 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1281 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1282 fi
ec530c81 1283fi
3142255c
BS
1284if test -n "$sparc_cpu"; then
1285 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1286 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1287fi
67b915a5
FB
1288if test "$gdbstub" = "yes" ; then
1289 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1290 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1291fi
97a847bc
FB
1292if test "$gprof" = "yes" ; then
1293 echo "TARGET_GPROF=yes" >> $config_mak
1294 echo "#define HAVE_GPROF 1" >> $config_h
1295fi
1296if test "$static" = "yes" ; then
1297 echo "CONFIG_STATIC=yes" >> $config_mak
50863472 1298 echo "#define CONFIG_STATIC 1" >> $config_h
7d13299d 1299fi
05c2a3e7
FB
1300if test $profiler = "yes" ; then
1301 echo "#define CONFIG_PROFILER 1" >> $config_h
1302fi
c20709aa
FB
1303if test "$slirp" = "yes" ; then
1304 echo "CONFIG_SLIRP=yes" >> $config_mak
1305 echo "#define CONFIG_SLIRP 1" >> $config_h
1306fi
8a16d273
TS
1307if test "$vde" = "yes" ; then
1308 echo "CONFIG_VDE=yes" >> $config_mak
1309 echo "#define CONFIG_VDE 1" >> $config_h
1310 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1311fi
0c58ac1c 1312for card in $audio_card_list; do
f6e5889e 1313 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
0c58ac1c 1314 echo "$def=yes" >> $config_mak
1315 echo "#define $def 1" >> $config_h
1316done
1317echo "#define AUDIO_DRIVERS \\" >> $config_h
1318for drv in $audio_drv_list; do
1319 echo " &${drv}_audio_driver, \\" >>$config_h
f6e5889e 1320 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
0c58ac1c 1321 echo "$def=yes" >> $config_mak
923e4521 1322 if test "$drv" = "fmod"; then
0c58ac1c 1323 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1324 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
2f6a1ab0
BS
1325 elif test "$drv" = "oss"; then
1326 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
0c58ac1c 1327 fi
1328done
1329echo "" >>$config_h
8ff9cbf7 1330if test "$mixemu" = "yes" ; then
1331 echo "CONFIG_MIXEMU=yes" >> $config_mak
1332 echo "#define CONFIG_MIXEMU 1" >> $config_h
1333fi
8d5d2d4c
TS
1334if test "$vnc_tls" = "yes" ; then
1335 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1336 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1337 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1338 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1339fi
b1a550a0
PB
1340qemu_version=`head $source_path/VERSION`
1341echo "VERSION=$qemu_version" >>$config_mak
d4b8f039 1342echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
97a847bc
FB
1343
1344echo "SRC_PATH=$source_path" >> $config_mak
ad064840
PB
1345if [ "$source_path_used" = "yes" ]; then
1346 echo "VPATH=$source_path" >> $config_mak
1347fi
97a847bc 1348echo "TARGET_DIRS=$target_list" >> $config_mak
cc8ae6de
PB
1349if [ "$build_docs" = "yes" ] ; then
1350 echo "BUILD_DOCS=yes" >> $config_mak
1351fi
49ecc3fa
FB
1352if test "$static" = "yes"; then
1353 sdl1=$sdl_static
1354else
1355 sdl1=$sdl
1356fi
1357if test "$sdl1" = "yes" ; then
1358 echo "#define CONFIG_SDL 1" >> $config_h
1359 echo "CONFIG_SDL=yes" >> $config_mak
1360 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1361 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1362 else
1363 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1364 fi
1365 if [ "${aa}" = "yes" ] ; then
1366 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1367 else
1368 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1369 fi
1370fi
1371if test "$cocoa" = "yes" ; then
4d3b6f6e
AZ
1372 echo "#define CONFIG_COCOA 1" >> $config_h
1373 echo "CONFIG_COCOA=yes" >> $config_mak
1374fi
1375if test "$curses" = "yes" ; then
1376 echo "#define CONFIG_CURSES 1" >> $config_h
1377 echo "CONFIG_CURSES=yes" >> $config_mak
1378 echo "CURSES_LIBS=-lcurses" >> $config_mak
49ecc3fa 1379fi
2e4d9fb1
AJ
1380if test "$brlapi" = "yes" ; then
1381 echo "CONFIG_BRLAPI=yes" >> $config_mak
1382 echo "#define CONFIG_BRLAPI 1" >> $config_h
1383 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1384fi
fb599c9a
AZ
1385if test "$bluez" = "yes" ; then
1386 echo "CONFIG_BLUEZ=yes" >> $config_mak
1387 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1388 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1389 echo "#define CONFIG_BLUEZ 1" >> $config_h
1390fi
414f0dab
BS
1391if test "$aio" = "yes" ; then
1392 echo "#define CONFIG_AIO 1" >> $config_h
a3392f9b 1393 echo "CONFIG_AIO=yes" >> $config_mak
414f0dab 1394fi
77755340
TS
1395if test "$blobs" = "yes" ; then
1396 echo "INSTALL_BLOBS=yes" >> $config_mak
1397fi
bf9298b9
AL
1398if test "$iovec" = "yes" ; then
1399 echo "#define HAVE_IOVEC 1" >> $config_h
1400fi
f652e6af
AJ
1401if test "$fdt" = "yes" ; then
1402 echo "#define HAVE_FDT 1" >> $config_h
1403 echo "FDT_LIBS=-lfdt" >> $config_mak
1404fi
97a847bc 1405
83fb7adf 1406# XXX: suppress that
7d3505c5 1407if [ "$bsd" = "yes" ] ; then
43003046 1408 echo "#define O_LARGEFILE 0" >> $config_h
43003046 1409 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
7d3505c5
FB
1410 echo "#define _BSD 1" >> $config_h
1411fi
1412
c5937220
PB
1413echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1414
68063649
BS
1415# USB host support
1416case "$usb" in
1417linux)
1418 echo "HOST_USB=linux" >> $config_mak
1419;;
1420bsd)
1421 echo "HOST_USB=bsd" >> $config_mak
1422;;
1423*)
1424 echo "HOST_USB=stub" >> $config_mak
1425;;
1426esac
1427
c39e3338
PB
1428tools=
1429if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1430 tools="qemu-img\$(EXESUF) $tools"
7a5ca864
FB
1431 if [ "$linux" = "yes" ] ; then
1432 tools="qemu-nbd\$(EXESUF) $tools"
1433 fi
c39e3338
PB
1434fi
1435echo "TOOLS=$tools" >> $config_mak
1436
15d9ca0f
TS
1437test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1438
1d14ffa9 1439for target in $target_list; do
97a847bc
FB
1440target_dir="$target"
1441config_mak=$target_dir/config.mak
1442config_h=$target_dir/config.h
1443target_cpu=`echo $target | cut -d '-' -f 1`
1444target_bigendian="no"
808c4954 1445[ "$target_cpu" = "armeb" ] && target_bigendian=yes
0938cda5
AJ
1446[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1447[ "$target_cpu" = "mips" ] && target_bigendian=yes
1448[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1449[ "$target_cpu" = "mips64" ] && target_bigendian=yes
67867308 1450[ "$target_cpu" = "ppc" ] && target_bigendian=yes
d4082e95 1451[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
22f8a8b3 1452[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
e85e7c6e 1453[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
908f52b0 1454[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
0938cda5
AJ
1455[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1456[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1457[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
97a847bc 1458target_softmmu="no"
997344f3 1459target_user_only="no"
831b7825 1460target_linux_user="no"
831b7825 1461target_darwin_user="no"
84778508 1462target_bsd_user="no"
9e407a85
PB
1463case "$target" in
1464 ${target_cpu}-softmmu)
1465 target_softmmu="yes"
1466 ;;
1467 ${target_cpu}-linux-user)
1468 target_user_only="yes"
1469 target_linux_user="yes"
1470 ;;
1471 ${target_cpu}-darwin-user)
1472 target_user_only="yes"
1473 target_darwin_user="yes"
1474 ;;
84778508
BS
1475 ${target_cpu}-bsd-user)
1476 target_user_only="yes"
1477 target_bsd_user="yes"
1478 ;;
9e407a85
PB
1479 *)
1480 echo "ERROR: Target '$target' not recognised"
1481 exit 1
1482 ;;
1483esac
831b7825 1484
97ccc689 1485if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1d14ffa9 1486 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
97ccc689 1487 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
9c038506 1488 echo "To build QEMU without graphical output configure with --disable-gfx-check"
4d3b6f6e
AZ
1489 echo "Note that this will disable all output from the virtual graphics card"
1490 echo "except through VNC or curses."
97ccc689
FB
1491 exit 1;
1492fi
1493
7c1f25b4 1494#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
97a847bc 1495
15d9ca0f
TS
1496test -f $config_h && mv $config_h ${config_h}~
1497
97a847bc 1498mkdir -p $target_dir
158142c2 1499mkdir -p $target_dir/fpu
57fec1fe 1500mkdir -p $target_dir/tcg
84778508 1501if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
69de927c
FB
1502 mkdir -p $target_dir/nwfpe
1503fi
1504
ec530c81
FB
1505#
1506# don't use ln -sf as not all "ln -sf" over write the file/link
1507#
1508rm -f $target_dir/Makefile
1509ln -s $source_path/Makefile.target $target_dir/Makefile
1510
97a847bc
FB
1511
1512echo "# Automatically generated by configure - do not modify" > $config_mak
1513echo "/* Automatically generated by configure - do not modify */" > $config_h
1514
de83cd02 1515
97a847bc
FB
1516echo "include ../config-host.mak" >> $config_mak
1517echo "#include \"../config-host.h\"" >> $config_h
1e43adfc 1518
e5fe0c52 1519bflt="no"
cb33da57 1520elfload32="no"
bd0c5661 1521target_nptl="no"
1e43adfc
FB
1522interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1523echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
56aebc89 1524gdb_xml_files=""
97a847bc 1525
5985ecee
AL
1526# Make sure the target and host cpus are compatible
1527if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
d76d1650 1528 \( "$target_cpu" = "ppcemb" -a "$cpu" = "powerpc" \) -o \
5985ecee
AL
1529 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1530 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
7ba1e619
AL
1531 kvm="no"
1532fi
1533# Disable KVM for linux-user
1534if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1535 kvm="no"
1536fi
1537
2408a527
AJ
1538case "$target_cpu" in
1539 i386)
1540 echo "TARGET_ARCH=i386" >> $config_mak
1541 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1542 echo "#define TARGET_I386 1" >> $config_h
da260249 1543 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
2408a527
AJ
1544 then
1545 echo "#define USE_KQEMU 1" >> $config_h
1546 fi
7ba1e619
AL
1547 if test "$kvm" = "yes" ; then
1548 echo "CONFIG_KVM=yes" >> $config_mak
1549 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
5985ecee 1550 echo "#define CONFIG_KVM 1" >> $config_h
7ba1e619 1551 fi
2408a527
AJ
1552 ;;
1553 x86_64)
1554 echo "TARGET_ARCH=x86_64" >> $config_mak
1555 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1556 echo "#define TARGET_I386 1" >> $config_h
1557 echo "#define TARGET_X86_64 1" >> $config_h
1558 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1559 then
1560 echo "#define USE_KQEMU 1" >> $config_h
1561 fi
7ba1e619
AL
1562 if test "$kvm" = "yes" ; then
1563 echo "CONFIG_KVM=yes" >> $config_mak
1564 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1565 echo "#define CONFIG_KVM 1" >> $config_h
1566 fi
2408a527
AJ
1567 ;;
1568 alpha)
1569 echo "TARGET_ARCH=alpha" >> $config_mak
1570 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1571 echo "#define TARGET_ALPHA 1" >> $config_h
1572 ;;
1573 arm|armeb)
1574 echo "TARGET_ARCH=arm" >> $config_mak
2408a527
AJ
1575 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1576 echo "#define TARGET_ARM 1" >> $config_h
2408a527 1577 bflt="yes"
bd0c5661 1578 target_nptl="yes"
56aebc89 1579 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
2408a527
AJ
1580 ;;
1581 cris)
1582 echo "TARGET_ARCH=cris" >> $config_mak
1583 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1584 echo "#define TARGET_CRIS 1" >> $config_h
2408a527
AJ
1585 ;;
1586 m68k)
1587 echo "TARGET_ARCH=m68k" >> $config_mak
1588 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1589 echo "#define TARGET_M68K 1" >> $config_h
1590 bflt="yes"
56aebc89 1591 gdb_xml_files="cf-core.xml cf-fp.xml"
2408a527
AJ
1592 ;;
1593 mips|mipsel)
1594 echo "TARGET_ARCH=mips" >> $config_mak
1595 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1596 echo "#define TARGET_MIPS 1" >> $config_h
1597 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1598 ;;
1599 mipsn32|mipsn32el)
1600 echo "TARGET_ARCH=mipsn32" >> $config_mak
1601 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1602 echo "#define TARGET_MIPS 1" >> $config_h
1603 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1604 ;;
1605 mips64|mips64el)
1606 echo "TARGET_ARCH=mips64" >> $config_mak
1607 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1608 echo "#define TARGET_MIPS 1" >> $config_h
1609 echo "#define TARGET_MIPS64 1" >> $config_h
1610 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1611 ;;
1612 ppc)
1613 echo "TARGET_ARCH=ppc" >> $config_mak
1614 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1615 echo "#define TARGET_PPC 1" >> $config_h
1616 ;;
1617 ppcemb)
1618 echo "TARGET_ARCH=ppcemb" >> $config_mak
1619 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1620 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1621 echo "#define TARGET_PPC 1" >> $config_h
1622 echo "#define TARGET_PPCEMB 1" >> $config_h
d76d1650
AJ
1623 if test "$kvm" = "yes" ; then
1624 echo "CONFIG_KVM=yes" >> $config_mak
1625 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1626 echo "#define CONFIG_KVM 1" >> $config_h
1627 fi
2408a527
AJ
1628 ;;
1629 ppc64)
1630 echo "TARGET_ARCH=ppc64" >> $config_mak
1631 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1632 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1633 echo "#define TARGET_PPC 1" >> $config_h
1634 echo "#define TARGET_PPC64 1" >> $config_h
1635 ;;
1636 ppc64abi32)
1637 echo "TARGET_ARCH=ppc64" >> $config_mak
1638 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1639 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1640 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1641 echo "#define TARGET_PPC 1" >> $config_h
1642 echo "#define TARGET_PPC64 1" >> $config_h
1643 echo "#define TARGET_ABI32 1" >> $config_h
1644 ;;
1645 sh4|sh4eb)
1646 echo "TARGET_ARCH=sh4" >> $config_mak
1647 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1648 echo "#define TARGET_SH4 1" >> $config_h
1649 bflt="yes"
0b6d3ae0 1650 target_nptl="yes"
2408a527
AJ
1651 ;;
1652 sparc)
1653 echo "TARGET_ARCH=sparc" >> $config_mak
1654 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1655 echo "#define TARGET_SPARC 1" >> $config_h
1656 ;;
1657 sparc64)
1658 echo "TARGET_ARCH=sparc64" >> $config_mak
1659 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1660 echo "#define TARGET_SPARC 1" >> $config_h
1661 echo "#define TARGET_SPARC64 1" >> $config_h
1662 elfload32="yes"
1663 ;;
1664 sparc32plus)
1665 echo "TARGET_ARCH=sparc64" >> $config_mak
1666 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1667 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1668 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1669 echo "#define TARGET_SPARC 1" >> $config_h
1670 echo "#define TARGET_SPARC64 1" >> $config_h
1671 echo "#define TARGET_ABI32 1" >> $config_h
1672 ;;
1673 *)
1674 echo "Unsupported target CPU"
1675 exit 1
1676 ;;
1677esac
de83cd02 1678if test "$target_bigendian" = "yes" ; then
97a847bc
FB
1679 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1680 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
de83cd02 1681fi
97a847bc
FB
1682if test "$target_softmmu" = "yes" ; then
1683 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1684 echo "#define CONFIG_SOFTMMU 1" >> $config_h
43ce4dfe 1685fi
997344f3
FB
1686if test "$target_user_only" = "yes" ; then
1687 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1688 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1689fi
831b7825
TS
1690if test "$target_linux_user" = "yes" ; then
1691 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1692 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1693fi
1694if test "$target_darwin_user" = "yes" ; then
1695 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1696 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1697fi
56aebc89
PB
1698list=""
1699if test ! -z "$gdb_xml_files" ; then
1700 for x in $gdb_xml_files; do
1701 list="$list $source_path/gdb-xml/$x"
1702 done
1703fi
1704echo "TARGET_XML_FILES=$list" >> $config_mak
97a847bc 1705
0938cda5
AJ
1706if test "$target_cpu" = "arm" \
1707 -o "$target_cpu" = "armeb" \
1708 -o "$target_cpu" = "m68k" \
1709 -o "$target_cpu" = "mips" \
1710 -o "$target_cpu" = "mipsel" \
1711 -o "$target_cpu" = "mipsn32" \
1712 -o "$target_cpu" = "mipsn32el" \
1713 -o "$target_cpu" = "mips64" \
1714 -o "$target_cpu" = "mips64el" \
3147d1e8
AJ
1715 -o "$target_cpu" = "ppc" \
1716 -o "$target_cpu" = "ppc64" \
71e991fd
AJ
1717 -o "$target_cpu" = "ppc64abi32" \
1718 -o "$target_cpu" = "ppcemb" \
0938cda5
AJ
1719 -o "$target_cpu" = "sparc" \
1720 -o "$target_cpu" = "sparc64" \
1721 -o "$target_cpu" = "sparc32plus"; then
158142c2
FB
1722 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1723 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1724fi
e5fe0c52
PB
1725if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1726 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1727 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1728fi
bd0c5661
PB
1729if test "$target_user_only" = "yes" \
1730 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1731 echo "#define USE_NPTL 1" >> $config_h
1732fi
cb33da57
BS
1733# 32 bit ELF loader in addition to native 64 bit loader?
1734if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1735 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1736 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1737fi
84778508
BS
1738if test "$target_bsd_user" = "yes" ; then
1739 echo "CONFIG_BSD_USER=yes" >> $config_mak
1740 echo "#define CONFIG_BSD_USER 1" >> $config_h
1741fi
5b0753e0 1742
15d9ca0f
TS
1743test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1744
97a847bc 1745done # for target in $targets
7d13299d
FB
1746
1747# build tree in object directory if source path is different from current one
1748if test "$source_path_used" = "yes" ; then
49ecc3fa 1749 DIRS="tests tests/cris slirp audio"
7d13299d 1750 FILES="Makefile tests/Makefile"
e7daa605 1751 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
e1ffb0f1 1752 FILES="$FILES tests/test-mmap.c"
7d13299d
FB
1753 for dir in $DIRS ; do
1754 mkdir -p $dir
1755 done
ec530c81 1756 # remove the link and recreate it, as not all "ln -sf" overwrite the link
7d13299d 1757 for f in $FILES ; do
ec530c81
FB
1758 rm -f $f
1759 ln -s $source_path/$f $f
7d13299d
FB
1760 done
1761fi