# This file is part of MXE. See LICENSE.md for licensing information.

From 41eb83cf4aa73f0ac4e70173562f11a17a1d0298 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sun, 12 May 2019 23:26:04 +0200
Subject: [PATCH 1/3] build: Fix "make install" failure with --disable-shared
 on glibc systems.

Reported by Gabor Z. Papp <gzp@papp.hu>.

This is a regression from 2018-11-25.

* gettext-tools/configure.ac (PRELOADABLE_LIBINTL): Set to false if
--disable-shared was specified.

diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac
index cf1dd734d..fdf75c1ad 100644
--- a/gettext-tools/configure.ac
+++ b/gettext-tools/configure.ac
@@ -119,7 +119,7 @@ AM_CONDITIONAL([USE_INCLUDED_LIBINTL], [test $USE_INCLUDED_LIBINTL = yes])
 AM_CONDITIONAL([BUILD_INCLUDED_LIBINTL], [test $BUILD_INCLUDED_LIBINTL = yes])
 AM_CONDITIONAL([PACKAGE_IS_GETTEXT_TOOLS], [true])
 AM_CONDITIONAL([PRELOADABLE_LIBINTL],
-  [test $USE_INCLUDED_LIBINTL = no && test $GLIBC2 = yes])
+  [test $USE_INCLUDED_LIBINTL = no && test $GLIBC2 = yes && test "$enable_shared" = yes])
 
 dnl This line internationalizes the bison generated parsers.
 BISON_I18N
-- 
2.20.1


From 767946e1c31506ecbb082240d3ea87818c777fdd 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/3] 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)

diff --git a/gettext-runtime/libasprintf/lib-asprintf.c b/gettext-runtime/libasprintf/lib-asprintf.c
index 54649659b..c2fe4ed16 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.20.1


From 546f164e95baa8be680a9f0b446a053e637f4488 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sat, 18 May 2019 18:01:31 +0200
Subject: [PATCH 3/3] build: Avoid trouble on mingw caused by mingw's *printf
 functions.

Reported by Michele Locati <michele@locati.it>
in <https://lists.gnu.org/archive/html/bug-gettext/2019-05/msg00103.html>.

* gettext-runtime/intl/Makefile.am (AM_CPPFLAGS): Define __USE_MINGW_ANSI_STDIO
to 0.
* gettext-runtime/libasprintf/Makefile.am (DEFS): Likewise.
* libtextstyle/lib/Makefile.am (AM_CPPFLAGS): Likewise.

(cherry picked from commit 45500ab1765581d6a3b7d2e6a6c2595466de70af)

diff --git a/gettext-runtime/intl/Makefile.am b/gettext-runtime/intl/Makefile.am
index 9f6e576f1..4b0e70f66 100644
--- a/gettext-runtime/intl/Makefile.am
+++ b/gettext-runtime/intl/Makefile.am
@@ -52,6 +52,15 @@ AM_CPPFLAGS = \
   -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \
   -DLIBDIR=\"$(libdir)\" -DBUILDING_LIBINTL -DBUILDING_DLL -DIN_LIBINTL
 
+if WOE32
+# On mingw, disable the declarations of *printf functions as aliases to the
+# corresponding __mingw_*printf functions, because
+# - these functions are useless for i18n purposes (not POSIX/XSI compliant),
+# - they pull in a dependency to the libgcc_s_sjlj DLL (through the symbols
+#   __udivdi3, __umoddi3).
+AM_CPPFLAGS += -D__USE_MINGW_ANSI_STDIO=0
+endif
+
 # Parametrization of the 'relocatable-lib-lgpl' module.
 AM_CPPFLAGS += \
   -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DNO_XMALLOC \
diff --git a/gettext-runtime/libasprintf/Makefile.am b/gettext-runtime/libasprintf/Makefile.am
index 4189ef1a1..be78f6835 100644
--- a/gettext-runtime/libasprintf/Makefile.am
+++ b/gettext-runtime/libasprintf/Makefile.am
@@ -26,6 +26,15 @@ RM = rm -f
 
 DEFS = -DIN_LIBASPRINTF @DEFS@
 
+if WOE32
+# On mingw, disable the declarations of *printf functions as aliases to the
+# corresponding __mingw_*printf functions, because
+# - these functions are useless for i18n purposes (not POSIX/XSI compliant),
+# - they pull in a dependency to the libgcc_s_sjlj DLL (through the symbols
+#   __udivdi3, __umoddi3).
+DEFS += -D__USE_MINGW_ANSI_STDIO=0
+endif
+
 
 # Library include file.
 
diff --git a/libtextstyle/lib/Makefile.am b/libtextstyle/lib/Makefile.am
index 9f2cb0e17..32b1a7c4f 100644
--- a/libtextstyle/lib/Makefile.am
+++ b/libtextstyle/lib/Makefile.am
@@ -48,6 +48,13 @@ if INCLUDED_LIBXML
 AM_CPPFLAGS += -DLIBXML_STATIC
 endif
 
+if WOE32
+# On mingw, disable the declarations of *printf functions as aliases to the
+# corresponding __mingw_*printf functions, because they pull in a dependency
+# to the libgcc_s_sjlj DLL (through the symbols __udivdi3, __umoddi3).
+AM_CPPFLAGS += -D__USE_MINGW_ANSI_STDIO=0
+endif
+
 # Rules generated and collected by gnulib-tool.
 include Makefile.gnulib
 
-- 
2.20.1

