summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aclocal.m440
-rw-r--r--configure.ac19
-rw-r--r--libraries/Makefile15
-rw-r--r--utils/hsc2hs/Makefile11
4 files changed, 64 insertions, 21 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 1daac0405a..5755dbe6e7 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -319,24 +319,30 @@ AC_SUBST(AlexVersion)
# Sets the output variable LdCmd to the (non-Cygwin version of the) full path
# of ld. Exits if no ld can be found
AC_DEFUN([FP_PROG_LD],
-[AC_PATH_PROG([fp_prog_ld_raw], [ld])
-if test -z "$fp_prog_ld_raw"; then
- AC_MSG_ERROR([cannot find ld in your PATH, no idea how to link])
+[
+if test -z "$1"
+then
+ AC_PATH_PROG([fp_prog_ld_raw], [ld])
+ if test -z "$fp_prog_ld_raw"; then
+ AC_MSG_ERROR([cannot find ld in your PATH, no idea how to link])
+ fi
+ LdCmd=$fp_prog_ld_raw
+ case $HostPlatform in
+ *mingw32) if test x${OSTYPE} != xmsys; then
+ LdCmd="`cygpath -w ${fp_prog_ld_raw} | sed -e 's@\\\\@/@g'`"
+ AC_MSG_NOTICE([normalized ld command to $LdCmd])
+ fi
+ # Insist on >= ld-2.15.x, since earlier versions doesn't handle
+ # the generation of relocatable object files with large amounts
+ # of relocations correctly. (cf. HSbase.o splittage-hack)
+ fp_prog_ld_version=`${LdCmd} --version | sed -n '/GNU ld/p' | tr -cd 0-9 | cut -b1-3`
+ FP_COMPARE_VERSIONS([$fp_prog_ld_version],[-lt],[214],
+ [AC_MSG_ERROR([GNU ld version later than 2.14 required to compile GHC on Windows.])])[]dnl
+ ;;
+ esac
+else
+ LdCmd="$1"
fi
-LdCmd=$fp_prog_ld_raw
-case $HostPlatform in
- *mingw32) if test x${OSTYPE} != xmsys; then
- LdCmd="`cygpath -w ${fp_prog_ld_raw} | sed -e 's@\\\\@/@g'`"
- AC_MSG_NOTICE([normalized ld command to $LdCmd])
- fi
- # Insist on >= ld-2.15.x, since earlier versions doesn't handle
- # the generation of relocatable object files with large amounts
- # of relocations correctly. (cf. HSbase.o splittage-hack)
- fp_prog_ld_version=`${LdCmd} --version | sed -n '/GNU ld/p' | tr -cd 0-9 | cut -b1-3`
- FP_COMPARE_VERSIONS([$fp_prog_ld_version],[-lt],[214],
- [AC_MSG_ERROR([GNU ld version later than 2.14 required to compile GHC on Windows.])])[]dnl
- ;;
-esac
AC_SUBST([LdCmd])
])# FP_PROG_LD
diff --git a/configure.ac b/configure.ac
index 6067f3c989..dce5a07d22 100644
--- a/configure.ac
+++ b/configure.ac
@@ -756,6 +756,25 @@ AC_ARG_WITH(gcc,
)
AC_SUBST(WhatGccIsCalled)
+dnl ** Which ld to use?
+dnl --------------------------------------------------------------
+AC_ARG_WITH(ld,
+[AC_HELP_STRING([--with-ld=ARG],
+ [Use ARG as the path to LD [default=autodetect]])],
+[if test "x$HostPlatform" = "xi386-unknown-mingw32"
+ then
+ if test "${OSTYPE}" != "msys"
+ then
+ # Canonicalise to <drive>:/path/to/ld
+ withval=`cygpath -w ${withval} | sed -e 's@\\\\@/@g' `
+ fi
+ fi;
+ LD=$withval
+ FP_PROG_LD([$LD])
+ ],
+ [FP_PROG_LD()]
+)
+
dnl ** Booting from .hc files?
dnl --------------------------------------------------------------
AC_ARG_ENABLE(hc-boot,
diff --git a/libraries/Makefile b/libraries/Makefile
index 82cf02e979..694adae8d0 100644
--- a/libraries/Makefile
+++ b/libraries/Makefile
@@ -56,6 +56,12 @@ endif
empty=
space=$(empty) $(empty)
+ifeq "$(Windows)" "YES"
+dot_bat=.bat
+else
+dot_bat=
+endif
+
CONFIGURE_OPTS =
CONFIGURE_STAMP_EXTRAS :=
@@ -122,10 +128,13 @@ stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).%: %/setup/Setup
cd $* && setup/Setup configure \
$(CONFIGURE_OPTS) \
--prefix=$(prefix) \
- --with-compiler=../../compiler/ghc-inplace \
- --with-hc-pkg=../../utils/ghc-pkg/ghc-pkg-inplace \
+ --with-compiler=../../compiler/ghc-inplace$(dot_bat) \
+ --with-hc-pkg=../../utils/ghc-pkg/ghc-pkg-inplace$(dot_bat) \
+ --with-hsc2hs=../../utils/hsc2hs/hsc2hs-inplace$(dot_bat) \
+ --with-ld=$(LD) \
--datasubdir=ghc \
- --haddock-args="--use-contents=../index.html --use-index=../doc-index.html"
+ --haddock-args="--use-contents=../index.html --use-index=../doc-index.html" \
+ --configure-option=--with-cc=$(CC)
touch $@
$(foreach SUBDIR,$(SUBDIRS),build.library.$(SUBDIR)):\
diff --git a/utils/hsc2hs/Makefile b/utils/hsc2hs/Makefile
index 88f3edbe85..f87d04927a 100644
--- a/utils/hsc2hs/Makefile
+++ b/utils/hsc2hs/Makefile
@@ -63,7 +63,7 @@ ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
extra_flags=$(addprefix --cflag=,$(filter-out -O,$(SRC_CC_OPTS)))
endif
-HSC2HS_EXTRA="--cc=$(CC) --ld=$(CC) $(extra_flags) --cflag=-D__GLASGOW_HASKELL__=$(ProjectVersionInt) -I$(FPTOOLS_TOP_ABS_PLATFORM)/$(GHC_INCLUDE_DIR_REL)"
+HSC2HS_EXTRA=--cc=$(CC) --ld=$(CC) $(extra_flags) --cflag=-D__GLASGOW_HASKELL__=$(ProjectVersionInt) -I$(FPTOOLS_TOP_ABS_PLATFORM)/$(GHC_INCLUDE_DIR_REL)
endif
$(SCRIPT_PROG) : Makefile
@@ -95,4 +95,13 @@ clean distclean maintainer-clean ::
$(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
endif
+ifeq "$(INSTALLING)$(HOSTPLATFORM)" "0i386-unknown-mingw32"
+all :: $(INPLACE_SCRIPT_PROG).bat
+
+FULL_INPLACE_PATH=$(subst /,\\,$(FPTOOLS_TOP_ABS)/utils/hsc2hs/)
+$(INPLACE_SCRIPT_PROG).bat :
+ echo '@call $(FULL_INPLACE_PATH)$(HS_PROG) --template=$(FULL_INPLACE_PATH)template-hsc.h $(HSC2HS_EXTRA) %*' >> $@
+ chmod 755 $@
+endif
+
include $(TOP)/mk/target.mk