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