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