From 27b39c7a632b85966bbe0776e6a6e2d34fcee018 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sat, 18 May 2019 17:25:10 +0200
Subject: [PATCH 2/2] libasprintf: Avoid compilation error on mingw with
 -D__USE_MINGW_ANSI_STDIO=1.

* gettext-runtime/libasprintf/lib-asprintf.c (asprintf, vasprintf): Don't define
on mingw when __USE_MINGW_ANSI_STDIO is non-zero.

(cherry picked from commit ca6f6cfbb4c78c063f2a50bb758edfc95c9d64a2)
---
 gettext-runtime/libasprintf/lib-asprintf.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gettext-runtime/libasprintf/lib-asprintf.c b/gettext-runtime/libasprintf/lib-asprintf.c
index 927fe7779..93d75bcf7 100644
--- a/gettext-runtime/libasprintf/lib-asprintf.c
+++ b/gettext-runtime/libasprintf/lib-asprintf.c
@@ -1,5 +1,5 @@
 /* Library functions for class autosprintf.
-   Copyright (C) 2002-2003, 2006, 2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2006, 2018-2019 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software: you can redistribute it and/or modify
@@ -40,10 +40,13 @@
 #include "asprintf.c"
 
 /* Define the same functions also without the 'libasprintf_' prefix,
-   for binary backward-compatibility.  */
+   for binary backward-compatibility.
+   But don't redefine functions already defined by mingw.  */
+#if !(defined __MINGW32__ && __USE_MINGW_ANSI_STDIO)
 #undef asprintf
 #undef vasprintf
 #include "vasprintf.c"
 #include "asprintf.c"
+#endif
 
 #endif
-- 
2.17.1

