summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings/Packages/IntegerGmp.hs
diff options
context:
space:
mode:
Diffstat (limited to 'hadrian/src/Settings/Packages/IntegerGmp.hs')
-rw-r--r--hadrian/src/Settings/Packages/IntegerGmp.hs24
1 files changed, 24 insertions, 0 deletions
diff --git a/hadrian/src/Settings/Packages/IntegerGmp.hs b/hadrian/src/Settings/Packages/IntegerGmp.hs
new file mode 100644
index 0000000000..7c2b5f635b
--- /dev/null
+++ b/hadrian/src/Settings/Packages/IntegerGmp.hs
@@ -0,0 +1,24 @@
+module Settings.Packages.IntegerGmp (integerGmpPackageArgs) where
+
+import Base
+import Expression
+import Oracles.Setting
+import Rules.Gmp
+
+-- TODO: Is this needed?
+-- ifeq "$(GMP_PREFER_FRAMEWORK)" "YES"
+-- libraries/integer-gmp_CONFIGURE_OPTS += --with-gmp-framework-preferred
+-- endif
+integerGmpPackageArgs :: Args
+integerGmpPackageArgs = package integerGmp ? do
+ path <- expr gmpBuildPath
+ let includeGmp = "-I" ++ path -/- "include"
+ gmpIncludeDir <- getSetting GmpIncludeDir
+ gmpLibDir <- getSetting GmpLibDir
+ mconcat [ builder Cc ? arg includeGmp
+
+ , builder GhcCabal ? mconcat
+ [ (null gmpIncludeDir && null gmpLibDir) ?
+ arg "--configure-option=--with-intree-gmp"
+ , arg ("--configure-option=CFLAGS=" ++ includeGmp)
+ , arg ("--gcc-options=" ++ includeGmp) ] ]