Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KWFn3-0003SY-Dq for qemu-devel@nongnu.org; Thu, 21 Aug 2008 15:25:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KWFn1-0003SM-Sa for qemu-devel@nongnu.org; Thu, 21 Aug 2008 15:25:48 -0400 Received: from [199.232.76.173] (port=45554 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KWFn1-0003SH-Ne for qemu-devel@nongnu.org; Thu, 21 Aug 2008 15:25:47 -0400 Received: from savannah.gnu.org ([199.232.41.3]:51522 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KWFn1-0005ia-R2 for qemu-devel@nongnu.org; Thu, 21 Aug 2008 15:25:48 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KWFn0-0004UG-MI for qemu-devel@nongnu.org; Thu, 21 Aug 2008 19:25:46 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KWFn0-0004U8-BJ for qemu-devel@nongnu.org; Thu, 21 Aug 2008 19:25:46 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Thu, 21 Aug 2008 19:25:46 +0000 Subject: [Qemu-devel] [5046] Fix windows build Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5046 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5046 Author: aliguori Date: 2008-08-21 19:25:45 +0000 (Thu, 21 Aug 2008) Log Message: ----------- 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 Modified Paths: -------------- trunk/Makefile trunk/block.c trunk/configure Modified: trunk/Makefile =================================================================== --- trunk/Makefile 2008-08-21 18:00:53 UTC (rev 5045) +++ trunk/Makefile 2008-08-21 19:25:45 UTC (rev 5046) @@ -46,7 +46,10 @@ BLOCK_OBJS=cutils.o qemu-malloc.o BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o -BLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o +BLOCK_OBJS+=block-qcow2.o block-parallels.o +ifndef CONFIG_WIN32 +BLOCK_OBJS+=block-nbd.o +endif ###################################################################### # libqemu_common.a: Target independent part of system emulation. The @@ -54,10 +57,14 @@ # system emulation, i.e. a single QEMU executable should support all # CPUs and machines. -OBJS=nbd.o $(BLOCK_OBJS) +OBJS=$(BLOCK_OBJS) OBJS+=readline.o console.o OBJS+=block.o +ifndef CONFIG_WIN32 +OBJS+=nbd.o +endif + OBJS+=irq.o OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o @@ -166,11 +173,11 @@ rm -f $@ $(AR) rcs $@ $(USER_OBJS) -QEMU_IMG_BLOCK_OBJS = nbd.o $(BLOCK_OBJS) +QEMU_IMG_BLOCK_OBJS = $(BLOCK_OBJS) ifdef CONFIG_WIN32 QEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-win32.o else -QEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-posix.o +QEMU_IMG_BLOCK_OBJS += nbd.o qemu-img-block-raw-posix.o endif ###################################################################### Modified: trunk/block.c =================================================================== --- trunk/block.c 2008-08-21 18:00:53 UTC (rev 5045) +++ trunk/block.c 2008-08-21 19:25:45 UTC (rev 5046) @@ -1332,7 +1332,9 @@ bdrv_register(&bdrv_vvfat); bdrv_register(&bdrv_qcow2); bdrv_register(&bdrv_parallels); +#ifndef _WIN32 bdrv_register(&bdrv_nbd); +#endif } void *qemu_aio_get(BlockDriverState *bs, BlockDriverCompletionFunc *cb, Modified: trunk/configure =================================================================== --- trunk/configure 2008-08-21 18:00:53 UTC (rev 5045) +++ trunk/configure 2008-08-21 19:25:45 UTC (rev 5046) @@ -283,8 +283,6 @@ ;; --disable-vnc-tls) vnc_tls="no" ;; - --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no" - ;; --disable-slirp) slirp="no" ;; --disable-vde) vde="no" @@ -347,13 +345,6 @@ esac done -if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then - AIOLIBS= -else - # Some Linux architectures (e.g. s390) don't imply -lpthread automatically. - AIOLIBS="-lrt -lpthread" -fi - # default flags for all hosts CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing" LDFLAGS="$LDFLAGS -g" @@ -423,7 +414,6 @@ echo " --disable-werror disable compilation abort on warning" echo " --disable-sdl disable SDL" echo " --enable-cocoa enable COCOA (Mac OS X only)" -echo " --enable-mingw32 enable Win32 cross compilation with mingw32" echo " --audio-drv-list=LIST set audio drivers list:" echo " Available drivers: $audio_possible_drivers" echo " --audio-card-list=LIST set list of additional emulated audio cards" @@ -467,12 +457,33 @@ exit 1 fi +# check compiler to see if we're on mingw32 +cat > $TMPC < +#ifndef _WIN32 +#error not windows +#endif +int main(void) {} +EOF + +if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then + mingw32="yes" +fi + if test "$mingw32" = "yes" ; then linux="no" EXESUF=".exe" oss="no" + linux_user="no" fi +if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then + AIOLIBS= +else + # Some Linux architectures (e.g. s390) don't imply -lpthread automatically. + AIOLIBS="-lrt -lpthread" +fi + # Check for gcc4, error if pre-gcc4 if test "$check_gcc" = "yes" ; then cat > $TMPC < $TMPC << EOF #include #undef main /* We don't want SDL to override our main() */ int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } EOF - 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 - _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'` - if test "$_sdlversion" -lt 121 ; then - sdl_too_old=yes - else - if test "$cocoa" = "no" ; then - sdl=yes - fi + 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 + _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'` + if test "$_sdlversion" -lt 121 ; then + sdl_too_old=yes + else + if test "$cocoa" = "no" ; then + sdl=yes fi + fi - # static link with sdl ? - if test "$sdl" = "yes" ; then - aa="no" - `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes" - sdl_static_libs=`$sdl_config --static-libs 2>/dev/null` - if [ "$aa" = "yes" ] ; then - sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`" - fi + # static link with sdl ? + if test "$sdl" = "yes" ; then + aa="no" + `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes" + sdl_static_libs=`$sdl_config --static-libs 2>/dev/null` + if [ "$aa" = "yes" ] ; then + sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`" + fi - if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then - sdl_static=yes - fi - fi # static link - fi # sdl compile test - fi # cross compilation + if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then + sdl_static=yes + fi + fi # static link + fi # sdl compile test else # Make sure to disable cocoa if sdl was set if test "$sdl" = "yes" ; then