From 99da58dc697de2a709a088038dfd92e8ed82a388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Tue, 2 Dec 2014 13:34:06 +0000 Subject: [PATCH] support GNU format printf and scanf on mingw Allow %lld and %Lf to work on mingw as per: http://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/ --- m4/extensions.m4 | 5 +++++ m4/stdio_h.m4 | 3 +++ modules/dtoastr | 1 + modules/ftoastr | 1 + modules/ldtoastr | 1 + modules/stdio | 1 + 6 files changed, 12 insertions(+) diff --git a/m4/extensions.m4 b/m4/extensions.m4 index 37f55ca..cf285ba 100644 --- a/m4/extensions.m4 +++ b/m4/extensions.m4 @@ -68,6 +68,10 @@ dnl configure.ac when using autoheader 2.62. #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif +/* Use GNU style printf and scanf. */ +#ifndef __USE_MINGW_ANSI_STDIO +# undef __USE_MINGW_ANSI_STDIO +#endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS @@ -100,6 +104,7 @@ dnl configure.ac when using autoheader 2.62. AC_DEFINE([_ALL_SOURCE]) AC_DEFINE([_DARWIN_C_SOURCE]) AC_DEFINE([_GNU_SOURCE]) + AC_DEFINE([__USE_MINGW_ANSI_STDIO]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([_TANDEM_SOURCE]) AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index d15913a..ef0dcc1 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -6,6 +6,9 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_STDIO_H], [ + dnl For __USE_MINGW_ANSI_STDIO + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) gl_NEXT_HEADERS([stdio.h]) diff --git a/modules/dtoastr b/modules/dtoastr index 60b09b4..72f0da8 100644 --- a/modules/dtoastr +++ b/modules/dtoastr @@ -8,6 +8,7 @@ lib/dtoastr.c m4/c-strtod.m4 Depends-on: +extensions intprops configure.ac: diff --git a/modules/ftoastr b/modules/ftoastr index b52ce26..2d583d4 100644 --- a/modules/ftoastr +++ b/modules/ftoastr @@ -7,6 +7,7 @@ lib/ftoastr.c m4/c-strtod.m4 Depends-on: +extensions intprops configure.ac: diff --git a/modules/ldtoastr b/modules/ldtoastr index 50731a5..5695e77 100644 --- a/modules/ldtoastr +++ b/modules/ldtoastr @@ -8,6 +8,7 @@ lib/ldtoastr.c m4/c-strtod.m4 Depends-on: +extensions intprops configure.ac: diff --git a/modules/stdio b/modules/stdio index 1eec2bf..e953316 100644 --- a/modules/stdio +++ b/modules/stdio @@ -6,6 +6,7 @@ lib/stdio.in.h m4/stdio_h.m4 Depends-on: +extensions include_next snippet/arg-nonnull snippet/c++defs -- 2.1.0