Support building with newest Mingw64 cross-toolchain.

This modifies android-configure.sh to detect the new Mingw64-based
cross toolchain (i.e. x86_64-w64-mingw32-gcc) and use it when it
is in the user's path.

Note that this only builds a 32-bit Windows binary, it just uses
a different toolchain to do it. A future patch will add support
for building both Win32 and Win64 binaries at the same time
(which the new toolchain supports).

Since this switches from GCC 4.2 to 4.8, this introduces a ton of
new warnings that require some cleanups in the sources too.

Only the most important warnings are fixed here.

Change-Id: Iec8c9b8332d4a38a2cb8acf368c8aa5341cf77be
diff --git a/Makefile.android b/Makefile.android
index 8c2db0a..c5bcd0d 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -151,6 +151,13 @@
   endif
 endif
 
+ifeq ($(HOST_OS)-$(BUILD_STANDALONE_EMULATOR),windows-true)
+  # Ensure that printf() et al use GNU printf format specifiers as required
+  # by QEMU. This is important when using the newer Mingw64 cross-toolchain.
+  # See http://sourceforge.net/apps/trac/mingw-w64/wiki/gnu%20printf
+  MY_CFLAGS += -D__USE_MINGW_ANSI_STDIO=1
+endif
+
 # Enable warning, except those related to missing field initializers
 # (the QEMU coding style loves using these).
 #
@@ -218,7 +225,7 @@
 #
 QEMU_SYSTEM_LDLIBS := -lm
 ifeq ($(HOST_OS),windows)
-  QEMU_SYSTEM_LDLIBS += -mno-cygwin -mwindows -mconsole
+  QEMU_SYSTEM_LDLIBS += -mwindows -mconsole
 endif
 
 ifeq ($(HOST_OS),freebsd)