Work around problems caused by limit on the length of the command line
in ld, which shows up when building OpenGL on Windows with SplitObjs=YES.
We now pass the names of the input files to ld via a linker script.
This is (probably) only supported by GNU ld, so we now have to detect
GNU ld in the configure script (yawn) and back off to the old method
if we don't have it.
+dnl
+dnl Check for GNU ld
+dnl
+AC_DEFUN(FPTOOLS_GNU_LD,
+[AC_CACHE_CHECK([whether ld is GNU ld], fptools_cv_gnu_ld,
+[
+if ${LdCmd} -v | grep GNU 2>&1 >/dev/null; then
+ fptools_cv_gnu_ld=yes
+else
+ fptools_cv_gnu_ld=no
+fi
+])
+if test "$fptools_cv_gnu_ld" = yes; then
+ LdIsGNULd=YES
+else
+ LdIsGNULd=NO
+fi
+AC_SUBST(LdIsGNULd)
+])
+
# FP_PROG_AR
# ----------
# FP_PROG_AR
# ----------
esac
AC_SUBST(LdCmd)
FPTOOLS_LD_X
esac
AC_SUBST(LdCmd)
FPTOOLS_LD_X
AC_CONFIG_FILES([mk/config.mk])
AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])
AC_CONFIG_FILES([mk/config.mk])
AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])
SED = @SedCmd@
SHELL = /bin/sh
SED = @SedCmd@
SHELL = /bin/sh
# Some ld's support the -x flag and some don't, so the configure
# script detects which we have and sets LdXFlag to "-x" or ""
# respectively.
# Some ld's support the -x flag and some don't, so the configure
# script detects which we have and sets LdXFlag to "-x" or ""
# respectively.
+# GNU ld supports input via a linker script, which is useful to avoid
+# overflowing command-line length limits.
+LdIsGNULd = @LdIsGNULd@
+
#
# In emergency situations, REAL_SHELL is used to perform shell commands
# from within the ghc driver script, by scribbling the command line to
#
# In emergency situations, REAL_SHELL is used to perform shell commands
# from within the ghc driver script, by scribbling the command line to
$(RM) $@; if [ ! -d $(basename $@)_split ]; then mkdir $(basename $@)_split; else \
$(FIND) $(basename $@)_split -name '*.$(way_)o' -print | xargs $(RM) __rm_food; fi
ifeq "$(GhcWithInterpreter)" "YES"
$(RM) $@; if [ ! -d $(basename $@)_split ]; then mkdir $(basename $@)_split; else \
$(FIND) $(basename $@)_split -name '*.$(way_)o' -print | xargs $(RM) __rm_food; fi
ifeq "$(GhcWithInterpreter)" "YES"
-HC_SPLIT_POST = (cd $(basename $@)_split && $(LD) -r $(LD_X) -o ../$(notdir $@) *.$(way_)o)
+ifeq "$(LdIsGNULd)" "YES"
+# If ld is GNU ld, we can use a linker script to pass the names of the
+# input files. This avoids problems with limits on the length of the
+# ld command line, which we run into for large Haskell modules.
+HC_SPLIT_POST = \
+ ( cd $(basename $@)_split; \
+ $(RM) ld.script; \
+ touch ld.script; \
+ echo "INPUT(" *.$(way_)o ")" >>ld.script; \
+ $(LD) -r $(LD_X) -o ../$(notdir $@) ld.script; \
+ )
+else
+HC_SPLIT_POST = \
+ ( cd $(basename $@)_split; \
+ $(LD) -r $(LD_X) -o ../$(notdir $@) *.$(way_)o; \
+ )
+endif # LdIsGNULd == YES
else
HC_SPLIT_POST = touch $@
endif # GhcWithInterpreter == YES
else
HC_SPLIT_POST = touch $@
endif # GhcWithInterpreter == YES