Commit cd01b4a312248dd4e12c3d389d1a349cea4015d8

Authored by aliguori
1 parent 2f6a1ab0

Fix windows build

Right now, the Windows build is broken because of NBD.  Using a mingw32 cross
compiler is also badly broken.

This patch fixes the Windows build by stubbing out NBD support until someone
fixes it for Windows.  It also santizing the mingw32 cross compiler support
by replacing the --enable-mingw32 option with a compiler check to determine
if we're on windows or not.

Also remove the weird SDL pseudo-detection for mingw32 using a cross compiler.
The hardcoded sdl-config name is seemly arbitrary.  If you cross compiler SDL
correctly and modify your PATH variable appropriately, it will Just Work when
cross compiling.

The audio driver detection is also broken for cross compiling so you have to
specify the audio drivers explicitly for now.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>




git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5046 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 3 changed files with 56 additions and 43 deletions
Makefile
... ... @@ -46,7 +46,10 @@ recurse-all: $(SUBDIR_RULES)
46 46 BLOCK_OBJS=cutils.o qemu-malloc.o
47 47 BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o
48 48 BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o
49   -BLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o
  49 +BLOCK_OBJS+=block-qcow2.o block-parallels.o
  50 +ifndef CONFIG_WIN32
  51 +BLOCK_OBJS+=block-nbd.o
  52 +endif
50 53  
51 54 ######################################################################
52 55 # libqemu_common.a: Target independent part of system emulation. The
... ... @@ -54,10 +57,14 @@ BLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o
54 57 # system emulation, i.e. a single QEMU executable should support all
55 58 # CPUs and machines.
56 59  
57   -OBJS=nbd.o $(BLOCK_OBJS)
  60 +OBJS=$(BLOCK_OBJS)
58 61 OBJS+=readline.o console.o
59 62 OBJS+=block.o
60 63  
  64 +ifndef CONFIG_WIN32
  65 +OBJS+=nbd.o
  66 +endif
  67 +
61 68 OBJS+=irq.o
62 69 OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
63 70 OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
... ... @@ -166,11 +173,11 @@ libqemu_user.a: $(USER_OBJS)
166 173 rm -f $@
167 174 $(AR) rcs $@ $(USER_OBJS)
168 175  
169   -QEMU_IMG_BLOCK_OBJS = nbd.o $(BLOCK_OBJS)
  176 +QEMU_IMG_BLOCK_OBJS = $(BLOCK_OBJS)
170 177 ifdef CONFIG_WIN32
171 178 QEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-win32.o
172 179 else
173   -QEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-posix.o
  180 +QEMU_IMG_BLOCK_OBJS += nbd.o qemu-img-block-raw-posix.o
174 181 endif
175 182  
176 183 ######################################################################
... ...
... ... @@ -1332,7 +1332,9 @@ void bdrv_init(void)
1332 1332 bdrv_register(&bdrv_vvfat);
1333 1333 bdrv_register(&bdrv_qcow2);
1334 1334 bdrv_register(&bdrv_parallels);
  1335 +#ifndef _WIN32
1335 1336 bdrv_register(&bdrv_nbd);
  1337 +#endif
1336 1338 }
1337 1339  
1338 1340 void *qemu_aio_get(BlockDriverState *bs, BlockDriverCompletionFunc *cb,
... ...
configure
... ... @@ -283,8 +283,6 @@ for opt do
283 283 ;;
284 284 --disable-vnc-tls) vnc_tls="no"
285 285 ;;
286   - --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
287   - ;;
288 286 --disable-slirp) slirp="no"
289 287 ;;
290 288 --disable-vde) vde="no"
... ... @@ -347,13 +345,6 @@ for opt do
347 345 esac
348 346 done
349 347  
350   -if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
351   - AIOLIBS=
352   -else
353   - # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
354   - AIOLIBS="-lrt -lpthread"
355   -fi
356   -
357 348 # default flags for all hosts
358 349 CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
359 350 LDFLAGS="$LDFLAGS -g"
... ... @@ -423,7 +414,6 @@ echo &quot; --static enable static build [$static]&quot;
423 414 echo " --disable-werror disable compilation abort on warning"
424 415 echo " --disable-sdl disable SDL"
425 416 echo " --enable-cocoa enable COCOA (Mac OS X only)"
426   -echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
427 417 echo " --audio-drv-list=LIST set audio drivers list:"
428 418 echo " Available drivers: $audio_possible_drivers"
429 419 echo " --audio-card-list=LIST set list of additional emulated audio cards"
... ... @@ -467,10 +457,31 @@ else
467 457 exit 1
468 458 fi
469 459  
  460 +# check compiler to see if we're on mingw32
  461 +cat > $TMPC <<EOF
  462 +#include <windows.h>
  463 +#ifndef _WIN32
  464 +#error not windows
  465 +#endif
  466 +int main(void) {}
  467 +EOF
  468 +
  469 +if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
  470 + mingw32="yes"
  471 +fi
  472 +
470 473 if test "$mingw32" = "yes" ; then
471 474 linux="no"
472 475 EXESUF=".exe"
473 476 oss="no"
  477 + linux_user="no"
  478 +fi
  479 +
  480 +if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
  481 + AIOLIBS=
  482 +else
  483 + # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
  484 + AIOLIBS="-lrt -lpthread"
474 485 fi
475 486  
476 487 # Check for gcc4, error if pre-gcc4
... ... @@ -700,42 +711,35 @@ if test -z &quot;$sdl&quot; ; then
700 711 sdl=no
701 712 sdl_static=no
702 713  
703   - if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
704   - # win32 cross compilation case
705   - sdl_config="i386-mingw32msvc-sdl-config"
706   - sdl=yes
707   - else
708   - # normal SDL probe
709 714 cat > $TMPC << EOF
710 715 #include <SDL.h>
711 716 #undef main /* We don't want SDL to override our main() */
712 717 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
713 718 EOF
714   - 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
715   - _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
716   - if test "$_sdlversion" -lt 121 ; then
717   - sdl_too_old=yes
718   - else
719   - if test "$cocoa" = "no" ; then
720   - sdl=yes
721   - fi
  719 + 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
  720 + _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
  721 + if test "$_sdlversion" -lt 121 ; then
  722 + sdl_too_old=yes
  723 + else
  724 + if test "$cocoa" = "no" ; then
  725 + sdl=yes
722 726 fi
  727 + fi
723 728  
724   - # static link with sdl ?
725   - if test "$sdl" = "yes" ; then
726   - aa="no"
727   - `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
728   - sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
729   - if [ "$aa" = "yes" ] ; then
730   - sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
731   - fi
732   -
733   - if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
734   - sdl_static=yes
735   - fi
736   - fi # static link
737   - fi # sdl compile test
738   - fi # cross compilation
  729 + # static link with sdl ?
  730 + if test "$sdl" = "yes" ; then
  731 + aa="no"
  732 + `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
  733 + sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
  734 + if [ "$aa" = "yes" ] ; then
  735 + sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
  736 + fi
  737 +
  738 + if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
  739 + sdl_static=yes
  740 + fi
  741 + fi # static link
  742 + fi # sdl compile test
739 743 else
740 744 # Make sure to disable cocoa if sdl was set
741 745 if test "$sdl" = "yes" ; then
... ...