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