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