[poppler] CMakeLists.txt configure.ac poppler/poppler-config.h.in

Albert Astals Cid aacid at kemper.freedesktop.org
Sat Jun 1 05:03:35 PDT 2013


 CMakeLists.txt              |    4 ++++
 configure.ac                |    3 +++
 poppler/poppler-config.h.in |    5 +++++
 3 files changed, 12 insertions(+)

New commits:
commit 860737c2a19c734a0c5b65ad506ba229ba439985
Author: Hib Eris <hib at hiberis.nl>
Date:   Sat Jun 1 12:05:17 2013 +0200

    Use ansi stdio extensions when using a mingw compiler
    
    In the C runtime used by mingw compilers (msvcrt.dll) the printf
    function does not support the C99 format-width specifier "%ll".
    
    Defining __USE_MINGW_ANSI_STDIO enables mingw's ansi stdio extensions
    that implement a C99 compliant printf function.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=65238

diff --git a/CMakeLists.txt b/CMakeLists.txt
index baafed3..cf2bb2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -161,6 +161,10 @@ if(ENABLE_LIBCURL)
 endif(ENABLE_LIBCURL)
 
 add_definitions(-DHAVE_CONFIG_H=1)
+if(MINGW)
+  # Use mingw's ansi stdio extensions
+  add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
+endif(MINGW)
 if(FONTCONFIG_FOUND)
   add_definitions(${FONTCONFIG_DEFINITIONS})
   include_directories(${FONTCONFIG_INCLUDE_DIR})
diff --git a/configure.ac b/configure.ac
index 09fa425..3b4c493 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,9 @@ case "$host_os" in
     win32_libs="-lgdi32"
     create_shared_lib="-no-undefined"
     auto_import_flags="-Wl,--enable-auto-import"
+
+    # Use mingw's ansi stdio extensions
+    CXXFLAGS="$CXXFLAGS -D__USE_MINGW_ANSI_STDIO=1"
   ;;
 esac
 
diff --git a/poppler/poppler-config.h.in b/poppler/poppler-config.h.in
index 11b5691..51705e8 100644
--- a/poppler/poppler-config.h.in
+++ b/poppler/poppler-config.h.in
@@ -158,8 +158,13 @@ char * strtok_r (char *s, const char *delim, char **save_ptr);
 //------------------------------------------------------------------------
 
 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+#ifdef __USE_MINGW_ANSI_STDIO
+#define GCC_PRINTF_FORMAT(fmt_index, va_index) \
+	__attribute__((__format__(__MINGW_PRINTF_FORMAT, fmt_index, va_index)))
+#else
 #define GCC_PRINTF_FORMAT(fmt_index, va_index) \
 	__attribute__((__format__(__printf__, fmt_index, va_index)))
+#endif
 #else
 #define GCC_PRINTF_FORMAT(fmt_index, va_index)
 #endif


More information about the poppler mailing list