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

This patch has been taken from:
https://github.com/flintlib/flint/issues/2098

diff -ruN flint-3.1.3-p1/Makefile.in flint-3.1.3-p1-patched/Makefile.in
--- flint-3.1.3-p1/Makefile.in	2024-05-24 08:52:40
+++ flint-3.1.3-p1-patched/Makefile.in	2024-10-20 23:32:18
@@ -416,6 +416,10 @@
 ifneq ($(SHARED), 0)
 shared: $(FLINT_DIR)/$(FLINT_LIB_FULL)
 
+ifneq ($(strip $(filter gnu% linux-gnu%,@FLINT_BUILD_OS@)),)
+# No command line length limitations under build_os=gnu*|linux-gnu*
+MERGED_LOBJS := $(foreach dir,$(DIRS),$($(dir)_LOBJS))
+else
 # The following is to avoid reaching the maximum length of command line
 # arguments, mainly present on MinGW.
 define xxx_merged_lobj_rule
@@ -424,6 +428,7 @@
 endef
 $(foreach dir, $(DIRS), $(eval $(call xxx_merged_lobj_rule,$(dir))))
 MERGED_LOBJS:=$(foreach dir, $(DIRS),$(BUILD_DIR)/$(dir)_merged.lo)
+endif
 
 $(FLINT_DIR)/$(FLINT_LIB_FULL): $(MERGED_LOBJS)
 	@echo "Building $(FLINT_LIB_FULL)"
@@ -437,6 +442,10 @@
 ifneq ($(STATIC), 0)
 static: $(FLINT_DIR)/$(FLINT_LIB_STATIC)
 
+ifneq ($(strip $(filter gnu% linux-gnu%,@FLINT_BUILD_OS@)),)
+# No command line length limitations under build_os=gnu*|linux-gnu*
+MERGED_OBJS := $(foreach dir,$(DIRS),$($(dir)_OBJS))
+else
 # The following is to avoid reaching the maximum length of command line
 # arguments, mainly present on MinGW.
 define xxx_merged_obj_rule
@@ -445,6 +454,7 @@
 endef
 $(foreach dir, $(DIRS), $(eval $(call xxx_merged_obj_rule,$(dir))))
 MERGED_OBJS:=$(foreach dir, $(DIRS),$(BUILD_DIR)/$(dir)_merged.o)
+endif
 
 $(FLINT_DIR)/$(FLINT_LIB_STATIC): $(MERGED_OBJS)
 	@echo "Building $(FLINT_LIB_STATIC)"
diff -ruN flint-3.1.3-p1/configure.ac flint-3.1.3-p1-patched/configure.ac
--- flint-3.1.3-p1/configure.ac	2024-05-24 08:52:40
+++ flint-3.1.3-p1-patched/configure.ac	2024-10-20 23:25:02
@@ -129,7 +129,11 @@
 
 dnl Get system triplet
 dnl NOTE: This is already invoked from LT_INIT
+dnl AC_CANONICAL_BUILD
 dnl AC_CANONICAL_HOST
+
+FLINT_BUILD_OS="${build_os}"
+AC_SUBST(FLINT_BUILD_OS)
 
 ################################################################################
 # configure headers
