summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings/Packages/IntegerGmp.hs
blob: 7c2b5f635b674b790aedd2d2eb69e5f0ef83d0f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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) ] ]