]> git.proxmox.com Git - qemu.git/blame - configure
Improve configure for Solaris, by Ben Taylor.
[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
PB
25gcc3_search="yes"
26gcc3_list="gcc-3.4 gcc34 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 ;;
ba68055e 38 armv*b)
808c4954
FB
39 cpu="armv4b"
40 ;;
ba68055e 41 armv*l)
7d13299d
FB
42 cpu="armv4l"
43 ;;
44 alpha)
45 cpu="alpha"
46 ;;
295defa5 47 "Power Macintosh"|ppc|ppc64)
7d13299d
FB
48 cpu="powerpc"
49 ;;
50 mips)
51 cpu="mips"
52 ;;
fb3e5849
FB
53 s390)
54 cpu="s390"
55 ;;
94ac5158 56 sparc|sun4[muv])
ae228531
FB
57 cpu="sparc"
58 ;;
59 sparc64)
60 cpu="sparc64"
61 ;;
a8baa8c5
FB
62 ia64)
63 cpu="ia64"
64 ;;
38e584a0
FB
65 m68k)
66 cpu="m68k"
67 ;;
bc51c5c9 68 x86_64|amd64)
0b0babc6 69 cpu="x86_64"
bc51c5c9 70 ;;
7d13299d
FB
71 *)
72 cpu="unknown"
73 ;;
74esac
75gprof="no"
76bigendian="no"
67b915a5
FB
77mingw32="no"
78EXESUF=""
79gdbstub="yes"
443f1376 80slirp="yes"
fb065187
FB
81adlib="no"
82oss="no"
1d14ffa9
FB
83dsound="no"
84coreaudio="no"
85alsa="no"
102a52e4
FB
86fmod="no"
87fmod_lib=""
88fmod_inc=""
b1a550a0 89bsd="no"
5327cf48 90linux="no"
c9ec1fe4 91kqemu="no"
05c2a3e7 92profiler="no"
5b0753e0 93cocoa="no"
97ccc689 94check_gfx="yes"
1aff381f 95check_gcc="yes"
0a8e90f4 96softmmu="yes"
831b7825
TS
97linux_user="no"
98darwin_user="no"
cc8ae6de 99build_docs="no"
c5937220 100uname_release=""
7d13299d
FB
101
102# OS specific
103targetos=`uname -s`
104case $targetos in
c326e0af
FB
105CYGWIN*)
106mingw32="yes"
6f30fa85 107OS_CFLAGS="-mno-cygwin"
c326e0af 108;;
67b915a5
FB
109MINGW32*)
110mingw32="yes"
111;;
7d3505c5
FB
112FreeBSD)
113bsd="yes"
fb065187 114oss="yes"
e99f9060 115if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
07f4ddbf
FB
116 kqemu="yes"
117fi
7d3505c5
FB
118;;
119NetBSD)
120bsd="yes"
fb065187 121oss="yes"
7d3505c5
FB
122;;
123OpenBSD)
124bsd="yes"
fb065187 125oss="yes"
7d3505c5 126;;
83fb7adf
FB
127Darwin)
128bsd="yes"
129darwin="yes"
831b7825 130darwin_user="yes"
fd677642
TS
131cocoa="yes"
132coreaudio="yes"
6f30fa85 133OS_CFLAGS="-mdynamic-no-pic"
83fb7adf 134;;
ec530c81 135SunOS)
c2b84fab
TS
136 solaris="yes"
137 make="gmake"
138 install="ginstall"
139 solarisrev=`uname -r | cut -f2 -d.`
140 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
141 if test "$solarisrev" -ge 10 ; then
142 kqemu="yes"
143 fi
144 ;;
1d14ffa9 145*)
fb065187 146oss="yes"
5327cf48 147linux="yes"
831b7825 148linux_user="yes"
07f4ddbf 149if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
c9ec1fe4
FB
150 kqemu="yes"
151fi
fb065187 152;;
7d13299d
FB
153esac
154
7d3505c5 155if [ "$bsd" = "yes" ] ; then
b1a550a0 156 if [ "$darwin" != "yes" ] ; then
83fb7adf
FB
157 make="gmake"
158 fi
7d3505c5
FB
159fi
160
7d13299d 161# find source path
ad064840
PB
162source_path=`dirname "$0"`
163if [ -z "$source_path" ]; then
7d13299d 164 source_path=`pwd`
ad064840
PB
165else
166 source_path=`cd "$source_path"; pwd`
167fi
168if test "$source_path" = `pwd` ; then
7d13299d 169 source_path_used="no"
ad064840
PB
170else
171 source_path_used="yes"
7d13299d
FB
172fi
173
174for opt do
a46e4035 175 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
7d13299d 176 case "$opt" in
2efc3265
FB
177 --help|-h) show_help=yes
178 ;;
b1a550a0 179 --prefix=*) prefix="$optarg"
7d13299d 180 ;;
b1a550a0 181 --interp-prefix=*) interp_prefix="$optarg"
32ce6337 182 ;;
b1a550a0 183 --source-path=*) source_path="$optarg"
ad064840 184 source_path_used="yes"
7d13299d 185 ;;
b1a550a0 186 --cross-prefix=*) cross_prefix="$optarg"
7d13299d 187 ;;
b1a550a0 188 --cc=*) cc="$optarg"
328a4240 189 gcc3_search="no"
7d13299d 190 ;;
b1a550a0 191 --host-cc=*) host_cc="$optarg"
83469015 192 ;;
b1a550a0 193 --make=*) make="$optarg"
7d13299d 194 ;;
6a882643
PB
195 --install=*) install="$optarg"
196 ;;
b1a550a0 197 --extra-cflags=*) CFLAGS="$optarg"
7d13299d 198 ;;
b1a550a0 199 --extra-ldflags=*) LDFLAGS="$optarg"
7d13299d 200 ;;
b1a550a0 201 --cpu=*) cpu="$optarg"
7d13299d 202 ;;
b1a550a0 203 --target-list=*) target_list="$optarg"
de83cd02 204 ;;
7d13299d
FB
205 --enable-gprof) gprof="yes"
206 ;;
43ce4dfe
FB
207 --static) static="yes"
208 ;;
97a847bc
FB
209 --disable-sdl) sdl="no"
210 ;;
1d14ffa9
FB
211 --enable-coreaudio) coreaudio="yes"
212 ;;
213 --enable-alsa) alsa="yes"
214 ;;
215 --enable-dsound) dsound="yes"
216 ;;
102a52e4
FB
217 --enable-fmod) fmod="yes"
218 ;;
b1a550a0 219 --fmod-lib=*) fmod_lib="$optarg"
102a52e4 220 ;;
b1a550a0 221 --fmod-inc=*) fmod_inc="$optarg"
102a52e4 222 ;;
87ac5427 223 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no"
1d14ffa9 224 ;;
443f1376 225 --disable-slirp) slirp="no"
1d14ffa9 226 ;;
fb065187 227 --enable-adlib) adlib="yes"
1d14ffa9 228 ;;
c9ec1fe4 229 --disable-kqemu) kqemu="no"
1d14ffa9 230 ;;
05c2a3e7
FB
231 --enable-profiler) profiler="yes"
232 ;;
1d14ffa9
FB
233 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
234 ;;
97ccc689
FB
235 --disable-gfx-check) check_gfx="no"
236 ;;
1aff381f
FB
237 --disable-gcc-check) check_gcc="no"
238 ;;
cad25d69 239 --disable-system) softmmu="no"
0a8e90f4 240 ;;
cad25d69 241 --enable-system) softmmu="yes"
0a8e90f4 242 ;;
831b7825 243 --disable-linux-user) linux_user="no"
0a8e90f4 244 ;;
831b7825
TS
245 --enable-linux-user) linux_user="yes"
246 ;;
247 --disable-darwin-user) darwin_user="no"
248 ;;
249 --enable-darwin-user) darwin_user="yes"
0a8e90f4 250 ;;
c5937220
PB
251 --enable-uname-release=*) uname_release="$optarg"
252 ;;
7d13299d
FB
253 esac
254done
255
6f30fa85
TS
256# default flags for all hosts
257CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
258LDFLAGS="$LDFLAGS -g"
259
af5db58e
PB
260if test x"$show_help" = x"yes" ; then
261cat << EOF
262
263Usage: configure [options]
264Options: [defaults in brackets after descriptions]
265
266EOF
267echo "Standard options:"
268echo " --help print this message"
269echo " --prefix=PREFIX install in PREFIX [$prefix]"
270echo " --interp-prefix=PREFIX where to find shared libraries, etc."
271echo " use %M for cpu name [$interp_prefix]"
272echo " --target-list=LIST set target list [$target_list]"
273echo ""
274echo "kqemu kernel acceleration support:"
275echo " --disable-kqemu disable kqemu support"
af5db58e
PB
276echo ""
277echo "Advanced options (experts only):"
278echo " --source-path=PATH path of source code [$source_path]"
279echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
280echo " --cc=CC use C compiler CC [$cc]"
281echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
282echo " --make=MAKE use specified make [$make]"
6a882643 283echo " --install=INSTALL use specified install [$install]"
af5db58e
PB
284echo " --static enable static build [$static]"
285echo " --enable-cocoa enable COCOA (Mac OS X only)"
286echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
287echo " --enable-adlib enable Adlib emulation"
288echo " --enable-coreaudio enable Coreaudio audio driver"
289echo " --enable-alsa enable ALSA audio driver"
290echo " --enable-fmod enable FMOD audio driver"
291echo " --enabled-dsound enable DirectSound audio driver"
292echo " --enable-system enable all system emulation targets"
293echo " --disable-system disable all system emulation targets"
831b7825
TS
294echo " --enable-linux-user enable all linux usermode emulation targets"
295echo " --disable-linux-user disable all linux usermode emulation targets"
296echo " --enable-darwin-user enable all darwin usermode emulation targets"
297echo " --disable-darwin-user disable all darwin usermode emulation targets"
af5db58e
PB
298echo " --fmod-lib path to FMOD library"
299echo " --fmod-inc path to FMOD includes"
c5937220 300echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
af5db58e 301echo ""
5bf08934 302echo "NOTE: The object files are built at the place where configure is launched"
af5db58e
PB
303exit 1
304fi
305
7d13299d
FB
306cc="${cross_prefix}${cc}"
307ar="${cross_prefix}${ar}"
308strip="${cross_prefix}${strip}"
309
064aae13
PB
310# check that the C compiler works.
311cat > $TMPC <<EOF
312int main(void) {}
313EOF
314
315if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
316 : C compiler works ok
317else
318 echo "ERROR: \"$cc\" either does not exist or does not work"
319 exit 1
a7350fa1
FB
320fi
321
67b915a5 322if test "$mingw32" = "yes" ; then
5327cf48 323 linux="no"
67b915a5 324 EXESUF=".exe"
9f059eca 325 oss="no"
07f4ddbf
FB
326 if [ "$cpu" = "i386" ] ; then
327 kqemu="yes"
328 fi
67b915a5
FB
329fi
330
328a4240
PB
331# Check for gcc4, error if pre-gcc4
332if test "$check_gcc" = "yes" ; then
333 cat > $TMPC <<EOF
334#if __GNUC__ < 4
335#error gcc3
336#endif
337int main(){return 0;}
338EOF
339 check_cc() {
340 which "$1" >&/dev/null
341 return $?
342 }
343
344 if "$cc" -o $TMPE $TMPC 2>/dev/null ; then
345 echo "WARNING: \"$cc\" looks like gcc 4.x"
346 found_compat_cc="no"
347 if test "$gcc3_search" = "yes" ; then
348 echo "Looking for gcc 3.x"
349 for compat_cc in $gcc3_list ; do
350 if check_cc "$compat_cc" ; then
351 echo "Found \"$compat_cc\""
352 cc="$compat_cc"
353 found_compat_cc="yes"
354 break
355 fi
356 done
357 if test "$found_compat_cc" = "no" ; then
358 echo "gcc 3.x not found!"
359 fi
360 fi
361 if test "$found_compat_cc" = "no" ; then
362 echo "QEMU is known to have problems when compiled with gcc 4.x"
363 echo "It is recommended that you use gcc 3.x to build QEMU"
364 echo "To use this compiler anyway, configure with --disable-gcc-check"
365 exit 1;
366 fi
367 fi
368fi
369
ec530c81
FB
370#
371# Solaris specific configure tool chain decisions
372#
373if test "$solaris" = "yes" ; then
374 #
375 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
376 # override the check with --disable-gcc-check
377 #
378 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
379 solgcc=`which $cc`
380 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
381 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
382 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
383 echo "or get the latest patch from SunSolve for gcc"
384 exit 1
385 fi
386 fi
387 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
388 if test -z "$solinst" ; then
389 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
390 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
391 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
392 exit 1
393 fi
394 if test "$solinst" = "/usr/sbin/install" ; then
395 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
396 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
397 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
398 exit 1
399 fi
ec530c81
FB
400 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
401 if test -z "$sol_ar" ; then
402 echo "Error: No path includes ar"
403 if test -f /usr/ccs/bin/ar ; then
404 echo "Add /usr/ccs/bin to your path and rerun configure"
405 fi
406 exit 1
407 fi
408fi
409
410
5327cf48
FB
411if test -z "$target_list" ; then
412# these targets are portable
0a8e90f4
PB
413 if [ "$softmmu" = "yes" ] ; then
414 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
415 fi
5327cf48 416# the following are Linux specific
831b7825
TS
417 if [ "$linux_user" = "yes" ] ; then
418 target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user ppc-linux-user mips-linux-user mipsel-linux-user m68k-linux-user $target_list"
419 fi
420# the following are Darwin specific
421 if [ "$darwin_user" = "yes" ] ; then
422 target_list="i386-darwin-user ppc-darwin-user $target_list"
5327cf48 423 fi
6e20a45f 424else
b1a550a0 425 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
5327cf48 426fi
0a8e90f4
PB
427if test -z "$target_list" ; then
428 echo "No targets enabled"
429 exit 1
430fi
5327cf48 431
7d13299d
FB
432if test -z "$cross_prefix" ; then
433
434# ---
435# big/little endian test
436cat > $TMPC << EOF
437#include <inttypes.h>
438int main(int argc, char ** argv){
1d14ffa9
FB
439 volatile uint32_t i=0x01234567;
440 return (*((uint8_t*)(&i))) == 0x67;
7d13299d
FB
441}
442EOF
443
444if $cc -o $TMPE $TMPC 2>/dev/null ; then
445$TMPE && bigendian="yes"
446else
447echo big/little test failed
448fi
449
450else
451
452# if cross compiling, cannot launch a program, so make a static guess
808c4954 453if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
7d13299d
FB
454 bigendian="yes"
455fi
456
457fi
458
b6853697
FB
459# host long bits test
460hostlongbits="32"
461if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
462 hostlongbits="64"
463fi
464
e8cd23de 465# check gcc options support
04369ff2
FB
466cat > $TMPC <<EOF
467int main(void) {
04369ff2
FB
468}
469EOF
470
e8cd23de
FB
471have_gcc3_options="no"
472if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
473 have_gcc3_options="yes"
04369ff2 474fi
ca735206 475
11d9f695
FB
476##########################################
477# SDL probe
478
479sdl_too_old=no
480
481if test -z "$sdl" ; then
482
a6e022ad
FB
483sdl_config="sdl-config"
484sdl=no
7c1f25b4 485sdl_static=no
a6e022ad
FB
486
487if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
488# win32 cross compilation case
489 sdl_config="i386-mingw32msvc-sdl-config"
490 sdl=yes
491else
492# normal SDL probe
11d9f695
FB
493cat > $TMPC << EOF
494#include <SDL.h>
495#undef main /* We don't want SDL to override our main() */
496int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
497EOF
498
a6e022ad
FB
499if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
500_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
11d9f695
FB
501if test "$_sdlversion" -lt 121 ; then
502sdl_too_old=yes
503else
fd677642
TS
504 if test "$cocoa" = "no" ; then
505 sdl=yes
506 fi
11d9f695 507fi
7c1f25b4
FB
508
509# static link with sdl ?
510if test "$sdl" = "yes" ; then
511aa="no"
512`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
513sdl_static_libs=`$sdl_config --static-libs`
514if [ "$aa" = "yes" ] ; then
d8d8aa4e 515 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
7c1f25b4
FB
516fi
517
518if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
519 sdl_static=yes
11d9f695
FB
520fi
521
7c1f25b4
FB
522fi # static link
523
524fi # sdl compile test
525
a6e022ad 526fi # cross compilation
fd677642
TS
527
528else
529 # Make sure to disable cocoa if sdl was set
530 if test "$sdl" = "yes" ; then
531 cocoa="no"
532 coreaudio="no"
533 fi
a6e022ad 534fi # -z $sdl
11d9f695 535
8f28f3fb
TS
536##########################################
537# alsa sound support libraries
538
539if test "$alsa" = "yes" ; then
540 cat > $TMPC << EOF
541#include <alsa/asoundlib.h>
542int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
543EOF
544 if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
545 :
546 else
547 echo
548 echo "Error: Could not find alsa"
549 echo "Make sure to have the alsa libs and headers installed."
550 echo
551 exit 1
552 fi
553fi
554
cc8ae6de 555# Check if tools are available to build documentation.
94ac5158 556if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
cc8ae6de
PB
557 build_docs="yes"
558fi
559
11d9f695
FB
560if test "$mingw32" = "yes" ; then
561if test -z "$prefix" ; then
562 prefix="/c/Program Files/Qemu"
563fi
564mandir="$prefix"
7efa4387 565datadir="$prefix"
1f50f8d1 566docdir="$prefix"
11d9f695
FB
567bindir="$prefix"
568else
569if test -z "$prefix" ; then
570 prefix="/usr/local"
571fi
5a67135a 572mandir="$prefix/share/man"
7efa4387 573datadir="$prefix/share/qemu"
1f50f8d1 574docdir="$prefix/share/doc/qemu"
11d9f695
FB
575bindir="$prefix/bin"
576fi
5a67135a 577
43ce4dfe 578echo "Install prefix $prefix"
7efa4387 579echo "BIOS directory $datadir"
11d9f695
FB
580echo "binary directory $bindir"
581if test "$mingw32" = "no" ; then
582echo "Manual directory $mandir"
43ce4dfe 583echo "ELF interp prefix $interp_prefix"
11d9f695 584fi
5a67135a 585echo "Source path $source_path"
43ce4dfe 586echo "C compiler $cc"
83469015 587echo "Host C compiler $host_cc"
43ce4dfe 588echo "make $make"
6a882643 589echo "install $install"
43ce4dfe 590echo "host CPU $cpu"
de83cd02 591echo "host big endian $bigendian"
97a847bc 592echo "target list $target_list"
43ce4dfe 593echo "gprof enabled $gprof"
05c2a3e7 594echo "profiler $profiler"
43ce4dfe 595echo "static build $static"
5b0753e0
FB
596if test "$darwin" = "yes" ; then
597 echo "Cocoa support $cocoa"
598fi
97a847bc 599echo "SDL support $sdl"
e4afee97
FB
600if test "$sdl" != "no" ; then
601 echo "SDL static link $sdl_static"
602fi
67b915a5 603echo "mingw32 support $mingw32"
fb065187 604echo "Adlib support $adlib"
1d14ffa9
FB
605echo "CoreAudio support $coreaudio"
606echo "ALSA support $alsa"
607echo "DSound support $dsound"
1d14ffa9
FB
608if test "$fmod" = "yes"; then
609 if test -z $fmod_lib || test -z $fmod_inc; then
610 echo
611 echo "Error: You must specify path to FMOD library and headers"
612 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
613 echo
614 exit 1
615 fi
b1a550a0
PB
616 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
617else
618 fmod_support=""
102a52e4 619fi
b1a550a0 620echo "FMOD support $fmod $fmod_support"
07f4ddbf 621echo "kqemu support $kqemu"
cc8ae6de 622echo "Documentation $build_docs"
c5937220
PB
623[ ! -z "$uname_release" ] && \
624echo "uname -r $uname_release"
67b915a5 625
97a847bc 626if test $sdl_too_old = "yes"; then
24b55b96 627echo "-> Your SDL version is too old - please upgrade to have SDL support"
7c1f25b4 628fi
24b55b96
FB
629#if test "$sdl_static" = "no"; then
630# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
631#fi
97a847bc
FB
632config_mak="config-host.mak"
633config_h="config-host.h"
7d13299d 634
7c1f25b4 635#echo "Creating $config_mak and $config_h"
7d13299d 636
97a847bc 637echo "# Automatically generated by configure - do not modify" > $config_mak
29517134 638echo "# Configured with: $0 $@" >> $config_mak
97a847bc 639echo "/* Automatically generated by configure - do not modify */" > $config_h
7d13299d 640
97a847bc 641echo "prefix=$prefix" >> $config_mak
11d9f695 642echo "bindir=$bindir" >> $config_mak
5a67135a 643echo "mandir=$mandir" >> $config_mak
7efa4387 644echo "datadir=$datadir" >> $config_mak
1f50f8d1 645echo "docdir=$docdir" >> $config_mak
7efa4387 646echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
97a847bc 647echo "MAKE=$make" >> $config_mak
6a882643 648echo "INSTALL=$install" >> $config_mak
97a847bc 649echo "CC=$cc" >> $config_mak
e8cd23de 650if test "$have_gcc3_options" = "yes" ; then
97a847bc 651 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
e8cd23de 652fi
97a847bc
FB
653echo "HOST_CC=$host_cc" >> $config_mak
654echo "AR=$ar" >> $config_mak
655echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
6f30fa85 656echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
97a847bc
FB
657echo "CFLAGS=$CFLAGS" >> $config_mak
658echo "LDFLAGS=$LDFLAGS" >> $config_mak
67b915a5 659echo "EXESUF=$EXESUF" >> $config_mak
97a847bc
FB
660if test "$cpu" = "i386" ; then
661 echo "ARCH=i386" >> $config_mak
662 echo "#define HOST_I386 1" >> $config_h
0b0babc6
FB
663elif test "$cpu" = "x86_64" ; then
664 echo "ARCH=x86_64" >> $config_mak
665 echo "#define HOST_X86_64 1" >> $config_h
808c4954
FB
666elif test "$cpu" = "armv4b" ; then
667 echo "ARCH=arm" >> $config_mak
668 echo "#define HOST_ARM 1" >> $config_h
7d13299d 669elif test "$cpu" = "armv4l" ; then
97a847bc
FB
670 echo "ARCH=arm" >> $config_mak
671 echo "#define HOST_ARM 1" >> $config_h
7d13299d 672elif test "$cpu" = "powerpc" ; then
97a847bc
FB
673 echo "ARCH=ppc" >> $config_mak
674 echo "#define HOST_PPC 1" >> $config_h
7d13299d 675elif test "$cpu" = "mips" ; then
97a847bc
FB
676 echo "ARCH=mips" >> $config_mak
677 echo "#define HOST_MIPS 1" >> $config_h
fb3e5849 678elif test "$cpu" = "s390" ; then
97a847bc
FB
679 echo "ARCH=s390" >> $config_mak
680 echo "#define HOST_S390 1" >> $config_h
295defa5 681elif test "$cpu" = "alpha" ; then
97a847bc
FB
682 echo "ARCH=alpha" >> $config_mak
683 echo "#define HOST_ALPHA 1" >> $config_h
ae228531 684elif test "$cpu" = "sparc" ; then
97a847bc
FB
685 echo "ARCH=sparc" >> $config_mak
686 echo "#define HOST_SPARC 1" >> $config_h
ae228531 687elif test "$cpu" = "sparc64" ; then
97a847bc
FB
688 echo "ARCH=sparc64" >> $config_mak
689 echo "#define HOST_SPARC64 1" >> $config_h
a8baa8c5 690elif test "$cpu" = "ia64" ; then
97a847bc
FB
691 echo "ARCH=ia64" >> $config_mak
692 echo "#define HOST_IA64 1" >> $config_h
38e584a0 693elif test "$cpu" = "m68k" ; then
38ca2abc
FB
694 echo "ARCH=m68k" >> $config_mak
695 echo "#define HOST_M68K 1" >> $config_h
7d13299d
FB
696else
697 echo "Unsupported CPU"
698 exit 1
699fi
700if test "$bigendian" = "yes" ; then
97a847bc
FB
701 echo "WORDS_BIGENDIAN=yes" >> $config_mak
702 echo "#define WORDS_BIGENDIAN 1" >> $config_h
703fi
b6853697 704echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
67b915a5
FB
705if test "$mingw32" = "yes" ; then
706 echo "CONFIG_WIN32=yes" >> $config_mak
11d9f695 707 echo "#define CONFIG_WIN32 1" >> $config_h
7d3505c5 708elif test -f "/usr/include/byteswap.h" ; then
67b915a5
FB
709 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
710fi
83fb7adf
FB
711if test "$darwin" = "yes" ; then
712 echo "CONFIG_DARWIN=yes" >> $config_mak
713 echo "#define CONFIG_DARWIN 1" >> $config_h
714fi
ec530c81
FB
715if test "$solaris" = "yes" ; then
716 echo "CONFIG_SOLARIS=yes" >> $config_mak
38cfa06c 717 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ec530c81 718fi
67b915a5
FB
719if test "$gdbstub" = "yes" ; then
720 echo "CONFIG_GDBSTUB=yes" >> $config_mak
721 echo "#define CONFIG_GDBSTUB 1" >> $config_h
722fi
97a847bc
FB
723if test "$gprof" = "yes" ; then
724 echo "TARGET_GPROF=yes" >> $config_mak
725 echo "#define HAVE_GPROF 1" >> $config_h
726fi
727if test "$static" = "yes" ; then
728 echo "CONFIG_STATIC=yes" >> $config_mak
50863472 729 echo "#define CONFIG_STATIC 1" >> $config_h
7d13299d 730fi
05c2a3e7
FB
731if test $profiler = "yes" ; then
732 echo "#define CONFIG_PROFILER 1" >> $config_h
733fi
c20709aa
FB
734if test "$slirp" = "yes" ; then
735 echo "CONFIG_SLIRP=yes" >> $config_mak
736 echo "#define CONFIG_SLIRP 1" >> $config_h
737fi
fb065187
FB
738if test "$adlib" = "yes" ; then
739 echo "CONFIG_ADLIB=yes" >> $config_mak
740 echo "#define CONFIG_ADLIB 1" >> $config_h
741fi
742if test "$oss" = "yes" ; then
743 echo "CONFIG_OSS=yes" >> $config_mak
744 echo "#define CONFIG_OSS 1" >> $config_h
745fi
1d14ffa9
FB
746if test "$coreaudio" = "yes" ; then
747 echo "CONFIG_COREAUDIO=yes" >> $config_mak
748 echo "#define CONFIG_COREAUDIO 1" >> $config_h
749fi
750if test "$alsa" = "yes" ; then
751 echo "CONFIG_ALSA=yes" >> $config_mak
752 echo "#define CONFIG_ALSA 1" >> $config_h
753fi
754if test "$dsound" = "yes" ; then
755 echo "CONFIG_DSOUND=yes" >> $config_mak
756 echo "#define CONFIG_DSOUND 1" >> $config_h
757fi
102a52e4
FB
758if test "$fmod" = "yes" ; then
759 echo "CONFIG_FMOD=yes" >> $config_mak
760 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
761 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
762 echo "#define CONFIG_FMOD 1" >> $config_h
763fi
b1a550a0
PB
764qemu_version=`head $source_path/VERSION`
765echo "VERSION=$qemu_version" >>$config_mak
d4b8f039 766echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
97a847bc
FB
767
768echo "SRC_PATH=$source_path" >> $config_mak
ad064840
PB
769if [ "$source_path_used" = "yes" ]; then
770 echo "VPATH=$source_path" >> $config_mak
771fi
97a847bc 772echo "TARGET_DIRS=$target_list" >> $config_mak
cc8ae6de
PB
773if [ "$build_docs" = "yes" ] ; then
774 echo "BUILD_DOCS=yes" >> $config_mak
775fi
97a847bc 776
83fb7adf 777# XXX: suppress that
7d3505c5 778if [ "$bsd" = "yes" ] ; then
43003046 779 echo "#define O_LARGEFILE 0" >> $config_h
43003046 780 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
7d3505c5
FB
781 echo "#define _BSD 1" >> $config_h
782fi
783
c5937220
PB
784echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
785
1d14ffa9 786for target in $target_list; do
97a847bc
FB
787target_dir="$target"
788config_mak=$target_dir/config.mak
789config_h=$target_dir/config.h
790target_cpu=`echo $target | cut -d '-' -f 1`
791target_bigendian="no"
808c4954 792[ "$target_cpu" = "armeb" ] && target_bigendian=yes
1e43adfc 793[ "$target_cpu" = "sparc" ] && target_bigendian=yes
64b3ab24 794[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
67867308 795[ "$target_cpu" = "ppc" ] && target_bigendian=yes
a2458627 796[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
d3258560 797[ "$target_cpu" = "mips" ] && target_bigendian=yes
908f52b0 798[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
e6e5906b 799[ "$target_cpu" = "m68k" ] && target_bigendian=yes
97a847bc
FB
800target_softmmu="no"
801if expr $target : '.*-softmmu' > /dev/null ; then
802 target_softmmu="yes"
803fi
997344f3
FB
804target_user_only="no"
805if expr $target : '.*-user' > /dev/null ; then
806 target_user_only="yes"
807fi
97a847bc 808
831b7825
TS
809target_linux_user="no"
810if expr $target : '.*-linux-user' > /dev/null ; then
811 target_linux_user="yes"
812fi
813
814target_darwin_user="no"
815if expr $target : '.*-darwin-user' > /dev/null ; then
816 target_darwin_user="yes"
817fi
818
97ccc689 819if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1d14ffa9 820 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
97ccc689 821 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
9c038506 822 echo "To build QEMU without graphical output configure with --disable-gfx-check"
97ccc689
FB
823 echo "Note that this will disable all output from the virtual graphics card."
824 exit 1;
825fi
826
7c1f25b4 827#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
97a847bc
FB
828
829mkdir -p $target_dir
158142c2 830mkdir -p $target_dir/fpu
831b7825 831if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
69de927c
FB
832 mkdir -p $target_dir/nwfpe
833fi
a7e61ed4
FB
834if test "$target_user_only" = "no" ; then
835 mkdir -p $target_dir/slirp
836fi
69de927c 837
ec530c81
FB
838#
839# don't use ln -sf as not all "ln -sf" over write the file/link
840#
841rm -f $target_dir/Makefile
842ln -s $source_path/Makefile.target $target_dir/Makefile
843
97a847bc
FB
844
845echo "# Automatically generated by configure - do not modify" > $config_mak
846echo "/* Automatically generated by configure - do not modify */" > $config_h
847
de83cd02 848
97a847bc
FB
849echo "include ../config-host.mak" >> $config_mak
850echo "#include \"../config-host.h\"" >> $config_h
1e43adfc 851
e5fe0c52 852bflt="no"
1e43adfc
FB
853interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
854echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
97a847bc
FB
855
856if test "$target_cpu" = "i386" ; then
857 echo "TARGET_ARCH=i386" >> $config_mak
858 echo "#define TARGET_ARCH \"i386\"" >> $config_h
859 echo "#define TARGET_I386 1" >> $config_h
07f4ddbf 860 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
824d560f
FB
861 echo "#define USE_KQEMU 1" >> $config_h
862 fi
808c4954 863elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
97a847bc
FB
864 echo "TARGET_ARCH=arm" >> $config_mak
865 echo "#define TARGET_ARCH \"arm\"" >> $config_h
866 echo "#define TARGET_ARM 1" >> $config_h
e5fe0c52 867 bflt="yes"
1e43adfc
FB
868elif test "$target_cpu" = "sparc" ; then
869 echo "TARGET_ARCH=sparc" >> $config_mak
870 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
871 echo "#define TARGET_SPARC 1" >> $config_h
64b3ab24
FB
872elif test "$target_cpu" = "sparc64" ; then
873 echo "TARGET_ARCH=sparc64" >> $config_mak
874 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
875 echo "#define TARGET_SPARC 1" >> $config_h
876 echo "#define TARGET_SPARC64 1" >> $config_h
67867308
FB
877elif test "$target_cpu" = "ppc" ; then
878 echo "TARGET_ARCH=ppc" >> $config_mak
879 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
880 echo "#define TARGET_PPC 1" >> $config_h
a2458627
FB
881elif test "$target_cpu" = "ppc64" ; then
882 echo "TARGET_ARCH=ppc64" >> $config_mak
883 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
884 echo "#define TARGET_PPC 1" >> $config_h
885 echo "#define TARGET_PPC64 1" >> $config_h
0b0babc6
FB
886elif test "$target_cpu" = "x86_64" ; then
887 echo "TARGET_ARCH=x86_64" >> $config_mak
888 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
889 echo "#define TARGET_I386 1" >> $config_h
890 echo "#define TARGET_X86_64 1" >> $config_h
07f4ddbf
FB
891 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
892 echo "#define USE_KQEMU 1" >> $config_h
893 fi
c20eb473 894elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
d3258560
FB
895 echo "TARGET_ARCH=mips" >> $config_mak
896 echo "#define TARGET_ARCH \"mips\"" >> $config_h
897 echo "#define TARGET_MIPS 1" >> $config_h
6ea83fed
FB
898 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
899 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
908f52b0 900elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
fdf9b3e8
FB
901 echo "TARGET_ARCH=sh4" >> $config_mak
902 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
903 echo "#define TARGET_SH4 1" >> $config_h
4dbed897 904 bflt="yes"
e6e5906b
PB
905elif test "$target_cpu" = "m68k" ; then
906 echo "TARGET_ARCH=m68k" >> $config_mak
907 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
908 echo "#define TARGET_M68K 1" >> $config_h
909 bflt="yes"
de83cd02
FB
910else
911 echo "Unsupported target CPU"
912 exit 1
913fi
914if test "$target_bigendian" = "yes" ; then
97a847bc
FB
915 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
916 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
de83cd02 917fi
97a847bc
FB
918if test "$target_softmmu" = "yes" ; then
919 echo "CONFIG_SOFTMMU=yes" >> $config_mak
920 echo "#define CONFIG_SOFTMMU 1" >> $config_h
43ce4dfe 921fi
997344f3
FB
922if test "$target_user_only" = "yes" ; then
923 echo "CONFIG_USER_ONLY=yes" >> $config_mak
924 echo "#define CONFIG_USER_ONLY 1" >> $config_h
925fi
831b7825
TS
926if test "$target_linux_user" = "yes" ; then
927 echo "CONFIG_LINUX_USER=yes" >> $config_mak
928 echo "#define CONFIG_LINUX_USER 1" >> $config_h
929fi
930if test "$target_darwin_user" = "yes" ; then
931 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
932 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
933fi
97a847bc 934
e6e5906b 935if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
158142c2
FB
936 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
937 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
938fi
e5fe0c52
PB
939if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
940 echo "TARGET_HAS_BFLT=yes" >> $config_mak
941 echo "#define TARGET_HAS_BFLT 1" >> $config_h
942fi
7c1f25b4
FB
943# sdl defines
944
945if test "$target_user_only" = "no"; then
946 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
dbb2c921 947 sdl1=$sdl_static
7c1f25b4 948 else
dbb2c921
FB
949 sdl1=$sdl
950 fi
951 if test "$sdl1" = "yes" ; then
952 echo "#define CONFIG_SDL 1" >> $config_h
953 echo "CONFIG_SDL=yes" >> $config_mak
954 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
955 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
956 else
7c1f25b4
FB
957 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
958 fi
dbb2c921 959 if [ "${aa}" = "yes" ] ; then
b1a550a0
PB
960 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
961 else
962 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
dbb2c921 963 fi
7c1f25b4 964 fi
7c1f25b4
FB
965fi
966
5b0753e0
FB
967if test "$cocoa" = "yes" ; then
968 echo "#define CONFIG_COCOA 1" >> $config_h
969 echo "CONFIG_COCOA=yes" >> $config_mak
970fi
971
97a847bc 972done # for target in $targets
7d13299d
FB
973
974# build tree in object directory if source path is different from current one
975if test "$source_path_used" = "yes" ; then
976 DIRS="tests"
977 FILES="Makefile tests/Makefile"
978 for dir in $DIRS ; do
979 mkdir -p $dir
980 done
ec530c81 981 # remove the link and recreate it, as not all "ln -sf" overwrite the link
7d13299d 982 for f in $FILES ; do
ec530c81
FB
983 rm -f $f
984 ln -s $source_path/$f $f
7d13299d
FB
985 done
986fi
7d13299d 987
97a847bc 988rm -f $TMPO $TMPC $TMPE $TMPS