[Spice-devel] [PATCH 2/4 v2] mingw: avoid problems for using %zd (C99)
Fabiano FidĂȘncio
fidencio at redhat.com
Thu Oct 8 08:23:26 PDT 2015
Otherwise the following problem can be faced:
src/vscclient.c: In function 'connect_to_qemu':
src/vscclient.c:642:16: error: unknown conversion type character 'z' in format [-Werror=format=]
printf("Connected (sizeof Header=%zd)!\n", sizeof(VSCMsgHeader));
^
src/vscclient.c:642:16: error: too many arguments for format [-Werror=format-extra-args]
---
Changes since v1:
- Fix the host_os check
- Fix the (linux) compilation break
---
Makefile.am | 4 ++++
configure.ac | 13 +++++++++++++
2 files changed, 17 insertions(+)
diff --git a/Makefile.am b/Makefile.am
index f106bd9..f39f5d8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -48,6 +48,10 @@ vscclient_SOURCES = src/vscclient.c
vscclient_LDADD = libcacard.la $(CACARD_LIBS) $(GTHREAD_LIBS)
vscclient_CFLAGS = $(AM_CPPFLAGS) $(GTHREAD_CFLAGS)
+if OS_WIN32
+vscclient_CFLAGS += -D__USE_MINGW_ANSI_STDIO=1
+endif
+
AM_CPPFLAGS = $(CACARD_CFLAGS) $(WARN_CFLAGS)
EXTRA_DIST = \
NEWS \
diff --git a/configure.ac b/configure.ac
index e2214b3..b841ec1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,6 +10,19 @@ AM_INIT_AUTOMAKE([foreign subdir-objects no-dist-gzip dist-xz])
AM_MAINTAINER_MODE([enable])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
+AC_CANONICAL_HOST
+AC_MSG_CHECKING([for native Win32])
+case "$host_os" in
+ *mingw*|*cygwin*)
+ os_win32=yes
+ ;;
+ *)
+ os_win32=no
+ ;;
+esac
+AC_MSG_RESULT([$os_win32])
+AM_CONDITIONAL([OS_WIN32],[test "$os_win32" = "yes"])
+
AX_CHECK_ENABLE_DEBUG([yes],[DEBUG])
AC_PROG_CC
--
2.4.3
More information about the Spice-devel
mailing list