summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aclocal.m414
-rw-r--r--hadrian/cfg/system.config.in6
-rw-r--r--hadrian/src/Hadrian/Haskell/Cabal/Parse.hs3
-rw-r--r--hadrian/src/Hadrian/Haskell/Cabal/Type.hs1
-rw-r--r--hadrian/src/Oracles/Flag.hs4
-rw-r--r--hadrian/src/Settings/Builders/Ghc.hs2
-rw-r--r--hadrian/src/Settings/Packages.hs12
-rw-r--r--libraries/integer-gmp/config.mk.in2
-rw-r--r--libraries/integer-gmp/configure.ac4
-rw-r--r--mk/config.mk.in2
-rw-r--r--rules/build-package-data.mk8
11 files changed, 45 insertions, 13 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index a7026e217a..62825c3068 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1780,8 +1780,22 @@ AC_DEFUN([FP_GMP],
[directory containing gmp library])],
[GMP_LIB_DIRS=$withval])
+ AC_ARG_ENABLE([intree-gmp],
+ [AC_HELP_STRING([--with-intree-gmp],
+ [force using the in-tree GMP])],
+ [GMP_FORCE_INTREE=YES],
+ [GMP_FORCE_INTREE=NO])
+
+ AC_ARG_ENABLE([gmp-framework-preferred],
+ [AC_HELP_STRING([--with-gmp-framework-preferred],
+ [on OSX, prefer the GMP framework to the gmp lib])],
+ [GMP_PREFER_FRAMEWORK=YES],
+ [GMP_PREFER_FRAMEWORK=NO])
+
AC_SUBST(GMP_INCLUDE_DIRS)
AC_SUBST(GMP_LIB_DIRS)
+ AC_SUBST(GMP_FORCE_INTREE)
+ AC_SUBST(GMP_PREFER_FRAMEWORK)
])# FP_GMP
# FP_CURSES
diff --git a/hadrian/cfg/system.config.in b/hadrian/cfg/system.config.in
index 7e132f7d77..7b92b29a6d 100644
--- a/hadrian/cfg/system.config.in
+++ b/hadrian/cfg/system.config.in
@@ -118,8 +118,10 @@ curses-lib-dir = @CURSES_LIB_DIRS@
iconv-include-dir = @ICONV_INCLUDE_DIRS@
iconv-lib-dir = @ICONV_LIB_DIRS@
-gmp-include-dir = @GMP_INCLUDE_DIRS@
-gmp-lib-dir = @GMP_LIB_DIRS@
+intree-gmp = @GMP_FORCE_INTREE@
+gmp-framework-preferred = @GMP_PREFER_FRAMEWORK@
+gmp-include-dir = @GMP_INCLUDE_DIRS@
+gmp-lib-dir = @GMP_LIB_DIRS@
use-system-ffi = @UseSystemLibFFI@
ffi-include-dir = @FFIIncludeDir@
diff --git a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
index 995270184b..8df343b423 100644
--- a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
+++ b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
@@ -280,7 +280,8 @@ resolveContextData context@Context {..} = do
, depIncludeDirs = forDeps Installed.includeDirs
, depCcOpts = forDeps Installed.ccOptions
, depLdOpts = forDeps Installed.ldOptions
- , buildGhciLib = C.withGHCiLib lbi' }
+ , buildGhciLib = C.withGHCiLib lbi'
+ , frameworks = C.frameworks buildInfo }
-- | Look for a @.buildinfo@ in all of the specified directories, stopping on
-- the first one we find.
diff --git a/hadrian/src/Hadrian/Haskell/Cabal/Type.hs b/hadrian/src/Hadrian/Haskell/Cabal/Type.hs
index dd6e4bdcc6..b2a7002d6c 100644
--- a/hadrian/src/Hadrian/Haskell/Cabal/Type.hs
+++ b/hadrian/src/Hadrian/Haskell/Cabal/Type.hs
@@ -64,6 +64,7 @@ data ContextData = ContextData
, depCcOpts :: [String]
, depLdOpts :: [String]
, buildGhciLib :: Bool
+ , frameworks :: [String]
} deriving (Eq, Generic, Show, Typeable)
instance Binary PackageData
diff --git a/hadrian/src/Oracles/Flag.hs b/hadrian/src/Oracles/Flag.hs
index 57dbf2decb..b294cebc93 100644
--- a/hadrian/src/Oracles/Flag.hs
+++ b/hadrian/src/Oracles/Flag.hs
@@ -13,6 +13,8 @@ data Flag = ArSupportsAtFile
| CrossCompiling
| GccIsClang
| GhcUnregisterised
+ | GmpInTree
+ | GmpFrameworkPref
| LeadingUnderscore
| SolarisBrokenShld
| SplitObjectsBroken
@@ -29,6 +31,8 @@ flag f = do
CrossCompiling -> "cross-compiling"
GccIsClang -> "gcc-is-clang"
GhcUnregisterised -> "ghc-unregisterised"
+ GmpInTree -> "intree-gmp"
+ GmpFrameworkPref -> "gmp-framework-preferred"
LeadingUnderscore -> "leading-underscore"
SolarisBrokenShld -> "solaris-broken-shld"
SplitObjectsBroken -> "split-objects-broken"
diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs
index 4957de77fe..488e551cdc 100644
--- a/hadrian/src/Settings/Builders/Ghc.hs
+++ b/hadrian/src/Settings/Builders/Ghc.hs
@@ -45,6 +45,7 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
pkg <- getPackage
libs <- getContextData extraLibs
libDirs <- getContextData extraLibDirs
+ fmwks <- getContextData frameworks
dynamic <- requiresDynamic
darwin <- expr osxHost
@@ -71,6 +72,7 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
, not (nonHsMainPackage pkg) ? arg "-rtsopts"
, pure [ "-l" ++ lib | lib <- libs ]
, pure [ "-L" ++ libDir | libDir <- libDirs ]
+ , darwin ? pure (concat [ ["-framework", fmwk] | fmwk <- fmwks ])
]
findHsDependencies :: Args
diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs
index 5993723bee..4be0fba740 100644
--- a/hadrian/src/Settings/Packages.hs
+++ b/hadrian/src/Settings/Packages.hs
@@ -136,14 +136,10 @@ packageArgs = do
[ builder Cc ? arg includeGmp
, builder (Cabal Setup) ? mconcat
- [ -- TODO: This should respect some settings flag "InTreeGmp".
- -- Depending on @IncludeDir@ and @LibDir@ is bound to fail, since
- -- these are only set if the configure script was explicilty
- -- called with GMP include and lib dirs. Their absense as such
- -- does not imply @in-tree-gmp@.
- -- (null gmpIncludeDir && null gmpLibDir) ?
- -- arg "--configure-option=--with-intree-gmp"
- arg ("--configure-option=CFLAGS=" ++ includeGmp)
+ [ flag GmpInTree ? arg "--configure-option=--with-intree-gmp"
+ , flag GmpFrameworkPref ?
+ arg "--configure-option=--with-gmp-framework-preferred"
+ , arg ("--configure-option=CFLAGS=" ++ includeGmp)
, arg ("--gcc-options=" ++ includeGmp) ] ]
---------------------------------- rts ---------------------------------
diff --git a/libraries/integer-gmp/config.mk.in b/libraries/integer-gmp/config.mk.in
index b66f94c5ad..2556326b2d 100644
--- a/libraries/integer-gmp/config.mk.in
+++ b/libraries/integer-gmp/config.mk.in
@@ -10,6 +10,8 @@ ifeq "$(HaveFrameworkGMP)" ""
HaveFrameworkGMP = @HaveFrameworkGMP@
endif
+GMP_FORCE_INTREE = @GMP_FORCE_INTREE@
+GMP_PREFER_FRAMEWORK = @GMP_PREFER_FRAMEWORK@
GMP_INCLUDE_DIRS = @GMP_INCLUDE_DIRS@
GMP_LIB_DIRS = @GMP_LIB_DIRS@
diff --git a/libraries/integer-gmp/configure.ac b/libraries/integer-gmp/configure.ac
index 1ccd48e698..d189375616 100644
--- a/libraries/integer-gmp/configure.ac
+++ b/libraries/integer-gmp/configure.ac
@@ -27,13 +27,13 @@ AC_ARG_WITH([gmp-libraries],
[GMP_LIB_DIRS=$withval; LDFLAGS="-L$withval"],
[GMP_LIB_DIRS=])
-AC_ARG_WITH([gmp-framework-preferred],
+AC_ARG_ENABLE([gmp-framework-preferred],
[AC_HELP_STRING([--with-gmp-framework-preferred],
[on OSX, prefer the GMP framework to the gmp lib])],
[GMP_PREFER_FRAMEWORK=YES],
[GMP_PREFER_FRAMEWORK=NO])
-AC_ARG_WITH([intree-gmp],
+AC_ARG_ENABLE([intree-gmp],
[AC_HELP_STRING([--with-intree-gmp],
[force using the in-tree GMP])],
[GMP_FORCE_INTREE=YES],
diff --git a/mk/config.mk.in b/mk/config.mk.in
index fb823ae29b..0119e9a984 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -898,6 +898,8 @@ ICONV_LIB_DIRS = @ICONV_LIB_DIRS@
GMP_INCLUDE_DIRS = @GMP_INCLUDE_DIRS@
GMP_LIB_DIRS = @GMP_LIB_DIRS@
+GMP_PREFER_FRAMEWORK = @GMP_PREFER_FRAMEWORK@
+GMP_FORCE_INTREE = @GMP_FORCE_INTREE@
CURSES_LIB_DIRS = @CURSES_LIB_DIRS@
diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk
index 2f0d7c9f2a..af1ead8099 100644
--- a/rules/build-package-data.mk
+++ b/rules/build-package-data.mk
@@ -90,6 +90,14 @@ ifneq "$$(GMP_LIB_DIRS)" ""
$1_$2_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="$$(GMP_LIB_DIRS)"
endif
+ifeq "$$(GMP_PREFER_FRAMEWORK)" "YES"
+$1_$2_CONFIGURE_OPTS += --configure-option=--with-gmp-framework-preferred
+endif
+
+ifeq "$$(GMP_FORCE_INTREE)" "YES"
+$1_$2_CONFIGURE_OPTS += --configure-option=--with-intree-gmp
+endif
+
ifneq "$$(CURSES_LIB_DIRS)" ""
$1_$2_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="$$(CURSES_LIB_DIRS)"
endif