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