]> git.proxmox.com Git - qemu.git/blame - configure
More serial ports for the mips machine.
[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"
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"
328a4240 183 gcc3_search="no"
7d13299d 184 ;;
b1a550a0 185 --host-cc=*) host_cc="$optarg"
83469015 186 ;;
b1a550a0 187 --make=*) make="$optarg"
7d13299d 188 ;;
6a882643
PB
189 --install=*) install="$optarg"
190 ;;
b1a550a0 191 --extra-cflags=*) CFLAGS="$optarg"
7d13299d 192 ;;
b1a550a0 193 --extra-ldflags=*) LDFLAGS="$optarg"
7d13299d 194 ;;
b1a550a0 195 --cpu=*) cpu="$optarg"
7d13299d 196 ;;
b1a550a0 197 --target-list=*) target_list="$optarg"
de83cd02 198 ;;
7d13299d
FB
199 --enable-gprof) gprof="yes"
200 ;;
43ce4dfe
FB
201 --static) static="yes"
202 ;;
97a847bc
FB
203 --disable-sdl) sdl="no"
204 ;;
1d14ffa9
FB
205 --enable-coreaudio) coreaudio="yes"
206 ;;
207 --enable-alsa) alsa="yes"
208 ;;
209 --enable-dsound) dsound="yes"
210 ;;
102a52e4
FB
211 --enable-fmod) fmod="yes"
212 ;;
b1a550a0 213 --fmod-lib=*) fmod_lib="$optarg"
102a52e4 214 ;;
b1a550a0 215 --fmod-inc=*) fmod_inc="$optarg"
102a52e4 216 ;;
87ac5427 217 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no"
1d14ffa9 218 ;;
443f1376 219 --disable-slirp) slirp="no"
1d14ffa9 220 ;;
fb065187 221 --enable-adlib) adlib="yes"
1d14ffa9 222 ;;
c9ec1fe4 223 --disable-kqemu) kqemu="no"
1d14ffa9 224 ;;
05c2a3e7
FB
225 --enable-profiler) profiler="yes"
226 ;;
1d14ffa9
FB
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"
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
PB
290echo ""
291echo "NOTE: The object files are build at the place where configure is launched"
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
cc8ae6de 512# Check if tools are available to build documentation.
94ac5158 513if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
cc8ae6de
PB
514 build_docs="yes"
515fi
516
11d9f695
FB
517if test "$mingw32" = "yes" ; then
518if test -z "$prefix" ; then
519 prefix="/c/Program Files/Qemu"
520fi
521mandir="$prefix"
7efa4387 522datadir="$prefix"
1f50f8d1 523docdir="$prefix"
11d9f695
FB
524bindir="$prefix"
525else
526if test -z "$prefix" ; then
527 prefix="/usr/local"
528fi
5a67135a 529mandir="$prefix/share/man"
7efa4387 530datadir="$prefix/share/qemu"
1f50f8d1 531docdir="$prefix/share/doc/qemu"
11d9f695
FB
532bindir="$prefix/bin"
533fi
5a67135a 534
43ce4dfe 535echo "Install prefix $prefix"
7efa4387 536echo "BIOS directory $datadir"
11d9f695
FB
537echo "binary directory $bindir"
538if test "$mingw32" = "no" ; then
539echo "Manual directory $mandir"
43ce4dfe 540echo "ELF interp prefix $interp_prefix"
11d9f695 541fi
5a67135a 542echo "Source path $source_path"
43ce4dfe 543echo "C compiler $cc"
83469015 544echo "Host C compiler $host_cc"
43ce4dfe 545echo "make $make"
6a882643 546echo "install $install"
43ce4dfe 547echo "host CPU $cpu"
de83cd02 548echo "host big endian $bigendian"
97a847bc 549echo "target list $target_list"
43ce4dfe 550echo "gprof enabled $gprof"
05c2a3e7 551echo "profiler $profiler"
43ce4dfe 552echo "static build $static"
5b0753e0
FB
553if test "$darwin" = "yes" ; then
554 echo "Cocoa support $cocoa"
555fi
97a847bc 556echo "SDL support $sdl"
e4afee97
FB
557if test "$sdl" != "no" ; then
558 echo "SDL static link $sdl_static"
559fi
67b915a5 560echo "mingw32 support $mingw32"
fb065187 561echo "Adlib support $adlib"
1d14ffa9
FB
562echo "CoreAudio support $coreaudio"
563echo "ALSA support $alsa"
564echo "DSound support $dsound"
1d14ffa9
FB
565if test "$fmod" = "yes"; then
566 if test -z $fmod_lib || test -z $fmod_inc; then
567 echo
568 echo "Error: You must specify path to FMOD library and headers"
569 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
570 echo
571 exit 1
572 fi
b1a550a0
PB
573 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
574else
575 fmod_support=""
102a52e4 576fi
b1a550a0 577echo "FMOD support $fmod $fmod_support"
07f4ddbf 578echo "kqemu support $kqemu"
cc8ae6de 579echo "Documentation $build_docs"
c5937220
PB
580[ ! -z "$uname_release" ] && \
581echo "uname -r $uname_release"
67b915a5 582
97a847bc 583if test $sdl_too_old = "yes"; then
24b55b96 584echo "-> Your SDL version is too old - please upgrade to have SDL support"
7c1f25b4 585fi
24b55b96
FB
586#if test "$sdl_static" = "no"; then
587# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
588#fi
97a847bc
FB
589config_mak="config-host.mak"
590config_h="config-host.h"
7d13299d 591
7c1f25b4 592#echo "Creating $config_mak and $config_h"
7d13299d 593
97a847bc 594echo "# Automatically generated by configure - do not modify" > $config_mak
29517134 595echo "# Configured with: $0 $@" >> $config_mak
97a847bc 596echo "/* Automatically generated by configure - do not modify */" > $config_h
7d13299d 597
97a847bc 598echo "prefix=$prefix" >> $config_mak
11d9f695 599echo "bindir=$bindir" >> $config_mak
5a67135a 600echo "mandir=$mandir" >> $config_mak
7efa4387 601echo "datadir=$datadir" >> $config_mak
1f50f8d1 602echo "docdir=$docdir" >> $config_mak
7efa4387 603echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
97a847bc 604echo "MAKE=$make" >> $config_mak
6a882643 605echo "INSTALL=$install" >> $config_mak
97a847bc 606echo "CC=$cc" >> $config_mak
e8cd23de 607if test "$have_gcc3_options" = "yes" ; then
97a847bc 608 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
e8cd23de 609fi
97a847bc
FB
610echo "HOST_CC=$host_cc" >> $config_mak
611echo "AR=$ar" >> $config_mak
612echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
613echo "CFLAGS=$CFLAGS" >> $config_mak
614echo "LDFLAGS=$LDFLAGS" >> $config_mak
67b915a5 615echo "EXESUF=$EXESUF" >> $config_mak
97a847bc
FB
616if test "$cpu" = "i386" ; then
617 echo "ARCH=i386" >> $config_mak
618 echo "#define HOST_I386 1" >> $config_h
0b0babc6
FB
619elif test "$cpu" = "x86_64" ; then
620 echo "ARCH=x86_64" >> $config_mak
621 echo "#define HOST_X86_64 1" >> $config_h
808c4954
FB
622elif test "$cpu" = "armv4b" ; then
623 echo "ARCH=arm" >> $config_mak
624 echo "#define HOST_ARM 1" >> $config_h
7d13299d 625elif test "$cpu" = "armv4l" ; then
97a847bc
FB
626 echo "ARCH=arm" >> $config_mak
627 echo "#define HOST_ARM 1" >> $config_h
7d13299d 628elif test "$cpu" = "powerpc" ; then
97a847bc
FB
629 echo "ARCH=ppc" >> $config_mak
630 echo "#define HOST_PPC 1" >> $config_h
7d13299d 631elif test "$cpu" = "mips" ; then
97a847bc
FB
632 echo "ARCH=mips" >> $config_mak
633 echo "#define HOST_MIPS 1" >> $config_h
fb3e5849 634elif test "$cpu" = "s390" ; then
97a847bc
FB
635 echo "ARCH=s390" >> $config_mak
636 echo "#define HOST_S390 1" >> $config_h
295defa5 637elif test "$cpu" = "alpha" ; then
97a847bc
FB
638 echo "ARCH=alpha" >> $config_mak
639 echo "#define HOST_ALPHA 1" >> $config_h
ae228531 640elif test "$cpu" = "sparc" ; then
97a847bc
FB
641 echo "ARCH=sparc" >> $config_mak
642 echo "#define HOST_SPARC 1" >> $config_h
ae228531 643elif test "$cpu" = "sparc64" ; then
97a847bc
FB
644 echo "ARCH=sparc64" >> $config_mak
645 echo "#define HOST_SPARC64 1" >> $config_h
a8baa8c5 646elif test "$cpu" = "ia64" ; then
97a847bc
FB
647 echo "ARCH=ia64" >> $config_mak
648 echo "#define HOST_IA64 1" >> $config_h
38e584a0 649elif test "$cpu" = "m68k" ; then
38ca2abc
FB
650 echo "ARCH=m68k" >> $config_mak
651 echo "#define HOST_M68K 1" >> $config_h
7d13299d
FB
652else
653 echo "Unsupported CPU"
654 exit 1
655fi
656if test "$bigendian" = "yes" ; then
97a847bc
FB
657 echo "WORDS_BIGENDIAN=yes" >> $config_mak
658 echo "#define WORDS_BIGENDIAN 1" >> $config_h
659fi
b6853697 660echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
67b915a5
FB
661if test "$mingw32" = "yes" ; then
662 echo "CONFIG_WIN32=yes" >> $config_mak
11d9f695 663 echo "#define CONFIG_WIN32 1" >> $config_h
7d3505c5 664elif test -f "/usr/include/byteswap.h" ; then
67b915a5
FB
665 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
666fi
83fb7adf
FB
667if test "$darwin" = "yes" ; then
668 echo "CONFIG_DARWIN=yes" >> $config_mak
669 echo "#define CONFIG_DARWIN 1" >> $config_h
670fi
ec530c81
FB
671if test "$solaris" = "yes" ; then
672 echo "CONFIG_SOLARIS=yes" >> $config_mak
38cfa06c 673 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ec530c81 674fi
67b915a5
FB
675if test "$gdbstub" = "yes" ; then
676 echo "CONFIG_GDBSTUB=yes" >> $config_mak
677 echo "#define CONFIG_GDBSTUB 1" >> $config_h
678fi
97a847bc
FB
679if test "$gprof" = "yes" ; then
680 echo "TARGET_GPROF=yes" >> $config_mak
681 echo "#define HAVE_GPROF 1" >> $config_h
682fi
683if test "$static" = "yes" ; then
684 echo "CONFIG_STATIC=yes" >> $config_mak
50863472 685 echo "#define CONFIG_STATIC 1" >> $config_h
7d13299d 686fi
05c2a3e7
FB
687if test $profiler = "yes" ; then
688 echo "#define CONFIG_PROFILER 1" >> $config_h
689fi
c20709aa
FB
690if test "$slirp" = "yes" ; then
691 echo "CONFIG_SLIRP=yes" >> $config_mak
692 echo "#define CONFIG_SLIRP 1" >> $config_h
693fi
fb065187
FB
694if test "$adlib" = "yes" ; then
695 echo "CONFIG_ADLIB=yes" >> $config_mak
696 echo "#define CONFIG_ADLIB 1" >> $config_h
697fi
698if test "$oss" = "yes" ; then
699 echo "CONFIG_OSS=yes" >> $config_mak
700 echo "#define CONFIG_OSS 1" >> $config_h
701fi
1d14ffa9
FB
702if test "$coreaudio" = "yes" ; then
703 echo "CONFIG_COREAUDIO=yes" >> $config_mak
704 echo "#define CONFIG_COREAUDIO 1" >> $config_h
705fi
706if test "$alsa" = "yes" ; then
707 echo "CONFIG_ALSA=yes" >> $config_mak
708 echo "#define CONFIG_ALSA 1" >> $config_h
709fi
710if test "$dsound" = "yes" ; then
711 echo "CONFIG_DSOUND=yes" >> $config_mak
712 echo "#define CONFIG_DSOUND 1" >> $config_h
713fi
102a52e4
FB
714if test "$fmod" = "yes" ; then
715 echo "CONFIG_FMOD=yes" >> $config_mak
716 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
717 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
718 echo "#define CONFIG_FMOD 1" >> $config_h
719fi
b1a550a0
PB
720qemu_version=`head $source_path/VERSION`
721echo "VERSION=$qemu_version" >>$config_mak
d4b8f039 722echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
97a847bc
FB
723
724echo "SRC_PATH=$source_path" >> $config_mak
ad064840
PB
725if [ "$source_path_used" = "yes" ]; then
726 echo "VPATH=$source_path" >> $config_mak
727fi
97a847bc 728echo "TARGET_DIRS=$target_list" >> $config_mak
cc8ae6de
PB
729if [ "$build_docs" = "yes" ] ; then
730 echo "BUILD_DOCS=yes" >> $config_mak
731fi
97a847bc 732
83fb7adf 733# XXX: suppress that
7d3505c5 734if [ "$bsd" = "yes" ] ; then
43003046 735 echo "#define O_LARGEFILE 0" >> $config_h
43003046 736 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
7d3505c5
FB
737 echo "#define _BSD 1" >> $config_h
738fi
739
c5937220
PB
740echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
741
1d14ffa9 742for target in $target_list; do
97a847bc
FB
743target_dir="$target"
744config_mak=$target_dir/config.mak
745config_h=$target_dir/config.h
746target_cpu=`echo $target | cut -d '-' -f 1`
747target_bigendian="no"
808c4954 748[ "$target_cpu" = "armeb" ] && target_bigendian=yes
1e43adfc 749[ "$target_cpu" = "sparc" ] && target_bigendian=yes
64b3ab24 750[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
67867308 751[ "$target_cpu" = "ppc" ] && target_bigendian=yes
a2458627 752[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
d3258560 753[ "$target_cpu" = "mips" ] && target_bigendian=yes
908f52b0 754[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
e6e5906b 755[ "$target_cpu" = "m68k" ] && target_bigendian=yes
97a847bc
FB
756target_softmmu="no"
757if expr $target : '.*-softmmu' > /dev/null ; then
758 target_softmmu="yes"
759fi
997344f3
FB
760target_user_only="no"
761if expr $target : '.*-user' > /dev/null ; then
762 target_user_only="yes"
763fi
97a847bc 764
97ccc689 765if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1d14ffa9 766 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
97ccc689 767 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
9c038506 768 echo "To build QEMU without graphical output configure with --disable-gfx-check"
97ccc689
FB
769 echo "Note that this will disable all output from the virtual graphics card."
770 exit 1;
771fi
772
7c1f25b4 773#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
97a847bc
FB
774
775mkdir -p $target_dir
158142c2 776mkdir -p $target_dir/fpu
808c4954 777if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
69de927c
FB
778 mkdir -p $target_dir/nwfpe
779fi
a7e61ed4
FB
780if test "$target_user_only" = "no" ; then
781 mkdir -p $target_dir/slirp
782fi
69de927c 783
ec530c81
FB
784#
785# don't use ln -sf as not all "ln -sf" over write the file/link
786#
787rm -f $target_dir/Makefile
788ln -s $source_path/Makefile.target $target_dir/Makefile
789
97a847bc
FB
790
791echo "# Automatically generated by configure - do not modify" > $config_mak
792echo "/* Automatically generated by configure - do not modify */" > $config_h
793
de83cd02 794
97a847bc
FB
795echo "include ../config-host.mak" >> $config_mak
796echo "#include \"../config-host.h\"" >> $config_h
1e43adfc 797
e5fe0c52 798bflt="no"
1e43adfc
FB
799interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
800echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
97a847bc
FB
801
802if test "$target_cpu" = "i386" ; then
803 echo "TARGET_ARCH=i386" >> $config_mak
804 echo "#define TARGET_ARCH \"i386\"" >> $config_h
805 echo "#define TARGET_I386 1" >> $config_h
07f4ddbf 806 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
824d560f
FB
807 echo "#define USE_KQEMU 1" >> $config_h
808 fi
808c4954 809elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
97a847bc
FB
810 echo "TARGET_ARCH=arm" >> $config_mak
811 echo "#define TARGET_ARCH \"arm\"" >> $config_h
812 echo "#define TARGET_ARM 1" >> $config_h
e5fe0c52 813 bflt="yes"
1e43adfc
FB
814elif test "$target_cpu" = "sparc" ; then
815 echo "TARGET_ARCH=sparc" >> $config_mak
816 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
817 echo "#define TARGET_SPARC 1" >> $config_h
64b3ab24
FB
818elif test "$target_cpu" = "sparc64" ; then
819 echo "TARGET_ARCH=sparc64" >> $config_mak
820 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
821 echo "#define TARGET_SPARC 1" >> $config_h
822 echo "#define TARGET_SPARC64 1" >> $config_h
67867308
FB
823elif test "$target_cpu" = "ppc" ; then
824 echo "TARGET_ARCH=ppc" >> $config_mak
825 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
826 echo "#define TARGET_PPC 1" >> $config_h
a2458627
FB
827elif test "$target_cpu" = "ppc64" ; then
828 echo "TARGET_ARCH=ppc64" >> $config_mak
829 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
830 echo "#define TARGET_PPC 1" >> $config_h
831 echo "#define TARGET_PPC64 1" >> $config_h
0b0babc6
FB
832elif test "$target_cpu" = "x86_64" ; then
833 echo "TARGET_ARCH=x86_64" >> $config_mak
834 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
835 echo "#define TARGET_I386 1" >> $config_h
836 echo "#define TARGET_X86_64 1" >> $config_h
07f4ddbf
FB
837 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
838 echo "#define USE_KQEMU 1" >> $config_h
839 fi
c20eb473 840elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
d3258560
FB
841 echo "TARGET_ARCH=mips" >> $config_mak
842 echo "#define TARGET_ARCH \"mips\"" >> $config_h
843 echo "#define TARGET_MIPS 1" >> $config_h
6ea83fed
FB
844 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
845 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
908f52b0 846elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
fdf9b3e8
FB
847 echo "TARGET_ARCH=sh4" >> $config_mak
848 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
849 echo "#define TARGET_SH4 1" >> $config_h
4dbed897 850 bflt="yes"
e6e5906b
PB
851elif test "$target_cpu" = "m68k" ; then
852 echo "TARGET_ARCH=m68k" >> $config_mak
853 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
854 echo "#define TARGET_M68K 1" >> $config_h
855 bflt="yes"
de83cd02
FB
856else
857 echo "Unsupported target CPU"
858 exit 1
859fi
860if test "$target_bigendian" = "yes" ; then
97a847bc
FB
861 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
862 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
de83cd02 863fi
97a847bc
FB
864if test "$target_softmmu" = "yes" ; then
865 echo "CONFIG_SOFTMMU=yes" >> $config_mak
866 echo "#define CONFIG_SOFTMMU 1" >> $config_h
43ce4dfe 867fi
997344f3
FB
868if test "$target_user_only" = "yes" ; then
869 echo "CONFIG_USER_ONLY=yes" >> $config_mak
870 echo "#define CONFIG_USER_ONLY 1" >> $config_h
871fi
97a847bc 872
e6e5906b 873if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
158142c2
FB
874 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
875 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
876fi
e5fe0c52
PB
877if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
878 echo "TARGET_HAS_BFLT=yes" >> $config_mak
879 echo "#define TARGET_HAS_BFLT 1" >> $config_h
880fi
7c1f25b4
FB
881# sdl defines
882
883if test "$target_user_only" = "no"; then
884 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
dbb2c921 885 sdl1=$sdl_static
7c1f25b4 886 else
dbb2c921
FB
887 sdl1=$sdl
888 fi
889 if test "$sdl1" = "yes" ; then
890 echo "#define CONFIG_SDL 1" >> $config_h
891 echo "CONFIG_SDL=yes" >> $config_mak
892 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
893 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
894 else
7c1f25b4
FB
895 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
896 fi
dbb2c921 897 if [ "${aa}" = "yes" ] ; then
b1a550a0
PB
898 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
899 else
900 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
dbb2c921 901 fi
7c1f25b4 902 fi
7c1f25b4
FB
903fi
904
5b0753e0
FB
905if test "$cocoa" = "yes" ; then
906 echo "#define CONFIG_COCOA 1" >> $config_h
907 echo "CONFIG_COCOA=yes" >> $config_mak
908fi
909
97a847bc 910done # for target in $targets
7d13299d
FB
911
912# build tree in object directory if source path is different from current one
913if test "$source_path_used" = "yes" ; then
914 DIRS="tests"
915 FILES="Makefile tests/Makefile"
916 for dir in $DIRS ; do
917 mkdir -p $dir
918 done
ec530c81 919 # remove the link and recreate it, as not all "ln -sf" overwrite the link
7d13299d 920 for f in $FILES ; do
ec530c81
FB
921 rm -f $f
922 ln -s $source_path/$f $f
7d13299d
FB
923 done
924fi
7d13299d 925
97a847bc 926rm -f $TMPO $TMPC $TMPE $TMPS