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,7 +46,10 @@ recurse-all: $(SUBDIR_RULES)
46 BLOCK_OBJS=cutils.o qemu-malloc.o 46 BLOCK_OBJS=cutils.o qemu-malloc.o
47 BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o 47 BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o
48 BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o 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 # libqemu_common.a: Target independent part of system emulation. The 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,10 +57,14 @@ BLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o
54 # system emulation, i.e. a single QEMU executable should support all 57 # system emulation, i.e. a single QEMU executable should support all
55 # CPUs and machines. 58 # CPUs and machines.
56 59
57 -OBJS=nbd.o $(BLOCK_OBJS) 60 +OBJS=$(BLOCK_OBJS)
58 OBJS+=readline.o console.o 61 OBJS+=readline.o console.o
59 OBJS+=block.o 62 OBJS+=block.o
60 63
  64 +ifndef CONFIG_WIN32
  65 +OBJS+=nbd.o
  66 +endif
  67 +
61 OBJS+=irq.o 68 OBJS+=irq.o
62 OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o 69 OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
63 OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o 70 OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o
@@ -166,11 +173,11 @@ libqemu_user.a: $(USER_OBJS) @@ -166,11 +173,11 @@ libqemu_user.a: $(USER_OBJS)
166 rm -f $@ 173 rm -f $@
167 $(AR) rcs $@ $(USER_OBJS) 174 $(AR) rcs $@ $(USER_OBJS)
168 175
169 -QEMU_IMG_BLOCK_OBJS = nbd.o $(BLOCK_OBJS) 176 +QEMU_IMG_BLOCK_OBJS = $(BLOCK_OBJS)
170 ifdef CONFIG_WIN32 177 ifdef CONFIG_WIN32
171 QEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-win32.o 178 QEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-win32.o
172 else 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 endif 181 endif
175 182
176 ###################################################################### 183 ######################################################################
@@ -1332,7 +1332,9 @@ void bdrv_init(void) @@ -1332,7 +1332,9 @@ void bdrv_init(void)
1332 bdrv_register(&bdrv_vvfat); 1332 bdrv_register(&bdrv_vvfat);
1333 bdrv_register(&bdrv_qcow2); 1333 bdrv_register(&bdrv_qcow2);
1334 bdrv_register(&bdrv_parallels); 1334 bdrv_register(&bdrv_parallels);
  1335 +#ifndef _WIN32
1335 bdrv_register(&bdrv_nbd); 1336 bdrv_register(&bdrv_nbd);
  1337 +#endif
1336 } 1338 }
1337 1339
1338 void *qemu_aio_get(BlockDriverState *bs, BlockDriverCompletionFunc *cb, 1340 void *qemu_aio_get(BlockDriverState *bs, BlockDriverCompletionFunc *cb,
configure
@@ -283,8 +283,6 @@ for opt do @@ -283,8 +283,6 @@ for opt do
283 ;; 283 ;;
284 --disable-vnc-tls) vnc_tls="no" 284 --disable-vnc-tls) vnc_tls="no"
285 ;; 285 ;;
286 - --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"  
287 - ;;  
288 --disable-slirp) slirp="no" 286 --disable-slirp) slirp="no"
289 ;; 287 ;;
290 --disable-vde) vde="no" 288 --disable-vde) vde="no"
@@ -347,13 +345,6 @@ for opt do @@ -347,13 +345,6 @@ for opt do
347 esac 345 esac
348 done 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 # default flags for all hosts 348 # default flags for all hosts
358 CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing" 349 CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
359 LDFLAGS="$LDFLAGS -g" 350 LDFLAGS="$LDFLAGS -g"
@@ -423,7 +414,6 @@ echo &quot; --static enable static build [$static]&quot; @@ -423,7 +414,6 @@ echo &quot; --static enable static build [$static]&quot;
423 echo " --disable-werror disable compilation abort on warning" 414 echo " --disable-werror disable compilation abort on warning"
424 echo " --disable-sdl disable SDL" 415 echo " --disable-sdl disable SDL"
425 echo " --enable-cocoa enable COCOA (Mac OS X only)" 416 echo " --enable-cocoa enable COCOA (Mac OS X only)"
426 -echo " --enable-mingw32 enable Win32 cross compilation with mingw32"  
427 echo " --audio-drv-list=LIST set audio drivers list:" 417 echo " --audio-drv-list=LIST set audio drivers list:"
428 echo " Available drivers: $audio_possible_drivers" 418 echo " Available drivers: $audio_possible_drivers"
429 echo " --audio-card-list=LIST set list of additional emulated audio cards" 419 echo " --audio-card-list=LIST set list of additional emulated audio cards"
@@ -467,10 +457,31 @@ else @@ -467,10 +457,31 @@ else
467 exit 1 457 exit 1
468 fi 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 if test "$mingw32" = "yes" ; then 473 if test "$mingw32" = "yes" ; then
471 linux="no" 474 linux="no"
472 EXESUF=".exe" 475 EXESUF=".exe"
473 oss="no" 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 fi 485 fi
475 486
476 # Check for gcc4, error if pre-gcc4 487 # Check for gcc4, error if pre-gcc4
@@ -700,42 +711,35 @@ if test -z &quot;$sdl&quot; ; then @@ -700,42 +711,35 @@ if test -z &quot;$sdl&quot; ; then
700 sdl=no 711 sdl=no
701 sdl_static=no 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 cat > $TMPC << EOF 714 cat > $TMPC << EOF
710 #include <SDL.h> 715 #include <SDL.h>
711 #undef main /* We don't want SDL to override our main() */ 716 #undef main /* We don't want SDL to override our main() */
712 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 717 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
713 EOF 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 fi 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 else 743 else
740 # Make sure to disable cocoa if sdl was set 744 # Make sure to disable cocoa if sdl was set
741 if test "$sdl" = "yes" ; then 745 if test "$sdl" = "yes" ; then