From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G5TK5-0008Kl-FY for qemu-devel@nongnu.org; Tue, 25 Jul 2006 16:16:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G5TK4-0008KY-Ot for qemu-devel@nongnu.org; Tue, 25 Jul 2006 16:16:08 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G5TK4-0008KV-Jw for qemu-devel@nongnu.org; Tue, 25 Jul 2006 16:16:08 -0400 Received: from [70.116.9.243] (helo=localhost.localdomain) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1G5TLR-0001ed-St for qemu-devel@nongnu.org; Tue, 25 Jul 2006 16:17:34 -0400 Received: from localhost ([127.0.0.1]) by localhost.localdomain with esmtp (Exim 4.60) (envelope-from ) id 1G5TJn-0004Wb-CT for qemu-devel@nongnu.org; Tue, 25 Jul 2006 15:15:51 -0500 Message-ID: <44C67BF5.2020702@codemonkey.ws> Date: Tue, 25 Jul 2006 15:15:49 -0500 From: Anthony Liguori MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080708020405030202080905" Subject: [Qemu-devel] [PATCH][RFC] configure changes to support cross compiling with mingw32 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 This is a multi-part message in MIME format. --------------080708020405030202080905 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit --enable-mingw32 hasn't ever worked for me. The follow patch is a set of changes to configure so that --cross-prefix=i586-mingw32-msvc does the right thing. It needs some testing. It works for me but I don't know if people have weird setups where the gcc cross prefix != the sdl cross prefix or something odd like that. Regards, Anthony Liguori --------------080708020405030202080905 Content-Type: text/x-patch; name="mingw32-cross.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mingw32-cross.diff" # HG changeset patch # User Anthony Liguori # Node ID 157550eed1f5e456a0f43167bd21bc14ad164d51 # Parent bda9c89460daa713765b316ea8ef1bfe7fd79091 A number of fixes to configure while getting cross compiling with mingw32 to work. Remove the --enable-mingw option. It hardcoded a cross-compile prefix and a different prefix is used on the mingw32 tools on some distros. Now: ./configure --cross-prefix=i586-mingw32msvc- ... will do the Right Thing so --enable-mingw is no longer needed. Add a check after $cc includes the cross-compile prefix so we can determine what the target really is (as opposed to using uname). Remove the check for test -e for /usr/include/byteswap.h to a compile check. This breaks cross compiling. Add a check for zlib so that we give a nice error if zlib-devel is missing. Use ${cross_prefix}sdl-config When we exit, make sure to remove TMP files. diff -r bda9c89460da -r 157550eed1f5 configure --- a/configure Sat Jul 22 22:06:44 2006 +0000 +++ b/configure Tue Jul 25 15:13:19 2006 -0500 @@ -213,8 +213,6 @@ for opt do ;; --fmod-inc=*) fmod_inc="$optarg" ;; - --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no" - ;; --disable-slirp) slirp="no" ;; --enable-adlib) adlib="yes" @@ -278,7 +276,6 @@ echo " --install=INSTALL use spe echo " --install=INSTALL use specified install [$install]" echo " --static enable static build [$static]" echo " --enable-cocoa enable COCOA (Mac OS X only)" -echo " --enable-mingw32 enable Win32 cross compilation with mingw32" echo " --enable-adlib enable Adlib emulation" echo " --enable-coreaudio enable Coreaudio audio driver" echo " --enable-alsa enable ALSA audio driver" @@ -301,6 +298,23 @@ ar="${cross_prefix}${ar}" ar="${cross_prefix}${ar}" strip="${cross_prefix}${strip}" +# we really ought move the whole archecture check down here +targetos=`$cc -dumpmachine` +case $targetos in + *-mingw32msvc) + mingw32="yes" + oss="no" + user="no" + linux="no" # hack + EXESUF=".exe" + if [ "$cpu" = "i386" ] ; then + kqemu="yes" + fi + ;; + *) + ;; +esac + # check that the C compiler works. cat > $TMPC < $TMPC < +int main(){(void)zlibVersion(); return 0;} +EOF +if $cc -o $TMPE $TMPC -lz 2>/dev/null; then + zlib="yes" +else + zlib="no" +fi + +if test "$zlib" = "no"; then + echo "ERROR: QEMU requires the zlib library. You may have to install" + echo "the development package." + rm -f $TMPO $TMPC $TMPE $TMPS + exit 1; +fi + ########################################## # SDL probe @@ -448,15 +472,10 @@ sdl_too_old=no if test -z "$sdl" ; then -sdl_config="sdl-config" +sdl_config="${cross-prefix}sdl-config" sdl=no sdl_static=no -if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then -# win32 cross compilation case - sdl_config="i386-mingw32msvc-sdl-config" - sdl=yes -else # normal SDL probe cat > $TMPC << EOF #include @@ -489,7 +508,6 @@ fi # static link fi # sdl compile test -fi # cross compilation fi # -z $sdl # Check if tools are available to build documentation. @@ -540,7 +558,6 @@ if test "$sdl" != "no" ; then if test "$sdl" != "no" ; then echo "SDL static link $sdl_static" fi -echo "mingw32 support $mingw32" echo "Adlib support $adlib" echo "CoreAudio support $coreaudio" echo "ALSA support $alsa" @@ -573,6 +590,13 @@ config_h="config-host.h" config_h="config-host.h" #echo "Creating $config_mak and $config_h" + +have_header() { + cat > $TMPC < +EOF + $cc -c -o $TMPO $TMPC 2>/dev/null +} echo "# Automatically generated by configure - do not modify" > $config_mak echo "# Configured with: $0 $@" >> $config_mak @@ -644,7 +668,7 @@ if test "$mingw32" = "yes" ; then if test "$mingw32" = "yes" ; then echo "CONFIG_WIN32=yes" >> $config_mak echo "#define CONFIG_WIN32 1" >> $config_h -elif test -f "/usr/include/byteswap.h" ; then +elif have_header "/usr/include/byteswap.h" ; then echo "#define HAVE_BYTESWAP_H 1" >> $config_h fi if test "$darwin" = "yes" ; then --------------080708020405030202080905--