]> git.proxmox.com Git - mirror_qemu.git/blame - configure
Fix rounding error.
[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"
7d13299d
FB
18
19# default parameters
11d9f695 20prefix=""
1e43adfc 21interp_prefix="/usr/gnemul/qemu-%M"
43ce4dfe 22static="no"
7d13299d
FB
23cross_prefix=""
24cc="gcc"
328a4240 25gcc3_search="yes"
fe8f78e4 26gcc3_list="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
7d13299d
FB
27host_cc="gcc"
28ar="ar"
29make="make"
6a882643 30install="install"
7d13299d
FB
31strip="strip"
32cpu=`uname -m`
5327cf48 33target_list=""
7d13299d
FB
34case "$cpu" in
35 i386|i486|i586|i686|i86pc|BePC)
97a847bc 36 cpu="i386"
7d13299d 37 ;;
aaa5fa14
AJ
38 x86_64|amd64)
39 cpu="x86_64"
40 ;;
41 alpha)
42 cpu="alpha"
43 ;;
ba68055e 44 armv*b)
808c4954
FB
45 cpu="armv4b"
46 ;;
ba68055e 47 armv*l)
7d13299d
FB
48 cpu="armv4l"
49 ;;
aaa5fa14
AJ
50 cris)
51 cpu="cris"
7d13299d 52 ;;
f54b3f92
AJ
53 parisc|parisc64)
54 cpu="hppa"
55 ;;
aaa5fa14
AJ
56 ia64)
57 cpu="ia64"
58 ;;
59 m68k)
60 cpu="m68k"
7d13299d
FB
61 ;;
62 mips)
63 cpu="mips"
64 ;;
fbe4f65b
TS
65 mips64)
66 cpu="mips64"
67 ;;
aaa5fa14
AJ
68 "Power Macintosh"|ppc|ppc64)
69 cpu="powerpc"
e7daa605 70 ;;
0e7b8a9f 71 s390*)
fb3e5849
FB
72 cpu="s390"
73 ;;
3142255c 74 sparc|sun4[cdmuv])
ae228531
FB
75 cpu="sparc"
76 ;;
77 sparc64)
78 cpu="sparc64"
79 ;;
7d13299d
FB
80 *)
81 cpu="unknown"
82 ;;
83esac
84gprof="no"
85bigendian="no"
67b915a5
FB
86mingw32="no"
87EXESUF=""
88gdbstub="yes"
443f1376 89slirp="yes"
fb065187 90adlib="no"
e5c9a13e 91ac97="no"
423d65f4 92gus="no"
fb065187 93oss="no"
1d14ffa9
FB
94dsound="no"
95coreaudio="no"
96alsa="no"
ca9cc28c 97esd="no"
102a52e4
FB
98fmod="no"
99fmod_lib=""
100fmod_inc=""
8d5d2d4c 101vnc_tls="yes"
b1a550a0 102bsd="no"
5327cf48 103linux="no"
c9ec1fe4 104kqemu="no"
05c2a3e7 105profiler="no"
5b0753e0 106cocoa="no"
97ccc689 107check_gfx="yes"
1aff381f 108check_gcc="yes"
0a8e90f4 109softmmu="yes"
831b7825
TS
110linux_user="no"
111darwin_user="no"
cc8ae6de 112build_docs="no"
c5937220 113uname_release=""
4d3b6f6e 114curses="yes"
7d13299d
FB
115
116# OS specific
117targetos=`uname -s`
118case $targetos in
c326e0af
FB
119CYGWIN*)
120mingw32="yes"
6f30fa85 121OS_CFLAGS="-mno-cygwin"
db8d7dd1
TS
122if [ "$cpu" = "i386" ] ; then
123 kqemu="yes"
124fi
c326e0af 125;;
67b915a5
FB
126MINGW32*)
127mingw32="yes"
db8d7dd1
TS
128if [ "$cpu" = "i386" ] ; then
129 kqemu="yes"
130fi
67b915a5 131;;
5c40d2bd
TS
132GNU/kFreeBSD)
133oss="yes"
134if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
135 kqemu="yes"
136fi
137;;
7d3505c5
FB
138FreeBSD)
139bsd="yes"
fb065187 140oss="yes"
e99f9060 141if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
07f4ddbf
FB
142 kqemu="yes"
143fi
7d3505c5
FB
144;;
145NetBSD)
146bsd="yes"
fb065187 147oss="yes"
7d3505c5
FB
148;;
149OpenBSD)
150bsd="yes"
fb065187 151oss="yes"
7d3505c5 152;;
83fb7adf
FB
153Darwin)
154bsd="yes"
155darwin="yes"
831b7825 156darwin_user="yes"
fd677642
TS
157cocoa="yes"
158coreaudio="yes"
6f30fa85 159OS_CFLAGS="-mdynamic-no-pic"
c2c59c3e 160OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
83fb7adf 161;;
ec530c81 162SunOS)
c2b84fab
TS
163 solaris="yes"
164 make="gmake"
165 install="ginstall"
0475a5ca 166 needs_libsunmath="no"
c2b84fab 167 solarisrev=`uname -r | cut -f2 -d.`
ef18c883
TS
168 # have to select again, because `uname -m` returns i86pc
169 # even on an x86_64 box.
170 solariscpu=`isainfo -k`
171 if test "${solariscpu}" = "amd64" ; then
172 cpu="x86_64"
173 fi
c2b84fab 174 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
0475a5ca
TS
175 if test "$solarisrev" -le 9 ; then
176 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
177 needs_libsunmath="yes"
178 else
179 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
180 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
181 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
182 echo "Studio 11 can be downloaded from www.sun.com."
183 exit 1
184 fi
185 fi
186 if test "$solarisrev" -ge 9 ; then
c2b84fab
TS
187 kqemu="yes"
188 fi
86b2bd93 189 fi
6b4d2ba1
TS
190 if test -f /usr/include/sys/soundcard.h ; then
191 oss=yes
192 fi
86b2bd93 193;;
1d14ffa9 194*)
fb065187 195oss="yes"
5327cf48 196linux="yes"
831b7825 197linux_user="yes"
07f4ddbf 198if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
c9ec1fe4
FB
199 kqemu="yes"
200fi
fb065187 201;;
7d13299d
FB
202esac
203
7d3505c5 204if [ "$bsd" = "yes" ] ; then
b1a550a0 205 if [ "$darwin" != "yes" ] ; then
83fb7adf
FB
206 make="gmake"
207 fi
7d3505c5
FB
208fi
209
7d13299d 210# find source path
ad064840 211source_path=`dirname "$0"`
59faef3a
AZ
212source_path_used="no"
213workdir=`pwd`
ad064840 214if [ -z "$source_path" ]; then
59faef3a 215 source_path=$workdir
ad064840
PB
216else
217 source_path=`cd "$source_path"; pwd`
7d13299d 218fi
724db118 219[ -f "$workdir/vl.c" ] || source_path_used="yes"
7d13299d 220
85aa5189 221werror="no"
0d1e2394
FB
222# generate compile errors on warnings for development builds
223#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
224#werror="yes";
225#fi
85aa5189 226
7d13299d 227for opt do
a46e4035 228 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
7d13299d 229 case "$opt" in
2efc3265
FB
230 --help|-h) show_help=yes
231 ;;
b1a550a0 232 --prefix=*) prefix="$optarg"
7d13299d 233 ;;
b1a550a0 234 --interp-prefix=*) interp_prefix="$optarg"
32ce6337 235 ;;
b1a550a0 236 --source-path=*) source_path="$optarg"
ad064840 237 source_path_used="yes"
7d13299d 238 ;;
b1a550a0 239 --cross-prefix=*) cross_prefix="$optarg"
7d13299d 240 ;;
b1a550a0 241 --cc=*) cc="$optarg"
328a4240 242 gcc3_search="no"
7d13299d 243 ;;
b1a550a0 244 --host-cc=*) host_cc="$optarg"
83469015 245 ;;
b1a550a0 246 --make=*) make="$optarg"
7d13299d 247 ;;
6a882643
PB
248 --install=*) install="$optarg"
249 ;;
b1a550a0 250 --extra-cflags=*) CFLAGS="$optarg"
7d13299d 251 ;;
b1a550a0 252 --extra-ldflags=*) LDFLAGS="$optarg"
7d13299d 253 ;;
b1a550a0 254 --cpu=*) cpu="$optarg"
7d13299d 255 ;;
b1a550a0 256 --target-list=*) target_list="$optarg"
de83cd02 257 ;;
7d13299d
FB
258 --enable-gprof) gprof="yes"
259 ;;
43ce4dfe
FB
260 --static) static="yes"
261 ;;
97a847bc
FB
262 --disable-sdl) sdl="no"
263 ;;
1d14ffa9
FB
264 --enable-coreaudio) coreaudio="yes"
265 ;;
266 --enable-alsa) alsa="yes"
267 ;;
ca9cc28c
AZ
268 --enable-esd) esd="yes"
269 ;;
1d14ffa9
FB
270 --enable-dsound) dsound="yes"
271 ;;
102a52e4
FB
272 --enable-fmod) fmod="yes"
273 ;;
b1a550a0 274 --fmod-lib=*) fmod_lib="$optarg"
102a52e4 275 ;;
b1a550a0 276 --fmod-inc=*) fmod_inc="$optarg"
102a52e4 277 ;;
8d5d2d4c
TS
278 --disable-vnc-tls) vnc_tls="no"
279 ;;
b93aebec 280 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
1d14ffa9 281 ;;
443f1376 282 --disable-slirp) slirp="no"
1d14ffa9 283 ;;
fb065187 284 --enable-adlib) adlib="yes"
1d14ffa9 285 ;;
e5c9a13e
AZ
286 --enable-ac97) ac97="yes"
287 ;;
423d65f4
AZ
288 --enable-gus) gus="yes"
289 ;;
c9ec1fe4 290 --disable-kqemu) kqemu="no"
1d14ffa9 291 ;;
2e4d9fb1
AJ
292 --disable-brlapi) brlapi="no"
293 ;;
05c2a3e7
FB
294 --enable-profiler) profiler="yes"
295 ;;
1d14ffa9
FB
296 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
297 ;;
97ccc689
FB
298 --disable-gfx-check) check_gfx="no"
299 ;;
1aff381f
FB
300 --disable-gcc-check) check_gcc="no"
301 ;;
cad25d69 302 --disable-system) softmmu="no"
0a8e90f4 303 ;;
cad25d69 304 --enable-system) softmmu="yes"
0a8e90f4 305 ;;
831b7825 306 --disable-linux-user) linux_user="no"
0a8e90f4 307 ;;
831b7825
TS
308 --enable-linux-user) linux_user="yes"
309 ;;
310 --disable-darwin-user) darwin_user="no"
311 ;;
312 --enable-darwin-user) darwin_user="yes"
0a8e90f4 313 ;;
c5937220
PB
314 --enable-uname-release=*) uname_release="$optarg"
315 ;;
3142255c
BS
316 --sparc_cpu=*)
317 sparc_cpu="$optarg"
318 case $sparc_cpu in
319 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
320 target_cpu="sparc"; cpu="sparc" ;;
321 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
322 target_cpu="sparc"; cpu="sparc" ;;
323 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
324 target_cpu="sparc64"; cpu="sparc64" ;;
325 *) echo "undefined SPARC architecture. Exiting";exit 1;;
326 esac
327 ;;
85aa5189
FB
328 --enable-werror) werror="yes"
329 ;;
330 --disable-werror) werror="no"
331 ;;
4d3b6f6e
AZ
332 --disable-curses) curses="no"
333 ;;
7f1559c6
AZ
334 *) echo "ERROR: unknown option $opt"; show_help="yes"
335 ;;
7d13299d
FB
336 esac
337done
338
209afb9e
TS
339if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
340 AIOLIBS=
341else
4259e1a5
TS
342 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
343 AIOLIBS="-lrt -lpthread"
209afb9e
TS
344fi
345
6f30fa85
TS
346# default flags for all hosts
347CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
348LDFLAGS="$LDFLAGS -g"
85aa5189
FB
349if test "$werror" = "yes" ; then
350CFLAGS="$CFLAGS -Werror"
351fi
6f30fa85 352
3142255c
BS
353#
354# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
355# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
356#
40293e58 357case "$cpu" in
3142255c
BS
358 sparc) if test -z "$sparc_cpu" ; then
359 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
360 ARCH_LDFLAGS="-m32"
361 else
362 ARCH_CFLAGS="${SP_CFLAGS}"
363 ARCH_LDFLAGS="${SP_LDFLAGS}"
364 fi
365 ;;
366 sparc64) if test -z "$sparc_cpu" ; then
367 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
368 ARCH_LDFLAGS="-m64"
369 else
370 ARCH_CFLAGS="${SP_CFLAGS}"
371 ARCH_LDFLAGS="${SP_LDFLAGS}"
372 fi
373 ;;
76d83bde
TS
374 s390)
375 ARCH_CFLAGS="-march=z900"
376 ;;
40293e58
FB
377 i386)
378 ARCH_CFLAGS="-m32"
379 ARCH_LDFLAGS="-m32"
380 ;;
381 x86_64)
382 ARCH_CFLAGS="-m64"
383 ARCH_LDFLAGS="-m64"
384 ;;
3142255c
BS
385esac
386
af5db58e
PB
387if test x"$show_help" = x"yes" ; then
388cat << EOF
389
390Usage: configure [options]
391Options: [defaults in brackets after descriptions]
392
393EOF
394echo "Standard options:"
395echo " --help print this message"
396echo " --prefix=PREFIX install in PREFIX [$prefix]"
397echo " --interp-prefix=PREFIX where to find shared libraries, etc."
398echo " use %M for cpu name [$interp_prefix]"
399echo " --target-list=LIST set target list [$target_list]"
400echo ""
401echo "kqemu kernel acceleration support:"
402echo " --disable-kqemu disable kqemu support"
af5db58e
PB
403echo ""
404echo "Advanced options (experts only):"
405echo " --source-path=PATH path of source code [$source_path]"
406echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
407echo " --cc=CC use C compiler CC [$cc]"
408echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
409echo " --make=MAKE use specified make [$make]"
6a882643 410echo " --install=INSTALL use specified install [$install]"
af5db58e 411echo " --static enable static build [$static]"
85aa5189 412echo " --disable-werror disable compilation abort on warning"
fe8f78e4 413echo " --disable-sdl disable SDL"
af5db58e
PB
414echo " --enable-cocoa enable COCOA (Mac OS X only)"
415echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
416echo " --enable-adlib enable Adlib emulation"
e5c9a13e 417echo " --enable-ac97 enable AC97 emulation"
423d65f4 418echo " --enable-gus enable Gravis Ultrasound emulation"
af5db58e
PB
419echo " --enable-coreaudio enable Coreaudio audio driver"
420echo " --enable-alsa enable ALSA audio driver"
ca9cc28c 421echo " --enable-esd enable EsoundD audio driver"
af5db58e 422echo " --enable-fmod enable FMOD audio driver"
ed5065e1 423echo " --enable-dsound enable DirectSound audio driver"
2e4d9fb1 424echo " --disable-brlapi disable BrlAPI"
8d5d2d4c 425echo " --disable-vnc-tls disable TLS encryption for VNC server"
af896aaa 426echo " --disable-curses disable curses output"
af5db58e
PB
427echo " --enable-system enable all system emulation targets"
428echo " --disable-system disable all system emulation targets"
831b7825
TS
429echo " --enable-linux-user enable all linux usermode emulation targets"
430echo " --disable-linux-user disable all linux usermode emulation targets"
431echo " --enable-darwin-user enable all darwin usermode emulation targets"
432echo " --disable-darwin-user disable all darwin usermode emulation targets"
af5db58e
PB
433echo " --fmod-lib path to FMOD library"
434echo " --fmod-inc path to FMOD includes"
c5937220 435echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
3142255c 436echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
af5db58e 437echo ""
5bf08934 438echo "NOTE: The object files are built at the place where configure is launched"
af5db58e
PB
439exit 1
440fi
441
7d13299d
FB
442cc="${cross_prefix}${cc}"
443ar="${cross_prefix}${ar}"
444strip="${cross_prefix}${strip}"
445
064aae13
PB
446# check that the C compiler works.
447cat > $TMPC <<EOF
448int main(void) {}
449EOF
450
db7287ed 451if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
064aae13
PB
452 : C compiler works ok
453else
454 echo "ERROR: \"$cc\" either does not exist or does not work"
455 exit 1
a7350fa1
FB
456fi
457
67b915a5 458if test "$mingw32" = "yes" ; then
5327cf48 459 linux="no"
67b915a5 460 EXESUF=".exe"
9f059eca 461 oss="no"
67b915a5
FB
462fi
463
5fafdf24 464# Check for gcc4, error if pre-gcc4
328a4240
PB
465if test "$check_gcc" = "yes" ; then
466 cat > $TMPC <<EOF
467#if __GNUC__ < 4
468#error gcc3
469#endif
470int main(){return 0;}
471EOF
db7287ed 472 if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
328a4240
PB
473 echo "WARNING: \"$cc\" looks like gcc 4.x"
474 found_compat_cc="no"
475 if test "$gcc3_search" = "yes" ; then
476 echo "Looking for gcc 3.x"
477 for compat_cc in $gcc3_list ; do
d4af3de2 478 if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
328a4240 479 echo "Found \"$compat_cc\""
1124426a 480 cc="$cross_prefix$compat_cc"
328a4240
PB
481 found_compat_cc="yes"
482 break
483 fi
484 done
485 if test "$found_compat_cc" = "no" ; then
486 echo "gcc 3.x not found!"
487 fi
488 fi
489 if test "$found_compat_cc" = "no" ; then
490 echo "QEMU is known to have problems when compiled with gcc 4.x"
491 echo "It is recommended that you use gcc 3.x to build QEMU"
492 echo "To use this compiler anyway, configure with --disable-gcc-check"
493 exit 1;
494 fi
495 fi
496fi
497
ec530c81
FB
498#
499# Solaris specific configure tool chain decisions
500#
501if test "$solaris" = "yes" ; then
502 #
503 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
504 # override the check with --disable-gcc-check
5fafdf24 505 #
ec530c81
FB
506 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
507 solgcc=`which $cc`
508 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
509 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
510 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
511 echo "or get the latest patch from SunSolve for gcc"
512 exit 1
513 fi
514 fi
515 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
516 if test -z "$solinst" ; then
517 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
518 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
519 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
520 exit 1
521 fi
522 if test "$solinst" = "/usr/sbin/install" ; then
523 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
524 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
525 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
526 exit 1
527 fi
ec530c81
FB
528 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
529 if test -z "$sol_ar" ; then
530 echo "Error: No path includes ar"
531 if test -f /usr/ccs/bin/ar ; then
532 echo "Add /usr/ccs/bin to your path and rerun configure"
533 fi
534 exit 1
535 fi
5fafdf24 536fi
ec530c81
FB
537
538
5327cf48
FB
539if test -z "$target_list" ; then
540# these targets are portable
0a8e90f4 541 if [ "$softmmu" = "yes" ] ; then
2408a527
AJ
542 target_list="\
543i386-softmmu \
544x86_64-softmmu \
545arm-softmmu \
546cris-softmmu \
547m68k-softmmu \
548mips-softmmu \
549mipsel-softmmu \
550mips64-softmmu \
551mips64el-softmmu \
552ppc-softmmu \
553ppcemb-softmmu \
554ppc64-softmmu \
555sh4-softmmu \
556sh4eb-softmmu \
557sparc-softmmu \
558"
0a8e90f4 559 fi
5327cf48 560# the following are Linux specific
831b7825 561 if [ "$linux_user" = "yes" ] ; then
2408a527
AJ
562 target_list="${target_list}\
563i386-linux-user \
564x86_64-linux-user \
565alpha-linux-user \
566arm-linux-user \
567armeb-linux-user \
568cris-linux-user \
569m68k-linux-user \
570mips-linux-user \
571mipsel-linux-user \
572ppc-linux-user \
573ppc64-linux-user \
574ppc64abi32-linux-user \
575sh4-linux-user \
576sh4eb-linux-user \
577sparc-linux-user \
578sparc64-linux-user \
579sparc32plus-linux-user \
580"
831b7825
TS
581 fi
582# the following are Darwin specific
583 if [ "$darwin_user" = "yes" ] ; then
2408a527 584 target_list="$target_list i386-darwin-user ppc-darwin-user"
5327cf48 585 fi
6e20a45f 586else
b1a550a0 587 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
5327cf48 588fi
0a8e90f4
PB
589if test -z "$target_list" ; then
590 echo "No targets enabled"
591 exit 1
592fi
5327cf48 593
7d13299d
FB
594if test -z "$cross_prefix" ; then
595
596# ---
597# big/little endian test
598cat > $TMPC << EOF
599#include <inttypes.h>
600int main(int argc, char ** argv){
1d14ffa9
FB
601 volatile uint32_t i=0x01234567;
602 return (*((uint8_t*)(&i))) == 0x67;
7d13299d
FB
603}
604EOF
605
db7287ed 606if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
7d13299d
FB
607$TMPE && bigendian="yes"
608else
609echo big/little test failed
610fi
611
612else
613
614# if cross compiling, cannot launch a program, so make a static guess
0938cda5 615if test "$cpu" = "armv4b" \
f54b3f92 616 -o "$cpu" = "hppa" \
0938cda5
AJ
617 -o "$cpu" = "m68k" \
618 -o "$cpu" = "mips" \
619 -o "$cpu" = "mips64" \
620 -o "$cpu" = "powerpc" \
621 -o "$cpu" = "s390" \
622 -o "$cpu" = "sparc" \
623 -o "$cpu" = "sparc64"; then
7d13299d
FB
624 bigendian="yes"
625fi
626
627fi
628
b6853697
FB
629# host long bits test
630hostlongbits="32"
0938cda5
AJ
631if test "$cpu" = "x86_64" \
632 -o "$cpu" = "alpha" \
633 -o "$cpu" = "ia64" \
634 -o "$cpu" = "sparc64"; then
b6853697
FB
635 hostlongbits="64"
636fi
637
e8cd23de 638# check gcc options support
04369ff2
FB
639cat > $TMPC <<EOF
640int main(void) {
04369ff2
FB
641}
642EOF
643
11d9f695
FB
644##########################################
645# SDL probe
646
647sdl_too_old=no
648
649if test -z "$sdl" ; then
069b0bda
TS
650 sdl_config="sdl-config"
651 sdl=no
652 sdl_static=no
653
654 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
655 # win32 cross compilation case
656 sdl_config="i386-mingw32msvc-sdl-config"
657 sdl=yes
658 else
659 # normal SDL probe
11d9f695
FB
660cat > $TMPC << EOF
661#include <SDL.h>
662#undef main /* We don't want SDL to override our main() */
663int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
664EOF
db7287ed 665 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
069b0bda
TS
666 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
667 if test "$_sdlversion" -lt 121 ; then
668 sdl_too_old=yes
669 else
670 if test "$cocoa" = "no" ; then
671 sdl=yes
672 fi
673 fi
11d9f695 674
069b0bda
TS
675 # static link with sdl ?
676 if test "$sdl" = "yes" ; then
677 aa="no"
678 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
679 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
680 if [ "$aa" = "yes" ] ; then
681 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
682 fi
683
8281db4d 684 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
069b0bda
TS
685 sdl_static=yes
686 fi
687 fi # static link
688 fi # sdl compile test
689 fi # cross compilation
fd677642 690else
069b0bda
TS
691 # Make sure to disable cocoa if sdl was set
692 if test "$sdl" = "yes" ; then
693 cocoa="no"
694 coreaudio="no"
695 fi
a6e022ad 696fi # -z $sdl
11d9f695 697
8d5d2d4c
TS
698##########################################
699# VNC TLS detection
700if test "$vnc_tls" = "yes" ; then
701 `pkg-config gnutls` || vnc_tls="no"
702fi
703if test "$vnc_tls" = "yes" ; then
704 vnc_tls_cflags=`pkg-config --cflags gnutls`
705 vnc_tls_libs=`pkg-config --libs gnutls`
706fi
707
8f28f3fb
TS
708##########################################
709# alsa sound support libraries
710
711if test "$alsa" = "yes" ; then
712 cat > $TMPC << EOF
713#include <alsa/asoundlib.h>
714int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
715EOF
db7287ed 716 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lasound 2> /dev/null ; then
8f28f3fb
TS
717 :
718 else
719 echo
720 echo "Error: Could not find alsa"
721 echo "Make sure to have the alsa libs and headers installed."
722 echo
723 exit 1
724 fi
725fi
726
2e4d9fb1
AJ
727##########################################
728# BrlAPI probe
729
730if test -z "$brlapi" ; then
731 brlapi=no
732cat > $TMPC << EOF
733#include <brlapi.h>
734int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
735EOF
a40e56d5 736 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev/null ; then
2e4d9fb1
AJ
737 brlapi=yes
738 fi # brlapi compile test
739fi # -z $brlapi
740
4d3b6f6e
AZ
741##########################################
742# curses probe
743
744if test "$curses" = "yes" ; then
745 curses=no
746 cat > $TMPC << EOF
747#include <curses.h>
748int main(void) { return curses_version(); }
749EOF
af896aaa 750 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then
4d3b6f6e
AZ
751 curses=yes
752 fi
753fi # test "$curses"
754
cc8ae6de 755# Check if tools are available to build documentation.
6c591867
TS
756if [ -x "`which texi2html 2>/dev/null`" ] && \
757 [ -x "`which pod2man 2>/dev/null`" ]; then
cc8ae6de
PB
758 build_docs="yes"
759fi
760
11d9f695 761if test "$mingw32" = "yes" ; then
308c3593
PB
762 if test -z "$prefix" ; then
763 prefix="/c/Program Files/Qemu"
764 fi
765 mansuffix=""
766 datasuffix=""
767 docsuffix=""
768 binsuffix=""
11d9f695 769else
308c3593
PB
770 if test -z "$prefix" ; then
771 prefix="/usr/local"
772 fi
773 mansuffix="/share/man"
774 datasuffix="/share/qemu"
775 docsuffix="/share/doc/qemu"
776 binsuffix="/bin"
11d9f695 777fi
5a67135a 778
43ce4dfe 779echo "Install prefix $prefix"
308c3593
PB
780echo "BIOS directory $prefix$datasuffix"
781echo "binary directory $prefix$binsuffix"
11d9f695 782if test "$mingw32" = "no" ; then
308c3593 783echo "Manual directory $prefix$mansuffix"
43ce4dfe 784echo "ELF interp prefix $interp_prefix"
11d9f695 785fi
5a67135a 786echo "Source path $source_path"
43ce4dfe 787echo "C compiler $cc"
83469015 788echo "Host C compiler $host_cc"
db7287ed 789echo "ARCH_CFLAGS $ARCH_CFLAGS"
43ce4dfe 790echo "make $make"
6a882643 791echo "install $install"
43ce4dfe 792echo "host CPU $cpu"
de83cd02 793echo "host big endian $bigendian"
97a847bc 794echo "target list $target_list"
43ce4dfe 795echo "gprof enabled $gprof"
05c2a3e7 796echo "profiler $profiler"
43ce4dfe 797echo "static build $static"
85aa5189 798echo "-Werror enabled $werror"
5b0753e0
FB
799if test "$darwin" = "yes" ; then
800 echo "Cocoa support $cocoa"
801fi
97a847bc 802echo "SDL support $sdl"
e4afee97
FB
803if test "$sdl" != "no" ; then
804 echo "SDL static link $sdl_static"
805fi
4d3b6f6e 806echo "curses support $curses"
67b915a5 807echo "mingw32 support $mingw32"
fb065187 808echo "Adlib support $adlib"
e5c9a13e 809echo "AC97 support $ac97"
423d65f4 810echo "GUS support $gus"
1d14ffa9
FB
811echo "CoreAudio support $coreaudio"
812echo "ALSA support $alsa"
ca9cc28c 813echo "EsounD support $esd"
1d14ffa9 814echo "DSound support $dsound"
1d14ffa9
FB
815if test "$fmod" = "yes"; then
816 if test -z $fmod_lib || test -z $fmod_inc; then
817 echo
818 echo "Error: You must specify path to FMOD library and headers"
819 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
820 echo
821 exit 1
822 fi
b1a550a0
PB
823 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
824else
825 fmod_support=""
102a52e4 826fi
b1a550a0 827echo "FMOD support $fmod $fmod_support"
6b4d2ba1 828echo "OSS support $oss"
8d5d2d4c
TS
829echo "VNC TLS support $vnc_tls"
830if test "$vnc_tls" = "yes" ; then
831 echo " TLS CFLAGS $vnc_tls_cflags"
832 echo " TLS LIBS $vnc_tls_libs"
833fi
3142255c
BS
834if test -n "$sparc_cpu"; then
835 echo "Target Sparc Arch $sparc_cpu"
836fi
07f4ddbf 837echo "kqemu support $kqemu"
2e4d9fb1 838echo "brlapi support $brlapi"
cc8ae6de 839echo "Documentation $build_docs"
c5937220
PB
840[ ! -z "$uname_release" ] && \
841echo "uname -r $uname_release"
67b915a5 842
97a847bc 843if test $sdl_too_old = "yes"; then
24b55b96 844echo "-> Your SDL version is too old - please upgrade to have SDL support"
7c1f25b4 845fi
20b40c6a
TS
846if [ -s /tmp/qemu-$$-sdl-config.log ]; then
847 echo "The error log from compiling the libSDL test is: "
848 cat /tmp/qemu-$$-sdl-config.log
849fi
850rm -f /tmp/qemu-$$-sdl-config.log
24b55b96
FB
851#if test "$sdl_static" = "no"; then
852# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
853#fi
97a847bc
FB
854config_mak="config-host.mak"
855config_h="config-host.h"
7d13299d 856
7c1f25b4 857#echo "Creating $config_mak and $config_h"
7d13299d 858
15d9ca0f
TS
859test -f $config_h && mv $config_h ${config_h}~
860
97a847bc 861echo "# Automatically generated by configure - do not modify" > $config_mak
29517134 862echo "# Configured with: $0 $@" >> $config_mak
97a847bc 863echo "/* Automatically generated by configure - do not modify */" > $config_h
7d13299d 864
97a847bc 865echo "prefix=$prefix" >> $config_mak
308c3593
PB
866echo "bindir=\${prefix}$binsuffix" >> $config_mak
867echo "mandir=\${prefix}$mansuffix" >> $config_mak
868echo "datadir=\${prefix}$datasuffix" >> $config_mak
4ad5b06d 869echo "docdir=\${prefix}$docsuffix" >> $config_mak
308c3593 870echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
97a847bc 871echo "MAKE=$make" >> $config_mak
6a882643 872echo "INSTALL=$install" >> $config_mak
97a847bc 873echo "CC=$cc" >> $config_mak
97a847bc
FB
874echo "HOST_CC=$host_cc" >> $config_mak
875echo "AR=$ar" >> $config_mak
876echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
40293e58
FB
877# XXX: only use CFLAGS and LDFLAGS ?
878# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
879# compilation of dyngen tool (useful for win32 build on Linux host)
6f30fa85 880echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
3142255c
BS
881echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
882echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
883echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
97a847bc
FB
884echo "CFLAGS=$CFLAGS" >> $config_mak
885echo "LDFLAGS=$LDFLAGS" >> $config_mak
67b915a5 886echo "EXESUF=$EXESUF" >> $config_mak
70956b77 887echo "AIOLIBS=$AIOLIBS" >> $config_mak
2408a527
AJ
888case "$cpu" in
889 i386)
890 echo "ARCH=i386" >> $config_mak
891 echo "#define HOST_I386 1" >> $config_h
892 ;;
893 x86_64)
894 echo "ARCH=x86_64" >> $config_mak
895 echo "#define HOST_X86_64 1" >> $config_h
896 ;;
897 alpha)
898 echo "ARCH=alpha" >> $config_mak
899 echo "#define HOST_ALPHA 1" >> $config_h
900 ;;
901 armv4b)
902 echo "ARCH=arm" >> $config_mak
903 echo "#define HOST_ARM 1" >> $config_h
904 ;;
905 armv4l)
906 echo "ARCH=arm" >> $config_mak
907 echo "#define HOST_ARM 1" >> $config_h
908 ;;
909 cris)
910 echo "ARCH=cris" >> $config_mak
911 echo "#define HOST_CRIS 1" >> $config_h
912 ;;
913 hppa)
914 echo "ARCH=hppa" >> $config_mak
915 echo "#define HOST_HPPA 1" >> $config_h
916 ;;
917 ia64)
918 echo "ARCH=ia64" >> $config_mak
919 echo "#define HOST_IA64 1" >> $config_h
920 ;;
921 m68k)
922 echo "ARCH=m68k" >> $config_mak
923 echo "#define HOST_M68K 1" >> $config_h
924 ;;
925 mips)
926 echo "ARCH=mips" >> $config_mak
927 echo "#define HOST_MIPS 1" >> $config_h
928 ;;
929 mips64)
930 echo "ARCH=mips64" >> $config_mak
931 echo "#define HOST_MIPS64 1" >> $config_h
932 ;;
933 powerpc)
934 echo "ARCH=ppc" >> $config_mak
935 echo "#define HOST_PPC 1" >> $config_h
936 ;;
937 s390)
938 echo "ARCH=s390" >> $config_mak
939 echo "#define HOST_S390 1" >> $config_h
940 ;;
941 sparc)
942 echo "ARCH=sparc" >> $config_mak
943 echo "#define HOST_SPARC 1" >> $config_h
944 ;;
945 sparc64)
946 echo "ARCH=sparc64" >> $config_mak
947 echo "#define HOST_SPARC64 1" >> $config_h
948 ;;
949 *)
950 echo "Unsupported CPU = $cpu"
951 exit 1
952 ;;
953esac
7d13299d 954if test "$bigendian" = "yes" ; then
97a847bc
FB
955 echo "WORDS_BIGENDIAN=yes" >> $config_mak
956 echo "#define WORDS_BIGENDIAN 1" >> $config_h
957fi
b6853697 958echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
67b915a5
FB
959if test "$mingw32" = "yes" ; then
960 echo "CONFIG_WIN32=yes" >> $config_mak
11d9f695 961 echo "#define CONFIG_WIN32 1" >> $config_h
210fa556
PB
962else
963 cat > $TMPC << EOF
964#include <byteswap.h>
965int main(void) { return bswap_32(0); }
966EOF
db7287ed 967 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
210fa556
PB
968 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
969 fi
67b915a5 970fi
83fb7adf
FB
971if test "$darwin" = "yes" ; then
972 echo "CONFIG_DARWIN=yes" >> $config_mak
973 echo "#define CONFIG_DARWIN 1" >> $config_h
974fi
ec530c81
FB
975if test "$solaris" = "yes" ; then
976 echo "CONFIG_SOLARIS=yes" >> $config_mak
38cfa06c 977 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
0475a5ca
TS
978 if test "$needs_libsunmath" = "yes" ; then
979 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
980 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
981 fi
ec530c81 982fi
3142255c
BS
983if test -n "$sparc_cpu"; then
984 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
985 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
986fi
67b915a5
FB
987if test "$gdbstub" = "yes" ; then
988 echo "CONFIG_GDBSTUB=yes" >> $config_mak
989 echo "#define CONFIG_GDBSTUB 1" >> $config_h
990fi
97a847bc
FB
991if test "$gprof" = "yes" ; then
992 echo "TARGET_GPROF=yes" >> $config_mak
993 echo "#define HAVE_GPROF 1" >> $config_h
994fi
995if test "$static" = "yes" ; then
996 echo "CONFIG_STATIC=yes" >> $config_mak
50863472 997 echo "#define CONFIG_STATIC 1" >> $config_h
7d13299d 998fi
05c2a3e7
FB
999if test $profiler = "yes" ; then
1000 echo "#define CONFIG_PROFILER 1" >> $config_h
1001fi
c20709aa
FB
1002if test "$slirp" = "yes" ; then
1003 echo "CONFIG_SLIRP=yes" >> $config_mak
1004 echo "#define CONFIG_SLIRP 1" >> $config_h
1005fi
fb065187
FB
1006if test "$adlib" = "yes" ; then
1007 echo "CONFIG_ADLIB=yes" >> $config_mak
1008 echo "#define CONFIG_ADLIB 1" >> $config_h
1009fi
e5c9a13e
AZ
1010if test "$ac97" = "yes" ; then
1011 echo "CONFIG_AC97=yes" >> $config_mak
1012 echo "#define CONFIG_AC97 1" >> $config_h
1013fi
423d65f4
AZ
1014if test "$gus" = "yes" ; then
1015 echo "CONFIG_GUS=yes" >> $config_mak
1016 echo "#define CONFIG_GUS 1" >> $config_h
1017fi
fb065187
FB
1018if test "$oss" = "yes" ; then
1019 echo "CONFIG_OSS=yes" >> $config_mak
1020 echo "#define CONFIG_OSS 1" >> $config_h
1021fi
1d14ffa9
FB
1022if test "$coreaudio" = "yes" ; then
1023 echo "CONFIG_COREAUDIO=yes" >> $config_mak
1024 echo "#define CONFIG_COREAUDIO 1" >> $config_h
1025fi
1026if test "$alsa" = "yes" ; then
1027 echo "CONFIG_ALSA=yes" >> $config_mak
1028 echo "#define CONFIG_ALSA 1" >> $config_h
1029fi
ca9cc28c
AZ
1030if test "$esd" = "yes" ; then
1031 echo "CONFIG_ESD=yes" >> $config_mak
1032 echo "#define CONFIG_ESD 1" >> $config_h
1033fi
1d14ffa9
FB
1034if test "$dsound" = "yes" ; then
1035 echo "CONFIG_DSOUND=yes" >> $config_mak
1036 echo "#define CONFIG_DSOUND 1" >> $config_h
1037fi
102a52e4
FB
1038if test "$fmod" = "yes" ; then
1039 echo "CONFIG_FMOD=yes" >> $config_mak
1040 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1041 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1042 echo "#define CONFIG_FMOD 1" >> $config_h
1043fi
8d5d2d4c
TS
1044if test "$vnc_tls" = "yes" ; then
1045 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1046 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1047 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1048 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1049fi
b1a550a0
PB
1050qemu_version=`head $source_path/VERSION`
1051echo "VERSION=$qemu_version" >>$config_mak
d4b8f039 1052echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
97a847bc
FB
1053
1054echo "SRC_PATH=$source_path" >> $config_mak
ad064840
PB
1055if [ "$source_path_used" = "yes" ]; then
1056 echo "VPATH=$source_path" >> $config_mak
1057fi
97a847bc 1058echo "TARGET_DIRS=$target_list" >> $config_mak
cc8ae6de
PB
1059if [ "$build_docs" = "yes" ] ; then
1060 echo "BUILD_DOCS=yes" >> $config_mak
1061fi
49ecc3fa
FB
1062if test "$static" = "yes"; then
1063 sdl1=$sdl_static
1064else
1065 sdl1=$sdl
1066fi
1067if test "$sdl1" = "yes" ; then
1068 echo "#define CONFIG_SDL 1" >> $config_h
1069 echo "CONFIG_SDL=yes" >> $config_mak
1070 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1071 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1072 else
1073 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1074 fi
1075 if [ "${aa}" = "yes" ] ; then
1076 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1077 else
1078 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1079 fi
1080fi
1081if test "$cocoa" = "yes" ; then
4d3b6f6e
AZ
1082 echo "#define CONFIG_COCOA 1" >> $config_h
1083 echo "CONFIG_COCOA=yes" >> $config_mak
1084fi
1085if test "$curses" = "yes" ; then
1086 echo "#define CONFIG_CURSES 1" >> $config_h
1087 echo "CONFIG_CURSES=yes" >> $config_mak
1088 echo "CURSES_LIBS=-lcurses" >> $config_mak
49ecc3fa 1089fi
2e4d9fb1
AJ
1090if test "$brlapi" = "yes" ; then
1091 echo "CONFIG_BRLAPI=yes" >> $config_mak
1092 echo "#define CONFIG_BRLAPI 1" >> $config_h
1093 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1094fi
97a847bc 1095
83fb7adf 1096# XXX: suppress that
7d3505c5 1097if [ "$bsd" = "yes" ] ; then
43003046 1098 echo "#define O_LARGEFILE 0" >> $config_h
43003046 1099 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
7d3505c5
FB
1100 echo "#define _BSD 1" >> $config_h
1101fi
1102
c5937220
PB
1103echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1104
c39e3338
PB
1105tools=
1106if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1107 tools="qemu-img\$(EXESUF) $tools"
7a5ca864
FB
1108 if [ "$linux" = "yes" ] ; then
1109 tools="qemu-nbd\$(EXESUF) $tools"
1110 fi
c39e3338
PB
1111fi
1112echo "TOOLS=$tools" >> $config_mak
1113
15d9ca0f
TS
1114test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1115
1d14ffa9 1116for target in $target_list; do
97a847bc
FB
1117target_dir="$target"
1118config_mak=$target_dir/config.mak
1119config_h=$target_dir/config.h
1120target_cpu=`echo $target | cut -d '-' -f 1`
1121target_bigendian="no"
808c4954 1122[ "$target_cpu" = "armeb" ] && target_bigendian=yes
0938cda5
AJ
1123[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1124[ "$target_cpu" = "mips" ] && target_bigendian=yes
1125[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1126[ "$target_cpu" = "mips64" ] && target_bigendian=yes
67867308 1127[ "$target_cpu" = "ppc" ] && target_bigendian=yes
d4082e95 1128[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
22f8a8b3 1129[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
e85e7c6e 1130[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
908f52b0 1131[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
0938cda5
AJ
1132[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1133[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1134[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
97a847bc 1135target_softmmu="no"
997344f3 1136target_user_only="no"
831b7825 1137target_linux_user="no"
831b7825 1138target_darwin_user="no"
9e407a85
PB
1139case "$target" in
1140 ${target_cpu}-softmmu)
1141 target_softmmu="yes"
1142 ;;
1143 ${target_cpu}-linux-user)
1144 target_user_only="yes"
1145 target_linux_user="yes"
1146 ;;
1147 ${target_cpu}-darwin-user)
1148 target_user_only="yes"
1149 target_darwin_user="yes"
1150 ;;
1151 *)
1152 echo "ERROR: Target '$target' not recognised"
1153 exit 1
1154 ;;
1155esac
831b7825 1156
97ccc689 1157if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1d14ffa9 1158 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
97ccc689 1159 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
9c038506 1160 echo "To build QEMU without graphical output configure with --disable-gfx-check"
4d3b6f6e
AZ
1161 echo "Note that this will disable all output from the virtual graphics card"
1162 echo "except through VNC or curses."
97ccc689
FB
1163 exit 1;
1164fi
1165
7c1f25b4 1166#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
97a847bc 1167
15d9ca0f
TS
1168test -f $config_h && mv $config_h ${config_h}~
1169
97a847bc 1170mkdir -p $target_dir
158142c2 1171mkdir -p $target_dir/fpu
57fec1fe 1172mkdir -p $target_dir/tcg
831b7825 1173if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
69de927c
FB
1174 mkdir -p $target_dir/nwfpe
1175fi
1176
ec530c81
FB
1177#
1178# don't use ln -sf as not all "ln -sf" over write the file/link
1179#
1180rm -f $target_dir/Makefile
1181ln -s $source_path/Makefile.target $target_dir/Makefile
1182
97a847bc
FB
1183
1184echo "# Automatically generated by configure - do not modify" > $config_mak
1185echo "/* Automatically generated by configure - do not modify */" > $config_h
1186
de83cd02 1187
97a847bc
FB
1188echo "include ../config-host.mak" >> $config_mak
1189echo "#include \"../config-host.h\"" >> $config_h
1e43adfc 1190
e5fe0c52 1191bflt="no"
cb33da57 1192elfload32="no"
1e43adfc
FB
1193interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1194echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
97a847bc 1195
2408a527
AJ
1196case "$target_cpu" in
1197 i386)
1198 echo "TARGET_ARCH=i386" >> $config_mak
1199 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1200 echo "#define TARGET_I386 1" >> $config_h
1201 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386"
1202 then
1203 echo "#define USE_KQEMU 1" >> $config_h
1204 fi
f2bf094e 1205 gcc3minver=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
11d1fdb0 1206 if test -n "$gcc3minver" && test $gcc3minver -gt 3
f2bf094e
AJ
1207 then
1208 echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1209 else
1210 echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1211 fi
2408a527
AJ
1212 ;;
1213 x86_64)
1214 echo "TARGET_ARCH=x86_64" >> $config_mak
1215 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1216 echo "#define TARGET_I386 1" >> $config_h
1217 echo "#define TARGET_X86_64 1" >> $config_h
1218 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1219 then
1220 echo "#define USE_KQEMU 1" >> $config_h
1221 fi
1222 ;;
1223 alpha)
1224 echo "TARGET_ARCH=alpha" >> $config_mak
bf6247fb 1225 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1226 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1227 echo "#define TARGET_ALPHA 1" >> $config_h
bf6247fb 1228 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1229 ;;
1230 arm|armeb)
1231 echo "TARGET_ARCH=arm" >> $config_mak
2408a527
AJ
1232 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1233 echo "#define TARGET_ARM 1" >> $config_h
2408a527
AJ
1234 bflt="yes"
1235 ;;
1236 cris)
1237 echo "TARGET_ARCH=cris" >> $config_mak
1238 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1239 echo "#define TARGET_CRIS 1" >> $config_h
2408a527
AJ
1240 ;;
1241 m68k)
1242 echo "TARGET_ARCH=m68k" >> $config_mak
1243 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1244 echo "#define TARGET_M68K 1" >> $config_h
1245 bflt="yes"
1246 ;;
1247 mips|mipsel)
1248 echo "TARGET_ARCH=mips" >> $config_mak
bf6247fb 1249 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1250 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1251 echo "#define TARGET_MIPS 1" >> $config_h
1252 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
bf6247fb 1253 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1254 ;;
1255 mipsn32|mipsn32el)
1256 echo "TARGET_ARCH=mipsn32" >> $config_mak
bf6247fb 1257 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1258 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1259 echo "#define TARGET_MIPS 1" >> $config_h
1260 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
bf6247fb 1261 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1262 ;;
1263 mips64|mips64el)
1264 echo "TARGET_ARCH=mips64" >> $config_mak
bf6247fb 1265 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1266 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1267 echo "#define TARGET_MIPS 1" >> $config_h
1268 echo "#define TARGET_MIPS64 1" >> $config_h
1269 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
bf6247fb 1270 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1271 ;;
1272 ppc)
1273 echo "TARGET_ARCH=ppc" >> $config_mak
bf6247fb 1274 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1275 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1276 echo "#define TARGET_PPC 1" >> $config_h
bf6247fb 1277 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1278 ;;
1279 ppcemb)
1280 echo "TARGET_ARCH=ppcemb" >> $config_mak
1281 echo "TARGET_ABI_DIR=ppc" >> $config_mak
bf6247fb 1282 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1283 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1284 echo "#define TARGET_PPC 1" >> $config_h
1285 echo "#define TARGET_PPCEMB 1" >> $config_h
ec5b78cd 1286 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1287 ;;
1288 ppc64)
1289 echo "TARGET_ARCH=ppc64" >> $config_mak
1290 echo "TARGET_ABI_DIR=ppc" >> $config_mak
bf6247fb 1291 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1292 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1293 echo "#define TARGET_PPC 1" >> $config_h
1294 echo "#define TARGET_PPC64 1" >> $config_h
bf6247fb 1295 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1296 ;;
1297 ppc64abi32)
1298 echo "TARGET_ARCH=ppc64" >> $config_mak
1299 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1300 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
bf6247fb 1301 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1302 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1303 echo "#define TARGET_PPC 1" >> $config_h
1304 echo "#define TARGET_PPC64 1" >> $config_h
1305 echo "#define TARGET_ABI32 1" >> $config_h
bf6247fb 1306 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1307 ;;
1308 sh4|sh4eb)
1309 echo "TARGET_ARCH=sh4" >> $config_mak
bf6247fb 1310 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
2408a527
AJ
1311 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1312 echo "#define TARGET_SH4 1" >> $config_h
bf6247fb 1313 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
2408a527
AJ
1314 bflt="yes"
1315 ;;
1316 sparc)
1317 echo "TARGET_ARCH=sparc" >> $config_mak
1318 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1319 echo "#define TARGET_SPARC 1" >> $config_h
1320 ;;
1321 sparc64)
1322 echo "TARGET_ARCH=sparc64" >> $config_mak
1323 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1324 echo "#define TARGET_SPARC 1" >> $config_h
1325 echo "#define TARGET_SPARC64 1" >> $config_h
1326 elfload32="yes"
1327 ;;
1328 sparc32plus)
1329 echo "TARGET_ARCH=sparc64" >> $config_mak
1330 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1331 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1332 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1333 echo "#define TARGET_SPARC 1" >> $config_h
1334 echo "#define TARGET_SPARC64 1" >> $config_h
1335 echo "#define TARGET_ABI32 1" >> $config_h
1336 ;;
1337 *)
1338 echo "Unsupported target CPU"
1339 exit 1
1340 ;;
1341esac
de83cd02 1342if test "$target_bigendian" = "yes" ; then
97a847bc
FB
1343 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1344 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
de83cd02 1345fi
97a847bc
FB
1346if test "$target_softmmu" = "yes" ; then
1347 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1348 echo "#define CONFIG_SOFTMMU 1" >> $config_h
43ce4dfe 1349fi
997344f3
FB
1350if test "$target_user_only" = "yes" ; then
1351 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1352 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1353fi
831b7825
TS
1354if test "$target_linux_user" = "yes" ; then
1355 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1356 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1357fi
1358if test "$target_darwin_user" = "yes" ; then
1359 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1360 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1361fi
97a847bc 1362
0938cda5
AJ
1363if test "$target_cpu" = "arm" \
1364 -o "$target_cpu" = "armeb" \
1365 -o "$target_cpu" = "m68k" \
1366 -o "$target_cpu" = "mips" \
1367 -o "$target_cpu" = "mipsel" \
1368 -o "$target_cpu" = "mipsn32" \
1369 -o "$target_cpu" = "mipsn32el" \
1370 -o "$target_cpu" = "mips64" \
1371 -o "$target_cpu" = "mips64el" \
1372 -o "$target_cpu" = "sparc" \
1373 -o "$target_cpu" = "sparc64" \
1374 -o "$target_cpu" = "sparc32plus"; then
158142c2
FB
1375 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1376 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1377fi
e5fe0c52
PB
1378if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1379 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1380 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1381fi
cb33da57
BS
1382# 32 bit ELF loader in addition to native 64 bit loader?
1383if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1384 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1385 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1386fi
5b0753e0 1387
15d9ca0f
TS
1388test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1389
97a847bc 1390done # for target in $targets
7d13299d
FB
1391
1392# build tree in object directory if source path is different from current one
1393if test "$source_path_used" = "yes" ; then
49ecc3fa 1394 DIRS="tests tests/cris slirp audio"
7d13299d 1395 FILES="Makefile tests/Makefile"
e7daa605 1396 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
e1ffb0f1 1397 FILES="$FILES tests/test-mmap.c"
7d13299d
FB
1398 for dir in $DIRS ; do
1399 mkdir -p $dir
1400 done
ec530c81 1401 # remove the link and recreate it, as not all "ln -sf" overwrite the link
7d13299d 1402 for f in $FILES ; do
ec530c81
FB
1403 rm -f $f
1404 ln -s $source_path/$f $f
7d13299d
FB
1405 done
1406fi
7d13299d 1407
97a847bc 1408rm -f $TMPO $TMPC $TMPE $TMPS