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