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