3 # qemu configure script (c) 2003 Fabrice Bellard
5 # set temporary file name
6 if test ! -z "$TMPDIR" ; then
8 elif test ! -z "$TEMPDIR" ; then
14 TMPC
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 TMPO
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16 TMPE
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17 TMPS
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
21 interp_prefix
="/usr/gnemul/qemu-%M"
26 gcc3_list
="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
37 i386|i486|i586|i686|i86pc|BePC
)
70 "Power Macintosh"|ppc|ppc64
)
114 device_tree_support
=""
121 OS_CFLAGS
="-mno-cygwin"
122 if [ "$cpu" = "i386" ] ; then
125 audio_possible_drivers
="sdl"
129 if [ "$cpu" = "i386" ] ; then
132 audio_possible_drivers
="dsound sdl fmod"
136 audio_possible_drivers
="oss sdl esd"
137 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
144 audio_possible_drivers
="oss sdl esd"
145 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
153 audio_possible_drivers
="oss sdl esd"
158 audio_possible_drivers
="oss sdl esd"
165 audio_drv_list
="coreaudio"
166 audio_possible_drivers
="coreaudio sdl fmod"
167 OS_CFLAGS
="-mdynamic-no-pic"
168 OS_LDFLAGS
="-framework CoreFoundation -framework IOKit"
174 needs_libsunmath
="no"
175 solarisrev
=`uname -r | cut -f2 -d.`
176 # have to select again, because `uname -m` returns i86pc
177 # even on an x86_64 box.
178 solariscpu
=`isainfo -k`
179 if test "${solariscpu}" = "amd64" ; then
182 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
183 if test "$solarisrev" -le 9 ; then
184 if test -f /opt
/SUNWspro
/prod
/lib
/libsunmath.so
.1; then
185 needs_libsunmath
="yes"
187 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
188 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
189 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
190 echo "Studio 11 can be downloaded from www.sun.com."
194 if test "$solarisrev" -ge 9 ; then
198 if test -f /usr
/include
/sys
/soundcard.h
; then
201 audio_possible_drivers
="oss sdl"
205 audio_possible_drivers
="oss alsa sdl esd pa"
208 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
210 audio_possible_drivers
="$audio_possible_drivers fmod"
213 if [ "$cpu" = "ia64" ] ; then
219 if [ "$cpu" = "powerpc" ]; then
225 if [ "$bsd" = "yes" ] ; then
226 if [ "$darwin" != "yes" ] ; then
232 source_path
=`dirname "$0"`
233 source_path_used
="no"
235 if [ -z "$source_path" ]; then
238 source_path
=`cd "$source_path"; pwd`
240 [ -f "$workdir/vl.c" ] || source_path_used
="yes"
243 # generate compile errors on warnings for development builds
244 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
249 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
251 --help|
-h) show_help
=yes
253 --prefix=*) prefix
="$optarg"
255 --interp-prefix=*) interp_prefix
="$optarg"
257 --source-path=*) source_path
="$optarg"
258 source_path_used
="yes"
260 --cross-prefix=*) cross_prefix
="$optarg"
265 --host-cc=*) host_cc
="$optarg"
267 --make=*) make="$optarg"
269 --install=*) install="$optarg"
271 --extra-cflags=*) CFLAGS
="$optarg"
273 --extra-ldflags=*) LDFLAGS
="$optarg"
275 --cpu=*) cpu
="$optarg"
277 --target-list=*) target_list
="$optarg"
279 --enable-gprof) gprof
="yes"
281 --static) static
="yes"
283 --disable-sdl) sdl
="no"
285 --fmod-lib=*) fmod_lib
="$optarg"
287 --fmod-inc=*) fmod_inc
="$optarg"
289 --audio-card-list=*) audio_card_list
="$optarg"
291 --audio-drv-list=*) audio_drv_list
="$optarg"
293 --disable-vnc-tls) vnc_tls
="no"
295 --enable-mingw32) mingw32
="yes" ; cross_prefix
="i386-mingw32-" ; linux_user
="no"
297 --disable-slirp) slirp
="no"
299 --disable-kqemu) kqemu
="no"
301 --disable-kvm) kvm
="no"
303 --disable-brlapi) brlapi
="no"
305 --enable-profiler) profiler
="yes"
307 --kernel-path=*) kernel_path
="$optarg"
312 audio_drv_list
="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
314 --disable-gfx-check) check_gfx
="no"
316 --disable-gcc-check) check_gcc
="no"
318 --disable-system) softmmu
="no"
320 --enable-system) softmmu
="yes"
322 --disable-linux-user) linux_user
="no"
324 --enable-linux-user) linux_user
="yes"
326 --disable-darwin-user) darwin_user
="no"
328 --enable-darwin-user) darwin_user
="yes"
330 --enable-uname-release=*) uname_release
="$optarg"
335 v7|v8
) SP_CFLAGS
="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
336 target_cpu
="sparc"; cpu
="sparc" ;;
337 v8plus|v8plusa
) SP_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
338 target_cpu
="sparc"; cpu
="sparc" ;;
339 v9
) SP_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m64"
340 target_cpu
="sparc64"; cpu
="sparc64" ;;
341 *) echo "undefined SPARC architecture. Exiting";exit 1;;
344 --enable-werror) werror
="yes"
346 --disable-werror) werror
="no"
348 --disable-curses) curses
="no"
350 --disable-nptl) nptl
="no"
352 --enable-mixemu) mixemu
="yes"
354 --disable-cpu-emulation) cpu_emulation
="no"
356 --disable-libfdt) device_tree_support
="no"
358 *) echo "ERROR: unknown option $opt"; exit 1
363 if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
366 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
367 AIOLIBS
="-lrt -lpthread"
370 # default flags for all hosts
371 CFLAGS
="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
372 LDFLAGS
="$LDFLAGS -g"
373 if test "$werror" = "yes" ; then
374 CFLAGS
="$CFLAGS -Werror"
378 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
379 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
382 sparc
) if test -z "$sparc_cpu" ; then
383 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
386 ARCH_CFLAGS
="${SP_CFLAGS}"
387 ARCH_LDFLAGS
="${SP_LDFLAGS}"
390 sparc64
) if test -z "$sparc_cpu" ; then
391 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_v9__"
394 ARCH_CFLAGS
="${SP_CFLAGS}"
395 ARCH_LDFLAGS
="${SP_LDFLAGS}"
399 ARCH_CFLAGS
="-march=z900"
411 if test x
"$show_help" = x
"yes" ; then
414 Usage: configure [options]
415 Options: [defaults in brackets after descriptions]
418 echo "Standard options:"
419 echo " --help print this message"
420 echo " --prefix=PREFIX install in PREFIX [$prefix]"
421 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
422 echo " use %M for cpu name [$interp_prefix]"
423 echo " --target-list=LIST set target list [$target_list]"
425 echo "kqemu kernel acceleration support:"
426 echo " --disable-kqemu disable kqemu support"
427 echo " --kernel-path=PATH set the kernel path (configure probes it)"
428 echo " --disable-kvm disable kernel virtual machine support"
430 echo "Advanced options (experts only):"
431 echo " --source-path=PATH path of source code [$source_path]"
432 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
433 echo " --cc=CC use C compiler CC [$cc]"
434 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
435 echo " --make=MAKE use specified make [$make]"
436 echo " --install=INSTALL use specified install [$install]"
437 echo " --static enable static build [$static]"
438 echo " --disable-werror disable compilation abort on warning"
439 echo " --disable-sdl disable SDL"
440 echo " --enable-cocoa enable COCOA (Mac OS X only)"
441 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
442 echo " --audio-drv-list=LIST set audio drivers list:"
443 echo " Available drivers: $audio_possible_drivers"
444 echo " --audio-card-list=LIST set list of additional emulated audio cards"
445 echo " Available cards: ac97 adlib cs4231a gus"
446 echo " --enable-mixemu enable mixer emulation"
447 echo " --disable-brlapi disable BrlAPI"
448 echo " --disable-vnc-tls disable TLS encryption for VNC server"
449 echo " --disable-curses disable curses output"
450 echo " --disable-nptl disable usermode NPTL support"
451 echo " --enable-system enable all system emulation targets"
452 echo " --disable-system disable all system emulation targets"
453 echo " --enable-linux-user enable all linux usermode emulation targets"
454 echo " --disable-linux-user disable all linux usermode emulation targets"
455 echo " --enable-darwin-user enable all darwin usermode emulation targets"
456 echo " --disable-darwin-user disable all darwin usermode emulation targets"
457 echo " --fmod-lib path to FMOD library"
458 echo " --fmod-inc path to FMOD includes"
459 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
460 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
461 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
462 echo " --disable-libfdt disables use of libfdt support for device tree"
464 echo "NOTE: The object files are built at the place where configure is launched"
468 cc
="${cross_prefix}${cc}"
469 ar="${cross_prefix}${ar}"
470 strip
="${cross_prefix}${strip}"
472 # check that the C compiler works.
477 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev
/null
; then
478 : C compiler works ok
480 echo "ERROR: \"$cc\" either does not exist or does not work"
484 if test "$mingw32" = "yes" ; then
490 # Check for gcc4, error if pre-gcc4
491 if test "$check_gcc" = "yes" ; then
496 int main(){return 0;}
498 if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
499 echo "WARNING: \"$cc\" looks like gcc 4.x"
501 if test "$gcc3_search" = "yes" ; then
502 echo "Looking for gcc 3.x"
503 for compat_cc
in $gcc3_list ; do
504 if "$cross_prefix$compat_cc" --version 2> /dev
/null | fgrep
'(GCC) 3.' > /dev
/null
2>&1 ; then
505 echo "Found \"$compat_cc\""
506 cc
="$cross_prefix$compat_cc"
507 found_compat_cc
="yes"
511 if test "$found_compat_cc" = "no" ; then
512 echo "gcc 3.x not found!"
515 if test "$found_compat_cc" = "no" ; then
516 echo "QEMU is known to have problems when compiled with gcc 4.x"
517 echo "It is recommended that you use gcc 3.x to build QEMU"
518 echo "To use this compiler anyway, configure with --disable-gcc-check"
525 # Solaris specific configure tool chain decisions
527 if test "$solaris" = "yes" ; then
529 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
530 # override the check with --disable-gcc-check
532 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
534 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
535 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
536 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
537 echo "or get the latest patch from SunSolve for gcc"
541 solinst
=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
542 if test -z "$solinst" ; then
543 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
544 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
545 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
548 if test "$solinst" = "/usr/sbin/install" ; then
549 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
550 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
551 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
554 sol_ar
=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
555 if test -z "$sol_ar" ; then
556 echo "Error: No path includes ar"
557 if test -f /usr
/ccs
/bin
/ar ; then
558 echo "Add /usr/ccs/bin to your path and rerun configure"
565 if test -z "$target_list" ; then
566 # these targets are portable
567 if [ "$softmmu" = "yes" ] ; then
586 # the following are Linux specific
587 if [ "$linux_user" = "yes" ] ; then
588 target_list
="${target_list}\
600 ppc64abi32-linux-user \
605 sparc32plus-linux-user \
608 # the following are Darwin specific
609 if [ "$darwin_user" = "yes" ] ; then
610 target_list
="$target_list i386-darwin-user ppc-darwin-user"
613 target_list
=`echo "$target_list" | sed -e 's/,/ /g'`
615 if test -z "$target_list" ; then
616 echo "No targets enabled"
620 if test -z "$cross_prefix" ; then
623 # big/little endian test
625 #include <inttypes.h>
626 int main(int argc, char ** argv){
627 volatile uint32_t i=0x01234567;
628 return (*((uint8_t*)(&i))) == 0x67;
632 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
633 $TMPE && bigendian
="yes"
635 echo big
/little
test failed
640 # if cross compiling, cannot launch a program, so make a static guess
641 if test "$cpu" = "armv4b" \
645 -o "$cpu" = "mips64" \
646 -o "$cpu" = "powerpc" \
648 -o "$cpu" = "sparc" \
649 -o "$cpu" = "sparc64"; then
655 # host long bits test
657 if test "$cpu" = "x86_64" \
658 -o "$cpu" = "alpha" \
660 -o "$cpu" = "sparc64"; then
664 # check gcc options support
670 # Check host NPTL support
673 #include <linux/futex.h>
676 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
682 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev
/null
; then
688 ##########################################
691 if test "$kvm" = "yes" ; then
695 #error "kvm no pit capability"
697 int main(void) { return 0; }
699 if $cc $ARCH_CFLAGS $CFLAGS -I"$kernel_path"/include
-o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
704 ##########################################
709 if test -z "$sdl" ; then
710 sdl_config
="sdl-config"
714 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
715 # win32 cross compilation case
716 sdl_config
="i386-mingw32msvc-sdl-config"
722 #undef main /* We don't want SDL to override our main() */
723 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
725 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp
/qemu-$$
-sdl-config.log
; then
726 _sdlversion
=`$sdl_config --version | sed 's/[^0-9]//g'`
727 if test "$_sdlversion" -lt 121 ; then
730 if test "$cocoa" = "no" ; then
735 # static link with sdl ?
736 if test "$sdl" = "yes" ; then
738 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa
="yes"
739 sdl_static_libs
=`$sdl_config --static-libs 2>/dev/null`
740 if [ "$aa" = "yes" ] ; then
741 sdl_static_libs
="$sdl_static_libs `aalib-config --static-libs`"
744 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev
/null
; then
748 fi # sdl compile test
749 fi # cross compilation
751 # Make sure to disable cocoa if sdl was set
752 if test "$sdl" = "yes" ; then
754 audio_drv_list
="`echo $audio_drv_list | sed s,coreaudio,,g`"
758 ##########################################
760 if test "$vnc_tls" = "yes" ; then
761 `pkg-config gnutls` || vnc_tls
="no"
763 if test "$vnc_tls" = "yes" ; then
764 vnc_tls_cflags
=`pkg-config --cflags gnutls`
765 vnc_tls_libs
=`pkg-config --libs gnutls`
768 ##########################################
769 # Sound support libraries probe
780 int main(void) { $exp }
782 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib 2> /dev
/null
; then
786 echo "Error: $drv check failed"
787 echo "Make sure to have the $drv libs and headers installed."
793 for drv
in $audio_drv_list; do
796 audio_drv_probe
$drv alsa
/asoundlib.h
-lasound \
797 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
801 if test -z $fmod_lib ||
test -z $fmod_inc; then
803 echo "Error: You must specify path to FMOD library and headers"
804 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
808 audio_drv_probe
$drv fmod.h
$fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
812 audio_drv_probe
$drv esd.h
-lesd 'return esd_play_stream(0, 0, "", 0);'
816 audio_drv_probe
$drv pulse
/simple.h
-lpulse-simple \
817 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
823 ##########################################
826 if test -z "$brlapi" ; then
830 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
832 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev
/null
; then
834 fi # brlapi compile test
837 ##########################################
840 if test "$curses" = "yes" ; then
844 int main(void) { return curses_version(); }
846 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev
/null
; then
851 # Check if tools are available to build documentation.
852 if [ -x "`which texi2html 2>/dev/null`" ] && \
853 [ -x "`which pod2man 2>/dev/null`" ]; then
857 if test "$mingw32" = "yes" ; then
858 if test -z "$prefix" ; then
859 prefix
="/c/Program Files/Qemu"
866 if test -z "$prefix" ; then
869 mansuffix
="/share/man"
870 datasuffix
="/share/qemu"
871 docsuffix
="/share/doc/qemu"
875 ######################################
878 if test -z "$device_tree_support" -a \
879 "$cpu" = "powerpc"; then
880 device_tree_support
="no"
883 /* XXX uncomment later when libfdt is built before this test */
884 //int main(void) { void *fdt; return fdt_create(fdt, 1024); }
885 int main (void) {return 0;}
887 # XXX for now do not try to link to libfdt and just check for header */
888 # if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC -lfdt 2> /dev/null ; then
889 if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
890 device_tree_support
="yes"
893 echo "Error: Could not find libfdt"
894 echo "Make sure to have the libfdt libs and headers installed."
900 echo "Install prefix $prefix"
901 echo "BIOS directory $prefix$datasuffix"
902 echo "binary directory $prefix$binsuffix"
903 if test "$mingw32" = "no" ; then
904 echo "Manual directory $prefix$mansuffix"
905 echo "ELF interp prefix $interp_prefix"
907 echo "Source path $source_path"
908 echo "C compiler $cc"
909 echo "Host C compiler $host_cc"
910 echo "ARCH_CFLAGS $ARCH_CFLAGS"
912 echo "install $install"
914 echo "host big endian $bigendian"
915 echo "target list $target_list"
916 echo "gprof enabled $gprof"
917 echo "profiler $profiler"
918 echo "static build $static"
919 echo "-Werror enabled $werror"
920 if test "$darwin" = "yes" ; then
921 echo "Cocoa support $cocoa"
923 echo "SDL support $sdl"
924 if test "$sdl" != "no" ; then
925 echo "SDL static link $sdl_static"
927 echo "curses support $curses"
928 echo "mingw32 support $mingw32"
929 echo "Audio drivers $audio_drv_list"
930 echo "Extra audio cards $audio_card_list"
931 echo "Mixer emulation $mixemu"
932 echo "VNC TLS support $vnc_tls"
933 if test "$vnc_tls" = "yes" ; then
934 echo " TLS CFLAGS $vnc_tls_cflags"
935 echo " TLS LIBS $vnc_tls_libs"
937 if test -n "$sparc_cpu"; then
938 echo "Target Sparc Arch $sparc_cpu"
940 echo "kqemu support $kqemu"
941 echo "kvm support $kvm"
942 echo "CPU emulation $cpu_emulation"
943 if test $cpu = "powerpc"; then
944 echo "libfdt support $device_tree_support"
946 echo "brlapi support $brlapi"
947 echo "Documentation $build_docs"
948 [ ! -z "$uname_release" ] && \
949 echo "uname -r $uname_release"
950 echo "NPTL support $nptl"
952 if test $sdl_too_old = "yes"; then
953 echo "-> Your SDL version is too old - please upgrade to have SDL support"
955 if [ -s /tmp
/qemu-$$
-sdl-config.log
]; then
956 echo "The error log from compiling the libSDL test is: "
957 cat /tmp
/qemu-$$
-sdl-config.log
959 rm -f /tmp
/qemu-$$
-sdl-config.log
960 #if test "$sdl_static" = "no"; then
961 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
963 config_mak
="config-host.mak"
964 config_h
="config-host.h"
966 #echo "Creating $config_mak and $config_h"
968 test -f $config_h && mv $config_h ${config_h}~
970 echo "# Automatically generated by configure - do not modify" > $config_mak
971 echo "# Configured with: $0 $@" >> $config_mak
972 echo "/* Automatically generated by configure - do not modify */" > $config_h
974 echo "prefix=$prefix" >> $config_mak
975 echo "bindir=\${prefix}$binsuffix" >> $config_mak
976 echo "mandir=\${prefix}$mansuffix" >> $config_mak
977 echo "datadir=\${prefix}$datasuffix" >> $config_mak
978 echo "docdir=\${prefix}$docsuffix" >> $config_mak
979 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
980 echo "MAKE=$make" >> $config_mak
981 echo "INSTALL=$install" >> $config_mak
982 echo "CC=$cc" >> $config_mak
983 echo "HOST_CC=$host_cc" >> $config_mak
984 echo "AR=$ar" >> $config_mak
985 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
986 # XXX: only use CFLAGS and LDFLAGS ?
987 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
988 # compilation of dyngen tool (useful for win32 build on Linux host)
989 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
990 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
991 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
992 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
993 echo "CFLAGS=$CFLAGS" >> $config_mak
994 echo "LDFLAGS=$LDFLAGS" >> $config_mak
995 echo "EXESUF=$EXESUF" >> $config_mak
996 echo "AIOLIBS=$AIOLIBS" >> $config_mak
999 echo "ARCH=i386" >> $config_mak
1000 echo "#define HOST_I386 1" >> $config_h
1003 echo "ARCH=x86_64" >> $config_mak
1004 echo "#define HOST_X86_64 1" >> $config_h
1007 echo "ARCH=alpha" >> $config_mak
1008 echo "#define HOST_ALPHA 1" >> $config_h
1011 echo "ARCH=arm" >> $config_mak
1012 echo "#define HOST_ARM 1" >> $config_h
1015 echo "ARCH=arm" >> $config_mak
1016 echo "#define HOST_ARM 1" >> $config_h
1019 echo "ARCH=cris" >> $config_mak
1020 echo "#define HOST_CRIS 1" >> $config_h
1023 echo "ARCH=hppa" >> $config_mak
1024 echo "#define HOST_HPPA 1" >> $config_h
1027 echo "ARCH=ia64" >> $config_mak
1028 echo "#define HOST_IA64 1" >> $config_h
1031 echo "ARCH=m68k" >> $config_mak
1032 echo "#define HOST_M68K 1" >> $config_h
1035 echo "ARCH=mips" >> $config_mak
1036 echo "#define HOST_MIPS 1" >> $config_h
1039 echo "ARCH=mips64" >> $config_mak
1040 echo "#define HOST_MIPS64 1" >> $config_h
1043 echo "ARCH=ppc" >> $config_mak
1044 echo "#define HOST_PPC 1" >> $config_h
1047 echo "ARCH=s390" >> $config_mak
1048 echo "#define HOST_S390 1" >> $config_h
1051 echo "ARCH=sparc" >> $config_mak
1052 echo "#define HOST_SPARC 1" >> $config_h
1055 echo "ARCH=sparc64" >> $config_mak
1056 echo "#define HOST_SPARC64 1" >> $config_h
1059 echo "Unsupported CPU = $cpu"
1063 if test "$bigendian" = "yes" ; then
1064 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1065 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1067 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1068 if test "$mingw32" = "yes" ; then
1069 echo "CONFIG_WIN32=yes" >> $config_mak
1070 echo "#define CONFIG_WIN32 1" >> $config_h
1073 #include <byteswap.h>
1074 int main(void) { return bswap_32(0); }
1076 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1077 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1080 if test "$darwin" = "yes" ; then
1081 echo "CONFIG_DARWIN=yes" >> $config_mak
1082 echo "#define CONFIG_DARWIN 1" >> $config_h
1084 if test "$solaris" = "yes" ; then
1085 echo "CONFIG_SOLARIS=yes" >> $config_mak
1086 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1087 if test "$needs_libsunmath" = "yes" ; then
1088 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1089 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1092 if test -n "$sparc_cpu"; then
1093 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1094 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1096 if test "$gdbstub" = "yes" ; then
1097 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1098 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1100 if test "$gprof" = "yes" ; then
1101 echo "TARGET_GPROF=yes" >> $config_mak
1102 echo "#define HAVE_GPROF 1" >> $config_h
1104 if test "$static" = "yes" ; then
1105 echo "CONFIG_STATIC=yes" >> $config_mak
1106 echo "#define CONFIG_STATIC 1" >> $config_h
1108 if test $profiler = "yes" ; then
1109 echo "#define CONFIG_PROFILER 1" >> $config_h
1111 if test "$slirp" = "yes" ; then
1112 echo "CONFIG_SLIRP=yes" >> $config_mak
1113 echo "#define CONFIG_SLIRP 1" >> $config_h
1115 for card
in $audio_card_list; do
1116 def
=CONFIG_
`echo $card | tr '[:lower:]' '[:upper:]'`
1117 echo "$def=yes" >> $config_mak
1118 echo "#define $def 1" >> $config_h
1120 echo "#define AUDIO_DRIVERS \\" >> $config_h
1121 for drv
in $audio_drv_list; do
1122 echo " &${drv}_audio_driver, \\" >>$config_h
1123 def
=CONFIG_
`echo $drv | tr '[:lower:]' '[:upper:]'`
1124 echo "$def=yes" >> $config_mak
1125 if test "$drv" = "fmod"; then
1126 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1127 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1131 if test "$mixemu" = "yes" ; then
1132 echo "CONFIG_MIXEMU=yes" >> $config_mak
1133 echo "#define CONFIG_MIXEMU 1" >> $config_h
1135 if test "$vnc_tls" = "yes" ; then
1136 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1137 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1138 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1139 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1141 qemu_version
=`head $source_path/VERSION`
1142 echo "VERSION=$qemu_version" >>$config_mak
1143 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1144 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1146 echo "SRC_PATH=$source_path" >> $config_mak
1147 if [ "$source_path_used" = "yes" ]; then
1148 echo "VPATH=$source_path" >> $config_mak
1150 echo "TARGET_DIRS=$target_list" >> $config_mak
1151 if [ "$build_docs" = "yes" ] ; then
1152 echo "BUILD_DOCS=yes" >> $config_mak
1154 if test "$static" = "yes"; then
1159 if test "$sdl1" = "yes" ; then
1160 echo "#define CONFIG_SDL 1" >> $config_h
1161 echo "CONFIG_SDL=yes" >> $config_mak
1162 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1163 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1165 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1167 if [ "${aa}" = "yes" ] ; then
1168 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1170 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1173 if test "$cocoa" = "yes" ; then
1174 echo "#define CONFIG_COCOA 1" >> $config_h
1175 echo "CONFIG_COCOA=yes" >> $config_mak
1177 if test "$curses" = "yes" ; then
1178 echo "#define CONFIG_CURSES 1" >> $config_h
1179 echo "CONFIG_CURSES=yes" >> $config_mak
1180 echo "CURSES_LIBS=-lcurses" >> $config_mak
1182 if test "$brlapi" = "yes" ; then
1183 echo "CONFIG_BRLAPI=yes" >> $config_mak
1184 echo "#define CONFIG_BRLAPI 1" >> $config_h
1185 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1188 # XXX: suppress that
1189 if [ "$bsd" = "yes" ] ; then
1190 echo "#define O_LARGEFILE 0" >> $config_h
1191 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1192 echo "#define _BSD 1" >> $config_h
1195 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1198 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1199 tools
="qemu-img\$(EXESUF) $tools"
1200 if [ "$linux" = "yes" ] ; then
1201 tools
="qemu-nbd\$(EXESUF) $tools"
1204 echo "TOOLS=$tools" >> $config_mak
1206 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1208 for target
in $target_list; do
1209 target_dir
="$target"
1210 config_mak
=$target_dir/config.mak
1211 config_h
=$target_dir/config.h
1212 target_cpu
=`echo $target | cut -d '-' -f 1`
1213 target_bigendian
="no"
1214 [ "$target_cpu" = "armeb" ] && target_bigendian
=yes
1215 [ "$target_cpu" = "m68k" ] && target_bigendian
=yes
1216 [ "$target_cpu" = "mips" ] && target_bigendian
=yes
1217 [ "$target_cpu" = "mipsn32" ] && target_bigendian
=yes
1218 [ "$target_cpu" = "mips64" ] && target_bigendian
=yes
1219 [ "$target_cpu" = "ppc" ] && target_bigendian
=yes
1220 [ "$target_cpu" = "ppcemb" ] && target_bigendian
=yes
1221 [ "$target_cpu" = "ppc64" ] && target_bigendian
=yes
1222 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian
=yes
1223 [ "$target_cpu" = "sh4eb" ] && target_bigendian
=yes
1224 [ "$target_cpu" = "sparc" ] && target_bigendian
=yes
1225 [ "$target_cpu" = "sparc64" ] && target_bigendian
=yes
1226 [ "$target_cpu" = "sparc32plus" ] && target_bigendian
=yes
1228 target_user_only
="no"
1229 target_linux_user
="no"
1230 target_darwin_user
="no"
1232 ${target_cpu}-softmmu)
1233 target_softmmu
="yes"
1235 ${target_cpu}-linux-user)
1236 target_user_only
="yes"
1237 target_linux_user
="yes"
1239 ${target_cpu}-darwin-user)
1240 target_user_only
="yes"
1241 target_darwin_user
="yes"
1244 echo "ERROR: Target '$target' not recognised"
1249 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1250 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1251 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1252 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1253 echo "Note that this will disable all output from the virtual graphics card"
1254 echo "except through VNC or curses."
1258 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1260 test -f $config_h && mv $config_h ${config_h}~
1262 mkdir
-p $target_dir
1263 mkdir
-p $target_dir/fpu
1264 mkdir
-p $target_dir/tcg
1265 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
1266 mkdir
-p $target_dir/nwfpe
1270 # don't use ln -sf as not all "ln -sf" over write the file/link
1272 rm -f $target_dir/Makefile
1273 ln -s $source_path/Makefile.target
$target_dir/Makefile
1276 echo "# Automatically generated by configure - do not modify" > $config_mak
1277 echo "/* Automatically generated by configure - do not modify */" > $config_h
1280 echo "include ../config-host.mak" >> $config_mak
1281 echo "#include \"../config-host.h\"" >> $config_h
1286 interp_prefix1
=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1287 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1289 disable_cpu_emulation
() {
1290 if test $cpu_emulation = "no"; then
1291 echo "#define NO_CPU_EMULATION 1" >> $config_h
1292 echo "NO_CPU_EMULATION=1" >> $config_mak
1297 if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
1298 \
( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \
); then
1299 echo "#define USE_KVM 1" >> $config_h
1300 echo "USE_KVM=1" >> $config_mak
1301 echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak
1302 if test $kvm_cap_pit = "yes" ; then
1303 echo "USE_KVM_PIT=1" >> $config_mak
1304 echo "#define USE_KVM_PIT 1" >> $config_h
1306 disable_cpu_emulation
1310 case "$target_cpu" in
1312 echo "TARGET_ARCH=i386" >> $config_mak
1313 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1314 echo "#define TARGET_I386 1" >> $config_h
1315 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1317 echo "#define USE_KQEMU 1" >> $config_h
1319 gcc3minver
=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
1320 if test -n "$gcc3minver" && test $gcc3minver -gt 3
1322 echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1324 echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1329 echo "TARGET_ARCH=x86_64" >> $config_mak
1330 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1331 echo "#define TARGET_I386 1" >> $config_h
1332 echo "#define TARGET_X86_64 1" >> $config_h
1333 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1335 echo "#define USE_KQEMU 1" >> $config_h
1340 echo "TARGET_ARCH=ia64" >> $config_mak
1341 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1342 echo "#define TARGET_IA64 1" >> $config_h
1346 echo "TARGET_ARCH=alpha" >> $config_mak
1347 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1348 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1349 echo "#define TARGET_ALPHA 1" >> $config_h
1350 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1353 echo "TARGET_ARCH=arm" >> $config_mak
1354 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1355 echo "#define TARGET_ARM 1" >> $config_h
1360 echo "TARGET_ARCH=cris" >> $config_mak
1361 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1362 echo "#define TARGET_CRIS 1" >> $config_h
1365 echo "TARGET_ARCH=m68k" >> $config_mak
1366 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1367 echo "#define TARGET_M68K 1" >> $config_h
1371 echo "TARGET_ARCH=mips" >> $config_mak
1372 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1373 echo "#define TARGET_MIPS 1" >> $config_h
1374 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1377 echo "TARGET_ARCH=mipsn32" >> $config_mak
1378 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1379 echo "#define TARGET_MIPS 1" >> $config_h
1380 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1383 echo "TARGET_ARCH=mips64" >> $config_mak
1384 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1385 echo "#define TARGET_MIPS 1" >> $config_h
1386 echo "#define TARGET_MIPS64 1" >> $config_h
1387 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1390 echo "TARGET_ARCH=ppc" >> $config_mak
1391 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1392 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1393 echo "#define TARGET_PPC 1" >> $config_h
1394 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1397 echo "TARGET_ARCH=ppcemb" >> $config_mak
1398 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1399 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1400 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1401 echo "#define TARGET_PPC 1" >> $config_h
1402 echo "#define TARGET_PPCEMB 1" >> $config_h
1403 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1404 if test "$device_tree_support" = "yes" ; then
1405 echo "#define CONFIG_LIBFDT 1" >> $config_h
1406 echo "CONFIG_LIBFDT=1" >> $config_mak
1411 echo "TARGET_ARCH=ppc64" >> $config_mak
1412 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1413 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1414 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1415 echo "#define TARGET_PPC 1" >> $config_h
1416 echo "#define TARGET_PPC64 1" >> $config_h
1417 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1420 echo "TARGET_ARCH=ppc64" >> $config_mak
1421 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1422 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1423 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1424 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1425 echo "#define TARGET_PPC 1" >> $config_h
1426 echo "#define TARGET_PPC64 1" >> $config_h
1427 echo "#define TARGET_ABI32 1" >> $config_h
1428 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1431 echo "TARGET_ARCH=sh4" >> $config_mak
1432 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1433 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1434 echo "#define TARGET_SH4 1" >> $config_h
1435 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1439 echo "TARGET_ARCH=sparc" >> $config_mak
1440 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1441 echo "#define TARGET_SPARC 1" >> $config_h
1444 echo "TARGET_ARCH=sparc64" >> $config_mak
1445 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1446 echo "#define TARGET_SPARC 1" >> $config_h
1447 echo "#define TARGET_SPARC64 1" >> $config_h
1451 echo "TARGET_ARCH=sparc64" >> $config_mak
1452 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1453 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1454 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1455 echo "#define TARGET_SPARC 1" >> $config_h
1456 echo "#define TARGET_SPARC64 1" >> $config_h
1457 echo "#define TARGET_ABI32 1" >> $config_h
1460 echo "Unsupported target CPU"
1464 if test "$target_bigendian" = "yes" ; then
1465 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1466 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1468 if test "$target_softmmu" = "yes" ; then
1469 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1470 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1472 if test "$target_user_only" = "yes" ; then
1473 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1474 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1476 if test "$target_linux_user" = "yes" ; then
1477 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1478 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1480 if test "$target_darwin_user" = "yes" ; then
1481 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1482 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1485 if test "$target_cpu" = "arm" \
1486 -o "$target_cpu" = "armeb" \
1487 -o "$target_cpu" = "m68k" \
1488 -o "$target_cpu" = "mips" \
1489 -o "$target_cpu" = "mipsel" \
1490 -o "$target_cpu" = "mipsn32" \
1491 -o "$target_cpu" = "mipsn32el" \
1492 -o "$target_cpu" = "mips64" \
1493 -o "$target_cpu" = "mips64el" \
1494 -o "$target_cpu" = "sparc" \
1495 -o "$target_cpu" = "sparc64" \
1496 -o "$target_cpu" = "sparc32plus"; then
1497 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1498 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1500 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1501 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1502 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1504 if test "$target_user_only" = "yes" \
1505 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1506 echo "#define USE_NPTL 1" >> $config_h
1508 # 32 bit ELF loader in addition to native 64 bit loader?
1509 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1510 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1511 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1514 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1516 done # for target in $targets
1518 # build tree in object directory if source path is different from current one
1519 if test "$source_path_used" = "yes" ; then
1520 DIRS
="tests tests/cris slirp audio"
1521 FILES
="Makefile tests/Makefile"
1522 FILES
="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1523 FILES
="$FILES tests/test-mmap.c"
1524 for dir
in $DIRS ; do
1527 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1528 for f
in $FILES ; do
1530 ln -s $source_path/$f $f
1534 rm -f $TMPO $TMPC $TMPE $TMPS