[commit: ghc] wip/nfs-locking: fix handling of --with-gmp-* configure arguments (80eac86)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:51:35 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/80eac86c555a8e0d48a694ffc23f0ac2c75236d0/ghc

>---------------------------------------------------------------

commit 80eac86c555a8e0d48a694ffc23f0ac2c75236d0
Author: Karel Gardas <karel.gardas at centrum.cz>
Date:   Wed Jan 13 22:24:38 2016 +0100

    fix handling of --with-gmp-* configure arguments


>---------------------------------------------------------------

80eac86c555a8e0d48a694ffc23f0ac2c75236d0
 src/Rules/Gmp.hs | 46 ++++++++++++++++++++++++++++++++--------------
 1 file changed, 32 insertions(+), 14 deletions(-)

diff --git a/src/Rules/Gmp.hs b/src/Rules/Gmp.hs
index b02fe36..94086e1 100644
--- a/src/Rules/Gmp.hs
+++ b/src/Rules/Gmp.hs
@@ -57,6 +57,19 @@ configureArguments = do
            , "--host=" ++ hostPlatform
            , "--build=" ++ buildPlatform]
 
+configureIntGmpArguments :: Action [String]
+configureIntGmpArguments = do
+    includes      <- settingList GmpIncludeDirs
+    libs          <- settingList GmpLibDirs
+    return ([]
+            ++ (if (not (null includes))
+                then map ((++) "--with-gmp-includes=") includes
+                else [])
+            ++ (if (not (null libs))
+                then map ((++) "--with-gmp-libraries=") libs
+                else [])
+           )
+
 -- TODO: we rebuild gmp every time.
 gmpRules :: Rules ()
 gmpRules = do
@@ -105,7 +118,8 @@ gmpRules = do
         runConfigure libPath envs args
 
         -- TODO: currently we configure integerGmp package twice -- optimise
-        runConfigure (pkgPath integerGmp) [] []
+        intGmpArgs <- configureIntGmpArguments
+        runConfigure (pkgPath integerGmp) envs intGmpArgs
 
         createDirectory $ takeDirectory gmpLibraryH
         -- check whether we need to build in tree gmp
@@ -115,19 +129,23 @@ gmpRules = do
         then do
             putBuild "| GMP framework detected and will be used"
             copyFile gmpLibraryFakeH gmpLibraryH
-        else do
-            putBuild "| No GMP framework detected; in tree GMP will be built"
-            runMake libPath ["MAKEFLAGS="]
-
-            copyFile (libPath -/- "gmp.h") gmpLibraryInTreeH
-            copyFile (libPath -/- "gmp.h") gmpLibraryH
-            -- TODO: why copy library, can we move it instead?
-            copyFile (libPath -/- ".libs/libgmp.a") gmpLibrary
-
-            createDirectory gmpObjects
-            build $ fullTarget gmpTarget Ar [gmpLibrary] [gmpObjects]
-
-            runBuilder Ranlib [gmpLibrary]
+        else if "HaveLibGmp = YES" `isInfixOf` configMk
+             then do
+               putBuild "| GMP detected and will be used"
+               copyFile gmpLibraryFakeH gmpLibraryH
+             else do
+               putBuild "| No GMP framework detected; in tree GMP will be built"
+               runMake libPath ["MAKEFLAGS="]
+
+               copyFile (libPath -/- "gmp.h") gmpLibraryInTreeH
+               copyFile (libPath -/- "gmp.h") gmpLibraryH
+               -- TODO: why copy library, can we move it instead?
+               copyFile (libPath -/- ".libs/libgmp.a") gmpLibrary
+
+               createDirectory gmpObjects
+               build $ fullTarget gmpTarget Ar [gmpLibrary] [gmpObjects]
+
+               runBuilder Ranlib [gmpLibrary]
 
         putSuccess "| Successfully built custom library 'integer-gmp'"
 



More information about the ghc-commits mailing list